Skip to content

Remove 63 dead duplicate dose records, and guard against regrowth - #12

Merged
monchee merged 3 commits into
mainfrom
prune-stale-protocols
Aug 22, 2026
Merged

Remove 63 dead duplicate dose records, and guard against regrowth#12
monchee merged 3 commits into
mainfrom
prune-stale-protocols

Conversation

@monchee

@monchee monchee commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Two commits. The first is pre-existing work found uncommitted in the working tree; the second is the actual fix.

1. polish: dashboard and chrome cleanup

Work found complete and uncommitted in the working tree, not authored in this session. Committed separately so it stays distinct and is easy to revert if it was not meant to land.

UI pass across 15 files, net −121 lines: removes redundant dark: variants where the base class already resolves, adds focus-visible ring offsets, drops a backdrop-blur, applies whitespace-nowrap to the footer strapline. Removes the RecentTestingActivity dashboard component and its test; no references remain.

Verified before committing: tsc clean, full suite green at 98 files / 851 tests.

2. fix: remove 63 dead duplicate dose records

dreamOnlyProtocols.ts held 109 records but drugMasterlist.ts referenced only 50. The other 63 were dead copies of drugs since migrated to SCRATCH — Cefepime, Ceftriaxone, Cefotaxime, Alfentanil, Azithromycin, Chlorhexidine and more — left behind as each tranche moved a drug from findDreamOnly to findGenerated.

Nothing read them, so no test covered them and SCRATCH's clinical sign-off gate did not apply. They could drift from the source of truth silently, and someone correcting a dose could edit the dead copy, see no effect, and believe it fixed. That is exactly the duplication this project exists to eliminate, regrowing one tranche at a time — with 28 SCRATCH pages still to migrate, it would have kept growing.

The guard matters more than the deletion

A new test fails when dreamOnlyProtocols.ts contains an unreferenced record, and when drugMasterlist.ts references one that does not exist — both directions. Proven by re-adding a dead Cefepime entry: it failed and named the record. Without it, the problem simply returns.

Verification

Check Result
Records 109 → 50, matching all 50 references
Unreferenced / referenced-missing 0 / 0
Guard fails on a dead record ✅ proven
Ordering 117 positions, 0 mismatches
tsc / lint / build 0 / 0 / 0
Tests 854 across 98 files
Coverage 78.8 / 70.9 / 72.8 / 80.0 vs 76 / 67 / 67 / 79

Ordering matters because DREAM selects protocol variants by array index — a positional shift would silently re-point a saved clinical plan at a different dose.

Note: 4 of the 50 references use the two-argument form findDreamOnly("Atropine", "skin") for drugs with an empty protocolLabel. Any tooling that parses these must handle both arity forms; a three-argument-only regex reports false orphans.

Left untracked deliberately

.github/agents/, .github/hooks/, .github/skills/ and four home-*.png screenshots — local tooling and visual-review artefacts. Probably worth gitignoring rather than committing.

🤖 Generated with Claude Code

Monchee and others added 3 commits August 22, 2026 04:48
Committing work found complete and uncommitted in the working tree. Not
authored in this session — recorded as its own commit so it stays separate
from the protocol-data changes that follow.

UI pass across 15 files, net -121 lines: removes redundant `dark:` variants
where the base class already resolves correctly, adds focus-visible ring
offsets, drops a backdrop-blur, and applies whitespace-nowrap to the footer
strapline. Removes the RecentTestingActivity dashboard component and its
test; no references remain.

Verified before committing: tsc clean, full suite green at 98 files /
851 tests.

Untracked items deliberately left alone: .github/agents/, .github/hooks/,
.github/skills/ and four home-*.png screenshots. Those look like local
tooling and visual-review artefacts rather than part of this change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dreamOnlyProtocols.ts held 109 records but drugMasterlist.ts referenced
only 46. The other 63 were dead copies of drugs since migrated to SCRATCH
— Cefepime, Ceftriaxone, Cefotaxime, Alfentanil, Azithromycin,
Chlorhexidine and more — left behind as each tranche moved a drug from
findDreamOnly to findGenerated.

Nothing read them, so no test covered them and SCRATCH's clinical sign-off
gate did not apply. They could drift from the source of truth silently, and
someone correcting a dose could edit the dead copy, see no effect, and
believe it fixed. That is precisely the duplication this whole project
exists to eliminate, regrowing one tranche at a time — with 28 SCRATCH
pages still to migrate, it would have kept growing.

Pruned to exactly the 50 referenced records (46 three-argument references
plus 4 two-argument ones for drugs with an empty protocolLabel: Atropine,
IV Contrast, Methylene Blue, Methoxybenzylpenicillin). Verified 0
unreferenced and 0 referenced-but-missing, in both directions.

The guard matters more than the deletion: a new test fails when
dreamOnlyProtocols.ts contains an unreferenced record. Proven by re-adding
a dead Cefepime entry — it failed and named the record. Without this the
problem simply returns.

Ordering untouched: 117 positions, 0 mismatches. DREAM selects protocol
variants by array index, so a shift would silently re-point a saved
clinical plan at a different dose.

tsc, lint, build clean. 854 tests across 98 files. Coverage 78.8/70.9/72.8/80.0
against thresholds 76/67/67/79.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CI caught these; I did not. When I committed the pre-existing polish work I
verified tsc and the unit suite and called it green — but e2e is a separate
suite and I never ran it. That gap is what let these through.

Both failures trace to 51ba2a4, and in both cases the code is right and the
test was wrong:

1. smoke.spec.ts — the polish commit promoted <p>The DREAM App</p> to
   <CardTitle as="h2">, an accessibility improvement. Playwright matches
   accessible names by SUBSTRING, so "The DREAM App" started matching
   getByRole('heading', { name: 'DREAM' }) alongside the real page heading,
   giving a strict-mode violation. Fixed with `exact: true` rather than
   reverting the heading, and commented so the next person does not
   reintroduce it.

2. testing-day.spec.ts — asserted "Recent Testing Activity" is visible, but
   that commit deleted the RecentTestingActivity component. The assertion
   was testing a deliberately removed feature. Removed it; reaching the
   dashboard is still asserted on the line above.

Full chromium e2e suite now 59/59. tsc and lint clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@monchee
monchee merged commit 59f7960 into main Aug 22, 2026
3 checks passed
@monchee
monchee deleted the prune-stale-protocols branch August 22, 2026 05:41
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