dashboard: trim comment bloat in tabs.js + swarm.js

Per mara's guidance on hyperhive#3901 (target ~15% comment density
overall, less where obvious, more where not; prefer docs for
abstract/general topics; don't restate facts in multiple places;
don't document history).

tabs.js: removed 4 pure "X now lives in Y" / "moved to Z" historical
asides (the underlying facts are already documented in
docs/web-ui/dashboard.md, not lost by removing the floating in-code
aside) and merged one comment block that had drifted into restating
the same fact twice (one ticker feeding two live displays, documented
as if it were two separate tickers).

swarm.js: cut a comment narrating the removal history of two features
that no longer exist in the code (a per-agent queued-badge and a
client-side jobq tally), keeping only the design constraint still in
force (why the jobq-derived state here is deliberately narrow); cut a
comment documenting a removed CSS class's history down to a statement
of the current class's purpose; cut a comment restating the
jobq-rollup rendering rationale already stated once, above, down to a
one-line pointer; trimmed a "legacy flat layout is bit-identical"
history clause down to what the depth-0 case actually renders.
This commit is contained in:
iris 2026-09-02 01:32:47 +02:00
commit 08f4f60106
2 changed files with 17 additions and 54 deletions

View file

@ -56,27 +56,16 @@ const selectionState = new Set();
// ─── job queue rollup (queue-summary banner only) ──────────────────────────
//
// The ONE piece of job-queue-derived state on this page, and deliberately
// narrow — mara, on review of the DagView migration: "swarm.js should not
// need to pull in the jobq to do its job." An earlier version of this file
// fetched GET /api/jobq/graph (the full node tree) for two things: a
// per-agent queued-but-not-running badge (`queuedOpsByAgent()`, removed
// per "remove the per agent pending stuff - only show what is running" —
// a card's pending badges are transients-only now, which already means
// "what is running") and this banner, which was pulled entirely per "dont
// replace one legacy thing with another" (a client-side tally over the
// generic graph was itself judged a stopgap). Rendering itself later
// moved out to the shared `JobqRollup` Preact component (same one
// swarm-ui's /jobs page mounts), which owns its own fetch of
// GET /api/jobq/rollup — this file just calls Preact's own
// `render(h(...))` directly (no `mountX()` wrapper: `render` is
// already the re-render/diff entry point, per mara on review) and
// bumps a refresh token to force a refetch.
// narrow — mara: "swarm.js should not need to pull in the jobq to do its
// job." Rendering is owned by the shared `JobqRollup` Preact component
// (same one swarm-ui's /jobs page mounts, self-fetching
// GET /api/jobq/rollup); this file just calls `render(h(...))` and bumps
// a refresh token to force a refetch.
//
// Rendered into #jobq-rollup-section, a sibling of #containers-section
// kept OUTSIDE that section's per-render `replaceChildren()` wipe (see
// dashboard.html's comment on the mount div) — rendering into a
// section that gets wiped on every container-state tick would defeat
// the component owning its own fetch lifecycle.
// dashboard.html) — a section that gets wiped on every container-state
// tick would defeat the component owning its own fetch lifecycle.
let jobqRollupToken = 0;
export function initJobqRollup() {
@ -334,12 +323,9 @@ function buildContainerLi(c, node, opts) {
pending, opRunning, selected,
url, containerBase, forgeBase, s,
} = opts;
// A single `pending-running` class now covers the whole "has at
// least one badge" state — there's no more queued-but-not-running
// row to distinguish it from (see the pending-badge derivation
// comment in renderContainers), so the separate no-tint `pending`
// class from before that removal is gone rather than kept as a
// class that would now always co-occur with this one.
// A single `pending-running` class covers any active transient
// badge state (see the pending-badge derivation comment in
// renderContainers).
const li = el('li', {
class: 'container-row'
+ (opRunning ? ' pending-running' : '')
@ -348,9 +334,7 @@ function buildContainerLi(c, node, opts) {
// Topology: depth contributes left-padding; the glyph string in
// the .tree-prefix span draws the ├─ / └─ joint + continuation
// lines (`│ `) for ancestors whose subtree extends below this
// row. Both are CSS-driven from the data attributes so the
// legacy flat layout (every container at depth 0) is bit-
// identical to today's render — no glyph, no indent.
// row. A depth-0 row gets neither — no glyph, no indent.
if (node.depth > 0) li.dataset.depth = String(node.depth);
const prefix = treePrefixDom(node);
if (prefix) li.prepend(prefix);
@ -615,9 +599,7 @@ export function renderContainers(s) {
));
}
// Queue-summary banner lives outside this section now — see
// #jobq-rollup-section / initJobqRollup, mounted once rather than
// rebuilt on every render this function does.
// Queue-summary banner: see initJobqRollup, above.
if (!containers.length && !transientsState.size) {
root.append(el('p', { class: 'empty' }, 'no managed containers'));