fix: stale sign-off pins block first publication, and calculator entries survive a resize

Merged
BI
1mo ago
+294-14

User description

Summary

These are the two follow-ups the owner approved from PR #3574.

  • Sign-off content check. Before, the first-publication plan checked only that reviewedContentSha256 looked like a SHA-256, so a record edited after its sign-off could still be planned for publication. After, the plan works out each pin again through the clinical:review contract and refuses any record whose content changed since sign-off. Forms are checked against data/forms-catalog.json and services against the curated records. A service whose curated records cannot be loaded is also refused. All 54 form pins and all 21 reviewed service pins in the repository still match.
  • Calculator keeps entries on resize. Before, the bedside CrCl, QTc and lithium panel lost everything entered when the window crossed 1280 px, because the sidebar copy and the mobile copy each held their own state. After, the calculator page holds one in-memory state and passes it to whichever panel is showing. Nothing is stored on the device.

Areas touched: App experience, Clinical reference content, Answer engine

Verification

  • Checks run:
    • npx vitest run on 7 suites (calculators, clinical math, first-publication CLI): Test Files 7 passed (7) Tests 119 passed (119)
    • New breakpoint test fails without the fix (Tests 1 failed (1)) and passes with it.
    • npm run typecheck: [gate-receipts] recorded a pass for "typecheck:internal" (10176 input files).
    • npx eslint --max-warnings=0 on the changed files: clean
    • npm run check:diff-integrity -- --base origin/main: PASS β€” 2 changed test file(s), 10 -> 13 test case(s)
    • npm run check:calculator-content: CALCULATOR_CONTENT_PASS sources=ok golden-vectors=ok rights=ok
    • First-publication dry run (--kind form): First-publication plan ready: 54 record(s) across 1 batch(es)
    • Browser suite left to CI.

Risk and rollout

  • Risk: Low. The publish change can only refuse more. It is an offline planning script and nothing calls it automatically. The calculator change moves where the same state lives.
  • Rollback: Revert the commit.
  • Provider or production effects: None. No database, ranking or clinical text changes.

Notes

  • RAG impact: no retrieval behaviour change. No ranking or retrieval files are touched.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_016imb8DCuk85z3FWRDDyZx5


Generated by Claude Code


Summary by cubic

Fixes two follow-ups from PR #3574: stale sign-off pins now block first publication, and bedside calculator entries survive window resizes.

Changes

  • The first-publication plan recomputes each content pin via the clinical:review contract β€” forms against data/forms-catalog.json, services against curated records loaded from the repository root β€” and refuses any record whose content changed since sign-off, any service pin whose content cannot be loaded, and any service record carrying legacy cost fields not covered by the sign-off.
  • The plan also refuses a sign-off that names a different record than the one being published, so a review matched only through a slug alias no longer counts.
  • The calculator page holds one in-memory state for the bedside CrCl, QTc, and lithium panels and passes it to whichever panel is mounted, so crossing the 1280px breakpoint no longer wipes entries.
  • Reverted unreviewed bot commits that had reintroduced separate per-layout calculator state and changed sign-off refusal behavior.

CodeAnt-AI Description

Prevent outdated clinical approvals from publishing changed content and preserve calculator entries during resizing

What Changed

  • Publication plans now reject clinical records if their content has changed since sign-off or cannot be checked.
  • Calculator entries remain filled in when resizing between the desktop sidebar and mobile layout.

Impact

βœ… Changed clinical content cannot rely on an outdated approval
βœ… Calculator entries survive desktop and mobile resizing

πŸ’‘ Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • New Features
    • Calculator panel entries now remain available when switching between desktop and mobile layouts.
  • Bug Fixes
    • First-publication plans now require service and form sign-off pins to match the reviewed content. Plans are rejected when a pin is stale or cannot be verified, including when required content is unavailable.