Skip to content

Correct the Ward Flow pinned-clock record and defend the fix at screen level - #2522

Merged
BigSimmo merged 3 commits into
mainfrom
claude/ward-flow-clock-t3dmsr
Sep 2, 2026
Merged

Correct the Ward Flow pinned-clock record and defend the fix at screen level#2522
BigSimmo merged 3 commits into
mainfrom
claude/ward-flow-clock-t3dmsr

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

The task this branch started from asked for a lost fix to be re-implemented. It turned out the fix is already on main, so this PR corrects the record instead and adds the guard that was genuinely missing.

  • #YTR84P was stale in four ways. The WardFlowProvider initialNow fix is on mainsrc/components/ward-management/ward-flow-provider.tsx uses the pinned instant verbatim, and tests/ward-flow-provider.dom.test.tsx already pins 07:30 and 21:05 to prove it. The unpushed Windows branch claude/serene-heyrovsky-7a5e53 is redundant. The Phase 6 morning page is not on main at all. The blast radius is 51 provider call sites across 20 test files (47 passing NOW_ANCHOR, 4 deliberately not), not the recorded 40.

  • The real regression vector was two documents, not the source. docs/superpowers/plans/2026-08-19-ward-flow-phase-3-role-screens.md and docs/ward-flow-phase-3-workspace/task-4-brief.md both still present the buggy clock (const elapsed = initialNow !== undefined ? 0 : …) as the build instruction, so anyone rebuilding the provider from them reintroduces the defect. The snippet is kept — it is the historical record of what was actually instructed — with a correction block above it naming the defect and pointing at the shipped implementation.

  • docs/ward-flow-pinned-clock-handover.md is rewritten to be true. Its banner read "Nothing here is on main", which invites a session to cherry-pick an applied commit.

  • The remaining Phase 6 action turned out not to be a test. The ledger asked for a D5 pre-08:00 test rendering MorningPage inside a pinned provider. That cannot pass: owner decision WB-DB-11 removed the fixed/live split on claude/ward-flow-phases-6-7-design, so NoHandoverYet — which holds the sentence such a test would assert — is exported and rendered by nothing. D5 now needs a decision before any test can exist. Recorded, along with a separate unlogged breakage it implies: tests/ui-ward-morning.spec.ts clicks controls the page no longer renders.

  • Two screen-level tests in tests/ward-discharge-board.dom.test.tsx drive releaseBand()'s two now-dependent branches through a rendered board — a same-day clock move flipping a band, and a next-operating-day clock dropping yesterday's released row. Before this, those branches were reachable only by calling the pure function directly, so nothing would have caught the defect returning through a real component.

  • One immutable ledger inbox request correcting #YTR84P. Left open, not closed, because the D5 decision is real and untaken. Run npm run issues:reconcile after this lands.

  • scripts/check-docs-links.mjs: the existing Phase 6 allowlist entry for the handover doc gains four more branch-only paths, which is what makes the findings above checkable rather than asserted.

Verification

  • npm run verify:pr-local — every selected gate green. lint and typecheck are reused receipts (exit 0 on this exact content, not fresh runs this invocation); format:changed, docs:check-links, check:ledger-write-discipline, check:outstanding-issues, check:branch-review-ledger, check:rag:fixtures, check:medication-interactions and check:medication-lexicon-report all ran fresh and passed.

Full unit suite: Tests 2 failed | 12052 passed | 4 skipped (12058).

Both failures are environmental, not this diff. tests/clinical-hazard-controls.test.ts and tests/rag-plan-package-parity.test.ts resolve historical commits (883f1007a, f3d1a3cce) that were absent because this container's clone is shallow. After git fetch --deepen=2000 both pass:

Test Files  2 passed (2)
     Tests  19 passed (19)

This diff touches no input either test reads. CI clones fully, so neither should appear there.

Mutation-proven, which is the evidence that matters here. With the defect reintroduced on the provider (? NOW_ANCHOR in place of ? initialNow), both new tests go red while all six pre-existing tests in the same file stay green:

AssertionError: expected [ 'By midday', 'By midday' ] to deeply equal [ 'Now', 'Now' ]
TestingLibraryElementError: Unable to find an element by: [data-testid="ward-discharge-group-released-today-empty"]

That is the point twice over: the new tests detect the defect, and the suite already there demonstrably could not, because every one of its renders pins NOW_ANCHOR. The provider was restored and the file re-run: Tests 8 passed (8).

  • UI verification not run: no component, route, style or chrome file changed, so there is no plausible browser regression for this diff to cause. No npm run ensure, no Playwright.
  • No provider-backed gate was run and none is claimed.

Risk and rollout

  • Risk: Low. No source or component change — the diff is documentation, one test file, one link-checker allowlist entry, and one ledger request. The only executable path touched is scripts/check-docs-links.mjs, and only to widen an existing allowlist for paths that live on another branch.
  • Rollback: Revert the single commit. Nothing depends on it and no behaviour changes.
  • Provider or production effects: None.
  • RAG impact: none — no retrieval, ranking, selection, chunking, scoring, source-rendering or answer-contract surface is touched.

Clinical Governance Preflight

Not applicable and deliberately left unchecked rather than ticked through. This diff touches no ingestion, answer generation, search/ranking, source rendering, document access, privacy, production environment, or clinical output path. The one behavioural surface it tests, the ward-flow discharge board, is synthetic design scratch under src/app/mockups/ward-flow/**, which 404s in production.

Notes

Follow-ups, both recorded in the ledger request rather than left in chat:

  1. The D5 decision on claude/ward-flow-phases-6-7-design — retire D5 with the fixed view, or restore the fixed view and then test it. Worth weighing against that branch's state: PR Ward Flow — synthetic bed-flow prototype (DRAFT, not for merge) #2466 was closed unmerged, 299 commits ahead of main.
  2. claude/serene-heyrovsky-7a5e53 can be closed from the workstation that holds it; it is not visible from any cloud session and its content is superseded.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NiskRgeXeNRiU3npGP4M9f


Generated by Claude Code


Note

Low Risk
No production or provider source changes; only docs, one ledger inbox JSON, link-check allowlist, and ward-flow DOM tests on mockup scratch that 404s in production.

Overview
This PR does not re-implement the WardFlowProvider pinned-clock fix — it is already on main. It corrects documentation and tracking that still described cherry-picks and a failing D5 test, and adds regression coverage the existing DOM suites could not provide.

Documentation rewrites docs/ward-flow-pinned-clock-handover.md so the status banner matches reality (fix on main, redundant local branch, updated initialNow blast radius). Correction callouts are added above the historical buggy clock snippets in the Phase 3 plan and task-4 brief so rebuilds do not re-teach elapsed = 0 when pinned. An outstanding-issues inbox update for #YTR84P records that the remaining work on Phase 6 is an owner decision on spec D5 (WB-DB-11 removed fixed/live UI), not a provider test.

Tests: tests/ward-discharge-board.dom.test.tsx gains two renders that assert Expected band labels and Released today grouping change when initialNow moves off NOW_ANCHOR — catching #YTR84P through a real screen where every other suite pins the anchor.

Tooling: scripts/check-docs-links.mjs widens the handover doc’s scoped allowlist for paths that exist only on claude/ward-flow-phases-6-7-design, keeping link checks honest while citing branch evidence.

Reviewed by Cursor Bugbot for commit 869880b. Configure here.

#YTR84P said the WardFlowProvider `initialNow` fix existed only on an
unpushed Windows branch and had to be re-applied. It does not. An
equivalent fix is already on `main`: the render body uses the pinned
instant verbatim, and `tests/ward-flow-provider.dom.test.tsx` pins 07:30
and 21:05 to prove it. So the work here is the record and the guard, not
the fix.

Three things were teaching or claiming the wrong state.

The regression vector is two documents, not the source. The Phase 3 plan
and its task-4 brief both still present the buggy clock as the build
instruction, so anyone rebuilding the provider from them reintroduces the
defect. The snippet stays -- it is the historical record of what was
actually instructed -- and each now carries a correction block above it
naming the defect and pointing at the shipped implementation.

The handover document asserted "Nothing here is on `main`", which invites
a session to cherry-pick an applied commit. Rewritten against what the
tree actually holds: the fix and where it lives, the redundant branch
closed out, the blast radius corrected from 40 call sites to 51, and the
Phase 6 branch recorded as reachable by fetch rather than workstation-only.

The remaining Phase 6 action turned out not to be a test at all. The
ledger asked for a D5 pre-08:00 test rendering `MorningPage` inside a
pinned provider. That cannot pass: owner decision WB-DB-11 removed the
fixed/live split, so `NoHandoverYet` -- which holds the sentence the test
would assert -- is exported and rendered by nothing. D5 now needs a
decision (retire it, or restore the fixed view) before any test can
exist. Recorded, with the separate unlogged breakage it implies for
`tests/ui-ward-morning.spec.ts`, whose clicks target controls the page no
longer renders.

Finally, the fix was undefended at screen level: `releaseBand`'s two
`now`-dependent branches were reachable only by calling the pure function
directly, so nothing would catch the defect returning through a real
component. Two tests in `tests/ward-discharge-board.dom.test.tsx` now
drive both through a rendered board -- a same-day clock move flipping a
band, and a next-operating-day clock dropping yesterday's released row.
Mutation-proven: with the defect reintroduced both go red while all six
pre-existing tests in the same file stay green, which is the point twice
over.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NiskRgeXeNRiU3npGP4M9f
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 1256d2a5-4b32-4dbc-a5c2-7a6f571a5ff5


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.

@supabase

supabase Bot commented Sep 2, 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 ↗︎.

@BigSimmo
BigSimmo marked this pull request as ready for review September 2, 2026 05:23
@cursor

cursor Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_30c397b1-15b8-4682-a087-e612b8eda37e)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T05:27:49.572864Z 869880b Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 869880bda6

ℹ️ 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/ward-flow-pinned-clock-handover.md
Codex review (P2) on this PR: the corrected status banner and the
introduction directly below it gave a reader mutually exclusive
instructions. The banner says the fix is on `main` and must not be
cherry-picked; the introduction still said it "lives on a branch nobody
else can see" and was needed by Phase 6 — which would send someone back
to the very branch the revision retires. Correct, and exactly the defect
class this PR exists to close, so the introduction is rewritten rather
than patched: the file's job is no longer to rescue stranded work, it is
to stop settled work being redone.

Two more of the same kind, found re-reading the whole document rather
than only the flagged lines:

- §1 asserted every `initialNow=` call site passes `NOW_ANCHOR`, which §3
  corrects to 51 sites with four deliberately pinned elsewhere. Put into
  the past tense and pointed at the current figure.
- The Phase 6 spec read instruction omitted the `origin/` prefix, so the
  `git show` it gives fails in exactly the fresh clone it is written for.

Also repoints §1's cross-reference, since §4 no longer describes the
workaround inline but under its own heading.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NiskRgeXeNRiU3npGP4M9f

BigSimmo commented Sep 2, 2026

Copy link
Copy Markdown
Owner Author

Codex's P2 on docs/ward-flow-pinned-clock-handover.md was correct and is fixed in 87ee0c7.

The finding: the corrected status banner and the introduction below it gave a reader mutually exclusive instructions — the banner says the fix is on main and must not be cherry-picked, while the introduction still said it "lives on a branch nobody else can see" and was needed by Phase 6. That would send a session back to the branch this revision retires, which is precisely the failure mode the PR exists to close. The introduction is rewritten rather than patched: the file's job is no longer to rescue stranded work, it is to stop settled work being redone.

Re-reading the whole document rather than only the flagged lines turned up two more of the same kind:

  • §1 asserted that every initialNow= call site passes NOW_ANCHOR, which §3 corrects to 51 sites with four deliberately pinned elsewhere. Now in the past tense and pointed at the current figure.
  • The Phase 6 spec read instruction omitted the origin/ prefix, so the git show it hands you fails in exactly the fresh clone it is written for.

Verified after the change: docs:check-links passes (4778 references resolve) and format:changed is clean. No test or source file is touched by this commit.


Generated by Claude Code

@BigSimmo
BigSimmo merged commit a1aa449 into main Sep 2, 2026
35 checks passed
@BigSimmo
BigSimmo deleted the claude/ward-flow-clock-t3dmsr branch September 2, 2026 05:38
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.

2 participants