Skip to content

Harden Patient Factsheets demo-status labelling on print/export and give the mode its own composer actions - #955

Merged
BigSimmo merged 2 commits into
mainfrom
claude/patient-factsheets-impl-ra7yi9
Jul 20, 2026
Merged

Harden Patient Factsheets demo-status labelling on print/export and give the mode its own composer actions#955
BigSimmo merged 2 commits into
mainfrom
claude/patient-factsheets-impl-ra7yi9

Conversation

@BigSimmo

@BigSimmoBigSimmo commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Reapplies three follow-up fixes flagged during the PR Rebuild Patient Factsheets as a first-class mode from the imported design #879 review that landed in separate Codex PRs and never merged, brought back onto the shared feature branch.
  • Print/export governance (P1): the exported/printed handout now carries a red "Sample — not for clinical use" band at the top and prepends the shared FACTSHEET_DEMO_NOTICE ("Demonstration content — not clinician-approved…") to the print footer, alongside an on-screen warning line, so a printed sheet can never read as approved local patient information. The notice is a single shared constant with a regression test.
  • Composer action menu: Factsheets now has its own action set (Search factsheets / Browse all sheets) instead of falling through to the Answer action set; master-search-header routes searchMode"factsheets" to it and dispatches the two actions via onSearchModeChange.
  • Print isolation: the clean A4 sheet is portaled to <body> and print now removes every other body subtree from layout flow with display:none (not visibility:hidden), so the full-height shell chrome no longer paginates into trailing blank PDF pages. The mount flag uses useSyncExternalStore to stay clear of the react-hooks/set-state-in-effect lint rule.
  • Factsheets stays visible in production (clearly labelled as demo), consistent with prior direction that demo content should be shown but marked as demo.

Verification

  • Ran the component gates individually and all pass: check:type-scale, check:icon-scale, brand:check, prettier --check (all six changed files), lint on the changed component files (clean), typecheck (no errors in changed files), and the factsheets-data + app-modes vitest suites (28 tests pass).
  • Verification not run: the full npm run verify:pr-local unit run hits pre-existing environment gaps in this container (@testing-library/* is not installed, so untouched *.dom.test.tsx files fail typecheck; the Python-OCR worker stack is absent) — both unrelated to this change and green in CI where those deps exist.
  • UI verification not run: npm run verify:ui (Playwright/Chromium) was not run for this small follow-up; the print band/footer are print-media-only CSS that was confirmed to compile, and the action-menu wiring reuses the already-QA'd composer pattern from Rebuild Patient Factsheets as a first-class mode from the imported design #879.

Risk and rollout

  • Risk: Low — self-contained changes in the /factsheets detail view, print CSS, and additive composer action-set wiring; no API, data, auth, privacy, Supabase, retrieval, or answer-generation behavior changes.
  • Rollback: Revert this PR's commit; every change is additive and isolated, with no migrations or provider state involved.
  • Provider or production effects: None.

Clinical Governance Preflight

These changes strengthen the demo/governance labelling on printed and exported patient information; no ingestion, answer-generation, retrieval, document-access, or Supabase behavior changes.

  • 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 when clinical decision-support behavior changed

Notes

  • The print "Sample — not for clinical use" band and footer notice use fixed hex colours because they render only inside @media print, where the app's design tokens are not the concern.
  • Print isolation deliberately uses display:none on non-print body subtrees (rather than visibility:hidden) so the full-height sidebar <aside> and tall screen article are removed from flow and cannot paginate into blank trailing PDF pages.

🤖 Generated with Claude Code

https://claude.ai/code/session_01U9NNpe5W616C4XvjRgW6pV


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added a dedicated Factsheets search mode with search and browse actions.
    • Added clear demonstration-content notices to on-screen and printable factsheets.
    • Improved printable factsheet layout and isolation for cleaner A4 printing.
  • Bug Fixes

    • Prevented unrelated page content from appearing in factsheet print layouts.
    • Ensured print-only content mounts correctly after page loading.
  • Tests

    • Added coverage verifying required factsheet demonstration and clinical-use notices.

…print isolation
Three follow-up fixes flagged during PR #879 review that landed in separate
Codex PRs and never merged, reapplied here on the shared feature branch.
- Print/export governance (P1): the exported handout now carries a red
"Sample — not for clinical use" band at the top and prepends the shared
FACTSHEET_DEMO_NOTICE ("Demonstration content — not clinician-approved…")
to the print footer, plus an on-screen warning line, so a printed sheet can
never read as approved local patient information. Notice is a single shared
constant (FACTSHEET_DEMO_NOTICE) with a regression test.
- Composer action menu: Factsheets now has its own action set (Search
factsheets / Browse all sheets) instead of falling through to the Answer
action set. master-search-header routes searchMode "factsheets" to it and
dispatches the two actions via onSearchModeChange.
- Print isolation: the clean A4 sheet is portaled to <body> and print now
removes every other body subtree from layout flow with
`display:none` (not `visibility:hidden`), so the full-height shell chrome
no longer paginates into trailing blank PDF pages. Mount flag uses
useSyncExternalStore to stay clear of the react-hooks/set-state-in-effect
lint rule.
Factsheets stays visible in production (labelled demo), per prior direction.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U9NNpe5W616C4XvjRgW6pV
@supabase

supabaseBot commented Jul 20, 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

coderabbitaiBot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 58fa65c8-c4d8-44d7-912d-ee1539bc62a6

📥 Commits

Reviewing files that changed from the base of the PR and between 30cd2fe and 773fe0a.

📒 Files selected for processing (6)
  • src/app/globals.css
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/clinical-dashboard/mode-action-popup.tsx
  • src/components/factsheets/factsheet-detail-page.tsx
  • src/components/factsheets/factsheets-data.ts
  • tests/factsheets-data.test.ts

📝 Walkthrough

Walkthrough

Factsheets now have dedicated search and browse actions. Print sheets render through a body portal with print-specific isolation, while shared demonstration notices appear on-screen and in printed output.

Changes

Factsheets experience

Layer / File(s)Summary
Factsheet print portal and notices
src/components/factsheets/factsheet-detail-page.tsx, src/components/factsheets/factsheets-data.ts, src/app/globals.css, tests/factsheets-data.test.ts
The print sheet mounts into document.body after hydration, non-portal content is removed from print layout, and shared demonstration notices are added to screen and print views with matching tests.
Factsheets search actions
src/components/clinical-dashboard/mode-action-popup.tsx, src/components/clinical-dashboard/master-search-header.tsx
The mode-action types and menu include factsheets search and browse actions, and the header routes them to factsheets mode with query clearing for browse.

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

Possibly related PRs

Suggested labels:codex

Suggested reviewers:claude

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly reflects the main changes: Factsheets demo labeling, print/export hardening, and dedicated composer actions.
Description check✅ PassedThe description covers all required sections and key governance/verification details, though the verification area is prose rather than checklist-form.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/patient-factsheets-impl-ra7yi9
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch claude/patient-factsheets-impl-ra7yi9

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

@BigSimmo

Copy link
Copy Markdown
OwnerAuthor

@coderabbitai please resolve the failing branch conflicts for me

@BigSimmo
BigSimmo marked this pull request as ready for review July 20, 2026 06:07
@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.

@coderabbitai

coderabbitaiBot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Merge conflicts resolved successfully!

Resolved 1 conflict file(s). Commit:694ec040f88bc8c3bed6beb0d7c305e3dadba3c0 pushed to claude/patient-factsheets-impl-ra7yi9.

6 file operation(s)
  • src/app/globals.css (update)
  • src/components/clinical-dashboard/master-search-header.tsx (update)
  • src/components/clinical-dashboard/mode-action-popup.tsx (update)
  • src/components/factsheets/factsheet-detail-page.tsx (update)
  • src/components/factsheets/factsheets-data.ts (update)
  • tests/factsheets-data.test.ts (update)
View agent analysis

@BigSimmo
BigSimmo enabled auto-merge (squash) July 20, 2026 06:11
Resolved conflicts in:
- src/components/factsheets/factsheet-detail-page.tsx (content)
Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@BigSimmo
BigSimmo merged commit e128384 into mainJul 20, 2026
16 checks passed
@BigSimmo
BigSimmo deleted the claude/patient-factsheets-impl-ra7yi9 branch July 20, 2026 06:22
Sign up for freeto 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

@BigSimmo@claude