Skip to content

fix(auth-files): prevent OAuth alias write races and silent drops#410

Merged
seakee merged 4 commits into
mainfrom
fix/oauth-model-alias-write-safety
Jul 20, 2026
Merged

fix(auth-files): prevent OAuth alias write races and silent drops#410
seakee merged 4 commits into
mainfrom
fix/oauth-model-alias-write-safety

Conversation

@seakee

@seakee seakee commented Jul 20, 2026

Copy link
Copy Markdown
Owner

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

  • Frontend panel

Changes

  • OAuth model-alias mutation write queue + soft-refresh baseline to prevent concurrent PUTs from overwriting each other
  • Client validation aligned with CPA sanitize rules: reject name===alias and duplicate aliases
  • Multi-channel renames planned before write with best-effort rollback
  • excluded-model DELETE fallback restricted to 404/405
  • AI provider per-section read-modify-write serialization + enable/disable synchronous lock
  • Demo GET /oauth-model-alias now returns the CPA-shaped channel→alias map
  • New oauthAliasValidation unit tests (+207 lines) and authFiles.test.ts cases

User 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

  • CPA panel mode: N/A (frontend-only)
  • Manager Server mode: N/A (frontend-only)
  • Full Docker / native packages: N/A (frontend-only)

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

  • Type check
  • Lint
  • Tests (new oauthAliasValidation.test.ts + authFiles.test.ts)
  • Build
  • Manual UI check
  • Not applicable, docs-only

Commands / evidence:

git log main..HEAD --oneline
d87f3df8 🐛 fix(demo): return CPA-shaped oauth-model-alias payload
2ed50653 🐛 fix(ai-providers): serialize provider config writes and toggle locks
f5996d4c 🐛 fix(auth-files): prevent OAuth alias write races and silent drops

Screenshots / Recordings

N/A — logic-only fix, no visual changes.

Docs

  • Not needed — explanation included below
    Reason: Frontend state serialization and demo data shape changes only; no user-visible capabilities affected.

Related

Fixes #398

seakee added 4 commits July 20, 2026 15:15
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.
@seakee
seakee merged commit 1a622d8 into main Jul 20, 2026
8 checks passed
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.
@seakee
seakee deleted the fix/oauth-model-alias-write-safety branch July 21, 2026 01:46
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.

[Bug]: Claude模型填写映射没效果,并且只能最多存在一个模型映射

1 participant