fix: tighten profile state handling and downloaded-recording file mode#9
Open
fix: tighten profile state handling and downloaded-recording file mode#9
Conversation
Load was applying BW_CLIENT_ID, BW_ACCOUNT_ID, and BW_ENVIRONMENT through the live *Profile pointer inside cfg.Profiles, so any subsequent Save would persist those session values onto the previously-active profile on disk. Move the overlay into ActiveProfileConfig, which now returns a fresh copy with env vars applied on top. Stored profiles are no longer mutated by Load. Existing env-overlay tests updated to match the read-time contract; new tests cover the persistence and copy-on-overlay invariants.
runSwitch was setting only the legacy top-level cfg.AccountID. Once a profile exists in cfg.Profiles, ActiveProfileConfig reads from the profile map, so the switch wasn't reflected in subsequent commands — they continued routing to the pre-switch account. Update the active profile's AccountID alongside the legacy field, the same way auth login (via SetProfile) and auth use already do. Adds a regression test that runs runSwitch end-to-end against a temp config and asserts the active profile is the source of truth on the next load.
Recordings can contain customer call audio. Match config.Save's permissions for sensitive blobs instead of 0644.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
band auth switchnow updates the active profile alongside the legacy field, so subsequent commands see the new account.config.Loadno longer mutates stored profiles;BW_*env overlays are applied at read time insideActiveProfileConfig.band recording downloadwrites with0600to matchconfig.Save.Tests added;
go test ./...,go vet ./...,go build ./...clean.