test: run the real code instead of hand-copied mirrors (sable-1drb) - #225
Closed
Rome-1 wants to merge 1 commit into
Closed
Conversation
The action's threshold-eval and PR-comment-tip tests each carried their own transcription of the bash they tested, so they could pass in full while action.yml was broken. The logic now lives once in github-action/lib/severity.sh, sourced by both action.yml steps and by both tests. Behaviour unchanged. A new end-to-end job runs the real action with findings above the threshold and asserts status=completed AND outcome=failure, which proves the counts reach the gate; drift check 17 asserts action.yml sources the library in both steps and carries no inline copy, so the tests cannot be silently detached again. node/tests/issues.test.ts mirrored four modules (dedup, issue-builder, from-text, from-scan) and tested the mirrors; one had already drifted. The copies are removed and every describe imports the shipped function. Three source functions gained `export` for that. Every guard was mutated by hand: each mutation fails named tests that were untouched by the same mutation before this change.
This was referenced Sep 2, 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.
Summary
Stacked on #224 (base branch is
fix/sable-fgk7-unreadable-report-is-not-clean; retarget tomainonce that merges).Two test suites passed by testing a transcription of the code rather than the code. Both now run the real thing.
GitHub Action bash (sable-1drb).
test-threshold-eval.shandtest-pr-comment-tip.sheach carried their own copy of the severitycasestatement and the report-only tip block, hand-copied fromaction.ymlwith a header admitting it must be kept in sync by hand. 39 assertions that could pass in full whileaction.ymlwas broken, and would keep passing after anyone edited it. The logic now lives once ingithub-action/lib/severity.sh(rafter_threshold_fails,rafter_report_only_tip), sourced by bothaction.ymlsteps via${{ github.action_path }}and by both tests. Behaviour is unchanged; the same 31 + 10 cases pass, plus two new ones pinning the::warning::on an unknown threshold and the tip namingseverity-threshold: high.Node
issues.test.ts(specimen 11 of sable-d2x2, found while fixing #224). The file mirrored four modules (dedup,issue-builder,from-text,from-scan) and tested the mirrors; one had already drifted (the copieddraftsFromLocalScanparsed a bare array only, while the real one has accepted{results:[...]}since 0.7.8). The 172 lines of copies are gone; everydescribenow imports the shipped function. Three source functions gainedexportfor that (severityLabel,parseNaturalText,draftsFromLocalScan); no behaviour change.Coverage that proves the wiring, not just the logic
test-threshold-gate-end-to-end: the real action against the mock with 1 critical, 1 high, 1 low andseverity-threshold: high. Assertsstatus=completedandoutcome=failureandfindings-count=3— the gate's signature: the report was read and counted, then the threshold rejected it. A unit test on the library cannot proveaction.ymlcalls it; this does.lib/severity.sh; new check 17 assertsaction.ymlsources the library in both steps, calls both functions, and carries no inlinecasebranch, so a "simplification" that pastes the case statement back into the YAML cannot land green and silently detach the tests again.Mutation-verified by hand (sable-d2x2 rule A, failing test names in the log):
high)made to ignore high → 2 threshold cases fail.none)set to fail → drift check 4 fails and 6 threshold cases fail. Tip gate dropped → 3 tip cases and drift check 3 fail.action.yml: onesourceline removed → check 17 fails. An inlinecritical)branch added → check 17 fails.severityLabelmappingerror→high→ 5 tests fail.draftsFromLocalScanreturning[]→ 6 tests fail. Before this PR, both mutations passed the suite untouched, because the suite never called them.Local: drift detector 0 failures; both YAML files parse;
tsc --noEmitclean;issues.test.ts109 pass;bash -esanity thatrafter_report_only_tipwith no findings does not triperrexitinside the comment builder.