[FIX] Make Preferences win over .subzillarc in the Mac app - #22
Merged
Merged
Conversation
- Rule: once the Preferences window has been saved, Preferences is the only source of settings. Until then a .subzillarc file seeds the initial values over the built-in defaults, and the window shows them, so saving locks them in. Restore Defaults hands control back. - The old "RC < stored" merge could not express any rule: electron-store materialises every default, so .subzillarc was ignored for almost every key (lineEndings, strip.html, ...) yet leaked through for the few keys without a default (output.directory, output.format, batch.maxDepth), even after the user had saved their preferences. - A userSavedConfig marker records the save. Installs that predate it count as saved when their stored values differ from the defaults, so an existing setup is never overridden. - getConfig() now awaits the RC load; previously the first conversion after launch could run before the file had been read. - Removed a second, hidden lookup through ConfigManager.loadConfig(): it searched process.cwd() on its own, returned schema-filled defaults, and never applied the environment variables its comment promised. - An RC file that is not a map or fails schema validation is ignored entirely instead of being half-applied. - The Preferences window and README now state the rule. Tests: 14 new cases against real .subzillarc files and a store that materialises defaults like electron-store does; 4 of them fail on the previous logic. Also verified in a real Electron process against the real electron-store (seed, save, relaunch, reset). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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
Implements the decision: in the Mac app, Preferences wins.
What was actually happening
Neither side cleanly won. electron-store writes every default into the store, so the old
RC < storedmerge meant:.subzillarcwas ignored for almost every key —lineEndings: crlf,strip.html: truenever applied in the app;output.directory,output.format,batch.maxDepth, include/exclude dirs) — even after the user had saved their preferences.Also found while fixing it:
ConfigManager.loadConfig(): it searchedprocess.cwd()on its own, returned schema-filled defaults, and never applied the environment variables its comment promised. Removed.electronimport threw and the error was swallowed.Changes
userSavedConfigmarker set on save. Installs that predate it count as saved when their stored values differ from the defaults, so an existing customised setup is never overridden by a file.getConfig()awaits the RC load.Verification
.subzillarcfiles and a store that materialises defaults the way electron-store does. 4 fail on the previous logic (checked by adding only the test seam first, with no behaviour change).HOMEanduserData:Note for your own machine
Your stored preferences will count as "saved" only if they differ from the defaults. If they don't, the app will now start honouring a
~/.subzillarcuntil your next save in Preferences.🤖 Generated with Claude Code