Stop the privacy readiness register failing on a shallow clone - #2720
Stop the privacy readiness register failing on a shallow clone#2720BigSimmo wants to merge 2 commits into
Conversation
The shallow-clone guard added for clinical-hazard-controls and rag-plan-package-parity missed a third check with the identical defect. On a web-container clone (depth ~102) the reviewedCommit is simply absent from a truncated history, and both the spec and the CLI gate report it as "reviewedCommit does not exist: d307494...", which reads as a corrupt privacy register rather than a truncated checkout. That is the wrong conclusion to invite about a governance manifest, and it costs a diagnosis every session. - tests/privacy-readiness-contract.test.ts: same guard as its two sibling specs. Deepen the history first, and only skip the commit checks when the commit is still unreachable AND the clone is still shallow. - scripts/check-privacy-readiness.mjs: the CLI gate had the same defect, so check:production-readiness carried it too. It now warns with PRIVACY_READINESS_SHALLOW_CLONE naming exactly what was skipped, matching check-clinical-hazard-controls.mjs. Fails closed by construction: the skip needs both a shallow clone and an unreachable commit, so on a full-history checkout a genuinely missing reviewedCommit still fails. Verified directly against a manifest carrying a bogus commit: with git checks on it still reports "does not exist"; only the explicit skip path suppresses it. CI checks out at fetch-depth 0, where the checks run in full. Verification: lint and typecheck clean; full offline unit suite 1268 files passed, 0 failed. The three specs that previously failed in this container now pass, and this container's clone is no longer shallow, so the commit checks ran rather than being skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RkMv1BzScPTvrzJ8F7DtzY
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_ae5cd679-60d9-4df3-a993-8810975ba6fe) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a21aa05a84
ℹ️ 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".
Two P1 findings from the Codex review of this PR, both correct. Release mode must never skip the reviewedCommit checks. The first commit applied the shallow-clone skip in every mode, including `--release`. But `check:privacy-readiness:release` backs `check:production-readiness` and `governance:release`, and the ancestry plus evidence-at-commit checks are exactly what bind the register to this repository. Once the remaining status blockers close, a release run from a truncated checkout could have printed PRIVACY_READINESS_PASS having proved none of that. The skip decision now lives in `shallowSkipDecision`, which returns `blocked` for release mode and makes the gate exit non-zero naming the full-history remedy. The spec must not reach the network. `ensureHistoryDeepened` ran `git fetch --deepen` from inside the unit suite: remote I/O and a repository mutation, not an offline probe, and an unreachable or credential-prompting remote would stall the suite rather than fail it. The spec now probes only, and a truncated checkout skips the commit checks and says so. Proven against a real depth-one clone, not argued. On the committed parent the release run printed the skip warning and reached validation, which is the reported defect. With the fix, in the same clone, release exits 1 with "reviewedCommit ... is unreachable in this shallow clone", and structural still passes with the checks skipped and stated. `shallowSkipDecision` is unit-tested across all four release/shallow/commit-present combinations. Verification: lint and typecheck clean; full offline unit suite 1268 files passed, 0 failed, 18036 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RkMv1BzScPTvrzJ8F7DtzY
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #16294 (cancelled). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
Summary
#1M0J6Dcoverstests/clinical-hazard-controls.test.tsandtests/rag-plan-package-parity.test.ts, but a third check with the identical defect was missed:tests/privacy-readiness-contract.test.tsand thecheck:privacy-readinessCLI gate behind it.reviewedCommitis simply absent from a truncated history, and both reportreviewedCommit does not exist: d3074946a917cac378de64284c67cbc1d4dc58fa. That reads as a corrupt privacy register rather than a truncated checkout, which is exactly the wrong conclusion to invite about a governance manifest.tests/privacy-readiness-contract.test.tsnow uses the same guard as its two sibling specs: deepen the history first, and skip the commit checks only when the commit is still unreachable and the clone is still shallow.scripts/check-privacy-readiness.mjshad the same defect, socheck:production-readinesscarried it too. It now warns withPRIVACY_READINESS_SHALLOW_CLONEnaming exactly what was skipped, mirroringcheck-clinical-hazard-controls.mjs.This does not weaken the check. The skip requires both a shallow clone and an unreachable commit, so on a full-history checkout a genuinely missing
reviewedCommitstill fails. CI checks out atfetch-depth: 0, where the commit and evidence-at-commit checks run in full.The helper trio is duplicated from the two sibling specs rather than extracted. Extracting it would mean editing two currently-passing governance specs, which is wider than this fix needs; noting it here as a deliberate choice rather than an oversight.
Verification
npm run lint— clean,[gate-receipts] recorded a pass for "lint:internal" (7425 input files)npm run typecheck— clean,[gate-receipts] recorded a pass for "typecheck:internal" (7425 input files)npm run test(full offline unit suite) —Test Files 1268 passed | 1 skipped (1269)/Tests 18035 passed | 2 expected fail | 3 skipped, zero failures. Before this change the same container failedprivacy-readiness-contract.node scripts/check-privacy-readiness.mjs—PRIVACY_READINESS_PASS mode=structural requirements=11reviewedCommiton this now-full-history clone:reviewedCommit does not exist→truecheckGit: falsepath suppresses it →truegit rev-parse --is-shallow-repository→false, 5898 commits), so the suite passed with the commit checks running, not skipped. The skip branch was proven by the direct fail-closed check above rather than by a shallow-clone reproduction.Verification not run:
npm run verify:pr-localand browser gates. No UI, routing, styling or browser surface is touched — the diff is one test file and one Node check script.Risk and rollout
Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy).Notes
#1M0J6D, closed 2026-09-06 as "Added auto-shallow clone detection to governance test suites". This completes that work for the third affected check.🤖 Generated with Claude Code
https://claude.ai/code/session_01RkMv1BzScPTvrzJ8F7DtzY
Generated by Claude Code
Note
Low Risk
Governance CLI and test-only behavior; skip is gated on shallow clone plus unreachable commit, so release/CI full-history gates are unchanged.
Overview
Privacy readiness no longer fails in truncated checkouts when
reviewedCommitis missing from shallow history, aligning with the existing guards on clinical hazard controls and RAG plan parity.scripts/check-privacy-readiness.mjsadds shallow-repo detection and, when the clone is shallow andreviewedCommitis absent, emitsPRIVACY_READINESS_SHALLOW_CLONEand runs validation withcheckGit: falseso existence, ancestry, and evidence-at-commit checks are skipped while structural checks still run.tests/privacy-readiness-contract.test.tsmirrors the sibling contract tests: trygit fetch --deepen, then setcheckGit: falseonly if the commit is still missing and the repo remains shallow.On full-history checkouts (including CI with
fetch-depth: 0), a bogus or missingreviewedCommitstill fails as before—the skip needs both conditions.Reviewed by Cursor Bugbot for commit a21aa05. Configure here.