ci(drift): route live-drift failures to a pinned issue and trigger on migrations - #1938
Conversation
… migrations Phase 0 of the database remediation plan (docs/database-remediation-plan.md). The weekly live-drift check has been red since 2026-07-26 with nobody told: a failed run was only a red row in the Actions list, with no assignable object. - A new drift-routing job creates or updates a single pinned issue titled "Live drift check failing" (label live-drift-failure) carrying the captured drift finding lines and the run URL, and comments the resolution and closes it on the next green run. Repeated failures update that issue in place. - issues: write is scoped to that job alone, so the job that runs npm ci and repository code keeps contents: read only. - The drift step now tees its output so the finding lines from check-drift.ts can be captured; when a run dies before the comparison the issue says so rather than implying a clean schema. - live-drift also runs on pushes to main touching supabase/migrations/** or supabase/schema.sql, so drift is checked within minutes of the change that could cause it instead of up to a week later. Schedule, workflow_dispatch, the secret preflight, and concurrency cancel-in-progress: false are unchanged. No Supabase code, migration, or RAG surface is touched, and no provider was called. docs/audit/live-drift-forensics-2026-08.md gains dated, empty, headed evidence sections for Phases 1-5, anchored to ledger #316. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BKNFogaYfCQBvFVqFQnfRt
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Immutable inbox request; docs/outstanding-issues.md is untouched and is reconciled separately after this PR lands. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BKNFogaYfCQBvFVqFQnfRt
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 43 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 (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d20e7d9096
ℹ️ 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".
|
@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 claude/db-remediation-phase-0-wfaiyl at starting commit 5e4b5fd; 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:claude/db-remediation-phase-0-wfaiyl, 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. What shall we delve into next? 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". |
The routing script merged in #1938/#1939 carries issues: write and had no test, so its create/update/close behaviour would first have been exercised against the real repository. Extracts the embedded github-script body and executes it against stubbed issue APIs, using the same extraction pattern as tests/codex-autofix-workflow.test.ts. Asserts: - a failure with no open issue creates exactly one labelled issue carrying the run URL and the captured findings - a repeat failure updates that same issue and comments, never opening a second - a run that died before the comparison is not presented as a clean schema - a green run comments the resolution and closes with state_reason completed - a green run with no open issue writes nothing at all - an unknown job result is treated as failure, not as a reason to close Also pins the trigger/privilege contract: schedule + dispatch + the migrations-push trigger, never pull_request, cancel-in-progress false, the secret preflight, the pinned github-script SHA, and issues: write appearing exactly once and only inside drift-routing. Verified by mutation: inverting the update-in-place branch, the close-on-green state, and escalating issues: write to workflow level each turn this test red. Registered in test:ci-workflows so a future workflow-scope change runs it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BKNFogaYfCQBvFVqFQnfRt
Four merge-safe inbox requests; docs/outstanding-issues.md is untouched and is reconciled separately after this PR lands. - update #316: Phase 0 closed, including the forced-dispatch proof (run 31813064485 -> auto-created issue #1963). Also supersedes the stale 2026-08-09 drift figures with measured ones: 10 RPC mismatches unchanged, 20 missing indexes, 2 unexpected, and the two trigram indexes confirmed restored. - done #331: its comparison-bug hypothesis is refuted; the staleness was real and wrapping-only, inherited from main by every branch. - update #333: the regeneration half is done here; its real question - the check runs in verify:pr-local but in no CI job - stays open. - update #292: records the #1938/#1939 Phase 0 duplicate against the existing duplicate-work row rather than opening a near-identical new one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BKNFogaYfCQBvFVqFQnfRt
…) (#2044) * docs(db): add coordination handover for multi-chat remediation oversight Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L7umYGe6hbCfq3NmpZ4Gz4 * docs(db): re-baseline the remediation coordination board to main (#316) Carries the coordination handover onto the coordination-chat branch and corrects it against the repository record as of main f5b0932: the tracking anchor is #316 (not #312), Phase 0 is complete (#1938/#1939/#1951/#1978), Phase 1 is partial with 1.2 the only executable next step, Phase 3 is blocked on ten UNCLASSIFIED RPCs, and Phase 4/5 have incident-scope partial evidence. The originating "never executed" verdict is marked superseded by the Phase 1.1 fingerprint. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore(ledger): record review of the coordination board PR (#2044) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Phase 0 of
docs/database-remediation-plan.md— repo-side enablement only. No hosted Supabase access of any kind was used, and no Supabase code, migration, or RAG surface is touched.drift-routingjob creates or updates a single pinned issue titledLive drift check failing(labellive-drift-failure) carrying the captured drift finding lines plus the run URL. Repeated failures update that same issue in place and add a short "still failing" comment, rather than stacking new issues. The next green run comments the resolution and closes it. Modelled on the existing rolling-issue pattern in.github/workflows/ops-digest.yml.permissionsstayscontents: read.issues: writeis granted only todrift-routing, which runs a single inlineactions/github-scriptstep and never checks out or executes repository code. Thelive-driftjob that runsnpm ciand the drift scripts keepscontents: readand gains no new permission.Compare live schema driftnow tees its output (with an explicitset -o pipefail, since the default step shell isbash -ewithout it, which would otherwise mask a failingcheck:driftbehindtee's exit code). Anif: always()step greps the line shapes emitted byscripts/check-drift.ts:280-311into a job output. When a run dies before the comparison — missing secret, identity guard — the issue says so explicitly rather than implying a clean schema.live-driftalso runs on pushes tomaintouchingsupabase/migrations/**orsupabase/schema.sql, so drift is checked within minutes of the change that could cause it instead of up to a week later.docs/audit/live-drift-forensics-2026-08.mdgains dated, empty, headed sections for Phases 1–5, each naming its approval requirement.workflow_dispatch, the weekly30 18 * * 0schedule, the secret preflight, andconcurrency.cancel-in-progress: falseare all unchanged.Two corrections to the task as written
#316, not#312. The playbook says to resolve the anchor by exact title and "never assume an ID".#316is the P1 titled "Live DB is missing 21 repo-defined indexes and 10 retrieval RPC bodies diverge; weekly live-drift has been red since 2026-07-26 with no routing".#312is an unrelated P3 aboutcheck:playwright-browser-revision. The ledger update targets#316.RAG impact
Not required, and stated explicitly:
classifyPullRequestFilesreturnsragRanking: falseandclinicalRisk: falsefor this diff (operationalRisk: true, from.github/workflows/**). No file undersrc/lib/rag/**, nomatch_*RPC, no ranking, selection, eval-harness, or golden-fixture surface is touched.Smallest-change choices made where the task was open-ended
docs/scripts-index.mdentry to maintain. Capped at 80 lines to bound the issue body.grepin the workflow rather than a newscripts/*.mjs, to avoid adding a gate/doc-index surface for six lines of pattern matching.Verification
npm run verify:pr-localIts
test:ci-workflowsleg:Test Files 14 passed (14)/Tests 302 passed (302).npm run check:github-actions—GitHub Actions pin check passed.npm run formatrun and the result committed. Independently confirmed on the two changed files:npx prettier --check→All matched files use Prettier code style!Additional local proof beyond the required gates, since the repo has no YAML parser in its dependency tree and its workflow checks are text-based:
['workflow_dispatch', 'schedule', 'push'];push: {"branches": ["main"], "paths": ["supabase/migrations/**", "supabase/schema.sql"]};concurrency: {"group": "live-drift-check", "cancel-in-progress": false}; workflowpermissions: {"contents": "read"};live-driftjob-level permissionsnull(inherits read-only);drift-routingpermissions{"contents": "read", "issues": "write"}; secret preflight step still present.github-scriptbody and rannode --checkon it → syntax OK.Not run, with reasons:
verify:ui(no UI, routing, styling, or browser behaviour changed).verify:release,check:production-readiness, and alleval:*gates (provider-backed; this phase is explicitly hosted-access-free). Lint, typecheck, the full unit suite, and the RAG fixture scan were skipped byverify:pr-localitself as recognised low-risk scope, and the build as having no build-affecting changes.The one Phase 0 definition-of-done item deliberately left to the operator: the playbook asks that a forced
workflow_dispatchfailure be observed producing the pinned issue. Dispatching the workflow is provider-backed and touches live Supabase, so it is out of scope for this phase's constraints and is recorded as outstanding in the forensics doc.Risk and rollout
needs.live-drift.resultand writes an issue; if the script itself throws, that job fails visibly without changing the drift job's outcome. The newpushtrigger is path-filtered tosupabase/migrations/**andsupabase/schema.sqlonmainonly, andcancel-in-progress: falsemeans added runs queue behind the weekly one rather than cancelling it. The one behavioural change inside the existing job isset -o pipefailon the drift step, which makes acheck:driftfailure more likely to be reported, not less.git revertthe single commit. Nothing is stateful and no migration, schema, or manifest is involved. If only the routing is unwanted but the trigger is worth keeping, delete thedrift-routingjob and theCapture drift findingsstep; thelive-driftjob then behaves exactly as it does onmaintoday. A pinned issue left open after a revert can simply be closed by hand.Notes
npm run formatalso reformatted 31 files unrelated to this change, includingsrc/lib/rag/rag-cache.ts,src/lib/rag/rag-provider.ts,scripts/ci-change-scope.mjs, and several components and docs (mostly union-type and prose reflow). That is pre-existing formatting drift onmain, not produced by this diff. All of it was reverted and is not in this PR, which keeps the diff to the two intended files and avoids dragging protected RAG surfaces into a docs/workflow change. Worth a separate follow-up:maincurrently does not satisfy a whole-treeprettier --check.engine-strict, so the firstnpm cifailedEBADENGINEand lefttsxunresolvable, which failedcheck:runtime. Node 24.19.0 was installed via the container's nvm and the dependencies reinstalled cleanly (npm ci --include=devexit 0, npm 11.17.0) before the gates above were run. Repository code was not changed to accommodate the environment.Generated by Claude Code