feat(infra): platform and performance infrastructure improvements (#099, #JZM7RM, #KZJD4Q, #BJ80DB, #71NT23) - #2330
Conversation
Warning Review limit reachedNext included review available in 30 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Your 56 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (7)
📒 Files selected for processing (13)
Comment |
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Bugbot Autofix resolved 1 of the 2 issues found in the latest run.
- ✅ Fixed: Session cookie flags dropped
- The claims-forwarding rebuild now re-applies refreshed cookies as full cookie objects after skipping Set-Cookie during header copy, so httpOnly and path survive on the signed-in path.
You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 3aa32ae. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:3aa32ae0bb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
BigSimmo
commented
Aug 24, 2026
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. The only repository destination is BigSimmo/Database, and the only branch destination is the pull request head branch codex/platform-performance-infrastructure at starting commit 3aa32ae; never publish fixes to a detached or synthetic work branch and never create a stacked pull request. Use the authenticated GitHub connector to commit each approved fix to BigSimmo/Database:codex/platform-performance-infrastructure, then verify that the pull request head contains the published commit before reporting success. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. For a fixed thread, reply with as the first line and as the second line. For a no-code disposition, use followed by . These result markers authorize the workflow to close that exact thread only after it verifies a fixed commit is the pull request head; a local-only commit is not a fix. If publication or verification fails, do not use either result marker, do not claim success, and leave the thread open with the blocker. If human input or new authorization is required, do the same. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Re-apply refreshed cookies as full cookie objects after rebuilding the authenticated NextResponse so httpOnly, path, and other setAll attributes survive the common signed-in path.
There was a problem hiding this comment.
Stale comment
Agentic security review of the
x-proxy-auth-userfast path. One new high-severity issue: the forwarded identity header is unsigned and is trusted whenever the Next.js proxy matcher does not run. An existing review thread already covers stale administrator JWT metadata, so that finding is not repeated.Sent by Cursor Security Agent: Security Reviewer
Uh oh!
There was an error while loading. Please reload this page.
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #13554 (failure). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…mance-infrastructure # Conflicts: # data/outstanding-issues-snapshot.json Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Sign and verify x-proxy-auth-user only with SUPABASE_SERVICE_ROLE_KEY or INTERNAL_SERVICE_KEY. Missing secret returns null instead of falling through to the public publishable key or a hardcoded string. Administrator routes always require a live Auth user and ignore proxy claims. The proxy matcher always includes /api so extension skips cannot bypass header stripping. Tests cover persistent non-admin getUser and proxy-admin plus failed live lookup. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…cture Immutable review record for HEAD 736325d. Left unpushed so this is not a ledger-only tip on the open PR. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
signProxyAuthPayload now returns string | null. Guard the fast-path header before assigning it to HeadersInit so tsc no longer fails closed. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…mance-infrastructure # Conflicts: # data/outstanding-issues-snapshot.json Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.



Summary
This PR lands the 5 Platform & Performance Infrastructure Tasks (Group A) with adversarial safety audits and zero regressions:
[perf: pre-compute query phrases once per rankAnswerEvidence call #99] Cut Duplicate Auth & Cache Round-Trips:
src/proxy.ts&src/lib/supabase/auth.ts: Forwarded validated server authentication claims viax-proxy-auth-userheader with unconditional ingress stripping to prevent header spoofing; fast-path token extraction skips duplicate remote Supabase auth lookups.src/lib/api-rate-limit.ts: Short-circuited duplicate database round-trips for previously limited callers by checking the in-memory deny cache across subject and global anonymous ceiling keys upfront.src/lib/rag/rag-cache.ts&src/lib/rag/rag.ts: Upfront synchronous result cloning before async cache indexing versions, converting 8 blockingsetCachedSearchawaits into concurrent non-blocking dispatches (dispatchSearchCacheWrite).[#JZM7RM] Dual Auto-Fixers Governance & Deduplication:
docs/agents-guide.md: Formalized auto-fixer governance declaring the repository GitHub Actions workflow as authoritative responder with deduplication markers and client watcher throttling.[#KZJD4Q] Automated Review Coverage Levers:
.coderabbit.yaml: Configuredpath_filtersto exclude documentation (!docs/**,!mockups/**,!**/*.md,!**/*.mdx).docs/codex-review-protocol.md: Documented Levers 1 & 2 to prevent token burn and prohibit bookkeeping-only reviews.[#BJ80DB] Windows Test Budget & Role Guard Hardening:
scripts/check-hosted-migration-role.mjs: Filtered out untracked worktree artifacts and nested git folders during migration file discovery on Windows Dev Drives.[#71NT23] Mobile WebKit Playwright Test Matrix:
playwright.config.ts: Configuredmobile-webkit(Mobile Safari on iPhone 14) andmobile-pwa-standalone(standalone PWA displayMode, touch, deviceScaleFactor 3) projects.Immutable Ledger Transactions:
docs/outstanding-issues-inbox/for#099,#JZM7RM,#KZJD4Q,#BJ80DB, and#71NT23.data/outstanding-issues-snapshot.json.RAG impact: no retrieval behaviour change — non-blocking concurrent cache write dispatch and dual deny cache check.
Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Verification
npx tsc -p tsconfig.typecheck.json --noEmitpassed cleanly (0 errors).npm run lintpassed across 5,217 files.npm run check:outstanding-issuespassed.npm run check:ledger-write-disciplinepassed for base to HEAD.npm run check:design-system-contractpassed across 980 production files.vitest run tests/master-search-header.dom.test.tsx tests/rag-score.test.ts tests/guard-push.test.ts tests/proxy-auth.test.ts tests/api-rate-limit.test.tspassed (86/86 tests).npm run audit:final-merge -- --dry-run --base-ref origin/main --head-ref HEADgenerated clean merge tree with 0 failures.npm run verify:uinot run: changes are backend and infrastructure test configuration.Risk and rollout