Skip to content

test: cover worker auth context propagation#253

Open
jasperan wants to merge 1 commit into
outerbase:mainfrom
jasperan:bounty-71-jwt-context-coverage
Open

test: cover worker auth context propagation#253
jasperan wants to merge 1 commit into
outerbase:mainfrom
jasperan:bounty-71-jwt-context-coverage

Conversation

@jasperan
Copy link
Copy Markdown

Summary

  • Add focused src/index.test.ts coverage for the Worker entrypoint: CORS preflight short-circuiting, admin bearer auth, websocket query-token auth, source/cache metadata, and regional Durable Object lookup.
  • Fix a JWT auth context propagation bug where a verified JWKS payload was assigned after DataSource.context was created, so downstream RLS/context consumers could miss claims like sub.
  • Keep production behavior scoped to copying the authenticated context onto the existing data source before delegating to StarbaseDB.handle.

Validation

  • corepack pnpm exec prettier --check src/index.ts src/index.test.ts
  • corepack pnpm exec vitest run src/index.test.ts
  • corepack pnpm exec vitest run src/index.test.ts --coverage.enabled --coverage.include=src/index.ts --coverage.reporter=text
  • git diff --check

Notes

  • I also ran the full Vitest suite; it still reports existing unrelated src/rls/index.test.ts assertion failures around multi-table/subquery RLS rewriting. This PR only touches src/index.ts and adds src/index.test.ts.
  • Non-UI/backend test change, so the verification commands above are the demo evidence.

/claim #71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant