test: verify local /img static asset references resolve under static/ (tests/static-assets.test.mjs) - #289
Open
kubestellar-hive[bot] wants to merge 1 commit into
Open
test: verify local /img static asset references resolve under static/ (tests/static-assets.test.mjs)#289kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
Adds tests/static-assets.test.mjs. The site references 83 distinct files under static/ from docs/, blog/, src/ and data/*.json, and nothing verified that any of them resolve. onBrokenLinks: 'throw' enforces page routes, not static assets, so a typo in an absolute /img path builds clean and ships a broken image. A case-only mismatch is worse: it resolves on a case-insensitive developer filesystem and 404s on GitHub Pages. The scan strips absolute and protocol-relative URLs first, so a remote https://.../images/foo.jpg is never mistaken for a local /images/foo.jpg. Closes #288 Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
This was referenced Sep 18, 2026
Open
[quality] docs/ and blog/ MDX component imports and CNCFProjectCard props have no unit coverage
#297
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
Adds one new test-only file,
tests/static-assets.test.mjs(6 tests). Noproduction code, no workflow, no
package.json, no lockfile, no dependency —it uses only
node:test,node:assert/strict,node:fsandnode:path.Files claimed by this PR:
tests/static-assets.test.mjs(new). Nothing else.The gap
The site references 83 distinct files under
static/fromdocs/,blog/,src/and the top-leveldata/*.jsonfiles. Nothing verified thatany of them resolve.
The largest group is the
logo="/img/cncf-projects/*.svg"props on<CNCFProjectCard>, hand-authored indocs/architectures/*.md; the componentrenders the value straight into an
<img src>.Why the existing gates do not cover it:
docusaurus.config.jssetsonBrokenLinks: 'throw', but that enforcespage routes, not static assets. A typo in an absolute
/img/...pathbuilds clean and ships a broken image.
scripts/validate-architecture-assets.mjschecksdata/architecturesassets only;
scripts/validate-awards.mjschecksdata/awards.jsonlogosonly. Neither touches
docs/,blog/,src/or the other data files.A case-only mismatch is the worst variant:
/img/Social-card.pngresolveson a case-insensitive developer filesystem and 404s on GitHub Pages, which
serves from a case-sensitive one.
existsSync()alone does not catch it, sothe test walks each path segment and compares against the real
readdirentry.What the 6 tests assert
silently making the other five tests vacuous.
static/via...CNCFProjectCardlogo=prop underdocs/resolves.Implementation note
The one non-obvious part: absolute and protocol-relative URLs are stripped
before scanning. Without that,
https://raw.githubusercontent.com/cncf/people/main/images/nate-waddington.jpgyields the token
/images/nate-waddington.jpgand is reported as a missinglocal asset. Five such false positives exist in the current tree
(
blog/authors.yml,data/community-people.json,data/community-roster.json,and two
docs/architectures/*.mdfiles); all are correctly ignored.References are then filtered to those whose first path segment is a real
top-level entry of
static/, so page routes like/awards/and/metricsare left to
onBrokenLinks.Verification
Local clone of
cncf/endusersat parent revision00b44df, node v26.8.2,after
npm ci.node --test: 61 pass, 0 fail (55 before; the 6 new tests are additive).No existing test, helper or fixture is modified.
reverted, and each turned the suite red:
a reference to a nonexistent
/img/definitely-missing.png; a case-onlymismatch
/img/Social-card.png; a traversal/img/../../package.json; atypo'd
CNCFProjectCardlogo prop; and truncating a referenced asset to zerobytes.
git statuswas clean after each revert.npx prettier --check tests/static-assets.test.mjsclean.Coverage evidence
node --test --experimental-test-coverageat00b44df, 2026-09-18.Baseline 55 tests; no test file read
static/or scanneddocs//blog//src/for asset references.
suite and publishes no coverage artifact from any suite (tracked in [quality] CI publishes no coverage evidence, so coverage findings cannot be verified #186).
No claim is made that this path lacks end-to-end coverage.
Disjointness
Checked against every open hold-gated PR. This PR claims the static asset
path existence surface in a new file no other PR touches:
tests/site-config.test.mjs) asserts branding assets named indocusaurus.config.js— this PR does not scan that file at all.data/architecturesassets viavalidate-architecture-assets.mjs;data/architectures/is excluded here.awards.jsonslug parity; [sec-check] fix: validate imported project card href by URL, not substring (scripts/import-architectures.mjs renderProjectCards + scripts/lib/project-card-links.mjs) #249/Fix CNCFProjectCard href allowlist bypass in renderProjectCards() #250 cover theCNCFProjectCardhref allowlist — this PR asserts the logo prop path only.
src/, so itis independent of that infrastructure and of [architect] refactor: split MemberDirectory into focused sub-modules #118's
MemberDirectoryrefactor.Related Issue
Closes #288
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5