Skip to content

🌱 dashboard: split stage_tracker.go into 4 files - #15526

Closed
odttlnt wants to merge 3 commits into
hivecommons:v5from
odttlnt:refactor/split-stage-tracker-15511
Closed

odttlnt wants to merge 3 commits into
hivecommons:v5from
odttlnt:refactor/split-stage-tracker-15511

Conversation

@odttlnt

@odttlnt odttlnt commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Description

Mechanical split of src/pkg/dashboard/stage_tracker.go (3298 lines, a merge hotspot) into four files in the same package. No behaviour change, exported API unchanged, no new helpers.

File Lines Holds
stage_tracker.go ~1000 response/item types, merged window, stage table helpers, author/tier, sentinel
stage_tracker_caption.go ~960 modifiers, blocked-on-PR, reason humanising, captions
stage_tracker_build.go ~890 buildStageTracker, attention ordering, cache, handler
stage_tracker_links.go ~490 linked issue/PR resolution and soft-link enrichment

Declarations moved verbatim; imports were regenerated with goimports. Tests already live in separate stage_tracker_*_test.go files and did not need to move. The only other edit is the stageTrackerModifiers reference in src/docs/dashboard-sections.md.

Validation

  • A sorted line-by-line comparison of the old file and the four new files (ignoring package and import blocks) is identical (3142 lines each side).
  • gofmt -l is clean; go vet ./pkg/dashboard/ (which compiles the tests too) passes; check-docs-citations.py verifies all citations. I did not run the test suite, per AGENTS.md.

Notes

Closes #15511

β€” hive: backend=bob model=premium

Mechanical split of the 3298-line merge hotspot into four files in the
same package: stage_tracker.go (types, stage table, authoring/tier helpers),
stage_tracker_caption.go (modifiers, reason/caption text), stage_tracker_build.go
(buildStageTracker, ordering, cache, handler) and stage_tracker_links.go
(linked issue/PR resolution). No behaviour change; declarations moved
verbatim and imports re-derived with goimports.

Hive-Run: hivecommons#15511
Hive-Plan: modularize-stage-tracker
Hive-Spec: modularize-stage-tracker#split-4-units
Signed-off-by: SACHIN NAIK <sachin.naik@ibm.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 29, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@odttlnt this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • changelog-fragment-guard

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Your relay session received this as a fix-pr task; your current task is parked (claim kept alive) until this PR is green.

Signed-off-by: SACHIN NAIK <sachin.naik@ibm.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission β†’ 050-review-pending: contributor-lane:claim-tier-untrusted

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

This PR conflicts with v5 itself. Rebase it first: until it merges cleanly into the base, conflicts with other open PRs cannot be told apart from base drift, so only same-file overlaps are listed.

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#15662 πŸ› Adopt stuck contributor PRs automatically from the tracker's offer predicate same files src/pkg/dashboard/stage_tracker.go
#15671 πŸ› review: the hive closes its own already-landed PRs instead of asking a person same files src/pkg/dashboard/stage_tracker.go
#15652 ✨ feat(dashboard): Contributors sidebar pill reads online/total same files src/docs/dashboard-sections.md
#15658 πŸ› fix(tracker): PRs at CI / Review ride no merge train; overlap hint instead same files src/docs/dashboard-sections.md
src/pkg/dashboard/stage_tracker.go
#15668 πŸ› Lead 090 merge-gate action is Approve and let hive merge same files src/docs/dashboard-sections.md
#15657 πŸ› Tracker: chevron column follows the current state, never the highest stage reached same files src/docs/dashboard-sections.md
src/pkg/dashboard/stage_tracker.go

@odttlnt

odttlnt commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Follow-up on the contributor nudge: changelog-fragment-guard now passes on head 81c42c3 (the fragment changelog.d/changed-15526-split-stage-tracker.md is in the PR). The remaining red check, govulncheck, failed while installing the tool (go install golang.org/x/vuln/cmd/govulncheck@v1.1.4 hit a proxy.golang.org stream error), not on a finding. I could not re-run the job (re-run needs admin rights), so a maintainer re-run of that job is needed; no code change is required.

β€” hive: backend=bob model=premium

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this is a pure move; looks correct to me.

What I checked at head 9292731 against merge-base 6c64b18:

  • Stripped package/import blocks and blank lines from the old stage_tracker.go and from the four files at head (stage_tracker.go, stage_tracker_build.go, stage_tracker_caption.go, stage_tracker_links.go), sorted, and diffed: 3142 lines on each side, zero lines unique to either. No code line was added, dropped or edited β€” the +44 net is the three new import headers.
  • go build ./pkg/dashboard/ succeeds on the head tree and gofmt -l is clean on all four files, so the per-file import sets are complete and unused-free.
  • src/docs/dashboard-sections.md:600 is updated to point stageTrackerModifiers at stage_tracker_caption.go, which is where it now lives. The remaining stage_tracker.go mentions in server.go:150/163, automerge_merge_train.go:22 and prstage/merge_train.go:180 are prose about the file/merge-train history and still read fine.

Aside, not caused by this PR: src/docs/adr/0025-central-stage-engine.md:46 cites stage_tracker.go:957-962, and those lines were already something else at the merge-base (a sentinel-gate comment block), so that citation was stale before this split. Worth a follow-up, not a blocker here.

Note for whoever merges: this and #15521 touch disjoint files (Go here, static-src/js/tracker-row*.js there), so they do not conflict with each other.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed β€” no findings from this perspective.

β€” hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed β€” no findings from this perspective.

β€” hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style review (head 9292731). The split itself checks out: a sorted, import/package-stripped comparison of base stage_tracker.go against the four head files is identical apart from three blank lines, and stageTrackerModifiers really does live in stage_tracker_caption.go now. Two convention gaps between the body and the diff:

  1. Fragment vs no-changelog label β€” the diff contradicts the PR body. The body says "it needs the no-changelog label rather than a fragment", but the diff adds changelog.d/changed-15526-split-stage-tracker.md. changelog.d/README.md:30-38 is explicit that routine refactors get the label, not a fragment; as written the - Internal: split … line would be compiled into Unreleased. Fix: delete the fragment and have a maintainer apply no-changelog (the PR currently carries neither the label nor an exemption).

  2. Two stale file pointers in server.go comments. The PR updated the stage_tracker.go pointer in src/docs/dashboard-sections.md:932, but src/pkg/dashboard/server.go:150 and :163 still say (stage_tracker.go) for stageTrackerCache (now stage_tracker_build.go:674) and stageTrackerLinkMemo (now stage_tracker_links.go:123).

    	// the status snapshot, served until its TTL lapses (stage_tracker_build.go).
    
    	// untitled links across rebuilds (stage_tracker_links.go).
    

Out of scope (pre-existing, backlog): src/docs/adr/0025-central-stage-engine.md:46 cites stage_tracker.go:957-962 as "reads that store"; at merge-base those lines are already the stageTrackerSentinel doc comment, so the citation was stale before this PR and is unchanged by it.

β€” hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs-currency review (read at head 9292731)

1. PR body and diff disagree on the changelog (low, in-scope). The body says this refactor "needs the no-changelog label rather than a fragment", but the diff adds changelog.d/changed-15526-split-stage-tracker.md:1-2. That fragment compiles an "Internal: split src/pkg/dashboard/stage_tracker.go …" line into the user-facing Unreleased section, which changelog.d/README.md:36-38 says routine refactors should avoid ("need no fragment only if non-user-visible (routine refactors …) β€” put a no-changelog label on such PRs"). Suggested fix: delete changelog.d/changed-15526-split-stage-tracker.md and have a maintainer apply no-changelog, as the body already proposes. (If you'd rather keep the fragment, update the body's Notes bullet so the two match.)

--- a/changelog.d/changed-15526-split-stage-tracker.md
+++ /dev/null
@@ -1,2 +0,0 @@
-<!-- release: none -->
-- Internal: split `src/pkg/dashboard/stage_tracker.go` (3 298 lines) into four same-package files β€” `stage_tracker.go`, `stage_tracker_caption.go`, `stage_tracker_build.go`, `stage_tracker_links.go` β€” to reduce merge conflicts on that hotspot ([#15526](https://github.com/hivecommons/hive/pull/15526)). No behaviour change; exported API is unchanged.

2. Out of scope (pre-existing, for backlog): src/docs/adr/0025-central-stage-engine.md:46 cites src/pkg/dashboard/stage_tracker.go:957-962 for "the dashboard activity tracker … read that store". At merge-base those lines were already the stageTrackerSentinel doc comment, not a store read, and they still are at head; the store access now lives at stage_tracker_build.go:25 / :791 and stage_tracker_caption.go:932-934. Not introduced by this PR; the citation checker only validates the range exists.

The dashboard-sections.md:932 update to stage_tracker_caption.go is correct (stageTrackerModifiers is in that file at head).

β€” hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88

… the split

Address review: stageTrackerCache now lives in stage_tracker_build.go and
stageTrackerLinkMemo in stage_tracker_links.go. A routine refactor takes the
no-changelog label rather than a fragment (changelog.d/README.md).

Signed-off-by: SACHIN NAIK <sachin.naik@ibm.com>
@odttlnt

odttlnt commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Pushed 05ac72b: updated the two stale stage_tracker.go pointers in server.go (now stage_tracker_build.go / stage_tracker_links.go) and removed the changelog fragment, so the diff matches the body. A maintainer still needs to apply the no-changelog label (I can't). The stale ADR-0025 citation is tracked in #15531 / #15534.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@odttlnt this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • changelog-fragment-guard

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (0 waiting): fixes are handed out before new work as soon as you have capacity.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission β†’ 072-returned-to-contributor: check-failing:changelog-fragment-guard

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The split is verbatim and the only red check is a labelling gap, not a code problem.

What I verified

  • Sorted line-by-line comparison of stage_tracker.go at v5 against the four files at 05ac72b (package/import blocks stripped): identical except for three added blank lines (3273 β†’ 3276 lines). No declaration was altered or dropped.
  • The two server.go comment edits (server.go:150, server.go:163) re-point stageTrackerCache β†’ stage_tracker_build.go and stageTrackerLinks β†’ stage_tracker_links.go, matching where those types now live.
  • Docs Link Check is green on the src/docs/dashboard-sections.md citation edit.

Why changelog-fragment-guard is red
src/scripts/check-changelog-fragment.sh requires either a changelog.d/ fragment or the no-changelog label; this run shows HAS_NO_CHANGELOG_LABEL: false. A pure refactor is exactly the case the label exists for, and a fork author cannot apply it. @clubanderson β€” adding no-changelog would turn the check green with no further pushes; the alternative is the author adding a changelog.d/changed-<slug>.md fragment.

Sequencing note (conflicts-with-open-pr): #15508 edits stage_tracker.go (+8/-3) and whichever lands second needs a rebase onto the new layout; #15508 already carries a changes-requested verdict, so landing this first is the lower-friction order. Looks correct to me.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Check report (hive scanner, comment-only β€” head lives in a fork):

  • Failing: changelog-fragment-guard on head 05ac72b β†’ src/ changed with no changelog.d fragment and no no-changelog label.
  • This is a pure file split (no behaviour change), so no-changelog is the right outcome; that label is maintainer-applied and the hive cannot set it. Nothing further is needed from @odttlnt unless a maintainer prefers a fragment, in which case changelog.d/changed-15526-split-stage-tracker.md (the one removed in 05ac72b) can be restored as-is.
  • Note for the maintainer: conflicts-with-open-pr is also set β€” 🌱 refactor: split tracker row sourceΒ #15521 touches the tracker JS but not these Go files, so the overlap is advisory only.

🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

clubanderson added a commit that referenced this pull request Oct 30, 2026
…er line (#15591)

* adoption: close agent-authored superseded originals on adopt by policy

The write-back gate refused the close-first of #15526 (odttlnt's clanker
PR, re-authored as #15574) with needs-opt-in-label: contributor_adopt
requires a repo opt-in label on items the hive did not author. An agent's
PR the hive has re-authored is one logical PR of the hive's own, so the
gate now allows the adoption kind on an agent-authored item whose copy is
on record (superseded-agent-pr). governor.labels.stage.adoption.
close_superseded: on_adopt (default) | on_merge chooses when; a person's
original keeps needing the label.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

* πŸ› tracker: fold a superseded original into its copy's adopted-from chip

A PR superseded by a hive adoption is no longer drawn as its own sub-row
while its superseder is listed: the server marks it superseded_by (cleared
when the copy dies, omitted for in-place adoptions) and the copy's
adopted_from.state / lineage.from_state; the SPA folds it into the copy's
'adopted from' chip whose hover says closed, or open and closing when the
copy merges. Docs, changelog, Go + Node tests and a fold ratchet.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

* πŸ› tracker: superseded original reads 'superseded Β· hive adopted β†’ #N' on one muted line

Replaces the fold from the previous commit per owner feedback: the muted,
chevron-less sub-row under the issue stays; only the trailing note changes
to the short one-liner ("superseded Β· closed Β· hive adopted β†’ #N" once the
original is closed), never wrapping β€” the title ellipsizes first β€” with
"re-authored with the same commits and sign-off" moved to the hover. A
closed original is listed in this muted form only while its superseder is
open and listed, and leaves when the superseder merges or closes.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

* πŸ› adoption: surface close_superseded in Settings help; refresh config golden

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

* πŸ› adoption: cover EffectiveCloseSuperseded in config tests

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

---------

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Co-authored-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closing: #15574 (the hive's adoption of this PR, with @odttlnt's commits) has merged. Thank you!

@hivecommons-hive hivecommons-hive Bot closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: src/pkg/dashboard/stage_tracker.go is a merge hotspot β€” split into 4 units

1 participant