Repository navigation
test(#1232): exec-path tests run in a temp git repo, never the developer's checkout - #1241
Merged
Merged
Conversation
…per's checkout phase-executor.model-ladder/model-roles/phase-agent tests called executePhaseWithRetry with no worktreePath, so the exec change guard ran against process.cwd() and the #1032 rescue auto-committed a dirty checkout as a wip checkpoint. They now pass a throwaway repo (HEAD one commit ahead of origin/main) and assert the dispatched cwd. Entire-Checkpoint: 8c34f86c09f8
QA follow-up: a git error after mkdtempSync leaked the dir, and afterAll's cleanup on an undefined repo masked the real error. Entire-Checkpoint: 1e9886dc23d5
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 #1232
What
Three test files drove the real
execphase with noworktreePath, soexecutePhaseran the exec change guard againstprocess.cwd(). On a dirty checkout, the #1032 rescue committed the developer's work aschore(#N): wip checkpoint ….src/lib/workflow/__fixtures__/exec-temp-repo.fixture.ts(new) creates a throwaway git repo. Its HEAD is one commit ahead ofrefs/remotes/origin/main, so the guard classifies it ascommits. That is the same success outcome CI saw before, whereorigin/mainis absent and the guard failed open. The identity is set before the first commit, for CI runners.phase-executor.model-ladder,.model-rolesand.phase-agent, every call goes through arunInExecRepowrapper that passes the temp repo asworktreePath. Each file also gains a gate test asserting that the dispatchedcwdis the temp repo.phase-agent, the AC-7 resume handle'soriginCwdis now the temp repo, because handle eligibility is keyed on cwd.Acceptance criteria
git rev-parse HEADandgit status --shortunchanged. Before this change, each of the three created a wip-checkpoint commit.git grep -l 'executePhaseWithRetry(\|executePhase(' -- '*.test.ts'returns 27 files. For each one I left an uncommitted sentinel file in the tree, ran the test file alone, and compared HEAD before and after. QA re-ran the non-live files independently and got the same result. One line per file:__tests__/integration/multi-issue-reliability.integration.test.ts: HEAD unchanged__tests__/integration/run-pipeline.integration.test.ts: HEAD unchangedsrc/commands/run.test.ts: HEAD unchangedsrc/lib/workflow/auto-wait.test.ts: HEAD unchangedsrc/lib/workflow/drivers/__tests__/driver-conformance.test.ts: HEAD unchanged; calls the driver method, not the phase-executor guardsrc/lib/workflow/drivers/aider-integration.test.ts: HEAD unchanged; calls the driver method, not the phase-executor guardsrc/lib/workflow/drivers/aider.phase-policy.test.ts: HEAD unchanged; calls the driver method, not the phase-executor guardsrc/lib/workflow/drivers/aider.test.ts: HEAD unchanged; calls the driver method, not the phase-executor guardsrc/lib/workflow/drivers/claude-code.phase-policy.test.ts: HEAD unchanged; calls the driver method, not the phase-executor guardsrc/lib/workflow/drivers/claude-code.test.ts: HEAD unchanged; calls the driver method, not the phase-executor guardsrc/lib/workflow/drivers/codex.live.integration.test.ts: not run: needs a live backend; calls the driver method, not the phase-executor guardsrc/lib/workflow/drivers/codex.test.ts: HEAD unchanged; calls the driver method, not the phase-executor guardsrc/lib/workflow/drivers/opencode.live.integration.test.ts: not run: needs a live backend; calls the driver method, not the phase-executor guardsrc/lib/workflow/drivers/opencode.test.ts: HEAD unchanged; calls the driver method, not the phase-executor guardsrc/lib/workflow/drivers/resume-semantics.test.ts: HEAD unchanged; calls the driver method, not the phase-executor guardsrc/lib/workflow/full-qa.test.ts: HEAD unchangedsrc/lib/workflow/phase-executor.codex.test.ts: HEAD unchangedsrc/lib/workflow/phase-executor.effort-escalation.test.ts: HEAD unchangedsrc/lib/workflow/phase-executor.model-ladder.test.ts: moved HEAD (wip checkpoint#971), fixed heresrc/lib/workflow/phase-executor.model-roles.test.ts: moved HEAD (wip checkpoint#975), fixed heresrc/lib/workflow/phase-executor.opencode.test.ts: HEAD unchangedsrc/lib/workflow/phase-executor.phase-agent.test.ts: moved HEAD (wip checkpoint#1150), fixed heresrc/lib/workflow/phase-executor.phase-policy.test.ts: HEAD unchangedsrc/lib/workflow/phase-executor.test.ts: HEAD unchanged; mockschild_processsrc/lib/workflow/phase-pause-handle.test.ts: HEAD unchangedsrc/lib/workflow/ready-gate.test.ts: HEAD unchangedsrc/lib/workflow/spec-retry.test.ts: HEAD unchangedVerification
QA follow-up (e7be1ee): the fixture removes its temp dir if repo setup throws, and
afterAllguards againstexecRepobeing undefined so it can't mask the setup error.phase-executor*, run-orchestrator* and batch-executor* test files: 17 files, 413 tests passed.
Mutation-verified: AC-1 —
runInExecRepopassesundefinedinstead ofexecRepo.path(model-ladder);1232 dispatches exec with the temp repo as cwdfailed; restored.Mutation-verified: AC-1 — the same mutation in model-roles;
1232 dispatches exec with the temp repo as cwdfailed; restored.Mutation-verified: AC-1 — the same mutation in phase-agent;
1232 dispatches exec with the temp repo as cwdfailed (AC-7 also failed, as expected); restored.🤖 Generated with Claude Code