Fix #73: stop regression-test.sh reporting a false green - #75
Closed
laird wants to merge 1 commit into
Closed
Conversation
The runner exited 0 with "✅ All tests passed!" after executing zero tests, and
wrote its report into a directory literally named `tests/test_*.sh`. Since the
/fix and /dev protocols treat a green regression run as licence to move on to
enhancements, the gate meant to block bad work was passing unconditionally.
Four defects, all fixed here:
1. REPORT_DIR took the FIRST `Location: ` line anywhere in CLAUDE.md — the Unit
Tests one (`tests/test_*.sh`), not the Test Reports one. `mkdir -p` then
created a glob-named directory, which afterwards matched `tests/test_*.sh`
expansions and broke callers iterating the shell suites. Now scoped by awk
to the `**Test Reports**:` block, with a guard rejecting any candidate
containing glob metacharacters or `..`.
2. UNIT_TEST_CMD was read from a `### Unit Tests Only` header present in no
CLAUDE.md in this repo, so extraction always missed and fell through to the
`npm test` default, which was then skipped. Extraction now falls back to
`### Regression Test Suite`, and CLAUDE.md gains the `### Unit Tests Only`
block the script has always documented. A self-reference guard rejects a
command naming regression-test.sh — in this repo that entry IS this script,
so adopting it would recurse without bound.
3. A run where every suite SKIPPED still printed success and exited 0. Zero
tests executed is not a pass; it now exits 1 and names the skip reasons.
4. The runner exported its own ISSUE_SOURCE bootstrap into the suite. Because
issue-config.sh treats a pre-set ISSUE_SOURCE as authoritative and skips
.autocoder.json, every test building a file-backend fixture silently talked
to GitHub and exited 3. This was invisible before — the false green hid four
genuinely failing tests. Suites now run under
`env -u ISSUE_SOURCE -u ISSUE_DIR_PATH -u ISSUE_BACKEND`.
Extraction uses awk, not a nested sed range: BSD sed (macOS) rejects
`/a/,/b/{/c/,/d/p}` outright, which aborted the entire run under `set -e`.
Adds REGRESSION_TEST_NO_ISSUES=1, a test-mode guard so the suite can exercise
the runner without touching a real tracker, plus tolerance for a tracker query
failing (no remote / no auth) rather than aborting a run whose tests passed.
Mirrors the REPORT_DIR, extraction and env-leak fixes into
.agent/scripts/regression-test.sh per the parallel-maintenance rule. That
mirror has no skip detection, so defect 3 does not apply there; its broader
staleness is tracked separately by #71.
Verification:
- tests/test_regression_test_config.sh (new): 10/10 pass
- all tests/test_*.sh: 10/10 pass
- build verification: BUILD_OK
- runner on this repo now executes the shell suites and reports the real
result; report lands in docs/test/regression-reports/; no glob directory
- patched mirror smoke-tested: env not leaked, suite ran, report path correct
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner
Author
|
Superseded by #78, which targets #78 also fixes a defect this PR did not: master's variant lacks |
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.
Closes #73
Root cause
regression-test.shexited 0 with✅ All tests passed!having executed zero tests, and wrote its report into a directory literally namedtests/test_*.sh. The /fix and /dev protocols treat a green regression run as licence to move on to enhancements — so the gate meant to block bad work was passing unconditionally.Four defects:
REPORT_DIRglob. It took the firstLocation:line anywhere inCLAUDE.md— the Unit Tests one (tests/test_*.sh), not the Test Reports one.mkdir -pthen created a glob-named directory which afterwards matchedtests/test_*.shexpansions and broke anything iterating the shell suites.UNIT_TEST_CMDwas read from### Unit Tests Only, a header present in noCLAUDE.mdin this repo, so extraction always missed and fell through to thenpm testdefault — which was then skipped.ISSUE_SOURCEbootstrap into the suite.issue-config.shtreats a pre-setISSUE_SOURCEas authoritative and skips.autocoder.json, so every test building a file-backend fixture silently talked to GitHub and exited 3.Defect 4 is the reason this matters beyond tidiness: the false green was hiding four genuinely failing tests. They only became visible once defects 1–3 were fixed.
Solution
REPORT_DIRscoped byawkto the**Test Reports**:block, plus a guard rejecting any candidate containing glob metacharacters or...### Regression Test Suite, andCLAUDE.mdgains the### Unit Tests Onlyblock the script has always documented. A self-reference guard rejects a command namingregression-test.sh— in this repo that entry is this script, so adopting it would recurse without bound.env -u ISSUE_SOURCE -u ISSUE_DIR_PATH -u ISSUE_BACKEND.Extraction uses
awk, not a nestedsedrange: BSDsed(macOS) rejects/a/,/b/{/c/,/d/p}outright, which aborted the whole run underset -e.Also adds
REGRESSION_TEST_NO_ISSUES=1, a test-mode guard letting the suite exercise the runner without touching a real tracker, and makes a failing tracker query (no remote / no auth) non-fatal rather than aborting a run whose tests already passed.Mirror
Per the parallel-maintenance rule, the
REPORT_DIR, extraction and env-leak fixes are mirrored into.agent/scripts/regression-test.sh. That mirror has no skip detection, so defect 3 does not apply there. Its broader staleness (437 diff lines vs the plugin copy) is pre-existing and tracked by #71 — deliberately not resynced here.Verification
docs/test/regression-reports/; no glob directory is created.2eeb88e).Known remaining gap (not fixed here)
The summary line still prints
PASSED (0/0 passed)— the pass/total counters don't parse this suite's output format. The exit code is now authoritative and correct, so this is cosmetic, but it is the same family of misleading-confidence bug and worth a follow-up.Push note
git pushis 403-blocked by a Zscaler proxy on this machine, so the branch was created viaPOST /git/refsand the commit via GraphQLcreateCommitOnBranch. Single-parent commit; history is faithful.🤖 Generated with Claude Code