Skip to content

Codex/ward management design - #2289

Merged
BigSimmo merged 107 commits into
mainfrom
codex/ward-management-design
Aug 22, 2026
Merged

Codex/ward management design#2289
BigSimmo merged 107 commits into
mainfrom
codex/ward-management-design

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

Verification

  • npm run verify:pr-local

During development, use npm run verify:cheap as the faster iteration gate before the final PR-local preflight.

  • npm run verify:ui when UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changed
  • npm run verify:release before release or handoff confidence claims

For retrieval, ranking, selection, chunking, source/citation rendering, or answer-contract changes, verify:pr-local runs eval:rag:offline automatically. Run the offline command directly during iteration before spending a live eval.

  • npm run eval:retrieval:quality (must stay 36/36) when retrieval, ranking, selection, chunking, or scoring behavior changed — CI cannot run it (needs live keys), so run it locally and paste the summary. A metadata/governance-weighting change once buried correct docs (recall 1.0→0.76) and only this eval caught it.
  • npm run eval:rag -- --limit 15 + npm run eval:quality -- --rag-only when answer generation, the synthesis prompt, or answer post-processing changed (grounded-supported must not drop; citation-failure 0)
  • npm run check:production-readiness when clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changed
  • npm run check:deployment-readiness when deployment startup, hosting, or rollout behavior changed

Risk and rollout

Complete this section for clinical, data, API, auth/privacy, workflow, dependency, build, or deployment changes.

  • Risk:
  • Rollback:
  • Provider or production effects: None / describe the explicitly authorized effect
  • RAG impact: Required if touching RAG ranking surfaces (src/lib/rag/, retrieval RPCs, golden fixtures, ranking tests; see docs/rag-behaviour/safeguards.md). Must use one of:
    • RAG impact: no retrieval behaviour change — <reason>
    • RAG impact: behaviour change — canary pair <baseline run> -> <post run>
    • (Use RAG impact: none or omit for non-RAG PRs)

Clinical Governance Preflight

Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output.

  • 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

BigSimmoand others added 30 commits August 18, 2026 15:38
…nd phase 1 plan
Baseline for the Phase 1 model rework. Adds the ward-management surface
(command, constellation, network, queue, capacity, movements, exceptions,
transport, governance, patient workspace), its synthetic fixtures, the
domain glossary and decision records, the metro patient-flow design spec,
and the Phase 1 implementation plan.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The subagent-driven-development ledger lives in git-ignored scratch and does
not survive a session. This records what a later session needs: the rulings
taken during Phase 1 with what each costs if wrong, the module map, the
deferred findings that Phase 4 must not inherit blindly, and the verification
lessons from this run.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ules
Fixes every finding from the final whole-branch review: gate icons that
ignored pass/fail (including MHA authorisation), a five-state bed grid
that double-counted held/blocked beds, "open movement" counts that
included arrived/closed records, generated movements whose stage
contradicted their own fields, negative-instant clock formatting,
bed-release blockers that leaked departing-patient detail, a "catchment"
label computed from origin ED rather than patient catchment, an
"exhausted search" blocker the fixture didn't actually support, a
Readiness panel that ticked a breached legal deadline, and an
unconditional "eligible candidate" claim. Also cleans up the smaller
deferred items: cohort/security gate grammar and pass/fail text, an
advertised-but-unrun exception rule, stale glossary prose, and one
leftover "AI" label.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The whole-branch review found defects the eight per-task reviews could not
see, because each looked at one task's diff. One fix wave closed them. This
records what the review caught and why it mattered, the findings parked at
the close with the ruling on each, the verification actually run, and the two
repo traps that make a green result untrustworthy.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…rief
Phase 2 builds the flow coordinator's screen — pressure strip, priority
queue, flow diagram, explainable shortlist, exceptions drawer, phone form —
and retires Constellation into it. Ten tasks, two of which build the pure
derivations the screen reads: the operational score (rebuilt with no urgency
component) and per-department pressure.
The kickoff brief carries what a cold session needs, including the process
calibration for a screen-heavy phase and the three Phase 1 lessons that
should shape how it is verified.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
One self-contained file a session can read cold: the problem, the WA clinical
and legal grounding, the ten settled scope decisions, the model with every
export and identifier, the non-negotiable rules, the repo conventions and the
two gates that report success without running, what Phase 1 learned and why it
shapes how Phase 2 is verified, and the decisions taken on the owner's behalf.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…nd blocker checks
Review findings against the real fixture:
- Declines detail rendered a self-contradictory fraction ("5 of 3 parallel
referrals declined") — declines.length is cumulative history, the cap
limits simultaneous live referrals, they never shared a denominator.
State only the count.
- Transport delay fired for movements already en route (WF-006, WF-014,
WF-306, WF-313, WF-320, WF-327), contradicting their own blocker text.
Require acceptedAt set and enRouteAt/collectedAt/cancelledAt all unset,
matching buildActionInbox's existing condition, and drop the truthiness
reads on Instant fields in favour of explicit === undefined.
- hasActiveBlocker's "starts with None" match was wide enough to hide a
real blocker like "None of the secure units can take him"; narrowed to
the exact sentinel or "None" + end-of-string/dash/colon.
- queueOrder's exclusion test only asserted a shorter list, which would
still pass if queueOrder dropped everything; pinned to the exact
isOpen-filtered count instead.
- Exported ward-clock's splitDuration (already zero-padding) and reused it
for the wait-time detail instead of a second, non-padded formatter.
- Removed the redundant .slice() after .filter() in queueOrder.
Six new/tightened tests cover the behavioural findings; watched them fail
against the unfixed code before applying each fix.
Adds edPressure(now), sorted worst-first by breaching then longest wait
then volume. Reuses ward-clock's clockState for the breach definition
instead of re-deriving it inline, and clamps per-movement waits at zero
so a movement with a future openedAt can never render a negative wait.
The sort test's original array-comparison assertion coerced both sides
to strings via `>=`, which would pass a genuinely wrong ordering; it is
replaced with an explicit numeric tuple comparison.
…ble tests
edPressure(now) imported wardMovements directly, so every assertion was
forced to key off the one fixture (every department busy, every wait
positive). That let three tests pass under mutations that should have
failed them: dropping quiet departments, misattributing counts between
departments, and removing the future-openedAt wait clamp.
Change the signature to edPressure(now, movements = wardMovements),
mirroring queueOrder(movements, now) in ward-priority.ts with now kept
first for the existing/planned call sites. Add tests that inject a
built movement list to prove: quiet departments still report zeros
(never drop, never substitute a different EmergencyDepartment), counts
attribute to the correct originEdId rather than a rotated neighbour,
and a future-dated openedAt clamps to zero rather than going negative.
Also cover the clockState "due exactly now" boundary, and correct the
pre-existing longest-wait test's own expectation to mirror the clamp
(it previously proved the clamp only by fixture coincidence). Use
ward-clock's minutesUntil instead of inline subtraction, matching the
existing elapsedLabel pattern.
Each of the three structural findings was verified red against its
named mutation before being accepted.
…ow, labelling
Two Criticals, three Importants, three Minors from the Task 3 review.
Criticals:
- Wire the unused selectedUnitId setter into a real (if currently unreachable)
"Clear unit selection" control in the diagram region instead of discarding it,
clearing the npm run lint no-unused-vars failure.
- Repointing /ward-management broke five tests in ui-ward-management.spec.ts that
still targeted WardManagementConsole. Repaired gotoWardFlow and three specs
against the coordinator screen, kept the network-diagram spec untouched, and
removed the two specs with no coordinator-screen equivalent yet — replaced by
test.fixme placeholders in ui-ward-coordinator.spec.ts naming the tasks that
will implement them (5/7 and 8).
Importants:
- The coordinator spec's overflow assertion measured document.documentElement,
which .screen's overflow:hidden makes impossible to fail. Now measures the
region grid's own scrollWidth/clientWidth via a testid; proved it goes red
against the pre-fix CSS (836px overflow at 320px) before applying the fix.
- The region grid had no narrow-layout fallback below its shrink breakpoint and
overflowed at 1100/820/390/320. Stacked the three regions into one column
below 1440px (min-width: 90rem restores the three-column grid), and separately
fixed a blank 72px band at <=640px where the hidden rail's grid track was
still reserved. Verified zero overflow at 1600/1280/1100/820/390/320.
- "N movements" labelled the open-only queue count as a total; now "N open
movements".
Minors:
- Dropped the inert z-index on the statically-positioned exceptions drawer (its
position in .main's row order already pins it) and the now-unused
--co-z-drawer token, plus two other declared-but-unused tokens.
--co-space-4, --co-space-16.
- Added a visually-hidden <h1> naming the screen.
Also fixed a wrapping regression the open-movements label change introduced in
the 14rem queue column header, caught by re-inspecting the recaptured
screenshot.
RAG impact: no retrieval behaviour change — this only touches the Ward Flow
coordinator screen shell (src/components/ward-management/coordinator/**) and
its tests; no file under src/lib/rag/**, retrieval-selection, ranking-config,
answer-ranking, the eval harness, or the golden fixture was touched.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…, selection visibility, empty state
- Tests could not detect a wrong card order or the queue filtering to the wrong
department; both are now pinned by data attributes (data-breaching,
data-longest-minutes, data-waiting, data-origin-ed) and asserted directly.
- aria-label on each pressure card replaced its whole accessible name, hiding
every figure from assistive technology; the name is now composed from the
hospital name plus the visible figures.
- Selected state was invisible on breaching cards (border/background were
overridden by the danger tint); a card outline now survives that and is
pinned to Highlight under forced-colors.
- A quiet department rendered "0 waiting · longest 0m"; it now shows an
explicit "No patients waiting" state, covered by a new dom test.
- Removed the click-retry loop around Playwright interactions in favour of a
networkidle wait in gotoCoordinator, matching the sibling ward-management
spec's helper.
- Added the ordering rule to the strip header and cleared the department
filter automatically if it ever names a department that cannot be resolved.
…roof, now-prop, origin label, ED lookup hoist
Three mutations survived the appended ordering test with the suite green: removing data-tier
still passed (empty-array vacuity), inverting the within-tier tiebreak still passed (no
machine-readable score on the row), and both a constant score and a deleted breach line still
passed. Fixes:
- Add a count floor before the tier-sortedness assertion so absence can't satisfy it.
- Add data-score to each row and assert non-increasing score within a tier (the property, not
the fixture).
- Assert the visible score text matches the row's own data-score, and that the breach line is
present on a breached-deadline row and absent on a non-breaching one.
Also: PriorityQueue now takes now: Instant as a prop (was reading NOW_ANCHOR directly, unlike
its now-prop sibling PressureStrip); origin department renders "from JHC" instead of the
unlabelled "JHC", which read as a destination next to the patient's required security level;
and allEmergencyDepartments() is looked up once per render via a Map instead of once per row.
… as a routed destination
Critical 1: eligibleCandidates sorts eligible-first but never filters, so the diagram was
drawing solid accent routes and "N shortlisted units" for candidates that had already
declined the movement or failed a hard gate (e.g. WF-009: zero of its three nearest
candidates were actually eligible). Every shortlisted node now carries data-eligible plus
its own candidateReason() text, ineligible routes render dashed and danger-toned, and the
hub states the true eligible count instead of the shortlist size.
Important 2: destinationUnit() conflated an accepted bed with an outstanding referral into
one badge and only looked at referredUnitIds[0]. Split into distinct Accepted
destination / Outstanding referral badges, checked directly against the movement's own
fields, so every parallel referral is visible.
Important 3/4: the routed-set and route-connector assertions now hold for a second
movement with a different shortlist (WF-009), and route connectors are marked
data-connector-kind so they're provably distinct from demand connectors, closing the gaps
a single-movement proof and an unmarked connector left open.
Important 5: routed state now reaches the accessible name as real text (candidateReason),
not just an outline colour behind an aria-hidden svg.
Minor 6/7: a unit that fails its service-group lookup renders as an explicit anomaly
instead of vanishing; the window resize listener now attaches unconditionally rather than
being gated behind ResizeObserver's own availability check.
Controller finding 8: the region grid's row-sizing squeezed the diagram to 208px of 1080px
content at 1280x900. `.regionGrid` now sizes to its own content (align-self: start) only in
the stacked (<90rem) layout, `.diagramRegion` gets a real min-height floor, and
`.queueRegion` gets a matching cap so it doesn't balloon to all 41 unclamped rows — the
>=90rem three-column layout is untouched (restored to align-self: stretch there), matching
its original, already-working behaviour exactly.
…ates
Task 7: builds ShortlistPanel, the surface Phase 1's whole-branch review found
rendering a green tick beside "is not authorised under the Mental Health Act".
Every gate row now states its own verdict in text ("Met"/"Not met"), all eight
gates render every time (never .slice()'d), the icon reads directly off
gate.pass, and an ineligible candidate is marked with a dashed danger border
(forced-colors safe) and never styled as a recommendation. Confirm/override are
the only way to place a patient — nothing auto-allocates.
@coderabbitai

coderabbitaiBot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your current included review allowance is based on your included PR review attempts over the past 7 days.

Next review available in:20 minutes

Limit details: You’ve used the included review currently available. Your 91 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 77d8b548-2570-471c-b73a-144d79aea48b

📥 Commits

Reviewing files that changed from the base of the PR and between 3e5c223 and b37be73.

📒 Files selected for processing (132)
  • docs/branch-review-records/b569eab9ffb958ffaebe6eeaaeccc2325bc626719590f2878d6270fe8cae032d.record.md
  • docs/branch-review-records/c7b727bab40ad00fb24a30334953c787ddd0d4d7b3d8d78ce589aff3c3a18250.record.md
  • docs/branch-review-records/d8a5b14dd4d19ea98ba238e61bc032a805eea1597bfaf53a2892856afb90488d.record.md
  • docs/codebase-index.md
  • docs/design-system/ADOPTION.md
  • docs/design-system/COMPONENTS.md
  • docs/design-system/adoption-contract.json
  • docs/design-system/adoption-manifest.json
  • docs/site-map.md
  • docs/superpowers/plans/2026-08-19-ward-flow-phase-3-role-screens.md
  • docs/superpowers/specs/2026-08-19-ward-flow-phase-3-role-screens-design.md
  • docs/ward-flow-complete-ledger.md
  • docs/ward-flow-context.md
  • docs/ward-flow-phase-3-handover.md
  • docs/ward-flow-phase-3-ledger.md
  • docs/ward-flow-phase-3-rulings.md
  • docs/ward-flow-phase-3-workspace/README.md
  • docs/ward-flow-phase-3-workspace/clinical-changes-report.md
  • docs/ward-flow-phase-3-workspace/concurrent-session-inventory.md
  • docs/ward-flow-phase-3-workspace/flow-diagram-fix-brief.md
  • docs/ward-flow-phase-3-workspace/flow-diagram-fix-report.md
  • docs/ward-flow-phase-3-workspace/handover-stage-coherence-report.md
  • docs/ward-flow-phase-3-workspace/preflight-tasks-9-to-12.md
  • docs/ward-flow-phase-3-workspace/progress.md
  • docs/ward-flow-phase-3-workspace/task-1-brief.md
  • docs/ward-flow-phase-3-workspace/task-1-report.md
  • docs/ward-flow-phase-3-workspace/task-1-review.md
  • docs/ward-flow-phase-3-workspace/task-10-brief.md
  • docs/ward-flow-phase-3-workspace/task-10-report.md
  • docs/ward-flow-phase-3-workspace/task-11-brief.md
  • docs/ward-flow-phase-3-workspace/task-11-report.md
  • docs/ward-flow-phase-3-workspace/task-12-addendum.md
  • docs/ward-flow-phase-3-workspace/task-12-brief.md
  • docs/ward-flow-phase-3-workspace/task-12-journey-design.md
  • docs/ward-flow-phase-3-workspace/task-2-brief.md
  • docs/ward-flow-phase-3-workspace/task-2-report.md
  • docs/ward-flow-phase-3-workspace/task-2-review.md
  • docs/ward-flow-phase-3-workspace/task-3-brief.md
  • docs/ward-flow-phase-3-workspace/task-3-report.md
  • docs/ward-flow-phase-3-workspace/task-3-review.md
  • docs/ward-flow-phase-3-workspace/task-4-brief.md
  • docs/ward-flow-phase-3-workspace/task-4-report.md
  • docs/ward-flow-phase-3-workspace/task-4-review.md
  • docs/ward-flow-phase-3-workspace/task-5-brief.md
  • docs/ward-flow-phase-3-workspace/task-5-report.md
  • docs/ward-flow-phase-3-workspace/task-5-review.md
  • docs/ward-flow-phase-3-workspace/task-6-brief.md
  • docs/ward-flow-phase-3-workspace/task-6-fix-round-3-findings.md
  • docs/ward-flow-phase-3-workspace/task-6-re-review-rounds-3-4.md
  • docs/ward-flow-phase-3-workspace/task-6-report.md
  • docs/ward-flow-phase-3-workspace/task-6-review.md
  • docs/ward-flow-phase-3-workspace/task-6a-brief.md
  • docs/ward-flow-phase-3-workspace/task-6a-re-review.md
  • docs/ward-flow-phase-3-workspace/task-6a-report.md
  • docs/ward-flow-phase-3-workspace/task-6a-review.md
  • docs/ward-flow-phase-3-workspace/task-7-addendum.md
  • docs/ward-flow-phase-3-workspace/task-7-brief.md
  • docs/ward-flow-phase-3-workspace/task-7-report.md
  • docs/ward-flow-phase-3-workspace/task-8-addendum.md
  • docs/ward-flow-phase-3-workspace/task-8-brief.md
  • docs/ward-flow-phase-3-workspace/task-8-report.md
  • docs/ward-flow-phase-3-workspace/task-9-brief.md
  • docs/ward-flow-phase-3-workspace/task-9-report.md
  • docs/ward-flow-phase-3-workspace/transport-leg-helper-report.md
  • docs/ward-flow-phase-3-workspace/transport-stage-coherence-report.md
  • docs/ward-management-mode-map.md
  • playwright.config.ts
  • scripts/playwright-pr-shards.mjs
  • src/app/ward-management/constellation/page.tsx
  • src/app/ward-management/ed/[edId]/page.tsx
  • src/app/ward-management/layout.tsx
  • src/app/ward-management/transport/officer/page.tsx
  • src/app/ward-management/transport/page.tsx
  • src/app/ward-management/ward/[unitId]/page.tsx
  • src/components/ward-management/coordinator/coordinator-screen.tsx
  • src/components/ward-management/coordinator/coordinator.module.css
  • src/components/ward-management/coordinator/exception-drawer.tsx
  • src/components/ward-management/coordinator/flow-diagram.tsx
  • src/components/ward-management/coordinator/pressure-strip.tsx
  • src/components/ward-management/coordinator/priority-queue.tsx
  • src/components/ward-management/coordinator/shortlist-panel.tsx
  • src/components/ward-management/ed/ed-screen.tsx
  • src/components/ward-management/ed/ed.module.css
  • src/components/ward-management/officer/officer-screen.tsx
  • src/components/ward-management/officer/officer.module.css
  • src/components/ward-management/tracker/live-tracker.module.css
  • src/components/ward-management/tracker/live-tracker.tsx
  • src/components/ward-management/tracker/tracker-derivations.ts
  • src/components/ward-management/ward-clock.ts
  • src/components/ward-management/ward-derivations.ts
  • src/components/ward-management/ward-flow-events.ts
  • src/components/ward-management/ward-flow-provider.tsx
  • src/components/ward-management/ward-flow-reducer.ts
  • src/components/ward-management/ward-management-console.tsx
  • src/components/ward-management/ward-management-modes.module.css
  • src/components/ward-management/ward-management-modes.tsx
  • src/components/ward-management/ward-management-navigation.tsx
  • src/components/ward-management/ward-management-network.module.css
  • src/components/ward-management/ward-management-network.tsx
  • src/components/ward-management/ward-management.module.css
  • src/components/ward-management/ward-model.ts
  • src/components/ward-management/ward-movements.ts
  • src/components/ward-management/ward-pressure.ts
  • src/components/ward-management/ward-priority.ts
  • src/components/ward-management/ward-role-switcher.module.css
  • src/components/ward-management/ward-role-switcher.tsx
  • src/components/ward-management/ward-sites.ts
  • src/components/ward-management/ward/ward-screen.tsx
  • src/components/ward-management/ward/ward.module.css
  • tests/design-system-adoption.test.ts
  • tests/pressure-strip.dom.test.tsx
  • tests/tracker-derivations.test.ts
  • tests/ui-ward-coordinator.spec.ts
  • tests/ui-ward-management.spec.ts
  • tests/ui-ward-roles.spec.ts
  • tests/ward-capacity-reconciliation.test.ts
  • tests/ward-clock.test.ts
  • tests/ward-derivations.test.ts
  • tests/ward-eligibility.test.ts
  • tests/ward-flow-clock-consistency.dom.test.tsx
  • tests/ward-flow-contracts.test.ts
  • tests/ward-flow-provider.dom.test.tsx
  • tests/ward-flow-queue-selection.dom.test.tsx
  • tests/ward-flow-reducer.test.ts
  • tests/ward-flow-single-source.test.ts
  • tests/ward-management.test.ts
  • tests/ward-model-phase3.test.ts
  • tests/ward-model.test.ts
  • tests/ward-pressure.test.ts
  • tests/ward-priority.test.ts
  • tests/ward-restriction-notice.test.ts
  • tests/ward-screen.dom.test.tsx

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

@supabase

supabaseBot commented Aug 22, 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 ↗︎.

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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:1813124690

ℹ️ 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 threadsrc/components/ward-management/ward-flow-reducer.ts
Comment threadsrc/components/ward-management/ward-derivations.ts Outdated
Comment threadsrc/components/ward-management/ward-derivations.ts
@BigSimmo
BigSimmo marked this pull request as draft August 22, 2026 14:12
@BigSimmo
BigSimmo marked this pull request as ready for review August 22, 2026 19:02

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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:2c9c56e244

ℹ️ 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 threadsrc/components/ward-management/ward-flow-reducer.ts
Comment threadsrc/components/ward-management/ward/ward-screen.tsx Outdated
Comment threadsrc/components/ward-management/ward-clock.ts
- ward-flow-reducer.ts: closing an examination as community_order/
revoked now cancels in-flight transport and releases any bed already
held at the accepted unit, and every downstream transition (referral,
acceptance, hold, decline, handover, transport, arrival, escalation)
now rejects once a movement carries a `closure`. Reproduces and fixes
the reported defect where TRANSPORT_EN_ROUTE still succeeded on a
movement already recorded as revoked, with its bed still reserved.
- ward-screen.tsx: resolves the unit from the provider's live `units`
instead of the frozen `unitById()` fixture, so CONFIRM_CAPACITY/
HOLD_BED updates are reflected on this screen instead of the seeded
count.
- ward-flow-provider.tsx: elapsed time is now accumulated across 30s
checkpoints instead of compared against the original mount instant,
so a session open past 24h (or any multiple of it) keeps counting
forward instead of resetting to zero on an exact-24h wall-clock
reading, which previously moved every deadline/wait/hold on every
screen backward by up to a day.
Each fix carries a regression test; the provider one is confirmed to
fail against the pre-fix code (702 vs expected 2142).
Addresses the three unresolved P1 review threads on PR #2289 as part
of a Run PR sweep.
@BigSimmo
BigSimmo enabled auto-merge (squash) August 22, 2026 19:36
@github-actions

Copy link
Copy Markdown
Contributor

CI triage

CI failed on this PR. Automated classification of the 3 failed job(s):

  • Static PR checksneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Unit coverageneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #13299 (success).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

@BigSimmo
BigSimmo merged commit 16f33d9 into mainAug 22, 2026
26 checks passed
@BigSimmo
BigSimmo deleted the codex/ward-management-design branch August 22, 2026 20:20
BigSimmo added a commit that referenced this pull request Aug 24, 2026
Reconciles the branch with `main` so the unlanded Ward Flow work can reach
it. 36 files conflicted; every conflict was resolved per file and per hunk
with intent, never per side, because neither side was wholly right.
Why 36. PR #2289 squash-merged this branch's Phase 3 work into `main` on
2026-08-22. A squash is not an ancestor of the branch, so git treats
identical lineage as unrelated content: most of the conflict was the
branch's own earlier work coming back at it. 135 hunks in total, of which
41 were mechanical repetitions of one already-decided rename and the rest
genuine judgement.
Which side is newer flips by concern, and that is what the resolution
turned on:
the fabricated Mental Health Act figure, dueAt on a 1A or 3B, and
statutory wording -> take main. PR #2340 is the newer
correction, reviewed twice, and it carries
a guard test the branch has never seen.
Phase 3 behaviour main lacks: reducer closure guards, live capacity, the
demo clock, expired bed holds, the role switcher
-> take HEAD. This is the work the merge
exists to deliver.
accessibility, forced-colors, CSS, layout and performance
-> take main. Ruling R76: main's design-system
work must survive the ward add/add
conflicts rather than be silently reverted.
Source 76 hunks (62 HEAD, 11 main, 3 combined); tests 51 hunks (32 HEAD,
14 main, 5 combined); config and generated docs 8 hunks, all main, with the
five generated files regenerated rather than hand-merged.
Two hunks genuinely contradicted, and both were ruled rather than guessed.
Which legal statuses receive a Form 1A on RAISE_REFERRAL. Taken from
main, which gives one only to a patient actually awaiting examination.
The branch gave one to anyone not voluntary, including a patient already
recorded as an involuntary inpatient, which would let RECORD_EXAMINATION
fire on someone already examined. Measured against the fixture: seven
involuntary-inpatient records, none carrying a 1A. This settles open
question 3 in the handover, in the conservative direction that document
itself leaned toward, and it is flagged to the product owner as settled
by merge rather than left to be discovered.
WF-018's withdrawn referral. Taken from HEAD's empty list: the record
carries no acceptedUnitId and no declines, so the withdrawal it displayed
can never have happened.
No test was dropped: per-file counts confirm every resolved file carries at
least as many as the larger side. One assertion was deliberately not kept,
main's toContainText(/Parallel referral|referred to 3/i) in
ui-ward-roles.spec.ts, which a single badge satisfies while its own comment
claims three. HEAD's toHaveCount(3) on the testid replaces it. Keeping both
would have kept a check that cannot fail beside one that can.
Invariants re-checked AFTER the merge, never only before. Ruling R81 exists
because the third fabricated statutory figure in this project arrived
through a file that appeared in no conflict list:
no statutory duration constant declared anywhere in src
no Form 1A or 3B carries a dueAt; the four that remain are 4A and 4C
tests/ward-legal-figure-guard.test.ts present and passing
both render sites read "no deadline recorded"
zero unattributed claims about what the Act imposes, across src, tests,
scripts, docs and worker. Ten code sites were fixed, two of them in
files that were never conflicted and appeared in no task list
eligibleCandidatesAmong still takes units as a required parameter, with
its static guard and its Playwright test intact
sex remains the only patient attribute
main's accessibility and CSS work survived; the only ward .module.css
delta from main is additive
all three ward specs registered in testMatch, productionSpecPattern and
the shard groups
Verification: tsc --noEmit clean, exit 0, zero errors. Ward unit suites,
20 files, 239 passed, more than either side carried alone. Adoption and
route-reachability, 59 passed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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