Repository navigation
test(action): pin the summary step's drift-score, risk-level and score-delta outputs - #704
Merged
vibgrate-team merged 1 commit intoNov 26, 2026
Conversation
…e-delta outputs Run the Action's real summary step script from action.yml against a hand-written summary JSON, with PATH built for each run so the no-jq case does not depend on the runner. Cover a measured 0 for the score and the delta, null values staying empty, riskLevel passing through, the missing-file notice and the no-jq notice that still sets summary-file. Closes vibgrate#413 Signed-off-by: Noah Khomer <108771853+noahkhomer18@users.noreply.github.com>
Contributor
|
Thanks @noahkhomer18 — pinning the summary step's drift-score, risk-level and score-delta outputs with tests is a great safety net for the action. Really appreciate the careful contribution, and we'd love to see more from you! |
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.
Pull Request
Summary
Adds
test/action-summary-outputs.test.ts, which pins the GitHub Action'ssummarystep: a measured DriftScore of0stays0, an unmeasured one stays empty, and the two::notice::branches behave asdocs/ci/github-actions.mddescribes.It follows
test/action-max-score.test.ts: it pulls therun:script of the step withid: summaryout ofaction.yml, writes a summary JSON by hand, and runs the script with bash against a tempGITHUB_OUTPUTandGITHUB_STEP_SUMMARY.PATHis set for every run, either a directory holding only ajqsymlink or an empty one for the no-jq case, so nothing depends on what the runner has installed. No Docker, no network.Related issues
Closes #413
Checklist
pnpm testpasses: 596 files, 5930 tests (the 9 new ones plus 5921 onmain).pnpm lintis clean: 0 errors (eslint src, so the new test file is outside its scope). The 5 existing warnings are in files not touched here.pnpm typecheckis clean.docs/ci/github-actions.md, so neither the script nor the docs needed changing.What the tests cover
driftScore: 0,delta: 0drift-score=0,score-delta=0, and the job summary lineDriftScore 0/100 (low), 0 since baselinedriftScore: null,riskLevel: null,delta: nullsummary-fileset, no job summary lineriskLevellow/moderate/highdelta: 5/delta: -55/-5::notice::the scan did not write ..., no outputs at alljqnot onPATH::notice::jq is not on this runner ...,summary-filestill set, no score outputsThe jq cases sit in a
describe.skipIfthat only skips whenjqcan't be found on the machine running the suite. GitHub-hosted runners have it. The missing-file and no-jq cases always run.Do the tests catch a real regression?
Since this only adds tests, I broke the script instead: each change below was made to
action.ymlon its own, the new test file was run, andaction.ymlwas restored afterwards.summarystep.driftScore // emptyto.driftScore // 0.driftScore // emptyto.driftScore(printsnull).driftScorewithselect(. != 0)(drops a measured 0).delta // emptyto.delta // 0.deltawithselect(. != 0)risk-level=written without${risk}summary-file=::notice::Every change was caught by at least one test about behaviour, not only by the sanity check that the step exists.
Notes for reviewers
While running the full suite locally,
test/code-acp-cli.test.tsfailed 5 of 5 whenever a builtdist/was present in the checkout (it reports "no map found") and passed 5 of 5 withdist/removed, onmainas well as on this branch. CI builds into a clean checkout, so it may never show there, but it can catch anyone who runspnpm buildbeforepnpm testlocally. Happy to open an issue for it if that's useful.