Repository navigation
Description
Problem Description
In tests/ci/test_fail_to_pass.py, the helper _ran_on_base reads a gate row call as a base run when the name of its working folder is tree. The test test_the_command_exits_0_for_a_gate_check_that_proves_the_fix runs devops ci fail-to-pass with no root, so the command takes the worktree of the current folder as the root (find_worktree_root), and the head run of the gate row runs in that root.
The replay of devops ci fail-to-pass runs the changed test files in a base tree at <temp-dir>/tree. There, the root of the test is that folder, so the fake answers the head run with the base output. The case then fails on head too, the replay proves nothing, and the test fails on base with assert (1, True, False) == (0, True, False). A checkout whose folder has the name tree gets the same failure.
Reproduction Steps
- Change only the body of one test function of
tests/ci/test_fail_to_pass.pyon a fix branch. - Run
uv run devops ci fail-to-pass --base origin/main. - The replay shows
failed on base: tests.ci.test_fail_to_pass::test_the_command_exits_0_for_a_gate_check_that_proves_the_fix (assert (1, True, False) == (0, True, False)). The fix does not change that test, so the replay refuses the fix.
Expected vs Actual Behavior
Expected: the test passes on the base tree of a replay, and in a checkout of any folder name.
Actual: the test fails when the root of the command has the folder name tree.
Environment Diagnostics
- DevOps CLI Version: 0.126.0
- Execution Environment: devcontainer, a worktree of devops-cli at a fix branch
Logs, Traces, or Terminal Output
failed on base: tests.ci.test_fail_to_pass::test_the_command_exits_0_for_a_gate_check_that_proves_the_fix (assert (1, True, False) == (0, True, False))Proposed Fix
Make the fake know the base tree from the git worktree add call that it answers, not from the folder name, or run the command of the test in a root under tmp_path.
The replay of the fix of #5353 showed this failure.
Alternatives check of 2026-11-17: none.
Tool: none found.
Proposed design
Problem statement
Fix the gate-row fake to use the worktree path recorded by git worktree add, not the folder name tree. The helper _ran_on_base in tests/ci/test_fail_to_pass.py treats any working folder named tree as the base replay tree. A head gate run whose checkout root is named tree then gets the base answer, so the replay proves nothing and test_the_command_exits_0_for_a_gate_check_that_proves_the_fix fails on base.
Acceptance criteria
Requirement: Recorded base worktree
The gate-row fake SHALL identify a base run by the worktree path that git worktree add recorded, not by the working folder name.
Scenario: Recorded base worktree
- WHEN A gate row runs in the worktree that _handle_worktree_add recorded.
- THEN The unit test asserts that _gate_row_answer returns gate_base.
Requirement: Unrecorded folder named tree
The gate-row fake MUST NOT treat a working folder named tree as a base worktree when no git worktree add recorded that path.
Scenario: Unrecorded folder named tree
- WHEN A gate row runs in a folder whose last path component is tree, and _handle_worktree_add recorded no such path.
- THEN The unit test asserts that _gate_row_answer returns gate_head.
Requirement: Gate check test in tree checkout
The test test_the_command_exits_0_for_a_gate_check_that_proves_the_fix SHALL pass when the checkout root folder is named tree.
Scenario: Checkout root named tree
- WHEN The regression test sets the command root to a folder named tree that is not a recorded base worktree.
- THEN The test asserts that the command exits 0 and gate_head is the answer for the gate row.
Existing Tool Considered
The alternatives check of 2026-11-17 records verdict none and no tool (see the alternatives block in the issue body). No open maintained tool or library covers the need. The change edits the existing test helper _ran_on_base and adds no library. The change builds no new tool; it edits existing test code.
Key questions
- How does the command choose its root when the test passes no root?: It uses find_worktree_root on the current folder. [sources: src/devops_cli/core/repo.py:256, tests/ci/test_fail_to_pass.py:1369]
- How should _ran_on_base tell a base gate run from a head gate run?: Use the worktree paths recorded by _handle_worktree_add in replay_state.active_worktrees. Test whether the call's working folder is that path or inside it. (best practice) [sources: tests/ci/test_fail_to_pass.py:268, tests/ci/test_fail_to_pass.py:1369]
- Chosen: Recorded worktree path. The fake already records each git worktree add destination in active_worktrees and removes it on git worktree remove; this uses the actual add call.
- Rejected: Folder name tree. This is the defect: a checkout root named tree gets the base answer for a head run.
- Rejected: Run the test in a root under tmp_path. This hides the defect in one test and leaves the folder-name assumption for other callers.
- Should a folder inside the recorded base worktree count as a base run?: Yes. Use Path(call.cwd).resolve().is_relative_to(worktree) for each recorded worktree, so a gate row in a subfolder of the base tree gets gate_base. (best practice) [sources: tests/ci/test_fail_to_pass.py:268]
- Chosen: Path or descendant of recorded worktree. The helper documents the replay tree, and a subfolder is still inside that tree.
- Rejected: Exact path equality only. It fails if the gate row runs from a subfolder of the recorded base tree.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 13, 2026
Both target the fail-to-pass gate replay, but #5353 fixes head-source import while this fixes the test helper that reads runs by folder name.devops-cli-service commentedon Nov 17, 2026
Alternatives check: none
Reason: Searches for a pytest fixture or library that fakes a
git worktree addcall, keys a fake subprocess answer by command rather than by path, or locates a worktree root returned only unrelated general pages, not a maintained tool that covers the need. The defect is in the repository's own test helper_ran_on_base, which infers the base tree from the folder nametree; only a change to that helper (reading the base tree from thegit worktree addcall it answers, or running the command in a root undertmp_path) fixes it, so no open tool or library covers the need.Tool: none found
Lacks:
git worktree addcall it answers instead of from the folder nametreetmp_pathso the head run cannot land in the base tree_ran_on_base/ test setup, not in a third-party packageSearches run:
Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Status set to Ready at 666a03f (see proposed design in issue body).
devops-cli-service commentedon Nov 18, 2026
Released in v0.177.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.177.1
devops-cli-service commentedon Nov 18, 2026
Live since 2026-11-18 17:16 UTC