[TW-4883] Mirror default grant writes through PersistDefaultGrant#68
Merged
qasim-nylas merged 3 commits intomainfrom Apr 30, 2026
Merged
[TW-4883] Mirror default grant writes through PersistDefaultGrant#68qasim-nylas merged 3 commits intomainfrom
qasim-nylas merged 3 commits intomainfrom
Conversation
SwitchGrant now routes through PersistDefaultGrant so it matches every other write path (auth switch, Air UI, login auto-default, setup wizard). Previously the TUI was the only path writing only to grants.json, leaving config.yaml's default_grant stale until the next non-TUI switch — which made `auth status` and Air/UI config endpoints display the previous default after a TUI-side switch. Adds a ConfigStore field to tui.Config; PersistDefaultGrant handles nil ConfigStore so demo mode keeps working.
The TUI mirror fix (9137b0e) closed one gap; this audit found five more write paths that updated only one of grants.json / config.yaml and relied on a follow-up call to mirror the other side. Replace each pair with a single PersistDefaultGrant call so every mutation is atomic with rollback. - Login / autoSwitchDefault / syncConfigWithGrantStore now persist via PersistDefaultGrant instead of SetDefaultGrant + manual config.Save. - setup.SyncGrants and setup.PromptDefaultGrant take a ConfigStore and persist the chosen default to both stores in one call. - nylas init's updateConfigGrants and nylas auth config's manual cfg.DefaultGrant assignment are removed — the persistence now lives inside SyncGrants / PromptDefaultGrant. - PersistDefaultGrant also clears the legacy in-memory cfg.Grants slice so the prior invariant (config.yaml never carries the grant list) is preserved end-to-end.
agtang96
approved these changes
Apr 30, 2026
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
Test Plan