Skip to content

🌱 dashboard: generate index.html from per-area sources - #15300

Merged
clubanderson merged 2 commits into
v5from
decompose/dashboard-index
Oct 29, 2026
Merged

clubanderson merged 2 commits into
v5from
decompose/dashboard-index

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Part 1 of #15299.

src/pkg/dashboard/static/index.html becomes a generated artifact; its sources live in src/pkg/dashboard/static-src/ (one file per dashboard area) and are concatenated verbatim per manifest.txt.

Byte-identical. The committed index.html is unchanged in this PR: go generate reproduces it exactly, so //go:embed static, the gzip-once path, the CSP style-sheet hashes, the node harnesses and every test that reads index.html are 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:generate directive) and webstatic/gen/concat.go (-src/-out/-check).
  • Tests: 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 "edit static-src/**, run make dashboard-gen, commit both", and the conflict recipe (take base's index.html, re-split the delta into the right part, regenerate, confirm identical). No .gitattributes merge driver: merge=union would interleave unrelated hunks and the guard test would reject the result anyway. Linked from dashboard.md and documentation-map.md.

Deviation from the brief: sources are in the sibling static-src/, not static/src/, because //go:embed static embeds everything under static/ 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.

@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 nicholasjackson 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
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

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
#15282 📖 docs: make Hive guides easier to follow same files src/docs/documentation-map.md

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@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.

@hivecommons-hive hivecommons-hive Bot added author/human A person pushed this PR themselves dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026

@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 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor
6083a87

ℹ️ Sentinel notice — informational; author is trusted (owner), merge is not blocked

Hive flagged this PR (author @clubanderson, head 6083a87056d8) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 1 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • Makefile

Hive did not add the sentinel-alert label because this author is trusted. The finding remains recorded for audit and the dashboard Security tab; set sentinel.trusted_authors_block: true to require the blocking label for trusted authors too.

@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.

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:

  • ConcatIndex writes each part verbatim with no separator (TestConcatIndexIsByteExact pins the no-trailing-newline case), so the split points carry no formatting risk.
  • ParseIndexManifest rejects absolute, unclean and .. paths, so the manifest cannot reach outside static-src/.
  • TestIndexManifestEveryFileListedAndUsed catches 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 under static/, 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

@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026
@clubanderson
clubanderson force-pushed the decompose/dashboard-index branch from 6083a87 to aad0282 Compare October 29, 2026 05:02
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 060-reviewed → 050-review-pending: required-check-pending:Sign-off survives the squash

@clubanderson
clubanderson force-pushed the decompose/dashboard-index branch 2 times, most recently from df88096 to cb5a4d5 Compare October 29, 2026 05:29
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • test (dashboard 1/4)
  • test (dashboard 3/4)
  • test (dashboard 4/4)
  • test (dashboard shuffle 3/3)

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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 071-needs-author: required-check-failing:build-and-test

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Shared CI baseline incident — not caused by this PR. The failing pkg/dashboard shards (and the downstream test, coverage, build-and-test, golangci-lint checks) are red on v5 HEAD itself:

pkg/dashboard/stage_tracker_linked_progress_test.go:95:31: not enough arguments in call to stageTrackerResolveLinkedPRs

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: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— 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>
@clubanderson
clubanderson force-pushed the decompose/dashboard-index branch from cb5a4d5 to 985ed0a Compare October 29, 2026 05:47
@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:Sign-off survives the squash

@clubanderson
clubanderson merged commit 467ca6a into v5 Oct 29, 2026
75 of 76 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the decompose/dashboard-index branch October 29, 2026 06:04
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/human A person pushed this PR themselves dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. stage/050-review-pending Review swarm requested; awaiting a verdict for the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant