[quality] test: cover validate-architecture-assets.mjs --fix write mode (tests/helpers.mjs args/readBack + tests/validate-architecture-assets.test.mjs) - #231
Open
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
The --fix branch of scripts/validate-architecture-assets.mjs — the only path in the repository that rewrites checked-in assets in place — was exercised by no test, because tests/helpers.mjs runScriptWithFixtures() could neither pass argv nor read a fixture back after the sandbox was torn down. Give the helper an optional third argument (args, readBack), backwards compatible with every existing caller, and add 11 --fix cases: repairs that land (DOCTYPE strip, viewBox synthesis, mxfile strip), findings --fix must not suppress (missing xmlns, embedded raster data, unresolvable dimensions), multi-repair and multi-file runs, and non-SVG assets left alone. 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 17, 2026
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
scripts/validate-architecture-assets.mjshas two modes. Read-only validation wasalready covered by
tests/validate-architecture-assets.test.mjs. The--fixwritemode — the only path in this repository that rewrites checked-in assets in place —
was exercised by no test at all. This PR covers it.
Files claimed by this PR (test-only; no production file is touched):
tests/helpers.mjs—runScriptWithFixtures(script, fixtures, options)gains anoptional third argument:
options.args(extra argv, e.g.['--fix']) andoptions.readBack(repo-relative paths whose contents are captured after the runand returned as
result.files, withnullfor a path the script never wrote).Read-back is necessary because the sandbox is deleted before the helper returns,
so write-mode behaviour was previously unobservable. The change is additive and
backwards compatible: every existing caller passes two arguments and is unchanged.
tests/validate-architecture-assets.test.mjs— 11 new--fixtests, appendedbelow the existing ten. They split into three groups:
viewBoxsynthesized from
width/heightincluding fractional and unit-suffixed values(
640.5px), draw.iomxfilemetadata stripped so the warning disappears,multiple repairs in one file reported as
Fixed 2 issue(s), and repairs writtento every asset in a walked directory tree.
--fixmust not suppress: missingxmlns, embedded raster data,and a missing
viewBoxwith no resolvable dimensions each still exit 1 andleave the file byte-identical.
rewritten.
Verification
node --test: 66 tests pass, 0 fail (55 before).npx prettier --checkisclean on both files. Local clone of
cncf/endusersat parent revision00b44dfafter
npm ci, 2026-09-17.Note on the coverage percentage
--experimental-test-coveragestill reportsvalidate-architecture-assets.mjsat57.43% line after this PR, unchanged. That is the fixture-sandbox attribution gap
being addressed in #225 — the profile only counts the in-process smoke run against
real repo data, not the subprocess runs where the behaviour is actually exercised.
The gap this PR closes is behavioural and verifiable by inspection: before it, no
test anywhere in
tests/passed--fixto this script; now eleven do.Coverage evidence
node --test --experimental-test-coverage, revision00b44df,2026-09-17, as above.
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.
Left open deliberately
The
--fixrun printsNo fixes were needed.immediately afterFixed N issue(s):lists the repairs it just made, because
issuesis empty once a finding isrepaired. These tests assert the
Fixed N issue(s)output and deliberately do notcement the contradictory line. Correcting it is a production change, out of scope
for the quality agent; it is written up in #230 so it is not lost.
Related Issue
Refs #230
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5