Skip to content

fix(ios): clear leftover sample journal files before installing the sample - #2983

Merged
datlechin merged 1 commit into
mainfrom
fix/ios-sample-orphaned-journals
Sep 18, 2026
Merged

datlechin merged 1 commit into
mainfrom
fix/ios-sample-orphaned-journals

Conversation

@datlechin

Copy link
Copy Markdown
Member

Follow-up to #2980, found while fixing the same class of bug in the Mac sample database.

Defect

SampleDatabaseInstaller.installIfNeeded copied a fresh Chinook.sqlite whenever the main file was missing, but left any Chinook.sqlite-journal, -wal or -shm beside it. A reset that removed the main file and then failed on a sidecar leaves exactly that state, and SQLite replays a hot journal or WAL it finds next to a database, so the fresh copy could open with the old edits or corrupted.

Fix

installIfNeeded and reset share one removal path that clears all three sidecars before copying. The tests now use their own suffix list rather than the production constant, so a missing suffix in the code fails them.

Verification

iPhone 18 Pro simulator (iOS 27): SampleDatabaseInstallerTests and AppStateLibraryTests, 12 of 12 passed, including the new "Installing over journal files a failed reset left behind removes them first". No CHANGELOG entry: the sample database is still unreleased (#2980).

@datlechin
datlechin merged commit 28a9109 into main Sep 18, 2026
8 of 9 checks passed
@datlechin
datlechin deleted the fix/ios-sample-orphaned-journals branch September 18, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant