Repository navigation
🌱 dashboard: generate index.html from per-area sources - #15300
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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply. |
There was a problem hiding this comment.
Verified the central claim at f3ffcea: the committed src/pkg/dashboard/static/index.html has no diff against v5 in this PR, and the concatenation of static-src/ in manifest.txt order reproduces it byte-for-byte — both via go run ./pkg/dashboard/webstatic/gen -src pkg/dashboard/static-src -out pkg/dashboard/static/index.html -check (exit 0) and an independent cat $(manifest) | cmp from the shell. So //go:embed static, the CSP hashes and every test that reads index.html are genuinely untouched; the 61k added lines are a copy, not a change.
The guard is real: TestIndexHTMLIsGenerated (webstatic/indexgen_test.go:15-20) reads the live ../static/index.html and ../static-src rather than fixtures, and TestIndexManifestEveryFileListedAndUsed (:42-78) fails on a source file missing from the manifest, which is the one way the concat could silently drop content. ParseIndexManifest (indexgen.go:30-33) rejects absolute, unclean and .. paths. The //go:generate directive's ../static-src / ../static/index.html resolve correctly from the webstatic package dir, matching the Makefile targets. Looks correct to me.
One operational consequence worth stating, not a defect: once this lands, every open PR that edits index.html directly will fail TestIndexHTMLIsGenerated on rebase and has to re-split its hunk into the right static-src/ part (the recipe in dashboard-source-layout.md). In the current queue that is at least #15297, #15302 and #15301 (all touch static/index.html). Merging the small ones first and rebasing this on top is cheaper than the reverse — the body already shows that re-anchoring cost is low.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
f3ffcea to
6083a87
Compare
6083a87
ℹ️ Sentinel notice — informational; author is trusted (owner), merge is not blockedHive flagged this PR (author @clubanderson, head
Hive did not add the |
There was a problem hiding this comment.
Read webstatic/indexgen.go, indexgen_test.go and the Makefile targets. The byte-identical claim is not just asserted, it is enforced: static/index.html is absent from the diff, and TestIndexHTMLIsGenerated (src/pkg/dashboard/webstatic/indexgen_test.go) concatenates static-src/ per manifest.txt and fails on the first differing byte — and that test is green on this head, so //go:embed static, the gzip-once path and the CSP hashes are provably unaffected.
Other things I checked:
ConcatIndexwrites each part verbatim with no separator (TestConcatIndexIsByteExactpins the no-trailing-newline case), so the split points carry no formatting risk.ParseIndexManifestrejects absolute, unclean and..paths, so the manifest cannot reach outsidestatic-src/.TestIndexManifestEveryFileListedAndUsedcatches a new area file that is not in the manifest (which would otherwise be silently dropped from the artifact) and a manifest entry with no file.- Sources live in the sibling
static-src/, not understatic/, so they are not embedded in the binary — the deviation from the brief is the right call for the reason the body gives.
Looks correct to me. The real cost of this change is the one the body already names: every open PR touching index.html now has to re-split its delta into the right part and regenerate, and the guard test will refuse a hand-edited index.html. Worth landing early rather than late for that reason.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
6083a87 to
aad0282
Compare
|
stage 060-reviewed → 050-review-pending: required-check-pending:Sign-off survives the squash |
df88096 to
cb5a4d5
Compare
|
@clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. |
|
stage 080-awaiting-merge-admission → 071-needs-author: required-check-failing:build-and-test |
|
Shared CI baseline incident — not caused by this PR. The failing Tracked in #15322; fix in #15321. No action needed here — once #15321 lands, this PR will go green on its next run / rebase. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
static/index.html is now a generated artifact. Its sources live in static-src/ (head, css/<area>.css, glue, js/<area>.js, html/<area>.html) listed in manifest.txt and concatenated verbatim by webstatic/gen/concat.go (go generate; make dashboard-gen). The committed artifact is byte-identical to before, so //go:embed, the CSP style hashes, the node harnesses and every test reading index.html are unchanged. TestIndexHTMLIsGenerated fails when artifact and sources drift; TestIndexManifestEveryFileListedAndUsed keeps the manifest honest. Docs: src/docs/dashboard-source-layout.md (layout, area list, conflict recipe: take base's index.html, re-split delta, regenerate). Signed-off-by: Andrew Anderson <andy@clubanderson.com>
…r paths Signed-off-by: Andrew Anderson <andy@clubanderson.com>
cb5a4d5 to
985ed0a
Compare
|
stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:Sign-off survives the squash |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Part 1 of #15299.
src/pkg/dashboard/static/index.htmlbecomes a generated artifact; its sources live insrc/pkg/dashboard/static-src/(one file per dashboard area) and are concatenated verbatim permanifest.txt.Byte-identical. The committed
index.htmlis unchanged in this PR:go generatereproduces it exactly, so//go:embed static, the gzip-once path, the CSP style-sheet hashes, the node harnesses and every test that readsindex.htmlare untouched. Split points sit at blank lines / section comments at brace depth 0; function groups are intact; nothing is reformatted.What's added
static-src/:head.html,css/<area>.css(32),glue/*.html(4 wrapper-tag files so parts are pure CSS/JS),js/boot.js+js/<area>.js(70),html/<area>.html(17),manifest.txt.webstatic/indexgen.go(ParseIndexManifest,ConcatIndex,//go:generatedirective) andwebstatic/gen/concat.go(-src/-out/-check).TestIndexHTMLIsGenerated(regenerates in memory, fails on drift so people edit the parts, not the artifact),TestIndexManifestEveryFileListedAndUsed,TestConcatIndexIsByteExact.make dashboard-gen/make dashboard-gen-check.src/docs/dashboard-source-layout.md: layout, area list, the rule "editstatic-src/**, runmake dashboard-gen, commit both", and the conflict recipe (take base'sindex.html, re-split the delta into the right part, regenerate, confirm identical). No.gitattributesmerge driver:merge=unionwould interleave unrelated hunks and the guard test would reject the result anyway. Linked fromdashboard.mdanddocumentation-map.md.Deviation from the brief: sources are in the sibling
static-src/, notstatic/src/, because//go:embed staticembeds everything understatic/recursively and would compile the sources into the binary and serve them.Rebases so far: #15285, #15186 and #15290 landed while this was prepared; each delta re-anchored cleanly into its area (
css/tracker.css,js/tracker-*.js,js/config-governor.js,css/agent-state.css) with the artifact staying byte-identical.Verified:
go build ./... && go vet ./pkg/dashboard/... && go test ./pkg/dashboard/... -race,make dashboard-gen(no diff),make dashboard-gen-check,check-api-reference-citations.sh,check-docs-links.py,check-docs-citations.py.