Skip to content

feat(coverage): add bounded PyO3 peer-evidence gate - #789

Open
seonghobae wants to merge 25 commits into
mainfrom
fix/pyo3-native-peer-gate
Open

feat(coverage): add bounded PyO3 peer-evidence gate#789
seonghobae wants to merge 25 commits into
mainfrom
fix/pyo3-native-peer-gate

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Buyer-visible blocker

Central OpenCode coverage could fail before pytest collection in maturin/PyO3 packages when the isolated source-only sandbox could not import an unchanged compiled extension. That environment limitation is now distinguished from source failures without converting it into passing evidence.

Integrated bounded repair

  • classify only complete pytest collection failures caused exclusively by the declared maturin/PyO3 module being absent;
  • seal pyproject.toml before untrusted tests and use its logical path only for repository-relative boundary checks;
  • reject symlinked ancestors, final-component links, non-regular files, descriptor/path identity drift, post-open retargeting, growth, malformed input, and bounded-read overflow;
  • reject deferral for Rust, Cargo, native crate/stub, packaging, dependency lock/input, any requirements/ path, workflow/action, or any repository pyproject.toml change;
  • preserve both sides of renames by inventorying them as delete/add paths;
  • emit a distinct DEFERRED coverage decision, never PASS;
  • require exact-current-head successful CheckRun evidence for CI::python, CI::rust, and CI::package, paginating every GraphQL context page;
  • fail closed on stale heads, malformed pagination, empty/repeated cursors, over 100 pages, pending/failed/status-only/lookalike/missing/duplicate evidence;
  • place potentially large pytest output on runner-owned storage;
  • retain the permanent Python 3.10/3.14 compatibility contract.

Exact identity and evidence

  • source_head_sha: 9299a4515b3436607bbad895bf1c73205dce3582
  • pr_base_snapshot_sha: 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba
  • independently resolved live_base_tip_sha: 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba
  • mergeable, zero unresolved review threads
  • current-head CodeRabbit review findings: all four addressed and resolved

The four current-head review findings were repaired test-first in commit 9299a45. The focused regression suite passes 97 tests. The complete repository suite passes 1,087 tests plus 16 subtests with exact 100% owned production statement/branch coverage, 100% production docstrings, compilation, clean-patch validation, and checksum-verified actionlint.

Exact-head hosted run 31570671841 and the current security/supply-chain cycle were started by this commit. Pending, queued, cancelled, skipped-required, neutral, or absent evidence is not passing. Merge remains prohibited until every applicable exact-head gate is terminal-success and qualifying independent approval satisfies protection.

Security and acceptance boundary

This PR does not skip tests, build PR-selected extensions, enable network access in the source sandbox, add a Python substitute, approve itself, or weaken protection. Deferral is authorized only for an unchanged native trust boundary and only when all exact-head peer checks pass.

A source merge would remain intermediate. Protected-main scheduled/manual consumer evidence for the original fast-mlsirm#546 failure class is required before operational closure.

Advances #784.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5835317e-55ab-4635-bac4-617fa383b40b

📥 Commits

Reviewing files that changed from the base of the PR and between f1dfc2f and 8c43ca2.

📒 Files selected for processing (11)
  • .github/workflows/opencode-review-dispatch.yml
  • AGENTS.md
  • ARCHITECTURE.md
  • CHANGELOG.md
  • CLAUDE.md
  • docs/doctoring/python-native-extension-peer-evidence.md
  • scripts/ci/python_native_extension_peer_gate.py
  • tests/test_materialize_base_python_requirements.py
  • tests/test_python_native_extension_peer_gate.py
  • tests/test_python_native_extension_peer_gate_nested_project.py
  • tests/test_python_native_extension_peer_gate_workflow_contract.py
📝 Walkthrough

Walkthrough

PyO3/maturin 네이티브 확장 수집 실패 분류기와 안전한 증거 파일 처리를 추가했습니다. 정확한 PR HEAD의 Python·Rust·package CheckRun 성공을 검증하고, 결과를 OpenCode 승인 흐름과 품질 CI에 연결했습니다.

Changes

Python 네이티브 확장 peer-gate

Layer / File(s) Summary
안전한 입력과 프로젝트 계약
scripts/ci/python_native_extension_peer_gate.py, tests/test_python_native_extension_peer_gate.py, tests/test_python_native_extension_peer_gate_file_safety.py, docs/doctoring/python-native-extension-peer-file-safety.md
제한된 일반 파일 읽기, 경로 검증, UTF-8 디코딩, Maturin/PyO3 메타데이터 검증을 추가했습니다. 심볼릭 링크, 비정규 파일, 크기 초과, 파일 교체와 동시 변경을 거부합니다.
pytest 수집 실패 분류
scripts/ci/python_native_extension_peer_gate.py, tests/test_python_native_extension_peer_gate.py, tests/test_python_native_extension_peer_gate_nested_project.py, tests/test_python_native_extension_peer_gate_requirements_directory.py
변경 파일 경계와 완전한 pytest collection 로그를 검사합니다. 선언된 네이티브 모듈 누락만 분류하고 다른 실패는 거부합니다.
exact-head peer check 검증
scripts/ci/python_native_extension_peer_gate.py, tests/test_python_native_extension_peer_gate.py
중첩 CheckRun 레코드를 해석합니다. CI::python, CI::rust, CI::package가 동일한 40자리 HEAD에서 COMPLETEDSUCCESS인지 검증합니다.
OpenCode 승인 흐름 연동
.github/workflows/opencode-review-dispatch.yml, tests/test_python_native_extension_peer_gate_workflow_contract.py, tests/test_opencode_agent_contract.py, tests/test_repository_branch_coverage_pr743_cleanup.py, CHANGELOG.md
Python 테스트 로그와 pyproject.toml 스냅샷을 수집합니다. 제한된 실패는 DEFERRED로 기록하고 peer check가 충족될 때만 승인을 허용합니다. 일반 승인과 모델 출력 불가 폴백에도 같은 검사를 적용합니다.
품질 게이트와 운영 문서
.github/workflows/python-native-extension-peer-gate-quality-ci.yml, docs/doctoring/python-native-extension-peer-evidence.md
Python 3.10·3.14 검증, 전체 테스트, 브랜치·docstring 커버리지, compileall, 체크섬 고정 actionlint, git diff --check를 추가했습니다. peer-evidence 조건과 운영 범위를 문서화했습니다.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PythonTest as Python 테스트 실행
  participant Classifier as classify-pytest
  participant GitHub as GitHub CheckRuns
  participant PeerGate as require-checks
  participant Approval as OpenCode 승인 흐름

  PythonTest->>Classifier: 로그·pyproject 스냅샷·변경 파일 전달
  Classifier-->>PythonTest: PASS 또는 DEFERRED 모듈명
  Approval->>GitHub: PR HEAD의 CheckRun 조회
  GitHub-->>PeerGate: Python·Rust·package CheckRun JSON
  PeerGate-->>Approval: exact-head 성공 여부
  Approval-->>Approval: peer check 충족 시 승인 진행
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers: opencode-agent

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 95.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 bounded PyO3 peer-evidence gate 추가라는 PR의 주요 변경을 정확하고 간결하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pyo3-native-peer-gate

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

@opencode-agent address

Integrate the published PyO3 native-extension helper into the protected central OpenCode coverage/review path on this same branch; keep the PR Draft until the integration is complete and exact-head evidence passes.

Mirror the existing fail-closed R peer-evidence pattern rather than creating a second privileged reviewer. Required behavior:

  1. In .github/workflows/opencode-review-dispatch.yml, capture each Python pytest/coverage command's complete bounded log and exit status without changing successful behavior.
  2. When and only when a Python suite fails, invoke scripts/ci/python_native_extension_peer_gate.py classify-pytest against the exact log, the relevant regular non-symlink pyproject.toml, and the exact base-to-head changed-file list.
  3. A successful classification must not be reported as ordinary passing coverage. Publish a distinct compact marker stating that source-only Python collection was deferred exclusively for the unchanged declared PyO3 module and requires exact-head native peer evidence.
  4. In the trusted review/approval phase, query live CheckRun objects for the exact PR head and verify the repository-owned Python, Rust/PyO3, and package checks with require-checks. Do not accept statuses, stale heads, queued/cancelled/skipped checks, name lookalikes, duplicate requirements, or predecessor evidence. Preserve the existing R peer gate and all normal failure paths.
  5. Approval must remain blocked if the classifier, changed-file trust boundary, check inventory, or required peer check is absent or malformed. The classifier is a deferral classifier, never approval evidence by itself.
  6. Add permanent workflow-contract tests covering: pure declared-module collection failure; mixed missing imports; test/setup/teardown/internal/crash/truncated failures; native/Cargo/Rust/stub/packaging/lock/requirements/workflow changes; exact-head successful peer checks; stale/pending/failed/status/lookalike evidence; coexistence with R deferral; coverage summary wording; and approval-gate enforcement.
  7. Include the helper and workflow contract tests in permanent Python 3.10/3.14, compilation, 100% production statement/branch coverage, and public-docstring gates. No temporary repair workflow, branch-selected privileged execution, Python compatibility stub, networked PR test, skipped test, synthesized approval, merge, release, or protection change may remain.
  8. After exact-head central checks pass, rerun OpenCode/Noema review for unchanged fast-mlsirm heads build(deps): bump cloudflare/wrangler-action from 3.15.0 to 4.0.0 #546 d111e2b1341b0daab6b813074c7a7dbcf5c24ff4, fix(deps): protobuf를 aiplatform 호환 범위로 유지 #549 12fc519ca798c8400840f04b3b19c07754ad7dfe, and build(deps): bump google-cloud-bigquery from 3.42.0 to 3.42.2 #550 8db4c235d466446429fc32bdeeef3ca1fdaa8827; do not reuse their failed source-only coverage verdicts.

Update the doctoring and CHANGELOG to distinguish source-only measurement, trusted native peer evidence, and remaining interpretation limits. Preserve immutable called-workflow source, reviewer credentials, NVIDIA/OpenCode model policy, independent approval, unresolved-thread, and branch-protection boundaries.

Copy link
Copy Markdown
Contributor Author

@jules Implement the remaining central workflow integration on this existing Draft PR. Preserve the published helper and fail-closed trust boundary; do not create another PR or temporary workflow.

Required scope:

  • wire python_native_extension_peer_gate.py classify-pytest into .github/workflows/opencode-review-dispatch.yml only after a real bounded Python suite failure, using the exact pytest log, regular non-symlink pyproject, and exact base-to-head changed-file list;
  • publish a distinct PyO3 deferral marker rather than ordinary passing coverage;
  • in the trusted approval phase, query live exact-head CheckRun records and call require-checks for protected Python, Rust/PyO3, and package peer checks;
  • reject stale/pending/failed/status/lookalike/missing/malformed evidence and preserve the existing R deferral independently;
  • add permanent workflow-contract tests for classification, changed-boundary rejection, exact-head peer evidence, R/PyO3 coexistence, summary wording, and approval enforcement;
  • include the helper and workflow integration in Python 3.10/3.14 compile, 100% statement/branch coverage, public docstrings, actionlint, security, and changelog/doctoring checks.

Do not build PR-selected native code in the central sandbox, add a compatibility stub, skip product tests, use networked PR execution, change reviewer tokens or NVIDIA/OpenCode policy, weaken approval/protection gates, mark Ready, merge, or release. Commit as normal descendants without force-push, and report exact verification commands and the final head SHA.

Copy link
Copy Markdown
Contributor Author

@jules Implement the remaining integration directly on this branch; do not create any temporary, self-modifying, encoded-patch, or branch-writing workflow.

Required GREEN slice:

  1. Wire scripts/ci/python_native_extension_peer_gate.py into .github/workflows/opencode-review-dispatch.yml after the isolated pytest attempt has produced a complete bounded log and exact changed-file inventory.
  2. Accept deferral only when classify-pytest proves the sole failure is the exact declared maturin/PyO3 module and require-checks proves trusted exact-head CI::python, CI::rust, and CI::package CheckRuns are completed/successful.
  3. Treat classification as deferred peer evidence, never as a passing test; preserve all coverage/docstring gates for the Python-owned changed files and fail closed on mixed failures, native/package/lock/workflow changes, stale or status-only evidence.
  4. Add permanent workflow-contract tests covering ordering, trusted workflow/check-name ownership, exact-head binding, malformed evidence, and the fast_mlsirm._core case.
  5. Run the focused suite, complete central tests, 100% production statement/branch/docstring evidence, compilation, and exact-head security workflows. Keep Draft until all current-head evidence is GREEN.

After integration, rerun OpenCode review for unchanged fast-mlsirm PRs #546, #549, and #550; predecessor coverage failures are not reusable.

Copy link
Copy Markdown
Contributor Author

@jules Integrate the committed helper into the central opencode-review-dispatch.yml now; keep this PR Draft until end-to-end exact-head evidence is complete.

Required fail-closed flow:

  1. Preserve the current central source-only coverage run and capture its complete bounded combined stdout/stderr plus exit status. On success, continue unchanged.
  2. On failure, write the exact base…head changed-file list to a bounded newline file and invoke python_native_extension_peer_gate.py classify-pytest. Deferral is allowed only when that helper proves the sole failure is absence of the exact unchanged maturin/PyO3 module-name; any native/Cargo/stub/packaging/lock/requirements/workflow/maturin-metadata change or mixed pytest failure remains blocking.
  3. A successful classification is not a pass. Query CheckRun—not StatusContext—evidence for the exact PR head and invoke require-checks for these exact fast-mlsirm CI jobs before the central review may treat source-only coverage as peer-proven:
    • CI::python
    • CI::rust
    • CI::package
    • CI::gpu-smoke
    • CI::fuzz
      Keep Security Scan and SAST under the existing central gates. Reject absent, pending, failed, stale-head, lookalike-workflow, duplicate-requirement, or malformed evidence.
  4. Emit an explicit non-success classification such as coverage_deferred_to_exact_head_native_peer_evidence; do not report the source-only sandbox as passing and do not lower the repository's 100% coverage contract.
  5. Add workflow contract tests that exercise the exact fast_mlsirm._core collection failure, successful exact-head peer evidence, stale/pending/failed/status-only/check-name/workflow-name mismatches, native-boundary changes, mixed failures, truncation, and normal pure-Python pytest failures.
  6. Re-run the central workflow against current exact heads of fast-mlsirm#546, #549, and #550. The integration is accepted only if those previously blocked Python-only PRs receive no coverage CHANGES_REQUESTED, while a synthetic native-code change and mixed pytest failure still block.

Do not build PR-selected native code inside the central sandbox, introduce a Python stub, auto-approve, weaken required checks, use COPILOT_GITHUB_TOKEN, or disturb the existing reviewer-agent secret contract. Update APA 7 doctoring and the authoritative changelog after GREEN.

Copy link
Copy Markdown
Contributor Author

@coderabbitai Review the current Draft head 68e8b1695280d11c58b5553457442527f9d0542c specifically as an implementation-design review for the remaining PyO3 workflow integration. Do not approve, mutate, or merge. Identify the exact existing R-deferral variables/functions/approval gates in .github/workflows/opencode-review-dispatch.yml, and provide a minimal patch plan that reuses them for python_native_extension_peer_gate.py while preserving ordinary Python failures, exact-head CheckRun validation, R/PyO3 coexistence, and all immutable-source/credential boundaries. Flag any defect in the published helper or tests before integration.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Rate Limit Exceeded

@seonghobae have exceeded the limit for the number of chat messages per hour. Please wait 5 minutes and 1 seconds before sending another message.

Copy link
Copy Markdown
Contributor Author

@opencode-agent

Prepare the next bounded integration only after .github#759 produces a GREEN exact head, because both changes touch the authoritative coverage workflow and stale-base integration would reintroduce or overwrite the LLVM runtime-boundary repair.

For the eventual current-main integration:

  • invoke python_native_extension_peer_gate.py classify-pytest only after a real pytest collection failure has been captured completely and before converting that failure into deferred peer-evidence requirements;
  • write changed paths from the exact base/head diff into a bounded regular file;
  • require the declared maturin/PyO3 module and refuse deferral for every native, packaging, dependency, workflow, stub, or metadata change already covered by the helper;
  • query CheckRun evidence from trusted GitHub metadata and require exact current head plus repository-owned Python, Rust/PyO3, and package checks, all completed/successful; statuses, stale heads, duplicates, lookalikes, and missing evidence remain blocking;
  • keep classification explicitly non-passing until peer checks are proven;
  • add permanent workflow-ordering, permission, exact-head, and fail-closed contracts; execute/cover/compile the helper through the exact-head quality lane;
  • rerun fast-mlsirm#546 only after the central integration merges.

Keep Draft. Do not mutate the authoritative workflow from the pre-#759 base, approve, or merge.

Copy link
Copy Markdown
Contributor Author

@jules Implement the existing TDD RED workflow contracts on exact live head 5bc9ba4070866934ed819c2ff06f209b785d7b88 as normal descendant commits. Keep this PR Draft. Do not amend, rebase, force-push, create a repair workflow, mark Ready, merge, release, change branch protection, change reviewer credentials, or alter NVIDIA/OpenCode model policy.

Precondition: before every write, re-read the live head and stop without mutation unless it is the expected current head or your own direct descendant.

Coverage integration

In .github/workflows/opencode-review-dispatch.yml, preserve the existing sandbox, run_and_capture, R deferral, immutable-source, credential, and publication boundaries. Add a separate Python-suite runner that uses the identical timeout --kill-after=20 900 setpriv ... low-privilege environment but retains the complete bounded log long enough to classify a real nonzero Python suite exit.

Initialize exactly:

python_native_peer_check_required=0

Only after a Python configured/default pytest/coverage command actually fails:

  1. snapshot changed_files_for_coverage to a bounded regular file;
  2. require the relevant ${project_dir}/pyproject.toml to be regular and non-symlink;
  3. invoke the trusted helper:
python3 "$GITHUB_WORKSPACE/scripts/ci/python_native_extension_peer_gate.py" classify-pytest \
  --log "$log_file" \
  --pyproject "$project_dir/pyproject.toml" \
  --changed-files "$changed_files_file" \
  --repo-root "$COVERAGE_SOURCE_WORKDIR"
  1. on classifier success, do not report ordinary PASS and do not increment failures; emit a distinct section containing all these literal contracts:
### Python native-extension source-only deferral
- Result: DEFERRED
the unchanged declared PyO3 module was unavailable in the source-only sandbox
exact-head Python, Rust/PyO3, and package CheckRuns

and set python_native_peer_check_required=1;
5. on classifier rejection, retain the ordinary exact exit failure and increment failures;
6. any other Python suite failure in the same run remains blocking.

In the compact PASS decision, when the variable is 1, emit exactly:

- Python native-extension peer evidence: deferred source-only collection requires successful exact-head peer checks

Do not build/install PR-selected native code, add a Python stub, skip tests, or grant network access.

Approval integration

Mirror—but do not replace—the existing R peer-check pattern. Add independent functions that:

  • detect only the exact compact Python deferral marker;
  • query the live PR statusCheckRollup immediately before approval and normalize only CheckRun nodes with __typename, workflow name, check name, exact trusted $HEAD_SHA, status, and conclusion into a bounded JSON file;
  • call:
python3 "$GITHUB_WORKSPACE/scripts/ci/python_native_extension_peer_gate.py" require-checks \
  --checks-json "$checks_file" \
  --head-sha "$HEAD_SHA" \
  --required-check "CI::python" \
  --required-check "CI::rust" \
  --required-check "CI::package"
  • reject missing, pending, failed, skipped, cancelled, stale, status-only, lookalike, malformed, or lookup-failed evidence.

Call this gate in both approval paths that already call require_r_cmd_check_for_deferred_coverage: the deterministic model-unavailable blocker path and the normal APPROVE path. R and PyO3 deferrals must coexist independently. On failure, leave review state unchanged with a bounded WAITING_FOR_PYTHON_NATIVE_PEER_CHECKS explanation; never synthesize approval.

Permanent tests and verification

Make the current tests GREEN without weakening them:

python -m pytest -q \
  tests/test_python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_nested_project.py \
  tests/test_python_native_extension_peer_gate_workflow_contract.py

Then run the permanent Python 3.10/3.14 quality workflow, focused and complete 100% production statement/branch coverage, interrogate 100%, compileall, actionlint, full central tests, security and supply-chain checks. Fix actual failures only. Preserve CHANGELOG.md and docs/doctoring/python-native-extension-peer-evidence.md; update them only where integration semantics or verified limitations changed.

After GREEN, report the exact final SHA and verification commands in a PR comment. Do not request approval or change Draft state.

Copy link
Copy Markdown
Contributor Author

Exact-head quality run 31133025300 confirms the intended integration RED: 87 focused tests passed and only the three workflow-contract tests failed because opencode-review-dispatch.yml still lacks python_native_peer_check_required, the distinct source-only deferral summary, and trusted require-checks enforcement. Python 3.10 compatibility passed; all security workflows passed.

@jules Implement the central workflow integration now rather than weakening these tests. Preserve the existing R peer gate and privileged reviewer chain. After GREEN, run full central coverage/docstrings/actionlint and replay OpenCode review against exact fast-mlsirm heads #546, #549, and #550.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Fix the exact current-head quality failure on 5bc9ba4070866934ed819c2ff06f209b785d7b88 by completing the integration already required by this Draft PR; do not weaken or delete the three failing workflow-contract tests.

Run 31133025300, job 92726135563, proves 87/90 focused tests pass and these exact contracts remain RED:

  1. python_native_peer_check_required=0 and the bounded classify-pytest invocation are absent from .github/workflows/opencode-review-dispatch.yml;
  2. the coverage artifact lacks the distinct ### Python native-extension source-only deferral, - Result: DEFERRED, and exact-head peer-check requirement text;
  3. the approval phase does not yet call require-checks for CI::python, CI::rust, and CI::package against PR_HEAD_SHA using live GraphQL CheckRun evidence.

Implement the documented fail-closed flow:

  • initialize python_native_peer_check_required=0 and keep ordinary source-test failure authoritative;
  • only after a real Python pytest failure, call scripts/ci/python_native_extension_peer_gate.py classify-pytest with the bounded pytest log, changed-file list, --repo-root "$COVERAGE_SOURCE_WORKDIR", and exact --pyproject "$project_dir/pyproject.toml";
  • if and only if that classifier succeeds, serialize a distinct DEFERRED section, never PASS, stating the unchanged declared PyO3 module was unavailable in the source-only sandbox and that exact-head Python, Rust/PyO3, and package CheckRuns are mandatory;
  • pass this state into the trusted approval job;
  • query current live check runs, preserve __typename, require actual CheckRun values, and call the helper's require-checks for CI::python, CI::rust, and CI::package with --head-sha "$PR_HEAD_SHA";
  • retain R CMD check deferral logic independently;
  • reject mixed failures, changed native/package/workflow boundaries, missing/pending/failed/stale/status-only/lookalike evidence, malformed metadata, or any classifier error;
  • keep all source handling read-only and bounded, no PR-selected build/install, no Python native stub, no token weakening, no approval or merge inside the helper.

After GREEN, run all 90 focused tests at 100% statement/branch coverage, the complete central suite, interrogate 100%, compileall, actionlint, Python 3.10 compatibility, security workflows, and exact-head review. Keep Draft, needs-revision, do-not-merge, and no auto-merge until integration and a live fast-mlsirm proof run are complete.

Copy link
Copy Markdown
Contributor Author

@jules Implement the missing production integration on current branch fix/pyo3-native-peer-gate; do not create a separate workflow-only substitute. Wire scripts/ci/python_native_extension_peer_gate.py into .github/workflows/opencode-review-dispatch.yml after the isolated pytest log and exact changed-file inventory exist. Deferral must remain non-PASS evidence and require exact-head successful trusted CheckRuns CI::python, CI::rust, and CI::package; preserve all Python coverage/docstring gates and the independent R peer gate; fail closed on mixed/native/package/lock/workflow changes or malformed/stale/status-only evidence. Add permanent ordering/ownership/exact-head workflow-contract tests, run focused/full quality and security, and keep Draft.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Implement the committed workflow-integration RED contract on this Draft branch. Do not weaken the helper or tests. Preserve the existing R peer gate and reviewer credential chain.

The central coverage job must capture bounded combined pytest output and status, classify only the exact unchanged maturin/PyO3 module-absence collection failure, then require trusted exact-head CheckRun success for CI::python, CI::rust, CI::package, CI::gpu-smoke, and CI::fuzz. StatusContext, stale heads, lookalike workflow/check names, pending/failed/missing/malformed evidence, native-boundary changes, and mixed failures remain blocking. Emit an explicit non-success source-only deferral classification; never call it passing, never build PR-selected native code, and never auto-approve.

After GREEN, run the permanent workflow contracts, full central coverage/docstrings/actionlint/security, then replay exact current heads of fast-mlsirm #546, #549, and #550.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Continue directly on exact head 247ebc6e89b6948b1848794cb52901dbac5e3c66. The staged PyO3 integration patch artifact has been correctly removed, but the canonical .github/workflows/opencode-review-dispatch.yml integration remains absent. Implement it as ordinary source/test/doc commits on this branch; do not recreate a staged patch, one-shot writer, compatibility stub, or second reviewer.

Required fail-closed behavior:

  • capture each real Python pytest/coverage command's bounded complete log and exit status;
  • only after a nonzero Python suite result, invoke python_native_extension_peer_gate.py classify-pytest with the exact log, regular non-symlink pyproject.toml, exact base-to-head changed-file list, and repository root;
  • emit a distinct DEFERRED marker, never PASS, only for exclusive missing-import collection failure of the unchanged declared maturin/PyO3 module;
  • preserve ordinary failure for mixed imports, tests, setup/teardown/internal errors, crashes, truncation, malformed metadata, and native/Cargo/Rust/stub/packaging/lock/requirements/workflow changes;
  • before approval, query live exact-head CheckRun records and call require-checks for repository-owned Python, Rust/PyO3, and package checks; reject statuses, stale/pending/failed/skipped/lookalike/duplicate/missing/malformed evidence;
  • preserve the independent R deferral and require both evidence sets when both apply;
  • add permanent workflow-contract coverage for summary wording and approval enforcement and keep Python 3.10/3.14, 100% statement/branch, public-docstring, compile, security, and clean-tree gates.

Keep Draft until canonical integration and exact-head checks are GREEN. After protected integration, rerun unchanged fast-mlsirm heads rather than reusing source-only failures.

Copy link
Copy Markdown
Contributor Author

/oc Refetch the live PR head and stop without writing unless it is exactly 247ebc6e89b6948b1848794cb52901dbac5e3c66. Fresh exact-head quality run 31150926881, job 92831594429, gives the required RED evidence: 87 focused tests pass and only the three permanent integration contracts fail because .github/workflows/opencode-review-dispatch.yml does not yet call the reviewed helper. Implement the bounded production integration directly on this branch; do not weaken the tests.

In the isolated coverage-evidence runtime:

  1. Initialize python_native_peer_check_required=0 alongside the existing r_peer_check_required state before Python measurement.
  2. Refactor only the Python test execution path so each real pytest/coverage command captures its complete bounded log and exit status. A zero exit remains ordinary PASS. A nonzero exit may be classified only by scripts/ci/python_native_extension_peer_gate.py classify-pytest using the exact project pyproject.toml, --repo-root "$COVERAGE_SOURCE_WORKDIR", and a read-only newline-delimited snapshot from changed_files_for_coverage. Never classify a configured non-pytest command, a successful run, a truncated log, mixed failures, changed native/packaging/workflow boundaries, or missing/malformed metadata.
  3. On successful classification, do not serialize PASS and do not increment the ordinary failure count. Emit a distinct section headed ### Python native-extension source-only deferral, - Result: DEFERRED, explain that the unchanged declared PyO3 module was unavailable in the source-only sandbox, state that exact-head Python, Rust/PyO3, and package CheckRuns are mandatory, and set python_native_peer_check_required=1. Preserve the original command/log evidence and remove all temporary files.
  4. Propagate one compact, machine-readable coverage-summary marker exactly matching Python native-extension peer evidence: deferred source-only collection requires successful exact-head peer checks; preserve the existing R deferral marker and all PASS/FAIL semantics.
  5. In both trusted approval/publication paths that currently enforce deferred R evidence, detect that marker fail-closed. Collect live current-head REST/GraphQL CheckRun records (never status-only evidence), snapshot them to a bounded regular non-symlink JSON file, and run the helper’s require-checks subcommand with --head-sha "$PR_HEAD_SHA" and exact requirements CI::python, CI::rust, and CI::package. Pending, duplicate/conflicting, stale-head, missing, failed, neutral, skipped, lookalike, malformed, or unavailable evidence must block approval with an explicit WAITING_FOR_PYTHON_NATIVE_PEER_CHECKS/equivalent source-backed reason. Keep the existing R peer gate independent; both gates must pass when both are required.
  6. Add/retain permanent workflow contracts proving classifier ordering, separate DEFERRED evidence, exact three-check approval enforcement in both publication paths, and absence of any path that reclassifies deferral as direct coverage success.

Preserve --network=none, exact-head source materialization, credential-free PR test execution, immutable action/tool pins, one-day artifact retention, archive validation, OpenCode/Noema identities and credentials, NVIDIA NIM boundaries, 100% statement/branch/public-docstring gates, and all existing failed-check/approval logic. Do not build or install PR-selected native code in the source-only sandbox, add a stub, add a one-shot/self-modifying workflow, branch writer, encoded patch, approval, merge, release, or force push.

Run the three RED workflow-contract tests first; then all 90+ focused peer-gate tests with 100% helper statement/branch coverage, the complete central suite, production docstrings 100%, Python 3.10 and 3.14 compatibility, actionlint, compileall, and git diff --check. Keep Draft until the new exact head is fully green and then request fresh current-head CodeRabbit/OpenCode/Noema review.

Copy link
Copy Markdown
Contributor Author

@coderabbitai autofix

Complete the existing production integration directly on exact head 247ebc6e89b6948b1848794cb52901dbac5e3c66; do not open a stacked PR or add a repair workflow. Wire python_native_extension_peer_gate.py classify-pytest only after a real failed Python pytest/coverage run, emit a distinct DEFERRED marker without converting failure to PASS, and require exact current-head successful CheckRuns for CI::python, CI::rust, and CI::package before approval. Preserve the independent R peer gate, source-only/no-network sandbox, no PR-selected native build, all exact-head/action-pin/100% coverage/docstring contracts, and fail closed on mixed/malformed/native-boundary-changing or missing/duplicate/pending/stale/status-only evidence. Run the existing workflow-contract tests first and commit directly to this branch.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found.

Copy link
Copy Markdown
Contributor Author

/oc Refetch the exact live PR head and abort unless it is 247ebc6e89b6948b1848794cb52901dbac5e3c66. Complete the permanent integration already required by this Draft PR; do not weaken the RED workflow contract and do not add a branch-writer or temporary workflow. Fix Python Native Extension Peer Gate Quality CI run 31150926881 by wiring scripts/ci/python_native_extension_peer_gate.py into .github/workflows/opencode-review-dispatch.yml exactly as the permanent tests require. Initialize python_native_peer_check_required=0; capture the real failed pytest collection log and exact changed-file inventory as bounded regular files; invoke classify-pytest only after the ordinary Python suite actually fails, with --repo-root "$COVERAGE_SOURCE_WORKDIR", the exact project pyproject.toml, and no shell interpolation of untrusted paths. A successful classifier must produce a distinct ### Python native-extension source-only deferral / - Result: DEFERRED evidence section, never normal passing coverage, and must state that unchanged declared PyO3 module absence still requires successful exact-head Python, Rust/PyO3, and package CheckRuns. In the trusted approval phase, when python_native_peer_check_required is set, fetch live exact-head CheckRun data and invoke require-checks --head-sha "$PR_HEAD_SHA" with exact requirements CI::python, CI::rust, and CI::package; reject StatusContext/lookalikes, pending/failed/stale/malformed evidence, and preserve the existing R peer-check path. Do not build or import the PR-selected extension in the credentialed/source-only sandbox, skip tests, treat deferral as success by itself, or change reviewer/model credentials. Run the three failing workflow-contract tests first, then all peer-gate tests and the complete central suite with 100% statement/branch coverage, public docstrings, compileall, actionlint, clean diff, and exact-head security checks. Keep Draft until GREEN.

Copy link
Copy Markdown
Contributor Author

@opencode-agent Complete the permanent central integration directly on exact Draft head 247ebc6e89b6948b1848794cb52901dbac5e3c66; do not create temporary/self-removing/encoded-patch/branch-writing workflows.

Exact-head run 31150926881 proves the standalone bounded classifier tests are green except for three intentionally unmet workflow contracts. Wire the reviewed helper into .github/workflows/opencode-review-dispatch.yml so that:

  1. Before running the supported Python suite, initialize python_native_peer_check_required=0 in trusted shell state.
  2. Only after a genuine Python pytest collection failure, invoke scripts/ci/python_native_extension_peer_gate.py with the exact materialized repository root, bounded captured pytest output, authenticated changed-file set, and exact PR head metadata.
  3. A valid source-only native-module classification emits a distinct ### Python native-extension source-only deferral evidence section and sets python_native_peer_check_required=1; it must never serialize ordinary Python coverage as passing.
  4. Mixed imports, runtime test failures, setup/teardown/internal pytest failures, malformed/truncated logs, native/Rust/Cargo/stub/packaging/lock/workflow changes, unsafe paths, or uncertain classification remain hard failures.
  5. The trusted approval phase, only when the deferral flag is set, fetches live GitHub CheckRun evidence for the exact unchanged head and requires exact configured successful Python, Rust/PyO3, and package-install/build checks. Reject statuses, stale heads, lookalike names, pending/failed/skipped/neutral checks, missing or duplicate requirements, and malformed API responses.
  6. A classifier result remains non-approval evidence until all three trusted peer checks pass; no token/model/write credential enters the untrusted coverage consumer.
  7. Add permanent workflow contracts and update doctoring/CHANGELOG only as needed. Run focused tests, complete central statement/branch coverage, public docstrings, Python 3.10 compatibility, compileall, actionlint, and clean-tree checks.

Keep Draft and do not approve, merge, release, alter reviewer credentials, or weaken protection.

Copy link
Copy Markdown
Contributor Author

/oc

Refetch PR #789 and implement the PyO3 peer-evidence integration directly on the live Draft branch; abort on movement. Keep the staged patch artifact deleted. Wire python_native_extension_peer_gate.py classify-pytest into the canonical coverage workflow only after a real bounded Python-suite failure, using the exact log, regular non-symlink pyproject, exact changed-file list, and repository root. Emit DEFERRED rather than PASS only for exclusive missing collection import of the unchanged declared module. Before approval, require live exact-head repository-owned Python, Rust/PyO3, and package CheckRuns via require-checks, rejecting status/stale/pending/failed/skipped/lookalike/duplicate/malformed evidence; preserve independent R deferral and require both when applicable. Add permanent workflow contracts, run Python 3.10/3.14, 100% statement/branch/docstrings/compile/security gates, and commit directly. No compatibility stub, native build in the source-only sandbox, repair workflow, or force-push.

Copy link
Copy Markdown
Contributor Author

@opencode-agent

Complete the planned production integration directly on fix/pyo3-native-peer-gate; refetch and abort unless the live head is 247ebc6e89b6948b1848794cb52901dbac5e3c66. Exact failing run 31150926881, job 92831594429, proves the helper is not wired into .github/workflows/opencode-review-dispatch.yml: 87 focused tests pass and only the three permanent workflow contracts fail.

Implement test-first and fail closed:

  1. In coverage-evidence initialize python_native_peer_check_required=0. When a real supported Python suite command fails, retain its bounded captured log and repository-relative changed-file list; call scripts/ci/python_native_extension_peer_gate.py classify-pytest with --repo-root "$COVERAGE_SOURCE_WORKDIR", the exact project --pyproject "$project_dir/pyproject.toml", --log "$python_native_pytest_log", and --changed-files "$python_native_changed_files". Deferral is allowed only when that command returns success; every other Python failure remains an ordinary coverage blocker.
  2. Serialize a successful classification as a distinct ### Python native-extension source-only deferral section with - Result: DEFERRED, the statement that the unchanged declared PyO3 module was unavailable in the source-only sandbox, and that exact-head Python, Rust/PyO3, and package CheckRuns are still required. Do not count it as passed test or coverage evidence. Emit the permanent summary marker Python native-extension peer evidence: deferred source-only collection requires successful exact-head peer checks and export the required flag for the trusted approval phase.
  3. In the credentialed trusted approval phase, only when python_native_peer_check_required is set, collect live check-runs for exact $PR_HEAD_SHA through the existing bounded check API path, preserve __typename, workflow identity, check name, head SHA, status, and conclusion, write them as bounded JSON, and run python_native_extension_peer_gate.py require-checks --head-sha "$PR_HEAD_SHA" with exactly --required-check "CI::python", --required-check "CI::rust", and --required-check "CI::package". Missing, duplicate, status-only, lookalike, stale-head, queued, failed, malformed, or unavailable evidence must block approval.
  4. Keep the existing R deferred-evidence gate independent; do not conflate r_peer_check_required with the native flag. Preserve the source-only sandbox, no PR-selected build/install/network, credential separation, and every existing 100% coverage/docstring/security gate.
  5. Update the PR body/doctoring/changelog only after the implementation exists. Do not add staged patch artifacts, temporary/one-shot/self-modifying branch writers, compatibility stubs, extension builds, test skips, or approval fallbacks.

Run the three failing workflow contracts first, all focused peer-gate/file-safety/nested-project/requirements-directory tests, then the complete central suite, 100% production statement/branch coverage, interrogate, compileall, actionlint, and clean-tree checks. Keep Draft until the new exact head is green.

Copy link
Copy Markdown
Contributor Author

/oc

Complete the missing permanent workflow integration on exact head 247ebc6e89b6948b1848794cb52901dbac5e3c66; keep the PR Draft and do not add a staged patch, one-shot, self-mutating, or branch-writer workflow.

Run 31150926881 proves 87 focused behavior tests pass and only three intentional workflow-contract tests remain RED because .github/workflows/opencode-review-dispatch.yml still lacks the bounded PyO3 peer-evidence path.

Implement directly in the permanent workflow:

  1. Initialize python_native_peer_check_required=0 and the associated exact declared-module/repository evidence before Python coverage classification.
  2. Invoke scripts/ci/python_native_extension_peer_gate.py only after a real, complete Python pytest collection failure, with the bounded repository root, exact changed-path set, declared maturin/PyO3 module, and complete log/evidence inputs.
  3. Serialize a distinct ### Python native-extension source-only deferral evidence section. A valid classifier result is DEFERRED, never ordinary passing coverage.
  4. Set the peer-check-required flag only for an exclusive, valid absence of the exact declared native module. Mixed imports, test/setup/teardown/internal failures, malformed/truncated logs, unsafe paths, or changes to Rust/native/packaging/dependency/workflow surfaces remain blockers.
  5. Before formal approval, query live GitHub CheckRun evidence for the exact current head and require the configured Python, Rust/PyO3, and package workflow/check identities to be completed with success. Reject stale-head, queued, pending, failed, skipped-required, status-only, lookalike, missing, duplicate, or malformed evidence.
  6. Preserve all existing exact-head, source, credential, dependency, native-fuzz, coverage, reviewer, and branch-protection gates. Do not build pull-request-selected native code inside the central source-only sandbox.

Run all five peer-gate test files, then complete central 100% statement/branch coverage and production docstrings, Python 3.10/3.14 compilation, actionlint, security/supply-chain workflows, and git diff --check. Keep the final permanent scope limited to the existing helper/tests/docs/quality workflow plus the necessary direct modification to opencode-review-dispatch.yml.

Copy link
Copy Markdown
Contributor Author

/oc Refetch the live head and continue only if it is 247ebc6e89b6948b1848794cb52901dbac5e3c66. Complete the existing PyO3 peer-gate integration directly in .github/workflows/opencode-review-dispatch.yml. Invoke python_native_extension_peer_gate.py classify-pytest only after a real failed Python pytest/coverage command, using the validated repo root, project pyproject, bounded log and current changed-file inventory. On successful classification emit the exact ### Python native-extension source-only deferral / - Result: DEFERRED marker and set a peer-check-required flag; never convert it to PASS. Before approval, if deferred, require live exact-head successful CheckRuns CI::python, CI::rust, and CI::package via require-checks --head-sha "$PR_HEAD_SHA", rejecting missing/duplicate/pending/failed/stale/lookalike/status-only evidence. Preserve the independent R peer gate, source-only no-network sandbox, no PR-selected native build, all pins and 100% gates. Run the three failing workflow-contract tests, the full focused suite, then complete central quality/security. Commit directly here; no stacked PR or repair workflow.

Copy link
Copy Markdown
Contributor Author

/oc

Continue from the exact current head and finish the permanent PyO3 peer-evidence integration if it is still incomplete. Classify only a complete pytest collection failure caused exclusively by the declared maturin/PyO3 module being absent, serialize it as distinct DEFERRED evidence rather than PASS, and require live successful exact-head Python, Rust/PyO3, and package CheckRuns before approval. Reject mixed imports, test failures, changed native/packaging/lock/workflow surfaces, stale or lookalike checks, status-only evidence, malformed logs, and unsafe paths. Do not build PR-selected native code in the central sandbox. Run all focused peer-gate tests, complete central 100% statement/branch coverage and public docstrings, Python 3.10/3.14 compilation, actionlint, and security/supply-chain gates. Remove temporary workflows, resolve only addressed threads, and mark Ready only on a fully green workflow-free head. Do not merge or bypass protection.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Complete the bounded PyO3 peer-evidence integration on exact current Draft head 247ebc6e89b6948b1848794cb52901dbac5e3c66. The authoritative .github/workflows/opencode-review-dispatch.yml blob observed on that head is 83f6830d5c21a324b4dbcd4e5c21a07968994b81. Protected main has advanced since this branch's recorded base, so refetch the live protected base before mutation; if a non-forced merge/replacement from current main is required, preserve the fail-first history and re-run all evidence on the resulting exact head rather than editing against stale assumptions.

Exact failing quality evidence is run 31150926881, job 92843314735: Python 3.10 compatibility is GREEN; the Python 3.14 focused gate has 87 passed and exactly 3 intended workflow-integration failures. Implement the production workflow contract rather than weakening these tests:

  1. Initialize a fail-closed python_native_peer_check_required=0 state and invoke scripts/ci/python_native_extension_peer_gate.py only after an actual Python suite/collection failure and only with bounded repository-root-aware evidence. A successful classifier result is deferred evidence, never passing Python coverage.
  2. Serialize that state distinctly in evidence/reporting with the permanent heading ### Python native-extension source-only deferral; preserve the original failed Python evidence and do not convert it to success.
  3. In the approval/evidence phase, when deferral is required, verify live GitHub CheckRun evidence for the exact unchanged PR head for all required Python, Rust/PyO3, and package checks using the helper's exact workflow/check allowlist. Require completed+success on the exact head; reject pending, failed, stale-head, status-only, duplicate/lookalike, missing, malformed, or predecessor evidence before approval.

Preserve the existing source-only/networkless sandbox, no PR-selected extension build or import stub, exact-head/base materialization, credential isolation, NVIDIA NIM/reviewer credential chain, native-fuzz separation, 100% production statement/branch/public-docstring policy, and branch protection. Do not add a temporary, one-shot, self-modifying, encoded-patch, staged-patch, branch-local repair, or competing writer workflow.

After the minimal integration, rerun the focused peer-gate suite, complete central suite, Python 3.10/3.14 compilation, actionlint/Bash checks, exact 100% production statement/branch/docstring gates, security/supply-chain workflows, clean-diff checks, and current-head automated review. Keep Draft until all exact-head gates and qualifying independent non-author approval are satisfied.

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Finish the bounded PyO3 native peer-evidence integration from a fresh protected-main base. Exact PR head is 247ebc6e89b6948b1848794cb52901dbac5e3c66; current protected main tip is 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba. The central .github/workflows/opencode-review-dispatch.yml blob is identically 83f6830d5c21a324b4dbcd4e5c21a07968994b81 on both revisions, proving this branch has not yet wired the helper into production. Exact helper blob is scripts/ci/python_native_extension_peer_gate.py=a4b12c9fe7c0253afa4beb67ca010bc5ab553ac0. Do not write if the PR head, protected-main tip, or these relevant blobs move.

First normally merge exact protected main into this existing branch without rewriting history. Then satisfy only the three intentional integration RED contracts from exact-head Python Native Extension Peer Gate Quality CI run 31150926881, job 92843314735 (3 failed, 87 passed):

  1. In the bounded Python coverage execution path, initialize python_native_peer_check_required=0. Only after an actual nonzero Python test execution, invoke the committed classifier with the exact repository root, bounded complete pytest log, exact changed-file set, and immutable pyproject.toml; never invoke it for a passing suite.
  2. A successful classification is distinct deferred evidence, never ordinary passing coverage. Emit an explicit ### Python native-extension source-only deferral section and set the peer-check-required signal; preserve the original Python failure evidence and do not manufacture tests_passed=true from the classifier alone.
  3. Before any approval path can treat that deferral as sufficient, collect live GitHub CheckRun evidence for the exact current PR head and run the committed require-checks verifier for all trusted peer requirements (CI::python, CI::rust, CI::package under the configured trusted workflow/check identities). Pending, failed, cancelled, skipped-required, stale-head, status-only, duplicate/lookalike, malformed, or missing evidence remains blocking.

Preserve every classifier refusal boundary already covered by the 87 focused tests: any Rust/Cargo/native crate/stub/maturin metadata/package/lock/requirements/workflow change, mixed imports, actual test/setup/teardown/internal failures, truncation/crash, malformed or unsafe path must remain an ordinary blocking test failure. Do not build or import PR-selected native code in the source-only sandbox, add network access, create a compatibility stub, weaken coverage, or let peer evidence approve by itself.

Do not force-push, use -X ours/-X theirs, alter reviewer credentials/model routing/branch protection, or create temporary/self-modifying/write-capable workflows. After integration run the focused peer-gate suite with exact 100% production statement/branch/docstring coverage, complete central suite and Strix quick gate, actionlint/compilation, then all exact-head Security Scan, SAST, CodeQL, Python Security, Secret Scan, OSV, Scorecard, and SBOM gates. Keep Draft until exact-head automated and qualifying independent review are clean; do not merge or synthesize approval.

Copy link
Copy Markdown
Contributor Author

Exact-head RCA for 247ebc6e89b6948b1848794cb52901dbac5e3c66 (observed failing run 31150926881; independently resolved live main 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba; live target base 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba):

First failing boundary: Python Native Extension Peer Gate Quality CI job 92843314735, focused peer-gate tests. Three permanent contracts expect python_native_peer_check_required=0, a distinct Python native-extension source-only deferral evidence section, and live exact-head Python/Rust/package check-run binding; none exists in the current review workflow. Python 3.10 compatibility passes. This is a test-first incomplete feature, not an infrastructure failure. Smallest remedy: implement the bounded fail-closed production evidence/gate behavior on the owning branch, then rerun focused coverage before the full suite; blind rerun is rejected.

Source mutation is frozen in this invocation because this open PR’s existing writer owns the branch/path. The branch remains Draft; no approval, success, or merge authority is inferred.

@seonghobae
seonghobae marked this pull request as ready for review August 12, 2026 06:08

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
tests/test_python_native_extension_peer_gate_workflow_contract.py (1)

31-82: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

require-checks 경로에 대한 계약 단언을 강화하십시오. 워크플로의 관련 값은 존재하지만, 테스트의 "check-runs", "__typename", "CheckRun" 단언은 여러 무관한 위치를 통과할 수 있습니다. collect_successful_python_native_peer_check_evidence 블록을 추출한 뒤 해당 블록에서 exact-head CheckRun 필터를 검사하십시오.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_python_native_extension_peer_gate_workflow_contract.py` around
lines 31 - 82, Strengthen
test_approval_requires_live_exact_head_python_rust_and_package_checkruns by
extracting the collect_successful_python_native_peer_check_evidence block from
the workflow and asserting that check-runs, __typename, and CheckRun appear
within that block. Keep the exact-head and required-check assertions scoped to
the relevant require-checks path rather than matching unrelated workflow text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/opencode-review-dispatch.yml:
- Around line 927-929: Update the temporary pytest log creation near
python_native_pytest_log to place the file under ${RUNNER_TEMP} (or otherwise
enforce an explicit size limit with truncation failure handling), instead of
relying on unbounded /tmp output. Keep the existing python_native_changed_files
and python_native_pyproject_snapshot temporary-file behavior unchanged.
- Line 930: changed_files_for_coverage가 rename된 파일의 이전 경로를 보존하도록 수정하십시오. rename을
add/delete로 기록하는 inventory를 사용하거나, helper가 old/new 경로를 모두 포함하는 name-status 입력을
검증·처리하게 하여 native crate 밖으로 이동한 경우에도 제거된 native 경로가 분류기에 전달되게 하십시오. 해당 rename 회귀
동작을 검증하는 테스트도 추가하십시오.
- Around line 7250-7251: statusCheckRollup 조회에서 contexts(first: 100)를
pageInfo.hasNextPage와 endCursor를 활용한 커서 페이지네이션으로 변경해 모든 CheckRun을 검사하도록 하십시오. 필수
CI::python、CI::rust、CI::package 검증이 후속 페이지에서도 수행되도록 기존 검증 흐름을 유지하고, 101번째 항목에 필수
CheckRun이 있는 회귀 테스트를 추가하십시오.

In `@scripts/ci/python_native_extension_peer_gate.py`:
- Around line 290-310: Update the changed-path checks in the peer-gate function
to always block repository-root pyproject.toml changes, including when
manifest_parent is nested, and to recognize pip dependency input files such as
requirements*.in alongside existing requirements*.txt files regardless of
directory. Extend the relevant tests with constraints.txt, requirements-ci.in,
and nested-project root pyproject.toml cases.

---

Nitpick comments:
In `@tests/test_python_native_extension_peer_gate_workflow_contract.py`:
- Around line 31-82: Strengthen
test_approval_requires_live_exact_head_python_rust_and_package_checkruns by
extracting the collect_successful_python_native_peer_check_evidence block from
the workflow and asserting that check-runs, __typename, and CheckRun appear
within that block. Keep the exact-head and required-check assertions scoped to
the relevant require-checks path rather than matching unrelated workflow text.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6bdeb467-44ec-4947-837a-724dc657f14b

📥 Commits

Reviewing files that changed from the base of the PR and between 6eb06cd and f1dfc2f.

📒 Files selected for processing (13)
  • .github/workflows/opencode-review-dispatch.yml
  • .github/workflows/python-native-extension-peer-gate-quality-ci.yml
  • CHANGELOG.md
  • docs/doctoring/python-native-extension-peer-evidence.md
  • docs/doctoring/python-native-extension-peer-file-safety.md
  • scripts/ci/python_native_extension_peer_gate.py
  • tests/test_opencode_agent_contract.py
  • tests/test_python_native_extension_peer_gate.py
  • tests/test_python_native_extension_peer_gate_file_safety.py
  • tests/test_python_native_extension_peer_gate_nested_project.py
  • tests/test_python_native_extension_peer_gate_requirements_directory.py
  • tests/test_python_native_extension_peer_gate_workflow_contract.py
  • tests/test_repository_branch_coverage_pr743_cleanup.py

Comment thread .github/workflows/opencode-review-dispatch.yml Outdated
Comment thread .github/workflows/opencode-review-dispatch.yml
Comment thread .github/workflows/opencode-review-dispatch.yml Outdated
Comment thread scripts/ci/python_native_extension_peer_gate.py

Copy link
Copy Markdown
Contributor Author

@opencode-agent

Review-only request for exact current head 9299a4515b3436607bbad895bf1c73205dce3582 against independently resolved live protected base 6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

Please inspect the five-file repair for all four addressed CodeRabbit findings: runner-owned pytest-log placement, rename-as-delete/add boundary inventory, fail-closed cursor pagination across every exact-head CheckRun page, and repository-wide pyproject.toml plus requirements*.in/constraints*.txt trust-boundary invalidation. Also inspect the executable regressions, including a required check beyond the first 100 contexts and rename-out-of-native-boundary behavior.

The exact-head focused quality workflow 31570671841 and Strix workflow 31570671729 are terminal-success. Other security/supply-chain checks remain queued; they are separate gate evidence and must not be interpreted as semantic source findings or approval. Do not modify the branch, approve on behalf of the author, merge, release, weaken protection, or reuse predecessor-head review evidence.

@seonghobae
seonghobae enabled auto-merge (squash) August 12, 2026 10:50

Copy link
Copy Markdown
Contributor Author

Exact-current-head review request for 9299a4515b3436607bbad895bf1c73205dce3582 over protected main@6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba.

Review the complete 13-file bounded PyO3 peer-evidence gate: defer only complete pytest collection failures caused exclusively by the unchanged declared native module; sealed regular pyproject.toml identity and bounded reads; fail-closed changed-path boundary including old/new rename paths, root/nested pyprojects, Cargo/native/packaging/workflow and requirements/constraints .txt/.in inputs; distinct DEFERRED, never PASS; exact-head paginated successful CheckRun evidence for CI::python, CI::rust, and CI::package; and bounded runner-owned pytest evidence. All four CodeRabbit findings and the scoped contract nitpick are addressed and resolved. Python Native Extension Peer Gate Quality CI, Trusted uv Materializer Quality CI, Strix Changed Path Quality CI, CodeQL PR, Python Security, Security Scan, SAST Semgrep, Secret Scan, OSV-Scanner PR, Scorecard PR, and SBOM Generation are terminal-success on this exact head.

Keep the exact head unchanged. Do not transfer predecessor evidence, synthesize author approval, build PR-selected native code in the source sandbox, treat deferral as success, relax peer-check/path/file boundaries, merge, release, or bypass protection.

@coderabbitai review
@opencode-agent review
@cwl-noema-review review
@strix review

Copy link
Copy Markdown
Contributor Author

@opencode-agent address

Finish this existing Draft PR in place. Do not create a stacked PR, compatibility stub, temporary branch writer, or networked execution of PR-selected native code.

Integrate scripts/ci/python_native_extension_peer_gate.py into the canonical central coverage/review path alongside the existing R peer-evidence architecture:

  1. Capture every real Python pytest/coverage command's bounded complete log and exit status without changing successful behavior.
  2. Invoke classify-pytest only after a genuine Python-suite failure, using the exact log, a regular non-symlink pyproject.toml, and the exact base-to-head changed-file inventory.
  3. Treat a valid classification as a distinct PyO3 source-only deferral marker, never ordinary passing coverage.
  4. In the trusted review/approval phase, query live CheckRun objects at the exact PR head and invoke require-checks for repository-owned Python, Rust/PyO3, packaging, and every configured GPU/native/fuzz gate. Reject statuses, stale heads, pending/cancelled/skipped/failed checks, duplicates, lookalikes, missing or malformed evidence.
  5. Preserve R deferral independently. Either deferral remains blocking until its own exact-head peer evidence succeeds.
  6. Add permanent contracts for the pure declared-module collection-failure shape; mixed imports; test/setup/teardown/internal/crash/truncation failures; native/Cargo/Rust/stub/package/lock/requirements/workflow changes; exact-head peer checks; stale/pending/failed/status/lookalike evidence; R/PyO3 coexistence; summary wording; and approval enforcement.
  7. Include the helper and integration contracts in Python 3.10/3.14 compilation, 100% production statement/branch coverage, 100% public docstrings, actionlint, security/supply-chain, and clean-tree gates. Update doctoring and CHANGELOG.md with authoritative APA 7 references and explicit interpretation limits.

Keep Draft until the direct canonical integration and all same-head gates are green. Do not approve, merge, release, alter reviewer credentials/protections, or use COPILOT_GITHUB_TOKEN.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

expected_head='9299a4515b3436607bbad895bf1c73205dce3582'
repo='ContextualWisdomLab/.github'
pr='789'

echo '== checked-out HEAD =='
git rev-parse HEAD
echo '== expected head =='
printf '%s\n' "$expected_head"

echo '== PR metadata =='
gh pr view "$pr" --repo "$repo" --json number,state,isDraft,headRefName,headRefOid,baseRefName,baseRefOid,mergeStateStatus,reviewDecision

echo '== changed files against base =='
git diff --name-status '6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba...HEAD'

echo '== relevant file outlines =='
ast-grep outline scripts/ci/python_native_extension_peer_gate.py --items all --view expanded
ast-grep outline tests/test_python_native_extension_peer_gate_workflow_contract.py --items all --view expanded

echo '== workflow symbols and integration references =='
rg -n -C 4 \
  -e 'r_peer_check_required' \
  -e 'python_native_peer_check_required' \
  -e 'python_native_extension_peer_gate\.py' \
  -e 'classify-pytest' \
  -e 'require-checks' \
  -e 'Python native-extension source-only deferral' \
  -e 'Python native-extension peer evidence' \
  .github/workflows/opencode-review-dispatch.yml

echo '== helper exact-head and changed-file logic references =='
rg -n -C 3 \
  -e 'def (classify_pytest_inputs|has_required_exact_head_checks|_read_bounded_regular)' \
  -e 'requirements|constraints|pyproject|rename|previous|old' \
  -e 'endCursor|hasNextPage|CheckRun|workflow' \
  scripts/ci/python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_workflow_contract.py

echo '== current-head check runs =='
gh api --paginate \
  "/repos/ContextualWisdomLab/.github/commits/$expected_head/check-runs?per_page=100" \
  --jq '.check_runs[] | [.name,.status,.conclusion,.head_sha,.details_url] | `@tsv`' || true

echo '== unresolved review threads =='
gh api graphql -F owner='ContextualWisdomLab' -F name='.github' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes { isResolved comments(first: 1) { nodes { author { login } body } } }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | [.comments.nodes[0].author.login, .comments.nodes[0].body] | `@json`' || true

Length of output: 78558


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== coverage execution and PyO3 classification =='
sed -n '780,1020p' .github/workflows/opencode-review-dispatch.yml

echo '== changed-file inventory function =='
rg -n -A100 -B10 'changed_files_for_coverage\(\)' .github/workflows/opencode-review-dispatch.yml

echo '== coverage summary, outputs, and transfer boundary =='
sed -n '2030,2140p' .github/workflows/opencode-review-dispatch.yml
rg -n -C5 -e 'COVERAGE_EVIDENCE_SUMMARY' -e 'r_peer_check_required' -e 'python_native_peer_check_required' .github/workflows/opencode-review-dispatch.yml

echo '== Python native peer collector and gate call sites =='
sed -n '7180,7425p' .github/workflows/opencode-review-dispatch.yml
rg -n -C5 -e 'coverage_defers_to_python_native_peer_checks' -e 'require_successful_python_native_peer_checks' -e 'collect_successful_python_native_peer_check_evidence' .github/workflows/opencode-review-dispatch.yml

echo '== helper implementations =='
sed -n '64,165p' scripts/ci/python_native_extension_peer_gate.py
sed -n '168,398p' scripts/ci/python_native_extension_peer_gate.py
sed -n '399,536p' scripts/ci/python_native_extension_peer_gate.py

echo '== complete workflow-contract tests =='
cat -n tests/test_python_native_extension_peer_gate_workflow_contract.py

echo '== focused base-to-head diff =='
git diff --no-ext-diff --unified=40 '6eb06cdd08c79a06f7b390069d4ffa49e2eb7dba...HEAD' -- \
  .github/workflows/opencode-review-dispatch.yml \
  scripts/ci/python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_workflow_contract.py \
  tests/test_python_native_extension_peer_gate_file_safety.py \
  tests/test_python_native_extension_peer_gate_requirements_directory.py

Length of output: 161049


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== all Python native peer-gate call sites and enclosing control flow =='
rg -n -C 18 \
  -e 'require_python_native_peer_checks_for_deferred_coverage\(\)' \
  -e 'require_python_native_peer_checks_for_deferred_coverage' \
  -e 'COVERAGE_EVIDENCE_RESULT' \
  -e 'create_pull_review.*APPROVE' \
  -e 'create_pull_review_with_payload.*APPROVE' \
  .github/workflows/opencode-review-dispatch.yml

echo '== verifier and test coverage for duplicate CheckRun records =='
rg -n -C 8 \
  -e 'len\(matches\)' \
  -e 'duplicate' \
  -e 'successful_checks' \
  -e 'has_required_exact_head_checks' \
  -e 'require-checks' \
  tests/test_python_native_extension_peer_gate.py \
  tests/test_python_native_extension_peer_gate_workflow_contract.py \
  scripts/ci/python_native_extension_peer_gate.py

echo '== final coverage decision and all result markers =='
rg -n -C 4 \
  -e 'Coverage Decision' \
  -e 'Result: PASS' \
  -e 'Result: DEFERRED' \
  -e 'Test evidence: supported repository test suites passed' \
  .github/workflows/opencode-review-dispatch.yml

echo '== permanent quality workflow =='
cat -n .github/workflows/python-native-extension-peer-gate-quality-ci.yml

echo '== doctoring and changelog references =='
rg -n -C 3 \
  -e 'DEFERRED|CheckRun|PyO3|maturin|source-only|exact-head|duplicate|rerun' \
  CHANGELOG.md \
  docs/doctoring/python-native-extension-peer-evidence.md \
  docs/doctoring/python-native-extension-peer-file-safety.md

echo '== PR review and latest current-head check suites =='
gh pr view 789 --repo ContextualWisdomLab/.github --json isDraft,reviewDecision,reviews,headRefOid
gh api "/repos/ContextualWisdomLab/.github/commits/9299a4515b3436607bbad895bf1c73205dce3582/check-suites?per_page=100" \
  --jq '.check_suites[] | [.app.slug,.status,.conclusion,.head_sha,.workflow_run.url] | `@tsv`' || true

Length of output: 90605


@seonghobae I found one blocking implementation defect.

[P1] Reject duplicate matching CheckRun records

In scripts/ci/python_native_extension_peer_gate.py, Lines 446–462, has_required_exact_head_checks() accepts multiple matching CheckRun records when every match is COMPLETED and SUCCESS.

The function checks only that matches is nonempty. It does not require len(matches) == 1.

This conflicts with the stated fail-closed contract. Duplicate same-head CI::python, CI::rust, or CI::package records are ambiguous rerun evidence. The approval path can currently accept two successful matching records. It must reject that inventory unless the workflow implements and verifies an explicit latest-rerun rule.

Update the verifier to require exactly one matching record for each required (workflow, name) pair. Add a regression that appends a second successful matching record and expects require-checks to fail. Keep the existing regression for duplicate --required-check declarations.

I also verified these non-source conditions:

  • The checked-out revision matches 9299a4515b3436607bbad895bf1c73205dce3582.
  • The PyO3 classifier uses the bounded runner-owned log, sealed pyproject.toml snapshot, and rename-preserving changed-file inventory.
  • The collector paginates statusCheckRollup.contexts and validates CheckRun records against PR_HEAD_SHA.
  • The workflow invokes the Python peer-check gate in the observed approval and fallback paths.
  • There are no unresolved review threads.
  • GitHub reports #789 as not Draft. It also reports REVIEW_REQUIRED.
  • codecov, claude, and coderabbitai check suites remain queued on this exact head.

I applied the repository rule that only successful checks on the exact current head count as merge evidence. I do not approve this PR.


🧠 Learnings used
Learnt from: seonghobae
Repo: ContextualWisdomLab/.github PR: 0
File: :0-0
Timestamp: 2026-08-05T13:44:10.007Z
Learning: For PR `#782`, only successful checks associated with the exact current head are valid merge evidence. Do not treat queued, in-progress, cancelled, predecessor-head, temporary-workflow, or administrative-bypass results as passing evidence. Before a formal approval, verify that the direct security and supply-chain workflows, the permanent hourly NVIDIA NIM contract, current-head reviews, unresolved-thread checks, and an independent approval have completed successfully.

You are interacting with an AI system.

Record the inclusion-of-untrusted-control-sphere prohibition so a source-only
sandbox cannot treat a missing compiled extension as license to run
pull-request maturin or cargo hooks. Force the trusted-uv installer tests
onto the linux x86_64 runner path and add the control-plane architecture
diagram.
@seonghobae

Copy link
Copy Markdown
Contributor Author

Hourly loop 2026-08-13: re-read exact head ba6a885188dab96143cdb02cf364546c5e95f462 against the four CodeRabbit majors.

Current head already implements each one:

  • pytest capture uses mktemp "$RUNNER_TEMP/python-native-pytest.XXXXXX"
  • changed_files_for_coverage uses git diff --name-only --no-renames, so a crate-to-docs rename still lists both old and new paths (covered by test_renamed_native_input_preserves_old_and_new_paths)
  • collect_successful_python_native_peer_check_evidence pages statusCheckRollup.contexts with pageInfo.hasNextPage / endCursor
  • _touches_native_or_trust_boundary blocks every pyproject.toml, requirements*.in / constraints*.txt, and any requirements/ directory

Removed stale needs-revision / do-not-merge. Did not self-approve. Merge remains blocked on #948.

A markdown file in docs/requirements/ is not a lock or packaging
change. Only .in/.txt/.lock names in a requirements path invalidate
source-only sandbox deferral.
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.

1 participant