-
Notifications
You must be signed in to change notification settings - Fork 0
fix(autofix): route Required OpenCode coverage failures to RCA #2170
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
Open
seonghobae
wants to merge
13
commits into
main
Choose a base branch
from
test/autofix-required-opencode-coverage-rca
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+147
−2
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
94f61b8
test(autofix): reproduce Required OpenCode coverage RCA deadlock
seonghobae 67dfa04
test(autofix): cover pending Required OpenCode coverage attempts
seonghobae 7cda25c
fix(autofix): admit source-backed pre-review coverage RCA
seonghobae d013169
test(autofix): bind coverage RCA to authoritative workflow
seonghobae d3f1d02
fix(autofix): bind coverage RCA to workflow provenance
seonghobae da3df12
chore(restack): advance autofix RCA onto protected main
seonghobae 9ae26db
chore(restack): advance autofix RCA through Noema follow-up
seonghobae 88b516e
test(review): pin full-suite Noema dependency closure
seonghobae efc2479
fix(review): provision full-suite Noema dependency
seonghobae ae0f2f5
chore(review): preserve unrelated quality syntax
seonghobae c741b60
merge(main): adopt protected OpenCode source-root repair
seonghobae d493cc4
chore(autofix): reconcile #2170 with protected main after #2147
seonghobae c346b83
chore(autofix): reconcile protected main into #2170
seonghobae 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
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
117 changes: 117 additions & 0 deletions
117
tests/test_pr_review_fix_scheduler_required_opencode_coverage_rca.py
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 |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| """Regression contracts for Required OpenCode pre-review coverage RCA routing.""" | ||
|
|
||
| from scripts.ci import pr_review_fix_scheduler as fix | ||
|
|
||
|
|
||
| def _required_opencode_check( | ||
| *, | ||
| name: str, | ||
| conclusion: str | None, | ||
| status: str = "COMPLETED", | ||
| created_at: str = "2026-09-13T00:00:00Z", | ||
| workflow_name: str = "Required OpenCode Review", | ||
| ) -> dict: | ||
| """Build one OpenCode-family check-run fixture with explicit workflow provenance.""" | ||
| return { | ||
| "__typename": "CheckRun", | ||
| "name": name, | ||
| "status": status, | ||
| "conclusion": conclusion, | ||
| "checkSuite": { | ||
| "createdAt": created_at, | ||
| "workflowRun": {"workflow": {"name": workflow_name}}, | ||
| }, | ||
| } | ||
|
|
||
|
|
||
| def _pr_with_checks(*checks: dict) -> dict: | ||
| """Build the minimal clean same-head PR context required by RCA classification.""" | ||
| return { | ||
| "number": 2079, | ||
| "isDraft": False, | ||
| "baseRefName": "main", | ||
| "baseRefOid": "b" * 40, | ||
| "headRefName": "feature", | ||
| "headRefOid": "a" * 40, | ||
| "headRepository": {"nameWithOwner": "owner/repo"}, | ||
| "mergeStateStatus": "CLEAN", | ||
| "reviews": {"nodes": []}, | ||
| "reviewThreads": {"nodes": []}, | ||
| "statusCheckRollup": {"contexts": {"nodes": list(checks)}}, | ||
| } | ||
|
|
||
|
|
||
| def test_required_opencode_coverage_failure_routes_to_rca_without_review() -> None: | ||
| """A failed source-backed coverage gate must reach RCA before model review exists.""" | ||
| pr = _pr_with_checks( | ||
| _required_opencode_check(name="coverage-evidence", conclusion="FAILURE") | ||
| ) | ||
|
|
||
| assert fix.current_head_failed_checks(pr) == ("coverage-evidence",) | ||
| assert fix.needs_rca_repair(pr) == ( | ||
| True, | ||
| ("current-head failed check(s) require RCA: coverage-evidence",), | ||
| ) | ||
|
|
||
|
|
||
| def test_other_opencode_workflow_coverage_name_stays_excluded() -> None: | ||
| """Coverage RCA admission must bind the exact authoritative workflow and check name.""" | ||
| pr = _pr_with_checks( | ||
| _required_opencode_check( | ||
| name="coverage-evidence", | ||
| conclusion="FAILURE", | ||
| workflow_name="OpenCode Review", | ||
| ) | ||
| ) | ||
|
|
||
| assert fix.current_head_failed_checks(pr) == () | ||
| assert fix.needs_rca_repair(pr) == (False, ()) | ||
|
|
||
|
|
||
| def test_required_opencode_orchestrator_failure_stays_nonrecursive() -> None: | ||
| """The OpenCode orchestration status must not recursively dispatch its own repair.""" | ||
| pr = _pr_with_checks( | ||
| _required_opencode_check(name="opencode-review", conclusion="FAILURE") | ||
| ) | ||
|
|
||
| assert fix.current_head_failed_checks(pr) == () | ||
| assert fix.needs_rca_repair(pr) == (False, ()) | ||
|
|
||
|
|
||
| def test_pending_required_opencode_coverage_attempt_supersedes_stale_failure() -> None: | ||
| """A pending coverage rerun must retire stale failure evidence until it is terminal.""" | ||
| pr = _pr_with_checks( | ||
| _required_opencode_check( | ||
| name="coverage-evidence", | ||
| conclusion="FAILURE", | ||
| created_at="2026-09-13T00:00:00Z", | ||
| ), | ||
| _required_opencode_check( | ||
| name="coverage-evidence", | ||
| conclusion=None, | ||
| status="IN_PROGRESS", | ||
| created_at="2026-09-13T00:05:00Z", | ||
| ), | ||
| ) | ||
|
|
||
| assert fix.current_head_failed_checks(pr) == () | ||
| assert fix.needs_rca_repair(pr) == (False, ()) | ||
|
|
||
|
|
||
| def test_newer_required_opencode_coverage_success_supersedes_stale_failure() -> None: | ||
| """A newer successful coverage attempt must retire the older failure evidence.""" | ||
| pr = _pr_with_checks( | ||
| _required_opencode_check( | ||
| name="coverage-evidence", | ||
| conclusion="FAILURE", | ||
| created_at="2026-09-13T00:00:00Z", | ||
| ), | ||
| _required_opencode_check( | ||
| name="coverage-evidence", | ||
| conclusion="SUCCESS", | ||
| created_at="2026-09-13T00:05:00Z", | ||
| ), | ||
| ) | ||
|
|
||
| assert fix.current_head_failed_checks(pr) == () | ||
| assert fix.needs_rca_repair(pr) == (False, ()) | ||
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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| """Regression contracts for review-repair full-suite dependency closure.""" | ||
|
|
||
| from pathlib import Path | ||
|
|
||
|
|
||
| WORKFLOW = Path(".github/workflows/agent-review-runtime-quality-ci.yml") | ||
|
|
||
|
|
||
| def test_review_repair_full_suite_installs_noema_document_dependency() -> None: | ||
| """Full-suite review-repair collection must provision Noema's XML reader.""" | ||
| workflow = WORKFLOW.read_text(encoding="utf-8") | ||
| install_step = workflow.split( | ||
| "- name: Install exact Noema document dependencies", | ||
| maxsplit=1, | ||
| )[1].split("- name: Verify Noema token-lifetime contracts", maxsplit=1)[0] | ||
|
|
||
| assert "steps.affected_suites.outputs.noema == 'true'" in install_step | ||
| assert "steps.affected_suites.outputs.review_repair == 'true'" in install_step | ||
| assert "requirements-noema-document-ci-hashes.txt" in install_step |
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.
Uh oh!
There was an error while loading. Please reload this page.