Repository navigation
test(shift-manager): fix main — snapshot test's workforce fake lacks watchRoster - #4793
Conversation
…ter (fix main) Main's CI went red at 335b846 (PR #4747). That merge brought in 79b03fc (FIX-2412), which moved useRoster from workforce.roster() to workforce.watchRoster(...) and updated the workforce fakes on its branch. 243a14a (FIX-2409) had meanwhile landed snapshot-subscribe.test.tsx on main with a fake carrying only roster(). The two merged with no textual conflict; the Sidebar's roster effect then threw "watchRoster is not a function", React unmounted the root, and the as-of line and its refresh link were gone. Give the fake the same watchRoster connection.test.tsx uses. No assertion changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
Second look + architecture reviewVerdict: the approach is right. Merge it as is. It's the smallest fix for a red Alternatives considered
Architecture note (optional follow-up, not for this PR)
This PR is the second time a missing Minor
No blocking findings. Generated by Claude Code |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…t (BP-006) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review.
Generated by Claude Code |
There was a problem hiding this comment.
Code Snob
joinWatch only stores the function watchRoster returns and calls it when the last view leaves. This screen's inventory is empty, so Talk never mounts and roster() never runs. withRoster draws no workers while the watch has not reported, the same workers as the empty delivery.
Drop the comment (it restates the next line and names FIX-2412), roster(), and the typed Promise.resolve([]) delivery. The stub is watchRoster: () => () => {}.
Against main that is the whole fix: one line in place of roster. POC: #4794 — snapshot-subscribe.test.tsx 11/11, and a call log on the longer fake recorded watch twice and roster never. Fold that subtraction into this PR. Close the POC unmerged after this lands. The shared workforce helper stays the follow-up this PR already split off.
Sent by Cursor Automation: Code Snob
There was a problem hiding this comment.
/simplify review
Problem: After FIX-2412, useRoster calls workforce.watchRoster(). The snapshot-subscribe suite mounts <App /> with a workforce fake that only implemented roster(), so the test blew up at runtime (watchRoster is not a function) and main broke.
Verdict: This is the right-sized fix. Extending the existing useWorkforce mock—not introducing a second strategy like vi.mock("../src/lib/roster")—matches every other App-level screen test in this package and keeps the real useRoster → joinWatch → watchRoster wiring under test. A shared emptyWorkforceClient() helper would only dedupe one other copy today (connection.test.tsx); extracting it here would add indirection without paying for itself yet.
Alternatives considered (and why not here):
- Mock
useRosterdirectly — no precedent inshift-manager/test/; would hide workforce-client regressions and fork conventions. - Richer stub (
roster-screen/coordinator-viewstyle) — over-scoped; this file cares about FIX-2409 subscription refresh, not roster UX. - Third-party package — N/A; this is test-local fake data.
Optional nits (non-blocking): The new inline comment names FIX-2412 and useRoster; connection.test.tsx uses the shorter // The roster watch, reporting one read. Aligning wording would reduce ticket noise in the mock body (BP-006 spirit) without changing behavior.
Follow-ups (separate PR if a third copy appears): shared test/workforce-stubs.ts with roster + empty one-shot watchRoster; optional Pick<WorkforceClient, "roster" | "watchRoster"> so the next missing method fails at compile time.
Verification: pnpm --filter @flow-state-dev/shift-manager test — 78 files, 703 passed (includes snapshot-subscribe.test.tsx).
Approving — nothing here over-engineers the fix.
Sent by Cursor Automation: Review For Best Approach
… reaches The snapshot test mounts App with an empty inventory, so Talk never mounts and roster() is never called; a call log on the longer fake recorded the watch twice and roster never. A watch that never reports draws the same as one empty read. The fake is now the one method useRoster calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Code Snob review: applied in I checked the claim before folding it in. A call log on the longer fake recorded
The PR is now a one-line change against Once this lands, POC #4794 can be closed unmerged. I haven't touched it. The shared workforce helper stays a separate follow-up. Generated by Claude Code |


Summary
Fixes red
mainCI:Test (1/3)failing inpackages/shift-manager/test/snapshot-subscribe.test.tsx(lines 282 and 292). Failing run: 42077021692, head335b8462e.Cause
A semantic merge conflict between two PRs that were each green on their own:
243a14a15(FIX-2409) putsnapshot-subscribe.test.tsxon main. Its fake foruseWorkforcehad onlyroster().79b03fcc2(FIX-2412, "live roster read") moveduseRoster(src/lib/roster.ts) fromworkforce.roster()toworkforce.watchRoster(...). It updated the workforce fakes on its own branch, but this test wasn't on that branch yet.335b8462e(merge of PR FIX-2412: the roster follows hires, forks, edits and fires in every app #4747) brought FIX-2412 onto main. Git found no textual conflict.After that merge, the Sidebar's roster effect threw
TypeError: workforce.watchRoster is not a function. There's no error boundary, so React 19 unmounted the whole root. That's why the failure showed an empty<div />: the subscription was closed (expected [] to have a length of 1) andshift-coordinator-as-of-refreshwas gone.4e3d10175(FIX-2403 starter lines) is not the cause. The error is raised fromroster.ts'sjoinWatch.Change
Gives the test's workforce fake the same
watchRosterthatconnection.test.tsxalready uses: one empty read, a no-op stop. No assertions change and no source changes.Verification
origin/main(162792f3e) with Node 24: 2 failed,watchRoster is not a functionin stderr.snapshot-subscribe.test.tsxpasses 11/11.dist-client, local sockets refused, a tmp-path realpath mismatch. They passed on the failing CI run and this diff doesn't touch them. CI on this PR is the real check.🤖 Generated with Claude Code