-
Notifications
You must be signed in to change notification settings - Fork 0
fix(opencode): correct stale draft/head-moved test expectation from #1697 #1709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,15 +186,37 @@ def test_stale_draft_request_reuses_live_ready_approval(tmp_path: Path) -> None: | |
|
|
||
|
|
||
| @pytest.mark.parametrize("script", (request_review_script(), fail_closed_script())) | ||
| def test_draft_exemption_fails_closed_when_live_head_moved( | ||
| def test_draft_exemption_survives_when_live_head_moved( | ||
| tmp_path: Path, | ||
| script: str, | ||
| ) -> None: | ||
| """The event cannot exempt a different live head even when it is still draft.""" | ||
| """A stale draft-conversion event still exempts a draft PR whose live head moved. | ||
|
|
||
| PR #1697 (`fix(opencode): retire stale draft/head dispatches without | ||
| false failure`) deliberately reordered both step bodies to check | ||
| closed/draft *before* head-SHA-match, following a real production | ||
| incident: contextual-orchestrator PR #1000 stayed draft the whole time, | ||
| but a push landed between the event snapshot and this step's live | ||
| re-fetch, and the old head-match-first ordering failed hard with | ||
| `::error::...head moved while validating live review state.` and exit 1 | ||
| even though no review was ever being requested against a stable target | ||
| (https://github.com/ContextualWisdomLab/contextual-orchestrator/actions/runs/33548447878/job/100066104033). | ||
| Draft/closed is a no-op exit either way -- no receipt-gate fetch, no | ||
| OIDC exchange, no dispatch, no polling -- so there is no genuine | ||
| correctness reason to distinguish a moved head from an unmoved one here; | ||
| this test's harness combines that moved head with the *event-level* | ||
| stale-draft-conversion metadata this file exercises throughout (unlike | ||
| `test_opencode_required_verdict_regression.py`'s own coverage of the | ||
| same #1697 fix, which does not vary event action/draft metadata), so it | ||
| is kept -- updated, not deleted -- for that distinct angle. This test | ||
| previously asserted the old, superseded ``head moved`` exit-1 behavior | ||
| this fix retired; do not reinstate that expectation. | ||
| """ | ||
| result = _run_step(tmp_path, script, live_draft=True, live_head="b" * 40) | ||
|
|
||
| assert result.returncode == 1 | ||
| assert "head moved while validating live" in result.stdout | ||
| assert result.returncode == 0, result.stderr | ||
| assert "still a draft on the live exact head" in result.stdout | ||
| assert "head moved" not in result.stdout | ||
|
Comment on lines
+217
to
+219
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
|
|
||
| @pytest.mark.parametrize("script", (request_review_script(), fail_closed_script())) | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Cross-repository reference breaks traceability
The new docstring uses “contextual-orchestrator PR #1000,” violating the required
owner/repo#numformat for cross-repository references.Was this helpful? React with 👍 or 👎 to provide feedback.