Skip to content

fix: keep Safety Plan Generator identifier-free#1119

Merged
BigSimmo merged 4 commits into
mainfrom
codex/safety-plan-no-patient-data-contract
Jul 24, 2026
Merged

fix: keep Safety Plan Generator identifier-free#1119
BigSimmo merged 4 commits into
mainfrom
codex/safety-plan-no-patient-data-contract

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Remove the Safety Plan Generator's patient name/initials field and keep its working content identifier-free.
  • State the transient browser-only boundary at entry and export points; clipboard, print and PDF copies are explicitly outside Clinical KB.
  • Align route/catalogue copy, the product privacy notice and the privacy impact assessment.
  • Add DOM and Chromium proofs for no identifier prompt, no app persistence/network request, and working copy/print handlers.

Why

Ledger issue #60 identified a direct contradiction: the privacy contract said not to enter patient identifiers while the Safety Plan Generator asked for a name or initials and included it in copy/print output. The safe default is now identifier-free without adding storage or provider transmission.

Areas touched

  • src/components/patient-safety-plan.tsx
  • /safety-plan metadata and shared tools catalogue copy
  • /privacy and docs/privacy-impact-assessment.md
  • focused DOM, privacy-copy and Chromium coverage
  • branch review ledger

Verification

  • node scripts/run-vitest.mjs run --reporter=dot tests/privacy-ui.test.ts tests/patient-safety-plan-privacy.dom.test.tsx — 5/5 passed, including after merging current origin/main.
  • npm run test:e2e -- tests/ui-tools.spec.ts --project=chromium --grep "safety-plan working content" — 1/1 passed against an isolated production build.
  • npm run verify:cheap — all 21 gates passed; 366 test files, 3,245 tests passed, 1 skipped.
  • npm run check:production-readiness with the existing canonical environment loaded read-only — READY; no provider call.
  • npm run build — 1,677 static pages generated; client-bundle secret scan passed.
  • npm run check:rag:fixtures — 36 golden cases / 21 suites passed.
  • Post-main-sync npm run typecheck — passed.
  • git diff --check and changed-file Prettier — passed.

npm run verify:pr-local passed runtime, formatting, lint and typecheck, then stopped when the unrelated reconciliation-preflight subprocess exceeded its 30-second test timeout under full-suite load. That test passed 5/5 isolated, and the preceding full suite in verify:cheap passed. The unchanged five-minute gate was not retried; its prevented build and fixture steps were run directly and passed.

Checks not run

  • Full npm run verify:ui: the changed production path has a focused Chromium production-build scenario; the full unrelated Chromium catalogue was not repeated locally.
  • No live Supabase, OpenAI, Railway, RAG evaluation, production data or deployment action was run.

Risk and rollout

  • Risk: exported copies can contain sensitive plan details and support contacts after they leave the transient app session. The export controls now disclose this boundary and direct use of the approved clinical-record process.
  • Rollback: revert the implementation commit; no schema, stored data, provider state or migration rollback is involved.
  • Provider or production effects: none until this PR is merged and the normal main deployment runs.

RAG impact: no retrieval behaviour change — no retrieval, ranking, generation, source-selection or RAG fixture content changed.

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use.
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval.
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy).
  • Service-role keys and private document access remain server-only.
  • Demo/synthetic content remains clearly separated from real clinical sources.
  • Source metadata, review status and outdated/unknown-source behavior remain conservative.
  • Deployment classification/TGA SaMD impact was checked; this changes data-entry/privacy handling, not clinical recommendations or decision logic.

Summary by CodeRabbit

  • Privacy & Data Handling

    • Safety Plan Generator no longer requests patient names or initials.
    • Working content remains identifier-free and local to the current browser session, with no app retention or transmission.
    • Exported, copied, printed, or PDF content includes guidance to add identifiers only through approved clinical-record workflows.
  • Documentation

    • Updated privacy, tool, and review documentation to clarify local handling, export boundaries, and responsibilities.
  • Tests

    • Added coverage verifying identifier omission, local-only behavior, export actions, and absence of network or browser-storage persistence.

BigSimmo added 3 commits July 24, 2026 10:17
Remove patient identifier entry from the transient planner, clarify export boundaries, and add component plus Chromium privacy proofs. Verification: verify:cheap; focused Playwright; production build and client-bundle secret scan.
@supabase

supabase Bot commented Jul 24, 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 ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@BigSimmo, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3dbe6631-d41f-4861-b780-8d3542c4757f

📥 Commits

Reviewing files that changed from the base of the PR and between e2a132b and f52d498.

📒 Files selected for processing (1)
  • docs/privacy-impact-assessment.md
📝 Walkthrough

Walkthrough

The safety-plan builder no longer collects patient identifiers and now marks identifiers for addition after export. Privacy documentation, catalog metadata, page copy, and DOM/browser tests describe and verify browser-local working content with explicit copy and print/PDF export boundaries.

Changes

Safety-plan privacy contract

Layer / File(s) Summary
Identifier-free builder and export flow
src/components/patient-safety-plan.tsx, src/app/safety-plan/page.tsx, src/lib/tools-catalog.ts
Removes patient identity state and inputs, adds identifier placeholders, and updates export workflow copy and metadata.
Privacy and data-flow documentation
docs/privacy-impact-assessment.md, src/app/privacy/page.tsx
Documents browser-local working content, lack of Clinical KB retention, and handling requirements after export.
Privacy behavior and governance validation
tests/patient-safety-plan-privacy.dom.test.tsx, tests/ui-tools.spec.ts, tests/privacy-ui.test.ts, docs/branch-review-ledger.md
Tests absent identifier inputs, no persistence or network transmission, copy/print behavior, and updated privacy wording; records review verification details.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Clinician
  participant SafetyPlanGenerator
  participant Browser
  participant ClinicalRecordProcess
  Clinician->>SafetyPlanGenerator: Enter identifier-free working content
  SafetyPlanGenerator->>Browser: Keep content in current tab
  Clinician->>SafetyPlanGenerator: Copy or print/PDF
  SafetyPlanGenerator->>Browser: Write clipboard or invoke print
  Browser->>ClinicalRecordProcess: Handle exported content and add identifiers
Loading

Possibly related PRs

Suggested labels: codex

Suggested reviewers: claude

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: keeping the Safety Plan Generator identifier-free.
Description check ✅ Passed The description covers the required sections and key verification, risk, and governance details, though some checklist items are written as prose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/safety-plan-no-patient-data-contract

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/ui-tools.spec.ts`:
- Around line 2203-2205: Remove the duplicate const testWindow declaration in
tests/ui-tools.spec.ts around lines 2203-2205, retaining only one declaration in
the evaluate block. Rerun the focused Chromium check, then update its recorded
result in docs/branch-review-ledger.md at line 23.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e676393b-b4b0-4639-8af6-7c6326bd223a

📥 Commits

Reviewing files that changed from the base of the PR and between 186c95b and e2a132b.

📒 Files selected for processing (9)
  • docs/branch-review-ledger.md
  • docs/privacy-impact-assessment.md
  • src/app/privacy/page.tsx
  • src/app/safety-plan/page.tsx
  • src/components/patient-safety-plan.tsx
  • src/lib/tools-catalog.ts
  • tests/patient-safety-plan-privacy.dom.test.tsx
  • tests/privacy-ui.test.ts
  • tests/ui-tools.spec.ts

Comment thread tests/ui-tools.spec.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2a132b707

ℹ️ 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".

Comment thread docs/privacy-impact-assessment.md Outdated
@BigSimmo

Copy link
Copy Markdown
Owner Author

@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. 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. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: e2a132b707

ℹ️ 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".

@BigSimmo
BigSimmo merged commit fea21f9 into main Jul 24, 2026
41 checks passed
@BigSimmo
BigSimmo deleted the codex/safety-plan-no-patient-data-contract branch July 24, 2026 02:40
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.

1 participant