Skip to content

fix: origin/main is fetched on pull_request runs; the #442 guard fails loudly instead of silently skipping - #445

Merged
fdaviddpt merged 1 commit into
mainfrom
fix/442
Aug 29, 2026
Merged

fdaviddpt merged 1 commit into
mainfrom
fix/442

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

What was wrong

tests/test_case_divergence_298.py::test_the_per_tool_call_path_is_not_touched -- the byte-pin guard stopping the per-tool-call hot path from growing a git spawn -- self-skipped ("origin/main not available") on every pull_request-triggered CI run. actions/checkout never makes origin/main a resolvable ref on that event, so the guard could never resolve its comparison base while a change was still reviewable. It only ran after a squash-merge landed on main via a push event -- exactly how #429's sanctioned-divergence allowance reached main and turned it red (#440) without its own pull request ever exercising the guard that would have caught it.

What changed, in the order the issue asked for

  1. .github/workflows/tests.yml: added git fetch --no-tags --depth=1 origin main:refs/remotes/origin/main right after actions/checkout, so origin/main resolves on pull_request runs too.
  2. tests/test_case_divergence_298.py: the guard's unavailable-base branch now calls a new pure helper, _origin_main_should_be_resolvable(env) (true when CI=true or GITHUB_ACTIONS=true). True -> pytest.fail with a message naming test_the_per_tool_call_path_is_not_touched silently self-skips on every pull_request run, so the byte-pin guard has never run during review #442. False (a contributor's local clone with no CI signal, e.g. no origin remote) -> still pytest.skip, so the suite stays runnable for a contributor who did nothing wrong.
  3. Two new unit tests pin the helper's two branches directly, independent of the real repo's git state, so a regression to always-skip would fail them.
  4. changelog.d/442.fixed.md added.

Doing the fetch first and the fail-loud second (rather than the reverse) was deliberate -- inverting it would turn CI red for a reason unrelated to the defect.

Tests

Red (helper missing): NameError: name '_origin_main_should_be_resolvable' is not defined on both new tests.
Green: tests/test_case_divergence_298.py, 22 passed.
Full suite: 1806 passed, 43 skipped, 1 error -- the error is an unrelated conftest.py worktree-set-changed guard tripped by concurrent sibling lanes (#443, #444) mutating the clone's worktree list mid-run, not a regression from this change.

Other skips checked (issue asked for a survey, not a fix)

Grepped every pytest.skip in tests/ for this same environment-conditioned shape. All others are legitimate platform-capability or permission-model skips, except one worth a maintainer's eye: tests/test_shell_parse_gate.py:161, "not a git checkout -- cannot cross-check the walk". Structurally similar (skips on a git precondition) but not the #442 exposure, because CI always runs inside a git checkout -- actions/checkout guarantees .git exists -- so it is never actually a false-pass on CI the way origin/main unavailability was. below-bar: this one is a class with no reachable CI caller today, so it is recorded here rather than filed -- flagging it for the maintainer's judgment rather than opening a new issue against it.

Review

Two spawns reviewed the committed diff (Explore + oss:auditor), both FINDINGS: 0, independently confirmed via scripts/review_return.py --framed, verdict no-findings for both.

Closes #442.

…ard fails instead of silently skipping

test_the_per_tool_call_path_is_not_touched has self-skipped on every
pull_request CI run since actions/checkout never resolves origin/main on
that event -- so the byte-pin guard it implements has never once run
during a review, only after a push-triggered merge to main, which is
exactly how #429's sanctioned-divergence allowance reached main and turned
it red without its own PR catching it (#440).

Fixed in the order the issue calls for: .github/workflows/tests.yml now
fetches origin/main explicitly right after checkout, then the guard's
unavailable-base case fails loudly on a CI runner instead of skipping,
while a contributor's local clone with no origin remote still skips.

Confirmed no other test in tests/ shares this exposure (grep across the
suite for origin/main usage) -- the rest use synthetic local repos or
mention origin/main only in prose.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@fdaviddpt
fdaviddpt merged commit 341dd6e into main Aug 29, 2026
13 checks passed
@fdaviddpt
fdaviddpt deleted the fix/442 branch August 29, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_the_per_tool_call_path_is_not_touched silently self-skips on every pull_request run, so the byte-pin guard has never run during review

1 participant