fix(macos): publish Unset prefs too — they carry the catalog default#68
Merged
Merged
Conversation
#67 filtered Unset entries at the snapshot→state boundary and defaulted them to unselected in the TUI editor. The reasoning ("Unset means user had no opinion, don't propagate") was wrong: macOS does not write default-equal values to the plist, so common cases like "Show Sound in menu bar" — a key the user has never explicitly touched but which macOS displays by default — capture as Unset. Filtering them dropped 8 of 9 Menu Bar items from publish and the web UI showed only "1", unchecked. Treat Unset as purely informational metadata going forward: - internal/cli/snapshot_import.go — drop the boundary filter; publish every captured pref (Unset entries carry the catalog default, which is the value we'd want to enforce regardless). - internal/ui/snapshot_editor.go — default Unset entries to selected. The `(unset, default = X)` badge in the description stays, so users can see which prefs originated from the catalog default vs the user's explicit plist value, but the default action is to include them. - internal/diff/compare.go — unchanged; diffMacOS already treats Unset as "no opinion" on either side, which remains the right semantic for diff (vs publish, which is about transmitting the configured state). Tests inverted to match (and renamed so the new contract is obvious).
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the bug introduced by #67. Live verification on @fullstackjam's machine showed:
defaults read com.apple.controlcenter "NSStatusItem Visible Sound"→does not exist./openboot snapshot --json --dry-run→ Sound captured withunset: truebuildImportConfig→ Sound filtered outThe reasoning behind #67's filter ("Unset means user had no opinion, don't propagate") was wrong: macOS does not write default-equal values to the plist, so any pref the user has never explicitly touched but which macOS displays by default captures as Unset. Filtering those dropped 8/9 Menu Bar items and similar across other categories.
Fix treats
Unsetas purely informational metadata:internal/cli/snapshot_import.go— drop the boundary filter; pass through every captured pref. Unset entries carry the catalog default Value, which is the value we'd want enforced regardless.internal/ui/snapshot_editor.go— default Unset entries to selected. The(unset, default = X)badge in the description stays so users can see which prefs originated from catalog vs explicit plist.internal/diff/compare.go— unchanged.diffMacOSalready treats Unset as "no opinion" on either side, which is the right semantic for diff (about state mismatch) but not for publish (about transmitting configured state).After this PR,
./openboot snapshot --json --dry-run | jq '[.macos_prefs[] | select(.domain=="com.apple.controlcenter")] | length'returns9instead of being silently filtered down to whatever the user's plist happens to contain.Test plan
make test-unitgreen (with two tests renamed + inverted to match the new contract)../openboot snapshot --json --dry-runnow reports all 9 Menu Bar prefs.