fix(profile): Snapshot the active setup when saving a new profile - #89
Merged
Merged
Conversation
Saving a new name reset to the base config, so a "save as" from a loaded profile silently dropped the setup actually in use. Resolve the effective config instead: it falls back to the active profile, and still lands on base when none is loaded. Re-saving an existing name keeps snapshotting that explicit target. Cover the explicit-target path too. The suite could not tell it apart from the active-profile fallback, because its only fixture saved a target that was already the active profile, where both branches return the same thing. Co-Authored-By: Claude <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.



profile save <new name>reset to the base config, so saving a new name while a profile was loaded silently dropped the setup actually in use. It now resolves the effective config, which falls back to the active profile and still lands on base when no profile is loaded. Re-saving an existing name keeps snapshotting that explicit target.This is what the README already documented ("snapshot the current setup"). The base-config behaviour came in with #85, which was fixing a different problem in
setup --profileand tightenedsaveon the way past.setup --profile <new name>still starts empty from base, and that divergence is deliberate.savesnapshots what you are using,setupis an editing entry point for a fresh profile. Out of scope here.The test coverage is the part worth reviewing. The suite could not tell the explicit-target path apart from the active-profile fallback, because its only fixture saved a target that was already the active profile, where both branches of the ternary return the same value. Replacing
resolveEffectiveConfig(config, name)withresolveEffectiveConfig(config)passed green before this PR, and now fails on one named test. The no-active-profile case had the same shape of hole: the old fixture carried no profiles map at all, so it could not separate "fall back to base" from "pick some saved profile".