uttrflow / uttrflow/uttrflow-swift
A failed dictionary seed write records success and prevents seeding after storage recovers
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## Problem
`seedShippedWords` persists the seeded-version marker before it persists the shipped entries. When only the second write fails, the next launch sees the current version and skips seeding permanently. The application ignores the initial error, leaving an empty or incomplete dictionary without a retry.
## Evidence
Reviewed main at `8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d`. Reproduced with unchanged repository source in an isolated Swift package on macOS. Checks assert the observed problem, not a completed fix or a full-app test pass.
Created a temporary dictionary containing `[]`, marked only that file immutable, and called `seedShippedWords`. The marker write succeeded and the dictionary write returned `couldNotWrite`. After clearing the immutable flag and reopening the store, a second seed call returned `[]` and `allEntries()` remained empty. All permissions and files were cleaned up afterwards. This is a deterministic write-failure reproduction; it does not claim that immutable dictionaries are common.
## Relevant code
- [Sources/UttrflowDictionary/PersonalDictionaryStore.swift:84](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowDictionary/PersonalDictionaryStore.swift#L84)
- [Sources/UttrflowDictionary/PersonalDictionaryStore.swift:105](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/UttrflowDictionary/PersonalDictionaryStore.swift#L105)
- [Sources/Uttrflow/AppDelegate.swift:230](https://github.com/uttrflow/uttrflow-swift/blob/8d93f5b8574f3c7b8c30086d9c817bf7f5d4827d/Sources/Uttrflow/AppDelegate.swift#L230)
## Acceptance criteria
- Record successful application only after the entries are durably present, with recovery for failures between writes.
- Test failure of the entries write followed by recovery and relaunch: shipped words are installed exactly once.
- Preserve the existing guarantee that a successfully seeded word deliberately deleted later stays deleted. Cover marker-write failure too.
## Existing work checked
#154 introduced shipped words; #687 concerns their UI wording and #680 reset wording. None covers a failed seed write being permanently marked complete.
Contributor guide
Research direction
Start with seedShippedWords and the marker and entries writes in Sources/UttrflowDictionary/PersonalDictionaryStore.swift at lines 84 and 105, then trace its call from Sources/Uttrflow/AppDelegate.swift:230. Reproduce the entries-write failure followed by recovery and relaunch. Done means failed writes can retry, successful seeding installs shipped words once, later deliberate deletions remain deleted, and marker-write failure is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- database, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100