Skip to content

fix(review): virtual workspace 커버리지와 Python 환경 정합성 복구#565

Open
seonghobae wants to merge 2 commits into
mainfrom
fix/opencode-virtual-workspace-coverage-env
Open

fix(review): virtual workspace 커버리지와 Python 환경 정합성 복구#565
seonghobae wants to merge 2 commits into
mainfrom
fix/opencode-virtual-workspace-coverage-env

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

문제

fast-mlsirm PR #160의 current-head coverage-evidence에서 두 독립적인 중앙 계약 오류가 재현됐습니다.

  1. uv sync가 프로젝트 .venv에 NumPy/pytest를 설치했지만, 신뢰 실행기는 시스템 PATHpytest를 실행하여 21개 수집 오류가 발생했습니다.
  2. Rust 기준 파서가 [package.metadata.opencode.coverage]만 읽어, 가상 Cargo workspace의 [workspace.metadata.opencode.coverage]를 표현할 수 없었습니다. 그 결과 중앙 기본값 100%가 강제됐습니다.

변경

  • 검증된 pytest argv의 shell=False 경계를 유지하면서, 존재하는 <project>/.venv/binPATH 앞에 둡니다.
  • Rust 커버리지 기준 파서를 신뢰 스크립트로 분리했습니다.
  • package metadata 우선, virtual-workspace metadata fallback을 지원합니다.
  • bool/비수치/0~100 범위 밖 값은 계속 fail-closed입니다.
  • 보안 경계·워크플로 계약·quick-gate 회귀 테스트를 보강했습니다.

검증

  • python3 -m pytest -q: 622 passed
  • 관련 보안/커버리지/에이전트 계약: 72 passed
  • fast-mlsirm 실제 virtual workspace manifest 파싱: 90
  • git diff --check: 통과

보안

PR이 지정한 셸을 실행하지 않습니다. 기존 allowlist를 통과한 pytest argv만 shell=False로 실행하며, 기준 파싱은 중앙 default-branch의 신뢰 코드에서 수행합니다.

Problem:
Required OpenCode coverage could not validate fast-mlsirm even after its Rust suite compiled and passed. The Python evidence command collected 21 import errors for dependencies already installed by uv, and the Rust gate forced the 100% central default because the target is a virtual Cargo workspace.

Reproduction/Evidence:
fast-mlsirm PR #160 coverage-evidence job 87244269792 installed the optional dev environment, then executed configured pytest outside .venv and failed to import numpy. Its root Cargo.toml has only [workspace], while rust_coverage_fail_under_lines inspected only [package.metadata] and therefore ran cargo llvm-cov with --fail-under-lines 100 despite the repository-owned baseline facility.

Root cause:
The trusted pytest executor preserved the system PATH after uv sync created <project>/.venv, so direct pytest/python argv did not resolve in the synchronized environment. The inline TOML parser modeled package manifests only and omitted the valid metadata namespace for virtual workspaces.

Change:
- Prepend an existing project .venv/bin to PATH while preserving shell=False and validated argv execution.
- Move Rust threshold resolution into a trusted, tested parser.
- Resolve package metadata first and workspace metadata as the virtual-workspace fallback.
- Keep invalid booleans, types, and values outside 0..100 fail-closed.
- Extend workflow, security-boundary, and quick-gate contracts for both paths.

Validation:
- python3 -m pytest -q: 622 passed
- targeted security/coverage/agent contracts: 72 passed
- parser against fast-mlsirm virtual workspace Cargo.toml: emitted 90
- git diff --check: passed
- long Strix quick-gate launched and continued through its expected negative fixtures; repository CI remains the authoritative complete shell-gate run

Security:
No PR-controlled shell is introduced. Commands remain allowlisted pytest argv executed with shell=False, and coverage metadata is parsed by trusted default-branch code with numeric range validation.
@seonghobae seonghobae enabled auto-merge (squash) July 15, 2026 01:37

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 40df799bece855efe37b2d99be78cd881d6fe15c.

  • Head SHA: 40df799bece855efe37b2d99be78cd881d6fe15c

  • Workflow run: 29382025123

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: opencode-review.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow: opencode-review.yml"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["CI script (3 files)"]
  S2 --> I2["review and security gate shell path"]
  I2 --> R2["Review risk: CI script (3 files)"]
  R2 --> V2["bash -n plus Strix self-test"]
  Evidence --> S3["Test (3 files)"]
  S3 --> I3["regression suite"]
  I3 --> R3["Review risk: Test (3 files)"]
  R3 --> V3["targeted test run"]
Loading

@opencode-agent

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: 40df799bece855efe37b2d99be78cd881d6fe15c
  • Workflow run: 29382025123
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 40df799bece855efe37b2d99be78cd881d6fe15c.

  • Head SHA: 40df799bece855efe37b2d99be78cd881d6fe15c

  • Workflow run: 29382025123

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: opencode-review.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow: opencode-review.yml"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["CI script (3 files)"]
  S2 --> I2["review and security gate shell path"]
  I2 --> R2["Review risk: CI script (3 files)"]
  R2 --> V2["bash -n plus Strix self-test"]
  Evidence --> S3["Test (3 files)"]
  S3 --> I3["regression suite"]
  I3 --> R3["Review risk: Test (3 files)"]
  R3 --> V3["targeted test run"]
Loading

Problem:
The central repository enforces 100% Python coverage. PR #565 first ran under the previous trusted workflow and reported rust_coverage_threshold.py at 76%, leaving its argparse, error-reporting, and __main__ paths unproven even though the parser logic tests passed.

Evidence:
Required coverage-evidence job 87247543719 reported 5,533 statements, 11 missed statements, 99% total coverage, with all misses at rust_coverage_threshold.py lines 55-64 and 68.

Change:
Add end-to-end tests for normalized CLI output, invalid metadata diagnostics and exit status, and the executable __main__ entrypoint when no repository baseline is declared.

Validation:
- parser test module: 10 passed
- python3 -m coverage run -m pytest -q: 625 passed
- python3 -m coverage report --show-missing: 5,533 statements, 0 missed, 100%
- git diff --check: passed
@seonghobae seonghobae dismissed opencode-agent[bot]’s stale review July 15, 2026 03:12

Superseded automated OpenCode change request from previous head 40df799; current head 65ddf64 has passing coverage and security checks. Current-head model output remains a separate required-review state.

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