Skip to content

fix(profile): Snapshot the active setup when saving a new profile - #89

Merged
4ndreello merged 1 commit into
mainfrom
fix/profile-save-clones-active
Sep 19, 2026
Merged

4ndreello merged 1 commit into
mainfrom
fix/profile-save-clones-active

Conversation

@4ndreello

Copy link
Copy Markdown
Owner

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 --profile and tightened save on the way past.

setup --profile <new name> still starts empty from base, and that divergence is deliberate. save snapshots what you are using, setup is 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) with resolveEffectiveConfig(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".

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>
@sonarqubecloud

Copy link
Copy Markdown

@4ndreello
4ndreello merged commit eb423bf into main Sep 19, 2026
4 checks passed
@4ndreello
4ndreello deleted the fix/profile-save-clones-active branch September 19, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant