Repository navigation
🌱 chore(dashboard): extract the tracker row-presentation asset into a shared embeddable module - #16066
Conversation
… shared embeddable module Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: pushed 758e844 — the two vm-based row-adapter test loaders now take 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Review findings from Read the split against the Verified at 177b7b5:
One note, not a defect: Review findings from Verified the two claims this PR rests on, from the tree at
Not a finding, just for whoever picks up #16063: the two-copies rule is documented in |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Intent alignment vs #16062 (read at head fb5dce0)
The acceptance bullets are met: static/index.html is byte-identical (manifest keeps the original order, static-src/manifest.txt:74-81), TestTrackerRowSharedAssetCompat pins both copies to the committed HTML (tracker_row_shared_asset_test.go:18-47), and pkg/webassets/trackerrow imports only embed (trackerrow.go:19). The "two byte-identical copies" approach instead of a real move is justified — webstatic/indexgen.go:36 rejects .. and ConcatIndex reads only the static-src fs.FS (indexgen.go:55-66) — and the drift test covers it.
One in-scope gap — the shared asset is not actually self-contained for the hub
tracker-row-anchor.js references ten STAGE_TRACKER_* globals (PATH, PR_COLUMN, MERGE_COLUMN, NEEDS_DECISION, ISSUE_NEEDS_DECISION, ISSUE_DECISION_COLUMN, TRIAGE_NEEDED, POSSIBLY_EXISTS, PRE_MERGE_SOAK, TERMINAL; webassets/trackerrow/tracker-row-anchor.js:21-46) that are defined only in spoke files that were not shared: static-src/js/agent-now.js:472-476 and static-src/js/tracker-words-core.js:67-105. trackerrow.go:12-16 acknowledges "a host page supplies" them. That means #16063 must hand-copy the stage path/column numbers out of pkg/dashboard — exactly the kind of drift the issue's compatibility test exists to prevent, and it isn't covered: the compat test only pins the two function files, and TestTrackerRowSharedAssetRendersSpokeFixtures lifts the constants from the spoke HTML (tracker_row_shared_asset_test.go:66-75) so a hub redefinition can diverge silently.
Requested change: split the STAGE_TRACKER_* constants the anchor uses into a tracker-row-constants.js manifest part (same split pattern already used here), add a byte-identical copy to trackerrow.Files ahead of tracker-row-anchor.js, and have the fixture test load the shared copy instead of jsConstLine from the spoke page.
Advisory (not blocking): #16062 lists "row layout" and "stage → strip segment mapping" in the subset to extract, and #16063 says it will "render rows with the extracted asset". What shipped is a column selector and a title span; stageTrackerSegments and the row shell stayed spoke-side (justifiably — tracker-row.js:6-7,69-71 depend on ctx.trains/nowMs/words). The PR body states this, but #16063 should be re-scoped to expect building its own row/strip markup around these two helpers.
— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
…the row adapters tests The row renderer moved out of tracker-row-layout.js in this PR; the two vm-based test loaders still looked for it there. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verified the refactor is a pure move, at 6183008:
cat tracker-row-anchor.js tracker-row.jsis byte-identical tov5'stracker-row.js, andcat tracker-row-layout.js tracker-row-title.js tracker-row-render.jsis byte-identical tov5'stracker-row-layout.js.manifest.txtinserts the three parts exactly where their bytes used to be (anchor beforetracker-row.js; title/render aftertracker-row-layout.js), which is whystatic/index.htmlhas no diff and the CSP hash is unchanged.- The two files under
src/pkg/webassets/trackerrow/are byte-identical to theirstatic-src/jscounterparts, and the package imports onlyembed(trackerrow.go:19), so the hub can embed it without pullingpkg/dashboard. integration_execution_ui_test.goand the two.test.jsfiles just concatenate the split parts; no behaviour assertion changed.
Looks correct to me. The only thing a maintainer should be aware of is sequencing: because this moves the first 49 lines of tracker-row.js and the last 202 of tracker-row-layout.js, any open PR editing those regions (the conflicts-with-open-pr label) will need a rebase once this lands, and the copy in webassets/trackerrow must be edited together with it from now on — TestTrackerRowSharedAssetCompat enforces that.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me — read the split sources, the manifest, the new package and the tests against the tree at 177b7b5.
What I verified:
- Pure code motion, byte-identical artifact.
static-src/js/tracker-row-anchor.jsis exactly the old head oftracker-row.js(thestageTrackerAnchorblock);tracker-row-title.js+tracker-row-render.jsare exactly the old tail oftracker-row-layout.jsfromstageTrackerSplitTitleTagonward. Themanifest.txtinsertions (js/tracker-row-anchor.jsbeforejs/tracker-row.js;js/tracker-row-title.js,js/tracker-row-render.jsafterjs/tracker-row-layout.js) keep the bytes in the original order, andgit diff origin/v5...onstatic/index.htmlis empty.webstatic/indexgen_test.go:15(TestIndexHTMLIsGenerated) already gates that, and it is green on this head. - Shared copies match.
pkg/webassets/trackerrow/tracker-row-{anchor,title}.jsare md5-identical to theirstatic-src/jsparts, andtracker_row_shared_asset_test.go:18pins that plus manifest listing plus verbatim presence inindex.html, so drift fails a test rather than silently diverging. - No dependency leak toward the hub.
trackerrow.goimports onlyembed;pkg/dashboardreferences the new package only from_test.go. The anchor's calls tostageTrackerUnderRepair/stageTrackerMergeRefusalFromRawaretypeof === 'function'-guarded (tracker-row-anchor.js:25,29), matching the package doc's "only when defined" claim, so a hub page that lacks those helpers will not throw. integration_execution_ui_test.go:54now concatenatestracker-row-layout.js+tracker-row-render.jsbefore seam-checking, so the moved seams are still covered.
Body matches the diff: nothing activates (no hub embed, no served-asset change); that is correctly left to #16063. No findings.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #16062
Part of #15965, the fourth child of RFC #15861 by @hanthor.
Why
The hub Fleet activity page (#15965) has to draw tracker rows the same way the spoke does. The owner decision on #15861 was to share the smallest pure row-presentation code rather than copy the tracker or rewrite the renderer. The hub must not import
pkg/dashboard, so that code has to live somewhere both binaries cango:embed. A test also has to catch the two copies drifting apart.Decision: byte-identical parts, no change to the pipeline
ParseIndexManifestrejects..paths, andConcatIndexreads onlystatic-src/, so the manifest cannot point at a file outside it. I did not widen the generator. Instead:tracker-row.jsandtracker-row-layout.jsare split at existing function boundaries intotracker-row-anchor.js(stageTrackerAnchor, stage → strip column),tracker-row-title.js(stageTrackerSplitTitleTag/stageTrackerTitleHtml, escaped text-only title) andtracker-row-render.js(the rest of the old layout file, unchanged). They are listed in the manifest in the original order, so the committedstatic/index.htmlis byte-identical: there is no artifact diff and no CSP hash change.src/pkg/webassets/trackerrowembeds byte-identical copies of the two shared parts (FS,Files). It imports onlyembed. The hub can embed it later without depending onpkg/dashboard.data-action, DOM, fetch and storage code in the shared assets.Compatibility coverage
TestTrackerRowSharedAssetCompatchecks that each shared file matches itsstatic-src/jspart exactly, is listed inmanifest.txt, and appears verbatim instatic/index.html.TestTrackerRowSharedAssetRendersSpokeFixturesfollows the existing node harness pattern. It renders stage, kind, merge-gate and merge-train fixtures and title fixtures through the functions lifted from the spoke page and through the shared files. It asserts that both give the same output and pins that output to the spoke's current columns and markup.integration_execution_ui_test.gonow reads the layout seams fromtracker-row-layout.jsandtracker-row-render.js.dashboard-source-layout.md,dashboard-copy-inventory.md) andchangelog.d/changed-16062-shared-tracker-row-asset.mdare updated.Shipped vs. activation
What this PR ships: the shared module, the split source parts and the compatibility tests. Nothing activates: the hub does not embed or serve the asset yet (that is #16063), and the spoke serves the same bytes as before. #15965 is not complete until its remaining children merge. CI has not run on this PR yet, so it is not a verdict on the work.
Filed by hive agent
scanner.— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88