Skip to content

fix(test): align live-draft/head-mismatch test with #1697's contract - #1703

Closed
seonghobae wants to merge 1 commit into
mainfrom
fix/opencode-live-draft-state-stale-head-mismatch-test
Closed

fix(test): align live-draft/head-mismatch test with #1697's contract#1703
seonghobae wants to merge 1 commit into
mainfrom
fix/opencode-live-draft-state-stale-head-mismatch-test

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Description

While driving docs/product-goal-directive.md's reconciliation work on a different branch, a routine full-suite run after merging current main in turned up 2 new failures in tests/test_opencode_live_draft_state_regression.py::test_draft_exemption_fails_closed_when_live_head_moved (both script parametrizations).

Root-caused via an isolated origin/main worktree (confirms this is a pre-existing regression on main, not caused by anything on the branch that surfaced it): #1697 ("fix(opencode): retire stale draft/head dispatches without false failure") deliberately reordered opencode-review.yml's "Request current-head OpenCode review execution" and "Fail closed" steps so live-draft state is checked before live-head match, not after — a currently-draft PR needs no review dispatched no matter which head a stale/racing event or live re-fetch names, so the old ordering's hard exit 1 on any head mismatch was pure red-X noise for an already-benign case.

#1697 added thorough new coverage for this intended behavior in tests/test_opencode_required_verdict_regression.py (test_request_review_step_exempts_a_draft_pr_whose_live_head_has_moved, test_fail_closed_step_exempts_a_draft_pr_whose_live_head_has_moved), but left this sibling file's test_draft_exemption_fails_closed_when_live_head_moved pinned to the old, pre-#1697 contract — directly contradicting the new tests added in the same PR. Since main's own required coverage-evidence check runs the full suite, every PR currently rebasing onto main (including .github#1538, this session's own docs PR) would inherit this failure regardless of its own diff.

Fix

Updated the test (renamed to test_draft_exemption_applies_even_when_live_head_has_moved) to assert the same contract #1697's own new tests establish: draft state exempts dispatch with exit 0 and no error output, even when the live head has also moved. No production code changed — #1697's reordering is the intentional, correct fix; this PR only brings the one stale test file back in sync with it.

Verification

  • python3 -m pytest tests/test_opencode_live_draft_state_regression.py -q → 19 passed
  • python3 -m pytest tests -q (full suite) → 2563 passed, 1 skipped, 21 subtests, 0 failed
  • Reproduced the failure first on an unmodified origin/main git worktree to confirm it predates and is independent of this fix

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Self-reviewed
  • Root-caused against a clean origin/main checkout before touching anything
  • New and existing unit tests pass locally with my changes
  • My changes generate no new warnings

🤖 Generated with Claude Code

https://claude.ai/code/session_019YgmaEKnPhrsbSyQBierFH


Generated by Claude Code

#1697 (fix(opencode): retire stale draft/head dispatches without false
failure) deliberately reordered the "Request current-head OpenCode
review execution" and "Fail closed" steps' checks so live-draft state
is validated before live-head match, not after -- a currently-draft PR
needs no review dispatched regardless of which head a stale/racing
event names. That PR added thorough new coverage for the intended
behavior in tests/test_opencode_required_verdict_regression.py, but
left this sibling file's test_draft_exemption_fails_closed_when_live_head_moved
pinned to the old pre-#1697 contract (fail closed, exit 1, on any head
mismatch regardless of draft state) -- directly contradicting the new
tests it added in the same PR. Reproduced identically on an unmodified
origin/main worktree, confirming this is a real regression introduced
by #1697 and not caused by anything on this branch.

Updated the test to assert the same contract #1697's own new tests
establish: draft state exempts dispatch even when the live head has
also moved, with exit 0 and no error output.

Verified: this test file alone (19 passed), and the full suite
(2563 passed, 1 skipped, 21 subtests, 0 failed) on the fix commit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019YgmaEKnPhrsbSyQBierFH
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

Duplicate of #1705

This is the same fix for the same main-tip regression (test_draft_exemption_fails_closed_when_live_head_moved vs. #1697's intentional check-reorder), independently arrived at in a parallel session at essentially the same timestamp — the diffs are functionally identical (same assertions, even the same renamed test function name).

#1705 already carries this exact delta and has full verification behind it (coverage run -m pytest tests -q: 2577 passed / 1 skipped / 0 failed; coverage report: 100% statements/branches on scripts/ci; interrogate: 100.0% docstrings) plus a PR description documenting the cross-validated root cause (confirmed independently by three other background agents working on #1242, #1245, #1476).

Closing this one as a full successor takeover by #1705, per this session's PR-closure policy (duplicate with an identical, already-verified successor) — not a bare close. No delta from this PR is lost; #1705 contains it. If #1705 doesn't land for any reason, please reopen this one rather than starting a third copy.


Generated by Claude Code

@seonghobae seonghobae closed this Sep 2, 2026

Copy link
Copy Markdown

Evidence log — closure audit — 2026-09-02

PR #1703 is closed and unmerged. Its exact head is abb5bbfa8f2a9bc46914ea9a04bd6bb1dc56cfa0.

Historical validation recorded on the PR body: focused tests/test_opencode_live_draft_state_regression.py19 passed; full python3 -m pytest tests -q2563 passed, 1 skipped, 21 subtests, 0 failed.

The GitHub Actions records for that exact head are historical skipped/cancelled runs across the security and provenance workflows. They are not current protected-main evidence. The PR is closed, so it is not a merge candidate and should not be reopened merely to manufacture current-head gate evidence; the fix it carried was subsequently incorporated into the mainline evolution.

Gate decision: CLOSED / NOT A MERGE CANDIDATE.

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.

3 participants