Repository navigation
π fix(hotspot): stop proposing source splits for generated files whose source is already split - #15471
Conversation
|
[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 |
Generated by changelog-fragment-guard from the PR title (#5675). Edit the wording freely, or replace this file with the no-changelog label if the change is not user-visible. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
stage 080-awaiting-merge-admission β 050-review-pending: required-check-pending:Sign-off survives the squash |
β¦ate changelog fragment Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
hive/awaiting-ci: CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
The fix itself is right, but the PR is red on its own test and on the changelog guard. Two concrete things:
-
The new test cannot pass as written.
Body()writes## Split proposalfor every recommendation exceptsplit-source(src/pkg/hotspot/issue.go:77,if h.Recommendation != RecommendSplitSource), so the report-only hotspot inTestGeneratedWithSplitSourceIsReportOnlystill gets the section andhotspot_test.go:466-469fails β that is thetest (rest 2/4)failure (hotspot_test.go:469: body has split proposal). Production is unaffected:Actionable()(hotspot.go:365) is false for report-only, so no issue is ever rendered for it. Either drop theBodyassertion or gate that section onh.Actionable(); the recommendation/reason assertions already cover the behaviour change. -
Changelog fragment shape.
changelog.d/fixed-hotspot-generated-source-already-split.mdstarts with prose, not-, sochangelog-fragment-guardfails (a fragment must start with a '- ' entry bullet). The guard's autofix then pushedchangelog.d/fixed-15471.md, so the PR now carries two fragments for one change. Keep one β prefix the descriptive one with-and deletefixed-15471.md, or the reverse.
Verified the rest against the tree: MaxUnits is defaulted to 4 at hotspot.go:154 before recommend runs, CheckoutRootFor returns "" when checkouts_dir is unset so the count stays 0 (unknown) and behaviour is unchanged for hives without a checkout, and WalkDir on a missing dir leaves the count at 0.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
The recommendation change itself is sound β withDefaults() runs before recommend (hotspot.go:177), so opts.MaxUnits is 4 not 0 when h.sourceFiles > opts.MaxUnits is evaluated at hotspot.go:316, and report-only hotspots never reach the filer (Actionable(), hotspot.go:352). Two things block it as pushed, both reproduced locally on 42e3f43:
-
The new test fails β
TestGeneratedWithSplitSourceIsReportOnly,hotspot_test.go:469"body has split proposal" (CItest (rest 2/4)).Body()writes## Split proposalfor every recommendation exceptRecommendSplitSource(src/pkg/hotspot/issue.go:77, pre-existing), so a report-only body always contains it. Since report-only hotspots are not filed, the assertion is testing a body nobody emits; either drop that assertion or tightenissue.go:77toSplitCode || SplitDocβ but one of the two has to change for the suite to go green. -
changelog-fragment-guardfails βsrc/scripts/check-changelog-fragment.sh v5on the head reportschangelog.d/fixed-hotspot-generated-source-already-split.md: "a fragment must start with a '- ' entry bullet". The autofix also added a second fragment,changelog.d/fixed-15471.md, so the PR currently ships two entries for one change; keeping the hand-written one (prefixed with-) and droppingfixed-15471.mdis the clean fix.
The hotspotSourceFileCount walker (hotspot_advisor.go:157) is fine: a missing root makes WalkDir call back once with err != nil and d == nil, which the err == nil && short-circuit handles.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Reviewed (docs-currency) β no blocking findings.
Advisory (non-blocking): src/pkg/hotspot/hotspot.go:69 still documents RecommendReportOnly as "lock/data files, or docs below the size bar"; after this PR it also covers generated files whose source tree already exceeds MaxUnits (hotspot.go:316-317). Worth a one-line godoc update since the operator-reference (src/docs/operator-reference.md:1354) was correctly updated for the same case.
β hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88
β¦eckout exists Review follow-ups for #15471: - hotspotSourceFileCount falls back to the git-trees API (HEAD:<dir>, recursive) and then the contents directory listing when project.checkouts_dir names no checkout, mirroring hotspotSourceReader; results are cached per pass. Without this the deployment that filed #15460 (which reads sources via GitHub) kept yielding 0 and the split-source issue would be re-filed after hotspot_refile_days. - Export Hotspot.SourceFiles (json "source_files,omitempty") like the other analysis attributes; documented in api-reference/dashboard-misc.md. - RecommendReportOnly godoc lists the generated-file case. - Drop the unreachable RecommendReportOnly branch in Body(): File() gates on Actionable() before Body is called. The test now asserts the gate. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
stage 080-awaiting-merge-admission: no activity for 30m0s: merge-train:queued-behind#15405:2/3:0/0:operator-reference.md |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #15460
Why
The issue asks to split
src/pkg/dashboard/static-src/β it is already 120 files, andstatic/index.htmlis the single generated output. Regeneration touches the output in every PR that edits any source file, so it will always look hot however the source is split. The evidence showedlines 0andconflicts attributed 0.The defect is in the advisor: it recommended
split-sourcefor any generated file with a known source tree.Fix
hotspot.Options.SourceFileCount(optional hook, populated incmd/hivefrom the local checkout) reports the source tree's file count.MaxUnitsfiles, the advisor now recommendsreport-only("already split into N files β¦ nothing to split"), so no issue is filed.Not run locally; CI is the verdict.
β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88