fix(auth-files): prevent OAuth alias write races and silent drops#410
Merged
Conversation
Serialize OAuth model-alias mutations with a write queue and soft-refresh baseline so concurrent diagram updates do not overwrite each other. Align client validation with CPA sanitize rules (reject name===alias and duplicate aliases), plan multi-channel renames before write with best-effort rollback, and restrict excluded-model DELETE fallbacks to 404/405. Improve list previews and scope/usage copy for OAuth channels.
Queue per-section read-modify-write updates so concurrent AI provider edits cannot lose each other's PUT payloads. Add a synchronous enable/disable lock for table toggles and clarify that API-key model aliases are separate from OAuth auth-file mappings.
Serve demo GET /oauth-model-alias as the real channel→alias map used by CPA instead of a legacy items array with identity mappings. This keeps demo mode from normalizing to an empty alias list and misleading manual checks of multi-mapping behavior.
$font-size-sm is not defined in styles/variables.scss, so the new .cardScopeHint rule broke vite production builds. Use 12px to match nearby secondary text styles in AuthFilesPage.
This was referenced Jul 20, 2026
AndrewZhuCC
added a commit
to AndrewZhuCC/CPA-Manager-Plus
that referenced
this pull request
Jul 21, 2026
Upstream seakee#410 returned fresh () => loadExcluded()/loadModelAlias() wrappers every render. AuthFilesPage's mount effect depends on those identities, so each setState retriggered hard loads of auth-files, oauth-model-alias, and oauth-excluded-models — page flicker + request storm. Return the stable useCallback references instead.
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
Fix OAuth auth-files model alias write races and silent drops under concurrent edits, serialize AI provider config updates, and align the demo endpoint with CPA's channel→alias map so demo mode no longer normalizes to an empty alias list.
Scope
Changes
name===aliasand duplicate aliasesGET /oauth-model-aliasnow returns the CPA-shaped channel→alias mapUser Impact
Concurrent edits in OAuth auth-files and AI provider config no longer silently lose changes; demo mode no longer misleads manual checks of multi-mapping behavior. No breaking API changes.
Compatibility / Runtime Notes
Data / Security Notes
N/A — frontend state serialization and client-side validation only; no SQLite, admin key, CPA Management Key, OAuth credentials, or auth file data affected.
Risk / Rollback
Risk level: Low
Rollback notes: All three commits touch frontend state and demo data shape only; revert is safe with no data migration concerns.
Verification
Commands / evidence:
Screenshots / Recordings
N/A — logic-only fix, no visual changes.
Docs
Reason: Frontend state serialization and demo data shape changes only; no user-visible capabilities affected.
Related
Fixes #398