-
Notifications
You must be signed in to change notification settings - Fork 0
fix(coverage): replace stale LLVM runtime-boundary repair #827
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
8
commits into
main
Choose a base branch
from
fix/opencode-rust-coverage-runtime-boundary-main
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.
+399
−1
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3887fab
test(coverage): specify LLVM 19 isolated runtime contract
seonghobae da31228
fix(coverage): provision verified LLVM 19 tools
seonghobae edddecd
ci(coverage): add exact-head LLVM runtime quality gate
seonghobae 6eb06cd
fix(strix): bound quality timeout fixtures (#823)
seonghobae 4f57dec
Merge edddecdfa2b66b61f472db8f754270ffc2fd147c into 6eb06cdd08c79a06f…
seonghobae 7f9c197
fix(coverage): preserve LLVM 19 across sandbox runtime
seonghobae 2a57f46
test(coverage): require live Rust toolchain trigger paths
seonghobae c100cca
docs(coverage): document LLVM 19 runtime boundary
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
56 changes: 56 additions & 0 deletions
56
.github/workflows/opencode-rust-coverage-toolchain-quality-ci.yml
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,56 @@ | ||
| name: OpenCode Rust Coverage Toolchain Quality CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - ".github/workflows/opencode-review-dispatch.yml" | ||
| - ".github/workflows/opencode-rust-coverage-toolchain-quality-ci.yml" | ||
| - "tests/test_opencode_rust_coverage_toolchain_contract.py" | ||
| - "docs/doctoring/opencode-rust-coverage-runtime-boundary.md" | ||
| - "CHANGELOG.md" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: opencode-rust-coverage-toolchain-quality-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| quality: | ||
| name: quality | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 15 | ||
| env: | ||
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | ||
| steps: | ||
| - name: Harden runner | ||
| uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0 | ||
| with: | ||
| egress-policy: audit | ||
|
|
||
| - name: Checkout exact pull request head | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | ||
| with: | ||
| python-version: "3.14" | ||
| cache: pip | ||
| cache-dependency-path: requirements-opencode-review-ci-hashes.txt | ||
|
|
||
| - name: Install exact hash-locked test tooling | ||
| run: >- | ||
| python -m pip install --disable-pip-version-check --require-hashes | ||
| -r requirements-opencode-review-ci-hashes.txt | ||
|
|
||
| - name: Run permanent LLVM runtime-boundary contract | ||
| run: | | ||
| set -euo pipefail | ||
| python -m pytest -q tests/test_opencode_rust_coverage_toolchain_contract.py | ||
| python -m compileall -q tests/test_opencode_rust_coverage_toolchain_contract.py | ||
| git diff --check "${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}" | ||
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
114 changes: 114 additions & 0 deletions
114
docs/doctoring/opencode-rust-coverage-runtime-boundary.md
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,114 @@ | ||
| # OpenCode Rust coverage LLVM runtime boundary | ||
|
|
||
| ## Decision | ||
|
|
||
| The trusted OpenCode coverage sandbox binds Rust coverage to the reviewed LLVM | ||
| 19 executables shipped by Debian's `llvm-19` package: | ||
|
|
||
| - `LLVM_COV=/usr/bin/llvm-cov-19` | ||
| - `LLVM_PROFDATA=/usr/bin/llvm-profdata-19` | ||
|
|
||
| These are compatibility and trust-boundary constants, not caller-selectable | ||
| configuration. The coverage image installs `llvm-19`, declares both exact paths, | ||
| and fails the image build unless both are executable before the pinned | ||
| `cargo-llvm-cov` archive is admitted. The isolated `docker run` passes the same | ||
| literal values through the networkless runtime boundary. Inside the container, | ||
| `ensure_rust_toolchain()` requires exact string equality and executable files | ||
| before the first `cargo llvm-cov` invocation. | ||
|
|
||
| The runtime MUST NOT fall back to unversioned `llvm-cov` or `llvm-profdata`, a | ||
| host-runner tool, a pull-request-selected path, or a dynamically downloaded LLVM | ||
| binary. Missing, changed, or non-executable reviewed paths are coverage-evidence | ||
| failures rather than reasons to measure a different toolchain. | ||
|
|
||
| ## Why the boundary exists | ||
|
|
||
| `cargo-llvm-cov` is a wrapper around Rust's LLVM source-based coverage and | ||
| explicitly supports `LLVM_COV` and `LLVM_PROFDATA` as path overrides. Its | ||
| current project documentation states that the LLVM tools must be compatible | ||
| with the LLVM version used by `rustc`. Allowing ambient `PATH` discovery would | ||
| therefore make a runner-image change capable of silently changing the coverage | ||
| producer. | ||
|
|
||
| Debian bookworm currently publishes the versioned `llvm-19` package from | ||
| `llvm-toolchain-19`; Debian package file inventories expose versioned LLVM 19 | ||
| tool entry points including `llvm-cov-19`. Pinning the reviewed executable names | ||
| inside the image converts that mutable ambient dependency into an explicit | ||
| contract that can be checked before source execution. | ||
|
|
||
| ## Trust-boundary sequence | ||
|
|
||
| ```mermaid | ||
| flowchart LR | ||
| A["Digest-pinned coverage base image"] --> B["Install Debian llvm-19"] | ||
| B --> C["ENV exact LLVM_COV / LLVM_PROFDATA paths"] | ||
| C --> D["Build-time test -x for both executables"] | ||
| D --> E["Verify pinned cargo-llvm-cov archive"] | ||
| E --> F["docker run --network=none with literal LLVM env values"] | ||
| F --> G["ensure_rust_toolchain exact-value + executable checks"] | ||
| G --> H["cargo llvm-cov"] | ||
| ``` | ||
|
|
||
| Each arrow is fail-closed. A later stage does not repair or broaden an earlier | ||
| stage's failed trust decision. | ||
|
|
||
| ## Security and supply-chain implications | ||
|
|
||
| The reviewed paths are fixed in trusted central workflow source. Pull-request | ||
| content cannot choose an LLVM package, executable path, download origin, or | ||
| runtime environment value. The existing coverage sandbox retains | ||
| `--network=none`, credential/Git isolation, exact-head/base materialization, | ||
| and the separately checksum-pinned `cargo-llvm-cov` archive. | ||
|
|
||
| This binding narrows reproducibility risk but does not by itself attest Debian's | ||
| whole package supply chain or prove a future Rust toolchain is compatible with | ||
| LLVM 19. A future rustc or base-image upgrade must revalidate compatibility and | ||
| update this contract, its tests, and CHANGELOG in one reviewed change rather | ||
| than silently selecting a different binary. | ||
|
|
||
| ## Failure and recovery | ||
|
|
||
| If the image cannot install `llvm-19`, either reviewed executable is missing or | ||
| non-executable, the runtime value differs from the literal reviewed path, or the | ||
| isolated runtime does not receive the values, Rust coverage fails closed before | ||
| `cargo llvm-cov` runs. The operator should identify whether the failure comes | ||
| from Debian package availability, the pinned image/base generation, a central | ||
| workflow regression, or an intentional Rust/LLVM compatibility change. | ||
|
|
||
| Do not work around the failure by removing the exact-value check, using an | ||
| unversioned executable, adding network access to the PR runtime, or accepting a | ||
| host-provided path. A deliberate toolchain migration requires fresh authoritative | ||
| compatibility evidence and the same RED→GREEN exact-head verification sequence. | ||
|
|
||
| ## Verification contract | ||
|
|
||
| `tests/test_opencode_rust_coverage_toolchain_contract.py` proves that: | ||
|
|
||
| 1. `llvm-19` is provisioned before the pinned `cargo-llvm-cov` archive; | ||
| 2. the image binds the two exact LLVM 19 executable paths; | ||
| 3. image construction verifies both executables; | ||
| 4. the isolated `docker run` receives both literal values before the coverage | ||
| image argument; | ||
| 5. `ensure_rust_toolchain()` revalidates exact values and executability before | ||
| Rust coverage; and | ||
| 6. every exact path named by the permanent quality workflow's | ||
| `pull_request.paths` filter resolves to a repository file, preventing a | ||
| dangling documentation trigger from becoming invisible debt. | ||
|
|
||
| The permanent quality workflow runs on Python 3.14, checks out the exact PR head, | ||
| executes the focused contract, compiles the test, and applies `git diff --check`. | ||
| Repository security and supply-chain workflows remain separate authorities. | ||
|
|
||
| ## References | ||
|
|
||
| Debian Project. (2026). *Package: llvm-19 (1:19.1.7-3~deb12u1), bookworm*. | ||
| Debian Packages. Retrieved August 10, 2026, from | ||
| https://packages.debian.org/bookworm/llvm-19 | ||
|
|
||
| Debian Project. (2026). *File list of package llvm-19*. Debian Packages. | ||
| Retrieved August 10, 2026, from | ||
| https://packages.debian.org/bookworm/amd64/llvm-19/filelist | ||
|
|
||
| Taiki Endo. (2026). *cargo-llvm-cov: Cargo subcommand to use LLVM source-based | ||
| code coverage*. GitHub. Retrieved August 10, 2026, from | ||
| https://github.com/taiki-e/cargo-llvm-cov |
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,51 @@ | ||
| # Strix quality timeout-fixture budget | ||
|
|
||
| 검토 기준일: **2026-08-07** | ||
|
|
||
| ## Incident | ||
|
|
||
| `Strix Changed Path Quality CI`는 실제 Strix 모델 스캔이 아니라 중앙 정책과 `scripts/ci/test_strix_quick_gate.sh`의 결정적 회귀를 검증하는 품질 게이트입니다. 그러나 테스트 하네스의 timeout fixture가 기본적으로 실제 프로세스 제한 30초와 가짜 sleep 60초를 사용하면서 여러 timeout/fallback 경로를 순차 실행했습니다. | ||
|
|
||
| PR #821 exact head `f92784f389317d512376a0725cbd78606b2e832c`의 품질 실행은 저장소 테스트 978개와 subtest 16개를 55.11초에 완료한 뒤 timeout fixture 구간을 수행하다가 job의 10분 제한에서 취소되었습니다. 동일 exact head의 rerun도 같은 단계에서 취소되었습니다. 이 결과는 소스 정책 실패가 아니라 결정적 테스트 fixture의 시간 스케일이 품질 job 예산과 맞지 않는다는 증거입니다. | ||
|
|
||
| ## Decision | ||
|
|
||
| 품질 workflow의 `Verify exact-head path policy and syntax` 단계에 테스트 전용 환경값만 전달합니다. | ||
|
|
||
| - `STRIX_TEST_PROCESS_TIMEOUT_SECONDS=3` | ||
| - `STRIX_TEST_FAKE_SLEEP_SECONDS=5` | ||
|
|
||
| `test_strix_quick_gate.sh`는 이미 두 값을 명시적 테스트 seam으로 제공하며, fake sleep이 process timeout보다 커야 한다고 fail closed 검증합니다. 따라서 timeout, cleanup, fallback의 순서와 결론은 그대로 유지하면서 wall-clock 대기만 축소합니다. | ||
|
|
||
| 다음 production scanner 설정은 이 변경에서 건드리지 않습니다. | ||
|
|
||
| - `STRIX_PROCESS_TIMEOUT_SECONDS` | ||
| - `STRIX_TOTAL_TIMEOUT_SECONDS` | ||
| - `LLM_TIMEOUT` | ||
| - 실제 Strix workflow의 90분 process budget과 95분 total budget | ||
| - 모델, provider, credential, 권한, changed-path 정책 및 branch-protection 의미 | ||
|
|
||
| 테스트 전용 환경값은 해당 품질 step에만 존재해야 하며 production Strix 실행으로 전파되어서는 안 됩니다. | ||
|
|
||
| ## Verification contract | ||
|
|
||
| `tests/test_strix_quality_timeout_fixture_budget.py`는 정확한 named step을 분리하여 다음을 고정합니다. | ||
|
|
||
| 1. 짧은 process/fake-sleep fixture 값이 모두 존재합니다. | ||
| 2. 하네스 실행이 같은 step에서 유지됩니다. | ||
| 3. production timeout 변수는 해당 step에서 override되지 않습니다. | ||
| 4. workflow trigger가 이 회귀 파일 자체를 포함하여 이후 변경이 정확한 품질 gate를 다시 실행합니다. | ||
|
|
||
| 전체 `tests` suite, shell harness, Python compilation, Bash syntax 및 clean-worktree 검증은 계속 같은 exact-head quality step에서 수행합니다. 품질 gate의 성공은 실제 Strix 모델 security review, 독립 승인 또는 branch protection을 대체하지 않습니다. | ||
|
|
||
| ## Rollback | ||
|
|
||
| 3초/5초 fixture가 GitHub-hosted runner에서 재현 가능한 race margin을 제공하지 못한다는 결정적 실패가 관찰되면 테스트 전용 값만 가장 작은 재현 가능한 상한으로 올립니다. production scanner timeout을 낮추거나 품질 테스트를 삭제하여 문제를 숨기지 않습니다. 10분 job timeout 자체를 늘리는 것은 fixture 가속으로도 완료할 수 없다는 실행 증거가 있을 때 별도 검토합니다. | ||
|
|
||
| ## References (APA 7th) | ||
|
|
||
| GitHub. (n.d.). *Workflow syntax for GitHub Actions*. GitHub Docs. Retrieved August 7, 2026, from https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax | ||
|
|
||
| GitHub. (n.d.). *Contexts reference*. GitHub Docs. Retrieved August 7, 2026, from https://docs.github.com/en/actions/reference/workflows-and-actions/contexts | ||
|
|
||
| GitHub. (n.d.). *Viewing job execution time*. GitHub Docs. Retrieved August 7, 2026, from https://docs.github.com/en/actions/how-tos/monitor-workflows/view-job-execution-time |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.