Skip to content

test(action): pin the summary step's drift-score, risk-level and score-delta outputs - #704

Merged
vibgrate-team merged 1 commit into
vibgrate:mainfrom
noahkhomer18:test/413-action-summary-outputs
Nov 26, 2026
Merged

vibgrate-team merged 1 commit into
vibgrate:mainfrom
noahkhomer18:test/413-action-summary-outputs

Conversation

@noahkhomer18

Copy link
Copy Markdown
Contributor

Pull Request

Summary

Adds test/action-summary-outputs.test.ts, which pins the GitHub Action's summary step: a measured DriftScore of 0 stays 0, an unmeasured one stays empty, and the two ::notice:: branches behave as docs/ci/github-actions.md describes.

It follows test/action-max-score.test.ts: it pulls the run: script of the step with id: summary out of action.yml, writes a summary JSON by hand, and runs the script with bash against a temp GITHUB_OUTPUT and GITHUB_STEP_SUMMARY. PATH is set for every run, either a directory holding only a jq symlink 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 test passes: 596 files, 5930 tests (the 9 new ones plus 5921 on main).
  • pnpm lint is 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 typecheck is clean.
  • Docs updated (README / DOCS / ARCHITECTURE) where behavior changed: no behaviour change, and no case disagreed with docs/ci/github-actions.md, so neither the script nor the docs needed changing.
  • Determinism preserved: test-only change.
  • No proprietary or internal references.
  • Commits use Conventional Commits and are signed off.

What the tests cover

Case Expected
driftScore: 0, delta: 0 drift-score=0, score-delta=0, and the job summary line DriftScore 0/100 (low), 0 since baseline
driftScore: null, riskLevel: null, delta: null all three outputs empty, summary-file set, no job summary line
riskLevel low / moderate / high passed through as written
delta: 5 / delta: -5 5 / -5
summary file missing ::notice::the scan did not write ..., no outputs at all
jq not on PATH ::notice::jq is not on this runner ..., summary-file still set, no score outputs

The jq cases sit in a describe.skipIf that only skips when jq can'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.yml on its own, the new test file was run, and action.yml was restored afterwards.

Change to the summary step Tests that fail
.driftScore // empty to .driftScore // 0 null values stay empty
.driftScore // empty to .driftScore (prints null) null values stay empty
.driftScore with select(. != 0) (drops a measured 0) measured 0, null values
.delta // empty to .delta // 0 null values stay empty
.delta with select(. != 0) measured 0, null values
risk-level= written without ${risk} measured 0, all three risk levels
no-jq branch skips summary-file= no-jq case
no-jq message without ::notice:: no-jq case
missing-file guard removed missing-file case
job summary line drops the delta measured 0

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.ts failed 5 of 5 whenever a built dist/ was present in the checkout (it reports "no map found") and passed 5 of 5 with dist/ removed, on main as well as on this branch. CI builds into a clean checkout, so it may never show there, but it can catch anyone who runs pnpm build before pnpm test locally. Happy to open an issue for it if that's useful.

…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>
@vibgrate-team
vibgrate-team merged commit 8d972fc into vibgrate:main Nov 26, 2026
1 check passed
@vibgrate-team

Copy link
Copy Markdown
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!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test: GitHub Action summary outputs keep a measured 0 and leave unmeasured values empty

2 participants