Repository navigation
fix(workflow): poll the store once per tick and report a failed read - #1565
Conversation
|
@Birfy review request — PR #1565 at Scope is P-98 only, 3 files: Red first with |
|
Verdict: PASS at 88b4b68 Ran at this tip (2026-10-28T09:54Z, tarball Red first holds: with only the changed source ( Tier: T2 — Scope: Checks at the tip (14 Code read (
Not run: a fresh-tree Non-blocking notes for Dev-4: the body's Docs: |
88b4b68 to
eba939f
Compare
|
@Birfy review request — PR #1565 at This tip is a pure rebase onto live main As of my read: 2 comments, newest Written-by: FlyBot Lead |
Two effects tested the same "a run is live" condition and both armed a 2 s interval, so every tick read the whole workflow/state twice ([0, 2001, 2001, 4003] on the probe). refresh() also awaited the host without settling a refusal, so an unreachable store became an unhandled rejection and the stage painted its empty state. Fold the two effects into one keyed on the boolean, route the read through settledCall (ThinkFlowLab#1522), and put the refusal on the section's alert instead of "No workflows yet."; the poll keeps retrying and a successful read clears it. Fixes ThinkFlowLab#1564 Docs-not-needed: plugins/workflow/client.js changes how the stage polls and reports a refused read; docs/subsystems/workflow.md already says the stage "refreshes state while runs are active" and that a failing stage control ends on the .wf-err alert, and no contract or data shape changes. Rebased onto main a221306 by Dev-4, content unchanged: only plugins/workflow/test/client.test.js conflicted (live main and this commit both append tests at end of file); main's block stays first and this commit's two tests follow it, with no line dropped or rewritten on either side.
|
Verdict: PASS at eba939f Ran at this tip: Red first holds: with only the changed source ( This is a new tip, not a carried PASS. Tier: T2 — Scope: Checks at the tip (14 Code read ( Not run: a fresh-tree Non-blocking: |
Fixes #1564
Owner: Dev-4
Reviewer: Reviewer
Written-by: Dev-4
Base:
a2213067fb3cc2f746e5f9256b09a21adec15738(main, #1567)Tip:
eba939f9892cb471f017ecb28b1bcea7aa53d972Tree:
fcf2f9885a5a906bfe17aa87765f8d00a6e4405cWhat changed
plugins/workflow/client.js, the sidebar section that also owns the stage. Two defects in the same place:useEffects tested "some workflow has an active run" — one on[pack], one onpack?.workflows?.some(...)— and each armed its own 2 ssetInterval, so every tick read the wholeworkflow/statetwice (the issue's probe:[0, 2001, 2001, 4003]). They are now one effect keyed on the boolean, so the timer is armed once while a run is live and no longer re-armed on every poll response.refresh()awaited the host call directly and neither caller handled a rejection, so an unreachable store became an unhandled rejection andpackstayednull, which renderedNo workflows yet.. The read now goes throughsettledCall(the#1522helper the stage controls already use — no second helper shape), a refusal lands on the section's.wf-erralert (role="alert"), the empty state is suppressed while a read has failed, and the same single poll keeps retrying every 2 s until a read succeeds and clears the alert.No server change, no new endpoint.
WorkflowSettings(#1504), the Runs row metadata (P-97) andcore/are untouched.Rebase
This tip replays that same change onto live main
a2213067; the earlier Verdict PASS was written at88b4b689(base176d33d0) and does not carry to this tip.Only
plugins/workflow/test/client.test.jsconflicted, because live main and this commit both append tests at the end of the file. Main's block stays first, this commit's two tests follow it, and the merge restores the blank line that separates them, so the appended lines are byte-identical to the original 67.plugins/workflow/client.js(13+/19−) andchangelog.d/1564-stage-poll.fixed.mdapplied with no hand edit.Self-proof, all machine comparisons:
git diff --numstat 176d33d0 88b4b689=1/0,13/19,67/0;git diff --numstat a2213067 eba939f9= the same three rows, 3 files+81 −19.+payload and the−payload of every file are byte-identical between the two diffs (grep '^+'/'^-'thencmp): client.js 13 added and 19 removed, test file 67 added and 0 removed, changelog 1 added.client.test.jsis byte-for-byte live main's file plus the same 2816 appended bytes; the changelog fragment is byte-identical to the one at88b4b689.Tests
Red first in
plugins/workflow/test/client.test.js, measured on this tree withclient.jsreverted to live maina2213067and the tests kept:a2213067(tests kept, source reverted)exactly one poll is armed for one live run, saw 2(2 !== 1), and a tick read the store twicefailureType: 'unhandledRejection',The workflow store is unreachable, stackrefresh←render; no alert,No workflows yet.on screenThe timing case stubs
setInterval/clearIntervaland counts realworkflow/statecalls, so it does not sleep through a tick. The failure case drives one refused read and one successful retry through the same stub and asserts the alert clears and the workflows appear.plugins/workflowat this tip: 144/144;test/client.test.js47/47.client.jsback ata2213067, tests kept → 142 pass / 2 fail of 144, exactly the two new cases.node .github/scripts/changelog.mjs check: 66 fragments well formed.TZ=UTC ARCH_DOCS_BASE=a2213067fb3cc2f746e5f9256b09a21adec15738 npm run verify→ exit 0: core 1870, social 527, tree 125, timeline 125, workflow 144,.github/scripts548, interop 37, live-e2e 24, all 0 fail; lint 0 errors (warnings 63/36/9/2/15/1/0, none inclient.js);arch-docs: OK (3 changed file(s));build-client --checksilent;ds-bot-patches check= 10 patches apply cleanly in order +core/equalsds-bot/+ patches.packagejob (pack, typecheck, actionlint) and the smoke test — neither is part ofverify, and this PR changes neithercore/index.jsnorcore/src/host/.T2 (
plugins/**), so this needs a Verdict naming this tip before it is enqueued.Docs-not-needed:
plugins/workflow/client.jschanges how the stage polls and how it reports a refused read;docs/subsystems/workflow.mdalready says the stage "refreshes state while runs are active" and that a failing stage control ends on the section's.wf-erralert, and no contract, endpoint or data shape changes.Checkpoint
{ "pr": 1565, "claim": "Dev-4", "issue": 1564, "summary": "Two effects armed a 2 s poll for the same 'a run is live' condition, so every tick read workflow/state twice; they are now one effect keyed on that boolean. A refused read went through a bare await, escaped as an unhandled rejection and painted the empty stage; it now settles through settledCall, shows on the .wf-err alert, suppresses 'No workflows yet.', and the same poll retries until a read succeeds. Rebased onto main a2213067: only the client.test.js tail merged, both sides kept.", "files": [ "plugins/workflow/client.js", "plugins/workflow/test/client.test.js", "changelog.d/1564-stage-poll.fixed.md" ], "checks": { "ran": "plugins/workflow 144/144 and client.test.js 47/47 at this tip; red first with client.js at a2213067: 142 pass/2 fail; verify exit 0 (core 1870, social 527, tree 125, timeline 125, scripts 548, interop 37, live-e2e 24, all 0 fail); changelog 66; lint 0 errors", "result": "green", "at": "eba939f9892cb471f017ecb28b1bcea7aa53d972" }, "next": "review: a Verdict at eba939f9 (T2; the PASS at 88b4b689 does not carry), then enqueue" }