Repository navigation
test(#1778): add offline tests for pre-fix and pre-retro - #1781
Conversation
pre-fix.src.sh and pre-retro.src.sh were the only pre-scripts without offline tests. Add scripts/pre-fix-test.sh and scripts/pre-retro-test.sh in the style of the other pre-*-test.sh files (mock bin on PATH, clean env, assert exit code, output and forge calls) and wire both into the script-test target. pre-fix-test covers each validation failure (forge, PR_NUMBER, REPO_FULL_NAME, dot segments, TRIGGER_SOURCE, instruction length, GitLab PR_URL host/format/repo/number), bot and human iteration caps, the fullsend-fix-budget/N label gate (lower, block, human bypass, read failure), base-branch and merge-state read fallbacks, and the conflict path: fetch of the PR base, push-remote setup and origin restore, token redaction on fetch failure, abort on restore failure, and missing repo. A git mock simulates fetch and delegates everything else to real git. GITHUB_PATH is asserted; pre-fix writes no GITHUB_OUTPUT. pre-retro-test covers GitHub and GitLab originating-URL validation, CI_SERVER_HOST checks, missing/invalid env, the on-demand and automatic messages, and asserts no forge calls are made. Both suites pass with SCRIPT_TEST_TARGET=source and bundled. make cannot spawn a shell in the sandbox, so script-test commands were run directly; other suites fail here only for environment reasons (no yq, sandbox git identity). make lint (skillsaw) could not run (no uvx); no skills or agent docs changed. pre-commit could not fetch hook repos; shellcheck 0.10.0 and pre-commit-hooks 6.0.0 hooks were run directly and passed. Closes #1778 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/fs-fix-stop |
|
Fix agent disabled for this PR. Remove the |
|
🤖 Review · Commit: Automated review did not complete for this commit. Check the latest review status before merging. If no review is queued or running, comment |
|
🤖 Finished Review · Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.55 This review was superseded by a newer commit. Check the current pull request HEAD's review status before merging. |
The gh mock returned post-jq values, so the library's --jq filters never ran: a broken labels filter would have disabled the fullsend-fix-budget gate with every test still green. The mock now builds the JSON gh returns and applies the caller's filter. Two cases cover the push-remote setup before the conflict fetch: the token is masked when GITHUB_ACTIONS=true, and a failed credentialed set-url warns, still fetches and leaves origin unchanged. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 7:28 PM UTC · Completed 7:47 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.20 |
|
<!-- fullsend:risk-assessment --> DetailsAdditive test-only change by a bot matching issue scope with high test file ratio and low rollback risk, offsetting elevated churn on the touched Makefile and protected script path additions to yield a moderate risk score. |
ReviewFindingsMedium
|
waynesun09
left a comment
There was a problem hiding this comment.
Approving at 73ed6c3: offline tests for pre-fix (51 cases) and pre-retro (21) running in source and bundled script-test; the gh mock now applies the caller's jq filter and the push-remote setup is covered. Protected path (scripts/) acknowledged as human-approved here.
Summary
Adds offline tests for the last two pre-scripts that had none, and wires them into
make script-test:scripts/pre-fix-test.sh: testspre-fix.src.shwith mockgh,curlandgiton PATH.scripts/pre-retro-test.sh: testspre-retro.src.shwith mockghandcurl.Makefile: adds both toscript-test, next to theirpost-*counterparts.pre-scribe-test.shwas already wired in and is unchanged.Coverage
pre-fix (49 cases)
PR_NUMBER, badREPO_FULL_NAME,./..segments, emptyTRIGGER_SOURCE, multiple errors counted,HUMAN_INSTRUCTIONlength cap (human only).PR_URLchecks: missing, untrusted host, malformed, repo mismatch, number mismatch.fullsend-fix-budget/Nlabel gate: lowers the bot cap, blocks a bot run over budget, skipped for human runs, never raises the cap, and falls back to the bot cap when the live label read fails.TARGET_BRANCH/mainon API failure; an unknown or empty merge state is not treated as a conflict; strategy warning and normalization.gh pr view ... --json labels|baseRefName|mergeable, GitLab MR endpoint) are asserted, as is the absence of calls on validation failures.GITHUB_PATHwrites are asserted;pre-fixwrites nothing toGITHUB_OUTPUT.The
gitmock simulatesfetchand passes every other call to the realgit, so the conflict path runs fully offline.pre-retro (21 cases): GitHub and GitLab originating-URL validation,
CI_SERVER_HOSTfail-closed and host checks, missing or invalid env, workflow-command sanitization, and the on-demand vs. automatic messages. Every case also asserts that no forge calls are made.Testing
SCRIPT_TEST_TARGET=sourceandSCRIPT_TEST_TARGET=bundled.pre-fix.src.shmakes the matching cases fail.makecannot spawn a shell in the agent sandbox, so thescript-testcommands were run one by one. Other existing suites fail there only for environment reasons (noyq, sandbox git identity); they are not touched by this PR. CI'smake script-testis the authoritative check.pre-commitcould not fetch its hook repos in the sandbox. shellcheck 0.10.0 (repo args) and the pre-commit-hooks 6.0.0 checks were run directly and passed.make lint(skillsaw) could not run (nouvx); no skills or agent docs changed.🤖 Generated with Claude Code
Closes #1778
Post-script verification
agent/1778-pre-fix-retro-tests)372c909351b43d71d23e7d95978ebe607a3ddcfa..HEAD)