fix(hooks): unblock verify:pr-local in web sessions; answer #248 offline half and correct #210 - #1880
Conversation
The SessionStart hook wrote its lockfile marker to node_modules/.session-start-lock-hash right after npm ci. That same npm ci already ran check-installed-lock-parity.mjs --write-stamp in postinstall, so the marker landed one file after the trusted inventory was taken: 51567 files against a stamp of 51566. check:installed-lock-parity therefore failed deterministically in every Claude Code web session, aborting verify:pr-local before format, lint, typecheck and test. Its printed remedy could not help either, since a fresh npm ci re-runs the hook and recreates the same off-by-one. Move the marker into node_modules/.cache, which is already in the check's VOLATILE_DIRECTORIES set and is still wiped by npm ci, so the hook's staleness semantics are unchanged. Verified: check:installed-lock-parity exits 0 at 51566 files, and the full verify:pr-local run now completes all 14 steps (6148 tests passed). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STG6AU5J4gxrFJagP4pRti
#248 — settled without touching live. check:drift does cover the missing-index class: all four 20260705180000 indexes are in schema.sql and in the drift manifest, indexes compare by name on table + def_hash, and the drift allowlist is empty, so a run would have failed with four missing_live findings. The gap is cadence, not coverage — live-drift.yml is weekly plus manual and gates nothing. Also records a genuinely uncovered sub-class: schema_drift_snapshot() reads pg_get_indexdef but never indisvalid/indisready, so an index left invalid by a failed CREATE INDEX CONCURRENTLY compares byte-identical while the planner cannot use it. The live forensic (partial apply vs manual drop vs history repair) remains operator work behind the approved window. #210 — half already fixed, and its prescribed fix refuted. npm run typecheck has used tsconfig.typecheck.json since 450690f, which excludes .next entirely; verified green with .next/dev/types/validator.ts present. Dropping the dev-types glob from tsconfig.json does not hold: Next 16 emits it deliberately and writeConfigurationDefaults pushes it back into an existing include on every next dev/build. What remains is narrower — the Playwright isolated tsconfig inherits the repo-root globs, confirmed by probe, and Next's own dev-types filter does not apply because useTypeScriptCli defaults true. Recorded as not yet proven end-to-end. Also records the session-start marker defect fixed in the previous commit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STG6AU5J4gxrFJagP4pRti
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in:30 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Comment |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STG6AU5J4gxrFJagP4pRti
…-e4rfob' into claude/task-completion-checklist-e4rfob
Summary
fix(hooks)— the SessionStart hook brokeverify:pr-localin every Claude Code web session. The hook wrote its lockfile marker tonode_modules/.session-start-lock-hashimmediately afternpm ci, but that samenpm cihad already recorded the trusted file inventory in postinstall (check-installed-lock-parity.mjs --write-stamp). The marker therefore landed one file after the stamp — 51567 files against a stamp of 51566 — socheck:installed-lock-parityfailed deterministically and aborted the PR gate beforeformat,lint,typecheckandtestever ran. Its printed remedy ("Runnpm ci") could not help, because a freshnpm cire-runs the hook and recreates the same off-by-one. Moving the marker intonode_modules/.cachefixes it: that directory is already in the check'sVOLATILE_DIRECTORIESset, andnpm cistill wipes it with the rest ofnode_modules, so the hook's staleness semantics are unchanged.docs—#248, offline half answered.check:driftdoes cover the missing-index class: all four20260705180000indexes are present insupabase/schema.sqland insupabase/drift-manifest.json, indexes are compared by name ontable+def_hash, andsupabase/drift-allowlist.jsonis empty, so a run would have failed with fourmissing_livefindings. The gap is cadence and gating, not coverage —check:driftruns only fromlive-drift.yml(weekly cron plus manual) and blocks no PR or release. The write-up also records a genuinely uncovered sub-class:schema_drift_snapshot()builds index rows frompg_get_indexdefand never readsindisvalid/indisready, so an index left invalid by a failedCREATE INDEX CONCURRENTLYcompares byte-identical while the planner refuses to use it.docs—#210, corrected. Half of the row is already fixed and its prescribed fix is refuted, so the row as written would have sent the next agent into a change that silently reverts.npm run typecheckhas usedtsconfig.typecheck.jsonsince 450690f (excludes.nextentirely; verified green with.next/dev/types/validator.tspresent). Dropping the dev-types glob fromtsconfig.jsondoes not hold: Next 16 emits it deliberately (type-paths.js, "to avoid tsconfig churn when switching between dev/build modes") andwriteConfigurationDefaultspushes it back into an existingincludeon everynext dev/next build. What remains is narrower than written —scripts/run-playwright.mjswrites an isolated tsconfig that inherits the repo-root globs, and Next's own dev-types filter does not cover it becauseuseTypeScriptClidefaults true. Recorded explicitly as not yet proven end-to-end.docs— new row for the hook defect above, since the failure is subtle and the tempting repair (re-stamping) would launder a real dependency mismatch as green.Not addressed, and why:
#022needs a deliberate hosted Supabase migration apply plus a qualified clinician's review of BMJ attestation evidence. Both are outside what this session can authorize or do; state verified unchanged (attestation_applied: falseacross all 11 manifest entries, migration20260727010000still unapplied). The live half of#248— whether the reconcile migration partially applied, indexes were manually dropped, orschema_migrationswas repaired — likewise needs the approved live/history window.Verification
npm run verify:pr-localnpm run check:installed-lock-paritybefore the fix:installed file inventory differs from the trusted post-install stamp(exit 1). After:760 package locations; 51566 files.(exit 0).UI verification not run: no UI, routing, styling, or browser-behaviour change in this diff.
Risk and rollout
npm ciat session start, not a broken install.git reverteither commit independently — the hook fix and the documentation are separate commits and share no file.#248findings were derived entirely from committed files (schema.sql,drift-manifest.json,drift-allowlist.json,check-drift.ts, the snapshot migration) with no live access.Notes
## Clinical Governance Preflightsection:classifyPullRequestFilesreturnsclinicalRisk: false,operationalRisk: false,ragRanking: false,ui: falsefor these three paths, and the diff touches no ingestion, answer-generation, ranking, source-rendering, document-access or privacy surface.AGENTS.md, each is listed as its own bullet above, and the only code change is isolated in its own commit so it stays separately revertible while the PR is open.Generated by Claude Code