Skip to content

fix: tolerate OAuth token sets missing token_type/scope (EPICSHOP-HG) - #654

Merged
kentcdodds merged 2 commits into
mainfrom
cursor/sentry-triage-epicshop-epicshop-hg-c527
Aug 14, 2026
Merged

fix: tolerate OAuth token sets missing token_type/scope (EPICSHOP-HG)#654
kentcdodds merged 2 commits into
mainfrom
cursor/sentry-triage-epicshop-epicshop-hg-c527

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

Sentry EPICSHOP-HG reported a handled ZodError while reading local data.json during warmCachegetAuthInforeadDb.

The stored auth entry for www.epicreact.dev had an OAuth tokenSet with access_token but missing token_type and scope. Those fields are optional in OAuth responses; the CLI already defaults them when saving (Bearer / ''), but the shared DB schema required both strings. Parse failure was treated as a corrupted database file (retries, Sentry capture, move to .bkp), which wipes preferences along with auth.

Fix

  • Default token_type to 'Bearer' and scope to '' in TokenSetSchema (workshop-utils + CLI auth schema).
  • Normalize those fields in setAuthInfo on write.
  • Aha tests for EPICSHOP-HG.

Risk

Low — isolated schema/default change with tests; preserves existing complete token sets.

Testing / CI

  • Local: nx run @epic-web/workshop-utils:test -- db-auth-token-set and npm run validate
  • CI: validate run 31755625281 green (incl. Windows Example after retrigger)

Merge note

Autonomous squash-merge was blocked by epicweb-dev OAuth App access restrictions; PR is ready for Kent to merge. After merge, resolve EPICSHOP-HG in the squash commit.

Open in Web Open in Cursor 

Incomplete local auth token metadata was failing Zod parse on DB read,
which treated the whole data file as corrupted and wiped preferences.
Default token_type/scope like CLI auth already does when persisting.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kentcdodds
kentcdodds marked this pull request as ready for review August 13, 2026 23:47
@nx-cloud

nx-cloud Bot commented Aug 13, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 3501956

Command Status Duration Result
nx run-many --target typecheck ✅ Succeeded 1s View ↗
nx run-many --target build ✅ Succeeded <1s View ↗
nx lint ✅ Succeeded 2s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-08-13 23:58:29 UTC

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kentcdodds
kentcdodds merged commit 7ee94ab into main Aug 14, 2026
10 checks passed
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.

2 participants