Skip to content

audit fixes (P21): draft the Caring Contacts hazard log and message review pack the ledger cites - #2626

Merged
BigSimmo merged 10 commits into
mainfrom
claude/audit-fix-p21
Sep 4, 2026
Merged

audit fixes (P21): draft the Caring Contacts hazard log and message review pack the ledger cites#2626
BigSimmo merged 10 commits into
mainfrom
claude/audit-fix-p21

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Audit remediation package P21 — Clinical governance documents, from docs/audit/full-repository-audit-2026-09-02.md (PR #2573). Findings: M6, L4.

These are drafts that require the owner's clinical sign-off. They are not clinical authority and neither approves nor unblocks a patient pilot. Both new files carry that statement at the top.

  • abc8b5c docs(caring-contacts): write the hazard log that #1S81R8 cites but no commit contains
  • 29d98ad docs(caring-contacts): write the message review pack the approval gate points at
  • db70eda docs(caring-contacts): remove the false recovery command from the Phase 1 handoff
  • e06baee docs(care-plan): record how each printed crisis number was verified, and when it is next due
  • f01b150 chore(docs): regenerate the repo-awareness snapshot for the three new governance documents

M6 — outstanding-issue #1S81R8 cites a hazard log and a message review pack that exist in no commit. Both are now written, assembled only from what this repository already records: the hazard analysis documents, docs/caring-contacts/**, clinical-hazard-controls.json, and the governance and message-policy code with its tests.

  • docs/caring-contacts/hazard-log.md38 hazards, 4 of them unmitigated. The four with no control cited are the three the ledger names (no named clinical safety officer, no lived-experience review of the message set, no Aboriginal cultural safety review) plus #TDKW4W's unconfirmed referral-feed feasibility. The other 34 are code-enforced, each with the file:line of its control and the offline test that proves the control runs. The original hazard numbering is unrecoverable, so reconstructed rows use H-C## and H-01H-43 are explicitly retired rather than reused.
  • docs/caring-contacts/message-review-pack.md — two patient-visible strings, two never-authored message types, three governed fragments, and 13 policy rules each with its check location and test line.

db70edaf6 corrected a false instruction, and could not replace it with a true one. The Phase 1 handoff carried a recovery command naming commit 32d408c2f; git cat-file -t 32d408c2f returns fatal: Not a valid object name, and git log --all --name-only matches no hazard-log, message-review-pack or referral-feasibility path. There is no real sha to substitute. The document now records the verified truth instead: those files are not in git, only in the two caring-contacts-handoff-2026-08-2* workstation bundles that PROGRESS-LEDGER §9 records as unprotected by any push — and two of the six have now been re-drafted rather than recovered.

L4docs/care-plan/crisis-lines-verification.md records, per printed crisis number, the source used to check it, the verifiedOn date already in the fixture, and a re-verification cadence. src/components/care-plan/mockups/fixtures.ts gains a comment pointing at it. No number and no verifiedOn date changed.

RAG impact: none

Two things found while drafting that this PR does not fix

  1. validateGovernedMessage has no production caller. grep -rn "validateGovernedMessage" src worker scripts returns only message-copy.ts and the module itself. Every message-content control this pack documents is therefore proof about a function, not about a delivered message. Recorded prominently in both new documents. It changes no present risk (nothing is being sent) but it should be read as blocking for a real-patient pilot alongside the three unmitigated reviews.
  2. src/components/care-plan/mockups/patient-plan-fixtures.ts prints contacts at 0491 570 210270, above the 156 upper bound of the block this repository treats as reserved for fiction. The range assertion at tests/care-plan-domain.test.ts:444 runs over a bundle built from fixtures.ts only, so it never sees them — the same defect class sdd-ledger.md:623-627 records fixing in fixtures.ts. Nothing was changed; it is written up in the crisis-lines document and needs an owner decision.

What the owner must check before signing

These claims are in the new documents and could not be verified from the repository:

  • The original text of the four unmitigated hazards (reconstructed from ledger detail cells; originals lost) and the original H-01H-43 numbering.
  • Lifeline 13 11 14 and 13YARN 13 92 76 at message-rules.ts:117 carry no source and no verification date anywhere in the repository, and nothing ages them. Marked to verify — no network access in this session.
  • That the 7-year retention period is lawful and appropriate — the handoff calls it "the working assumption".
  • That a small-cell threshold of 5 is adequate — the source itself says it rests on analogy, not calculation.
  • Where the ACMA fiction number block actually ends — cloud-session.md:258-259 records that this was never checked.
  • That Part B is exhaustive: it surveys src/lib/caring-contacts/; screens, routes and the database layer were not swept the same way.
  • Whether any control is the right control. The repository cannot answer that; only a clinician can.
  • The crisis numbers were not re-checked today (no network), nor were their availability windows; the 2026-08-20 verifier is not named. The six-month cadence is a proposal with no repository precedent — the audit proposed twelve months, and that disagreement is flagged inline in the document.

Verification

  • npm run verify:pr-local — result: - completed: check:runtime, check:installed-lock-parity, format:changed, check:diff-integrity, sitemap:check, check:repo-awareness-snapshot, docs:check-index, docs:check-inventory, docs:check-scripts, docs:check-links, check:branch-review-ledger, check:outstanding-issues, check:ledger-write-discipline, lint, typecheck, test, build, check:rag:fixtures, check:medication-interactions, check:medication-lexicon-report · - failed: (none) · - not reached: (none) · Tests 15135 passed | 2 expected fail | 3 skipped (15140) (the gate runner recorded exit code 0)
  • npm run check:clinical-hazard-controlsCLINICAL_HAZARD_CONTROLS_PASS hazards=6 decisions=2
  • npm run check:repo-awareness-snapshot[repo-awareness] in step with data/repo-awareness-snapshot.json (211 pages, 856 documents, 2692 reviews)
  • npm run check:diff-integrity[diff-integrity] PASS — 0 changed test file(s), 0 -> 0 test case(s), against base 33c2dc161. No test file is touched by this package.

Verification not run: npm run verify:ui — no UI surface changes; browser proof left to CI.
Verification not run: npm run verify:release, and every provider-backed gate — all work was offline, and no crisis number could be checked against its source without network access.

Risk and rollout

  • Risk: low as code (one comment in a fixture file; no number, threshold or logic changed), but high as governance, because these documents will be read as a record of what is controlled. That is why every unverifiable claim is listed above rather than smoothed over, and why both files are marked DRAFT.
  • Rollback: revert this PR's commits; each is independent.
  • Provider or production effects: None.
  • RAG impact: none

Clinical Governance Preflight

Each item confirmed against this package's diff (findings M6, L4). The checked line is the exact policy item; the note beneath it is the evidence.

  • Source-backed claims still require linked source verification before clinical use
    unchanged; the new documents state explicitly which of their own claims are unverified.
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
    none introduced or expanded; these are records of existing controls.
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
    no Supabase env value, migration target or configured project changes.
  • Service-role keys and private document access remain server-only
    unchanged; no access path is touched.
  • Demo/synthetic content remains clearly separated from real clinical sources
    reinforced — the crisis-lines document records exactly which printed numbers are real and which are fiction, and flags one fixture whose invented numbers may fall outside the reserved block.
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
    unchanged.
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed
    reviewed; documentation only, no decision-support behaviour added.

Notes

  • Ledger discipline: docs/outstanding-issues.md and docs/branch-review-ledger.md were read but never edited. The follow-ups this package surfaced are queued for a later pass through npm run issues:add.
  • One owner per file across the remediation programme: this package's files are edited by no other open remediation PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DHSyfuC6mS98ystWFiitAR


Generated by Claude Code


Note

Medium Risk
Runtime risk is minimal (one fixture comment), but the new draft hazard and crisis-line records are clinically sensitive and could be read as signed controls or verifications without owner sign-off.

Overview
Addresses audit P21 (findings M6, L4) by adding three DRAFT, unsigned governance documents the ledger and code already referenced but that were never in git, plus index and snapshot updates. No crisis numbers, verifiedOn values, or Caring Contacts runtime logic change.

Caring Contacts (M6): New hazard-log.md reconstructs 38 hazards (four UNMITIGATED governance gaps: safety officer, lived-experience message review, Aboriginal cultural safety review, unconfirmed referral feed) and 34 code-backed rows with file:line controls and test evidence, using new H-C## ids because the original log is unrecoverable. New message-review-pack.md lists the two provisional patient SMS strings, unauthored first/closing types, and policy rules with test pointers. phase-1-handoff.md replaces a broken git checkout 32d408c2f recovery story with the verified fact that six governance files were never committed and only off-repo handoff paths are named.

Care Plan (L4): New crisis-lines-verification.md documents sources, fixture pins, re-verification procedure (proposed six-month cadence), and explicit limits (nothing ages verifiedOn). fixtures.ts gains a comment linking to that record only.

docs/README.md and data/repo-awareness-snapshot.json catalogue the new paths. Both new Caring Contacts packs prominently note validateGovernedMessage has no production caller today (tests/message-copy only).

Reviewed by Cursor Bugbot for commit 2efd8c5. Configure here.

… commit contains

Audit finding M6. The P1 ledger row #1S81R8 says
`docs/caring-contacts/hazard-log.md records H-00, H-04 and H-05`. The file has
never existed in any commit reachable from this repository, so the only P1
clinical-governance blocker for a suicide-aftercare workspace could not be read,
reviewed or signed off from here.

This is a reconstruction from the code and the ledger rows, NOT a recovery. The
original wording and numbering of H-00/H-04/H-05/H-44 are lost; newly recorded
hazards therefore carry an H-C## identifier so no future reader mistakes a
2026-09-04 draft for a row from the lost 2026-08-19 log.

38 hazards recorded:
  * 4 UNMITIGATED with no control cited -- H-00 (no named clinical safety
    officer), H-04 (no lived-experience review of the message set), H-05 (no
    Aboriginal cultural safety review) and H-44 (referral feed feasibility
    unconfirmed). None blocks the synthetic build; every one blocks a pilot.
  * 34 the code enforces, each with the file:line of its control, read at commit
    time, and the offline test that proves it runs.

The document opens with a DRAFT block: it is a starting point assembled from the
repository, not clinical authority, and nothing in it approves a pilot. It ends
with eight claims it could not verify -- including that the Lifeline and 13YARN
numbers in the crisis-support sentence have no recorded source or verification
date anywhere in the repository, and that no production code path calls
validateGovernedMessage, so every message-content row is proof about a function
rather than about a delivered message.

Registered in docs/README.md in the same commit so docs:check-links guards it.

Verified: npm run docs:check-links, docs:check-index,
check:clinical-hazard-controls, prettier --check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DHSyfuC6mS98ystWFiitAR
…e points at

Audit finding M6, second half. src/lib/caring-contacts/message-copy.ts:11 and
:20 name `docs/caring-contacts/message-review-pack.md` as "the lived-experience
and clinical-programme approval gate that owns final wording", and two archived
task briefs cite it the same way. The file has never existed. Hazard H-04 -- the
message set has never been read by anyone with lived experience -- is the one
pilot blocker that is ready to run today, and its facilitation material was
missing.

Reconstructed from the code, not recovered. It lists:
  * the two patient-visible strings that exist (the scheduled caring contact and
    the automated reply), quoted with their fragments resolved;
  * the two message types that have never been authored at all -- `first` and
    `closing` -- and why an implementer may not write the closing one;
  * the no-reply notice, and why its previous wording became untrue;
  * the crisis-support sentence, which is the owner's own words and not the
    reviewer's to reword;
  * 13 policy rules, each with where the check is and the test line that proves
    it runs;
  * the clinician-facing strings deliberately out of scope.

It states plainly that validateGovernedMessage has no production caller, so the
evidence column proves that a function refuses, not that a delivered message was
checked -- and that no message has ever been sent to any number, real or test.

DRAFT block at the top; five unverified claims listed at the bottom, including
that the Lifeline and 13YARN numbers carry no recorded source or verification
date, and that the owner's written authorisation of the crisis sentence exists
only as a source comment.

Verified: npm run docs:check-links, docs:check-index, prettier --check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DHSyfuC6mS98ystWFiitAR
…se 1 handoff

Audit finding M6, third part. phase-1-handoff.md told a recoverer that six
governance documents were "intact in history" and to run
`git checkout 32d408c -- docs/caring-contacts/`.

Both halves are false, verified in this worktree:
  * `git cat-file -t 32d408c` -> fatal: Not a valid object name
  * `git log --all --name-only` across the full fetched history matches no path
    containing hazard-log, message-review-pack or referral-feasibility

The instruction was worse than a dead link: it sent anyone looking for the P1
hazard record to a commit that does not exist, and told them the material was
safe.

Replaced with what is true -- the documents are not in git, the only copies named
anywhere are the two off-machine bundles in PROGRESS-LEDGER SS3/SS8/SS9 (which
SS9 records are on the same workstation and not protected by the push), nothing
here can confirm those bundles contain these six documents, and two of the six
have now been re-drafted from scratch rather than recovered.

No number, threshold or clinical value changed.

Verified: npm run docs:check-links, prettier --check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DHSyfuC6mS98ystWFiitAR
…and when it is next due

Audit finding L4. The four real public crisis numbers in the Care Plan fixtures
carry verifiedOn: "2026-08-20" and a comment saying to correct them if they have
changed, but nothing in the repository ages that date -- no test, no gate, no
ledger row -- while the same file models its synthetic community teams as
review_due after a few months. These numbers render on the printed Personal
Safety Plan and Patient Plan, sheets a person is meant to take home.

Adds docs/care-plan/crisis-lines-verification.md, recording per number: the
number, the source used to check it (every URL already present in a repository
document -- triplezero.gov.au, the WA Health MHERL and Rurallink pages), the
verifiedOn date already in the fixture, every other line in fixtures.ts where the
same number is printed, and a six-monthly re-verification cadence with its
procedure and a history table.

NO NUMBER WAS CHANGED. The only source edit is a verification-record comment
above publicCrisisContacts pointing at the new document.

Also recorded, deliberately not acted on: patient-plan-fixtures.ts prints
invented contacts at 0491 570 210-270, above the 0491 570 156 upper bound of the
block this repository treats as reserved for fiction -- the same defect
sdd-ledger.md:623-627 records finding and fixing in fixtures.ts. The numeric
range assertion at care-plan-domain.test.ts:444 runs over a bundle built from
fixtures.ts only, so it does not see them.

Five unverified claims are listed, first among them that nothing was checked
online: there was no network access in this session, so this document records
what the repository asserts and is not itself a verification.

Verified: npm run docs:check-links, docs:check-index, prettier --check,
npx tsc --noEmit, npx vitest run tests/care-plan-domain.test.ts (63 passed).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DHSyfuC6mS98ystWFiitAR
… governance documents

Adds docs/caring-contacts/hazard-log.md,
docs/caring-contacts/message-review-pack.md and
docs/care-plan/crisis-lines-verification.md to the snapshot (853 -> 856
documents). Generated with `npm run snapshot:repo-awareness`, never edited by
hand.

Verified: npm run check:repo-awareness-snapshot -> in step (211 pages, 856
documents, 2692 reviews).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DHSyfuC6mS98ystWFiitAR
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: d3d8b978-18f5-4c4e-98eb-57ef2dec9b95


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Sep 4, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@BigSimmo
BigSimmo marked this pull request as ready for review September 4, 2026 16:25
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@cursor

cursor Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot 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_eefbb485-8a0f-4750-923d-3d9caf916624)

@BigSimmo
BigSimmo enabled auto-merge (squash) September 4, 2026 16:26
@BigSimmo
BigSimmo disabled auto-merge September 4, 2026 16:44
@cursor

cursor Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot 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_1abb5787-6c95-44df-8f92-04500d739740)

@BigSimmo
BigSimmo merged commit 02a82b2 into main Sep 4, 2026
33 checks passed
@BigSimmo
BigSimmo deleted the claude/audit-fix-p21 branch September 4, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants