Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/changed-16062-shared-tracker-row-asset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The tracker's stage-to-column mapping and text-only row title now live in a shared embeddable module (`src/pkg/webassets/trackerrow`) that both the spoke dashboard and the hub can load, with a compatibility test that fails if the spoke's rows and the shared copy drift. The spoke dashboard serves byte-identical HTML; nothing changes for operators yet — this is groundwork for the hub Fleet activity page ([#16062](https://github.com/hivecommons/hive/issues/16062), part of [#15965](https://github.com/hivecommons/hive/issues/15965)).
2 changes: 1 addition & 1 deletion src/docs/dashboard-copy-inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ old name).
| `stageTrackerTrainQueueTip` | chevron hover | *Behind #15253 … Estimated turn: ~25m.* / *Front of the merge queue* | *2nd of 6 in the merge queue · behind #15253 · ETA ~25m.* / *1st of 6 in the merge queue · merges next · ETA ~4m.*; *· merge sweep running* lives here only (one label per chevron, #15416) | same |
| `stageTrackerTrainHeaderText` + `stageTrackerTrainIconHtml` | train header chip | `⛓ merge train · 2 PRs · front #15400` | 🚆 (inline-SVG railcar, hover *Merge queue*) `merge train · 2 PRs · 1st: #15400` | `TestStageTrackerMergeTrain` |
| `stageTrackerQueueMemberState` (`tracker-queue.js`) | Merge queue popover | *front of the queue* | *merges next* | `TestStageTrackerMergeQueuePopover` |
| `stageTrackerAnchor` (`tracker-row.js`) | which column lights | a 1st-in-train head at 050/070 lit **CI / Review** | every train state lights **Merge queue** | `TestStageTrackerMergeTrainStatesLightMergeColumn` |
| `stageTrackerAnchor` (`tracker-row-anchor.js`) | which column lights | a 1st-in-train head at 050/070 lit **CI / Review** | every train state lights **Merge queue** | `TestStageTrackerMergeTrainStatesLightMergeColumn` |
| `stageTrackerHeaderHtml` | column header | *Merge gate* | 🚆 *Merge queue* (same icon as the chip and the 080 chevron) | `TestStageTrackerHeader…` |
| Go: `prstage.MergeTrain.Sentence`, `stageTrackerMergeTrainFrontCaption`, `eta_basis` | gate reason, caption, hover | *front of the merge train (1st of 3)*, *Front of a merge train of N PRs* | *1st in the merge queue; merges next (1st of 3)*, *1st in a merge queue of N PRs* | `TestParseMergeTrainRejectsMalformed` |
| "merge gate" in decision copy (`delegatedecision` glossary, ladder, dashboard decided/new/vocabulary) | glossary, ⋯ hints, PR comments | *the merge gate merges it once every check passes* | *the merge queue merges it …* | `TestStageTrackerDecisionGlossaryMirrorsGo` |
Expand Down
17 changes: 15 additions & 2 deletions src/docs/dashboard-source-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ Body HTML (`html/`): `auth`, `root-notices`, `chat`, `dialogs`, `sidebar`,
JS (`js/`): `boot`, `core`, `feedback`, `sections`, `layout`, `agent-detail`,
`sidebar`, `history-sparklines`, `cost-trend`, `stats`, `agent-now`,
`tracker-words-core`, `tracker-words-stage`, `tracker-words-gate`,
`tracker-words`, `tracker-row`, `tracker-row-strip`, `tracker-row-acted`,
`tracker-row-layout`, `tracker-motion`, `tracker-filter`,
`tracker-words`, `tracker-row-anchor`, `tracker-row`, `tracker-row-strip`,
`tracker-row-acted`, `tracker-row-layout`, `tracker-row-title`,
`tracker-row-render`, `tracker-motion`, `tracker-filter`,
`tracker-filter-state`, `nav-count-delta`, `tracker-preparation`,
`tracker-native-queue`, `tracker-filter-render`,
`tracker-filter-fetch`, `tracker-actions`, `tracker-merged`, `tracker-queue`,
Expand All @@ -98,6 +99,18 @@ clearly belongs to another area than the file it sits in, move it — the
generator does not care about order inside a region as long as the manifest
order still yields a document where every definition precedes its first use.

### Shared with the hub

`js/tracker-row-anchor.js` (which strip column a stage lights) and
`js/tracker-row-title.js` (the escaped, text-only row title) are also embedded
by `src/pkg/webassets/trackerrow`, so the hub can draw rows with the same
code without importing `pkg/dashboard`. The generator only reads
`static-src/`, so the two copies are kept byte-identical by hand:
`TestTrackerRowSharedAssetCompat` fails when they drift or when
`index.html` stops carrying them verbatim, and
`TestTrackerRowSharedAssetRendersSpokeFixtures` renders the same fixtures
through both. Edit both copies in the same PR.

## Working with it

```sh
Expand Down
10 changes: 7 additions & 3 deletions src/pkg/dashboard/integration_execution_ui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ assert.ok(!stageTrackerExecutionHtml(item).includes('<script>'));
if output, err := command.CombinedOutput(); err != nil {
t.Fatalf("execution caption regression: %v\n%s", err, output)
}
layout, err := os.ReadFile("static-src/js/tracker-row-layout.js")
if err != nil {
t.Fatal(err)
var layout []byte
for _, part := range []string{"static-src/js/tracker-row-layout.js", "static-src/js/tracker-row-render.js"} {
b, err := os.ReadFile(part)
if err != nil {
t.Fatal(err)
}
layout = append(layout, b...)
}
for _, seam := range []string{"stageTrackerExecutionHtml(pr)", "stageTrackerExecutionHtml(shown)", "stageTrackerPreparationNodeHtml", "stageTrackerPreparationCommentHtml"} {
if !strings.Contains(string(layout), seam) {
Expand Down
3 changes: 2 additions & 1 deletion src/pkg/dashboard/stage_tracker_human_attention.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ function load() {
});
for (const name of ['stageTrackerLinkedSuperseder', 'stageTrackerLinkedSupersededGone', 'stageTrackerLinkedSupersededText', 'stageTrackerLinkedSupersededTip']) vm.runInContext(fn('tracker-words-gate', name), c);
for (const name of ['stageTrackerItemKey', 'stageTrackerPRKey', 'stageTrackerRowPRKeys']) vm.runInContext(fn('tracker-merged', name), c);
for (const name of ['stageTrackerLinkedPRItem', 'stageTrackerLinkedPROpen', 'stageTrackerLinkedDrawnHere', 'stageTrackerLinkedSorted', 'stageTrackerHeadColsHtml', 'stageTrackerRowHtml', 'stageTrackerSubRowHtml']) vm.runInContext(fn('tracker-row-layout', name), c);
for (const name of ['stageTrackerLinkedPRItem', 'stageTrackerLinkedPROpen', 'stageTrackerLinkedDrawnHere', 'stageTrackerLinkedSorted', 'stageTrackerHeadColsHtml', 'stageTrackerSubRowHtml']) vm.runInContext(fn('tracker-row-layout', name), c);
vm.runInContext(fn('tracker-row-render', 'stageTrackerRowHtml'), c);
vm.runInContext(fn('tracker-filter', 'stageTrackerPRIssueSlot'), c);
vm.runInContext(source('tracker-human-attention'), c);
return c;
Expand Down
3 changes: 2 additions & 1 deletion src/pkg/dashboard/stage_tracker_preparation_visual.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ function load() {
for (const name of ['stageTrackerTrainIconHtml', 'stageTrackerTrainAccentClass', 'stageTrackerOrdinal']) vm.runInContext(fn('tracker-words-core', name), ctx);
for (const name of ['stageTrackerLinkedSuperseder', 'stageTrackerLinkedSupersededGone', 'stageTrackerLinkedSupersededText', 'stageTrackerLinkedSupersededTip']) vm.runInContext(fn('tracker-words-gate', name), ctx);
for (const name of ['stageTrackerPRKey', 'stageTrackerItemKey', 'stageTrackerRowPRKeys']) vm.runInContext(fn('tracker-merged', name), ctx);
for (const name of ['stageTrackerLinkedPRItem', 'stageTrackerLinkedPROpen', 'stageTrackerLinkedDrawnHere', 'stageTrackerLinkedSorted', 'stageTrackerAdoptOrphanPRs', 'stageTrackerHeadColsHtml', 'stageTrackerSubRowHtml', 'stageTrackerRowHtml']) vm.runInContext(fn('tracker-row-layout', name), ctx);
for (const name of ['stageTrackerLinkedPRItem', 'stageTrackerLinkedPROpen', 'stageTrackerLinkedDrawnHere', 'stageTrackerLinkedSorted', 'stageTrackerAdoptOrphanPRs', 'stageTrackerHeadColsHtml', 'stageTrackerSubRowHtml']) vm.runInContext(fn('tracker-row-layout', name), ctx);
vm.runInContext(fn('tracker-row-render', 'stageTrackerRowHtml'), ctx);
for (const name of ['stageTrackerPreparationWord', 'stageTrackerPreparationAge', 'stageTrackerPreparationChipHtml']) vm.runInContext(fn('tracker-queue', name), ctx);
for (const name of ['stageTrackerSort', 'stageTrackerPage', 'stageTrackerPRIssueSlot']) vm.runInContext(fn('tracker-filter', name), ctx);
ctx.stageTrackerChipsHtml = item => ctx.stageTrackerPreparationChipHtml(item);
Expand Down
49 changes: 49 additions & 0 deletions src/pkg/dashboard/static-src/js/tracker-row-anchor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Which strip segment a stage lights: main stages light themselves,
// 040 shares the PR in progress column with 030, 060 shares CI / Review
// with 050, 095 and 100 share the Merge gate column with 080, detours
// light the segment they branch from (stageTrackerColumn in Go).
// kind is 'issue' or 'pr': an issue parked on a person (045, or a
// pre-045 085) is parked before any PR exists, so it lights Actionable
// rather than the merge gate. item (optional) is the row: once a merge
// call has been made on its head (merge_gate.state merging /
// merge-failed) the outcome is a Merge gate matter whatever numeric
// stage the lane fell back to — hivecommons/docs#512 drew "Merge
// failed" in CI / Review because the PR sat at 060.
//
// The column follows the CURRENT state, never the highest stage the
// row once reached: a PR under repair (stageTrackerUnderRepair) lights
// CI / Review even when a stale merge_gate ("merge-failed" from the
// attempt that found the conflict) or a planner-ordered merge_train
// still rides on the record — hive's own #15574 read "Fixing" under
// Merge queue after "fell back to Fixing — conflicting".
function stageTrackerAnchor(stage, stages, kind, item) {
const cur = Number(stage) || 0;
if (cur >= STAGE_TRACKER_TERMINAL) return STAGE_TRACKER_TERMINAL;
// Under repair past 030 → CI / Review, before any gate or train
// promotion. The one park the predicate also names, 085 needs
// decision, stays at the gate: the person decides there.
const repairing = typeof stageTrackerUnderRepair === 'function' && !!stageTrackerUnderRepair(cur, item && item.reason);
if (repairing && cur > STAGE_TRACKER_PR_COLUMN && cur !== STAGE_TRACKER_NEEDS_DECISION) return 50;
const mg = item && item.merge_gate;
const refusal = mg && mg.state === 'merge-failed'
? mg.merge_failed_kind || (typeof stageTrackerMergeRefusalFromRaw === 'function' ? stageTrackerMergeRefusalFromRaw(String(mg.merge_failed || '')).kind : '') : '';
if ((cur === 50 || cur === 60) && refusal === 'checks-pending') return 50;
if (mg && (mg.state === 'merging' || mg.state === 'merge-failed') && cur > STAGE_TRACKER_PR_COLUMN) return STAGE_TRACKER_MERGE_COLUMN;
// A merge-train member is a Merge queue matter too, 1st included:
// the train's facts are mirrored onto its head while the head still
// sits at 050/070, and hive's own #15400 ("1st") lit CI / Review
// next to its 2nd-place sibling in Merge queue (hivecommons/hive#15395).
if (item && item.merge_train && item.merge_train.state && cur > STAGE_TRACKER_PR_COLUMN) return STAGE_TRACKER_MERGE_COLUMN;
if (cur === STAGE_TRACKER_ISSUE_NEEDS_DECISION || cur === STAGE_TRACKER_TRIAGE_NEEDED || cur === STAGE_TRACKER_POSSIBLY_EXISTS) return STAGE_TRACKER_ISSUE_DECISION_COLUMN;
if (cur === STAGE_TRACKER_NEEDS_DECISION && kind === 'issue') return STAGE_TRACKER_ISSUE_DECISION_COLUMN;
if (STAGE_TRACKER_PATH.indexOf(cur) >= 0) return cur;
if (cur === 40) return STAGE_TRACKER_PR_COLUMN;
// 060 reviewed is pre-admission (approved, CI pending or red; it can
// regress to 070): it lights CI / Review (50), never the merge gate.
if (cur === 60) return 50;
if (cur === STAGE_TRACKER_PRE_MERGE_SOAK || cur === 100) return STAGE_TRACKER_MERGE_COLUMN;
const st = (stages || []).find(x => Number(x.number) === cur) || {};
let from = Number(st.branch_from) || 0;
if (from === 60) from = 50;
return STAGE_TRACKER_PATH.indexOf(from) >= 0 ? from : 0;
}
Loading
Loading