swarm.js: migrate pending-row fallback + queue-summary banner off DagView
hyperhive#2822/PR#3026 moved swarm.js's per-agent in-flight status off the rebuild queue. Two other reads of the same rebuild_queue field survived that PR by design (a different feature, atlas flagged it on #2985) and are the last DagView/NodeView consumers on the frontend: queuedOpsByAgent()'s pending-row fallback and the SW4RM queue-summary banner. Both now read GET /api/jobq/graph (hive-jobq-wire's generic GraphNode shape) instead, matching the pattern builds.js already established for <hive-jobq-graph>. Along the way: DagView no longer carries state/kind fields (removed in an earlier refactor that pushed roll-up derivation client-side), so both migrated functions were silently reading undefined fields and had become permanent no-ops — the pending-badge fallback never lit and the queue-summary banner never rendered. This restores real behavior rather than porting broken logic forward. The queue-summary banner's node-count-vs-group-count question (flagged on hyperhive#3028 as needing a decision) resolves cleanly: a GraphNode group root (parent: null) is an ordinary node whose own state already IS the group's roll-up per hive-jobq-wire's contract, so counting roots by state is a direct filter, not a parent-chain walk or a client-side rollup calculation. Verified the derivation logic against constructed GraphNode fixtures (multi-step chains, settled history that must not count, Finishing roots, multi-agent single-DAG groups) before wiring it in — 13/13 checks passed. docs/web-ui/dashboard.md's Container-row + BU1LDS sections updated to match.
This commit is contained in:
parent
8a16d4ca7e
commit
45710ab739
3 changed files with 121 additions and 70 deletions
|
|
@ -209,8 +209,10 @@ Three sub-tabs: **R3BU1LD QU3U3** (default), **M3T4 1NPUTS**,
|
|||
**BUILD L0GS**. Its own esbuild bundle (`builds.js`); cold-loads
|
||||
`/api/state` and subscribes to `/api/dashboard/stream` for
|
||||
`rebuild_queue_changed`, `meta_inputs_changed`, `meta_update_running`.
|
||||
The dashboard tab keeps the rebuild-queue *state* for the SW4RM
|
||||
card badges without rendering these panels.
|
||||
The SW4RM tab (`/dashboard.html`) independently self-fetches the same
|
||||
`GET /api/jobq/graph` endpoint for its own card badges + queue-summary
|
||||
banner (`refreshJobqGraph`, `swarm.js`) — same data source, no panel
|
||||
rendering, no shared fetch between the two pages.
|
||||
|
||||
**R3BU1LD QU3U3** — pending, in-flight, and recently-settled container
|
||||
operations: rebuilds, meta-update cascades, and first-spawns. One
|
||||
|
|
@ -222,9 +224,11 @@ listens for its `hive-jobq-graph-update` event to drive the two things
|
|||
below it that the generic view doesn't show. The component owns
|
||||
fetching, cold and live: `GET /api/jobq/graph` on mount, and
|
||||
`.refresh()` on every `rebuild_queue_changed` SSE tick (that event
|
||||
still carries its own `Vec<QueueEntry>` payload on the wire — the
|
||||
SW4RM tab still consumes it for the badges, untouched — this page just
|
||||
ignores the payload and treats the tick as a refetch trigger).
|
||||
still carries its own `Vec<QueueEntry>` payload — `DagView`-shaped,
|
||||
also read by `hivectl`'s own wait/progress loop, a separate migration
|
||||
— on the wire, but neither dashboard page reads it anymore; both
|
||||
treat the tick as a pure refetch trigger against the generic
|
||||
endpoint).
|
||||
|
||||
Each row is one root graph node (`parent: null`); a multi-step op's
|
||||
per-agent subgraphs and sub-steps render as nodes within that one
|
||||
|
|
@ -912,17 +916,21 @@ fetch entirely.
|
|||
their own label directly via `TransientSet`/`TransientCleared`
|
||||
events carrying no backing node at all.
|
||||
|
||||
(2) The **rebuild-queue fallback** (`rebuildQueueState`) only
|
||||
fires when an agent has **zero** transients — since (1) now covers
|
||||
every `Running` node unconditionally, a `Running` rebuild-queue
|
||||
entry can never usefully reach this fallback by the time it's
|
||||
consulted; the fallback exists purely for the **`Pending`
|
||||
(queued, not yet started)** case, which `running_transients()`'s
|
||||
Running-only test cannot represent. `queuedOpsByAgent()` (swarm.js)
|
||||
reflects this: it only ever looks at `Pending`-state queue nodes,
|
||||
and (mara, on review) the badge shows the queue entry's raw `kind`
|
||||
string as-is — no English-phrase lookup translating it first, same
|
||||
opaque-string treatment a transient's own label already gets.
|
||||
(2) The **job-queue fallback** (`jobqNodesState`, the flat
|
||||
`GraphNode[]` from `GET /api/jobq/graph` — `swarm.js`'s
|
||||
`refreshJobqGraph`, same generic endpoint the BU1LDS page's
|
||||
`<hive-jobq-graph>` self-fetches, see above) only fires when an
|
||||
agent has **zero** transients — since (1) now covers every
|
||||
`Running` node unconditionally, a `Running` job-queue node can
|
||||
never usefully reach this fallback by the time it's consulted; the
|
||||
fallback exists purely for the **`Pending` (queued, not yet
|
||||
started)** case, which `running_transients()`'s Running-only test
|
||||
cannot represent. `queuedOpsByAgent()` (swarm.js) reflects this: it
|
||||
only ever looks at `Pending`-state nodes carrying a non-empty
|
||||
`payload.data.agent`, and (mara, on review) the badge shows the
|
||||
node's raw `payload.label` string as-is — no English-phrase lookup
|
||||
translating it first, same opaque-string treatment a transient's
|
||||
own label already gets.
|
||||
`opRunning` (driving the `pending-running` row class + spinner) is
|
||||
simply "does this agent have at least one transient" — a queued-only
|
||||
entry (no transient yet) leaves it false.
|
||||
|
|
@ -966,13 +974,19 @@ per-agent actions and navigation links. Contents:
|
|||
agent is stale. Banner pulses on each broker SSE event
|
||||
(`pulseBanner` with a 4s grace timer).
|
||||
|
||||
**Build-queue summary banner** — when the rebuild queue has any
|
||||
`queued` / `running` entries, a compact amber banner sits above the
|
||||
container list: `◐ build queue — N running · M queued — view queue →`
|
||||
(the link goes to the BU1LDS page's R3BU1LD QU3U3). It replaces the
|
||||
old per-transient spinner list; the actual running node for each
|
||||
agent is already shown on its card (transient + in-flight-queue
|
||||
badges), so the top of the tab only needs the at-a-glance summary.
|
||||
**Build-queue summary banner** — when `jobqNodesState` has any
|
||||
`Pending` / `Running`(-or-`Finishing`) **group roots** (`parent:
|
||||
null` — each an independent queued/running operation, not a raw
|
||||
node count: a multi-step op's not-yet-started sub-steps don't inflate
|
||||
the number), a compact amber banner sits above the container list:
|
||||
`◐ build queue — N running · M queued — view queue →` (the link goes
|
||||
to the BU1LDS page's R3BU1LD QU3U3). A root's own `state` already
|
||||
carries its subtree's roll-up (`hive-jobq-wire`'s contract), so this
|
||||
is a direct filter over `jobqNodesState`, not a client-side rollup
|
||||
derivation. It replaces the old per-transient spinner list; the
|
||||
actual running node for each agent is already shown on its card
|
||||
(transient + in-flight-queue badges), so the top of the tab only
|
||||
needs the at-a-glance summary.
|
||||
|
||||
### Themed dialogs
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue