The rule editor drops a key it does not know at the top of the rules file when it saves
Maintainers usually reply within 1 day
A pull request for this has already been merged.
- #237 by @JWhite212 — merged
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start with RulesDocument.load in Sources/NotificationCore/RulesDocument.swift and the existing ReadOnlyReason cases in Sources/NotificationCore/EditorText.swift; follow compiler-reported exhaustive switches such as SetupPlan.swift. Add tests for files with unknown top-level keys and document the editor behavior in docs/rules-format.md, then update CHANGELOG.md. Verify the issue’s pins and stop if any stated stop condition applies; done means existing tests pass unchanged and the new read-only behavior is covered.
Written by the indexing model from the issue text.
Description
Audit row: B21, Defects (added by #193). Line numbers are those of 4553590. Find the code by what it says, and re-run every pin command on the branch point.
What is wrong. The codec reads only rules from the file's top level (RuleSetCodec.swift:511-519). RulesDocument.load calls such a file editable, and Save writes back only version and rules, so a "_comment" beside them is gone; rules.previous.json keeps one save. RulesDocument.swift:18-19 says a file the editor cannot represent in full is not offered for saving. A scratch program: a file with "_comment" loads, opens as editable, and has no "_comment" after Save.
Behaviour that must survive. The loader accepts such a file as it does now; only the editor changes.
The change. RulesDocument.load returns .readOnly with a new reason when the top level holds any key besides version and rules. Its words go beside the other reasons in EditorText.readOnly, naming the keys and saying the file can be edited by hand. Owner after: RulesDocument.load.
In scope: Sources/NotificationCore/RulesDocument.swift, Sources/NotificationCore/EditorText.swift, every exhaustive switch over ReadOnlyReason the compiler names (SetupPlan.swift among them), new tests, docs/rules-format.md (what the editor does with such a file), CHANGELOG.md.
Out of scope, however tempting: Refusing such a file at load, and keeping unknown keys through a save.
Frozen side: the tests. Every existing test passes unchanged; new tests are added.
Pins (counts at 4553590):
grep -rn 'ReadOnlyReason' Tests | wc -l→ 14.grep -rn 'ReadOnlyReason' Sourceslists the switches the new case reaches.
Check, on the branch:
swift build --build-tests -Xswiftc -warnings-as-errors: no warning.swift test --skip-build: 0 failures, at the branch point's count plus the new tests (state both in the pull request).- Each new test is seen to fail once against the code as it was.
Stop, and say so here before going on, if: the code cited has already changed; a pin appears that is not listed; a file outside the scope is needed; or any existing test would have to change.
Hold: not merged before v1.1.0 is tagged (owner, 2026-11-06). It changes the app's code, and a code change restarts the go/no-go bar's two weeks.
Prevention: Guard added: a test that a file with an unknown top-level key opens read-only with that reason.
Size: S.
- Dominant language
- Swift
- Stars
- 2
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 152
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JWhite212/SignalLadder
-
bug
Difficulty 3/5 Half a day Newbie friendliness 38/100
JWhite212/SignalLadder#216 · 2 comments ·
Maintainers usually reply within 1 day
All issues in JWhite212/SignalLadder
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ls1intum/artemis-ios#571 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ml-explore/mlx-swift-lm#791 ·
Maintainers usually reply within 2 days
-
a: plugins d: docs/ fyi-macos P2 platform-ios platform-macos team-ios
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
swiftlang/github-workflows#352 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day