Repository navigation
test(cli): keep size-limited ripr children from corrupting coverage profiles (#4978) - #5170
Conversation
…rofiles (#4978) `init_that_cannot_finish_writing_keeps_the_previous_config` (#4887) runs `ripr init` twice under `trap '' XFSZ; ulimit -f 1`. With SIGXFSZ ignored the child exits normally and its LLVM profile write at exit is cut to 512 bytes inside target/llvm-cov-target. `llvm-profdata merge` (default failure mode `any`) then rejects the whole set: two consecutive-PID "file header is corrupt" warnings and "no profile can be merged", the rust-coverage signature on every main push since #4887 merged. Route both `ulimit -f` children through one helper that points the child's LLVM_PROFILE_FILE at /dev/null. That profile can never be complete under the cap; every other process keeps its profile. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5D7B2JxJ754s1p6ktir1Y
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review. Summary by CodeRabbit
WalkthroughThe size-limited test child now runs through ChangesSize-limited test execution
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~5 minutes Change: Other Merge Risk: ⚪ Minimal · up to Both size-limited tests retain their intended checks while discarding child coverage output. No specific merge blocker is evident from the reviewed source. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
A rabbit checks the capped child’s trail, Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a new helper function run_size_limited in the CLI smoke tests to execute commands under size limits while redirecting the LLVM profile file to /dev/null to prevent profile corruption during coverage runs. A review comment correctly identifies a type mismatch in the return type of run_size_limited (std::io::Error instead of String), which would cause a compilation error when used with the ? operator in tests.
EffortlessSteven
left a comment
There was a problem hiding this comment.
review-pr (exact head, author-comment)
Findings
- No blocking findings. Non-blocking: the
LLVM_PROFILE_FILE=/dev/nullredirect is only proven by the hostedrust-coveragelane, which has not finished (see missing evidence). Non-blocking: other tests that spawn size-capped children would still corrupt profiles. None exist at this head:git grep ulimitfinds only the two sites routed throughrun_size_limited.
reviewed_head_sha: ff03a69a935a3982bc8043efa682477b1b024812 (draft)
integration_basis: main; no conflicts observed
claim_boundary: #4978 - size-capped (ulimit -f) ripr children must not write truncated LLVM profraw that makes llvm-profdata merge fail. Test-harness only (crates/ripr/tests/cli_smoke.rs). Non-goals: product behavior.
changed_surfaces_and_semantic_owners_inspected: cli_smoke.rs `run_size_limited_init` and the `interrupted_report_write_keeps_the_previous_complete_report` call site, both now via new `run_size_limited` -> `spawn_command` (the harness' single spawn point, env param). Both use sites are `#[cfg(unix)]`, matching the new cfg(unix) helper, so no Windows dead-code/compile break.
blocking_findings: none
non_blocking_suggestions: none beyond the above
refuted_or_stale_findings: none
proof_and_ci_observed: pending at review time - rust-coverage, Rust gates, Rust-only feature lane, ub-review, windows-advisory-subset, wheel build, droid-review, CodeRabbit. Passed: pr-plan, cargo-deny, dependency-review, GitGuardian, Devin (skipped credits).
proof_or_review_missing: the only real oracle for this claim is a green `rust-coverage` run at this head (no "no profile can be merged"). Also, tests still pass/fail on the same assertions: the redirect does not weaken them (the SIGXFSZ/ulimit stays, EFBIG path unchanged). Wrong-behavior challenge: reverting the env var leaves every unit test green, so only the coverage lane discriminates; this is inherent to the claim.
affected_currentness_dimensions: test stimulus/harness; candidate head
residual_assumptions_and_non_claims: assumes the instrumented child honors LLVM_PROFILE_FILE (standard) and /dev/null is writable on the CI runners; does not claim coverage of the capped child (intentionally dropped).
disposition: REVIEW_INCOMPLETE (draft; required hosted gates and rust-coverage pending). Source reads clean; promote once rust-coverage is green at this head.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
EffortlessSteven
left a comment
There was a problem hiding this comment.
reviewed_head_sha: ff03a69a9e33454b50d249f338872f3ef840742f
integration_basis: main
claim_boundary: Fix #4978: isolate LLVM coverage profraw output from size-limited ripr child processes in CLI smoke tests to prevent coverage file corruption.
changed_surfaces_and_semantic_owners_inspected:
- tests/cli_smoke.rs: run_size_limited and run_size_limited_init child-process environment isolation and error handling.
blocking_findings: none
non_blocking_suggestions: none
refuted_or_stale_findings: - Gemini comment on run_size_limited return type: refuted with primary source evidence (callers use ? into Box or map_err to String; spawn_command returns Result<Output, std::io::Error>). Verified 2/2 tests pass; thread resolved.
proof_and_ci_observed: - Required checks on exact head ff03a69: Ripr Rust Small on GitHub Hosted / Rust gates SUCCESS (23:58:18Z), Ripr Rust Small Result SUCCESS (23:58:23Z).
- rust-coverage oracle: SUCCESS (20m15s).
- Security checks (cargo-deny, dependency-review, GitGuardian) and advisory wheel/windows checks all SUCCESS.
proof_or_review_missing: none
affected_currentness_dimensions: none
residual_assumptions_and_non_claims: Test isolation fix only; does not alter production profraw behavior or ripr CLI semantics.
disposition: REVIEW_READY
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm no test proves /dev/null actually discards the LLVM profile under SIGXFSZ+ulimit-f; fix relies on coverage lane oracle only.
- Confirm coverage honesty paragraph claims 'never inflates' coverage but no test or proof artifact verifies the capped-children line count delta; the claim is editorial, not test-enforced.
Refuted
- Test would still corrupt coverage because ulimit -f 1 caps /dev/null writes too.; refuted because: /dev/null is a character device, not a regular file; RLIMIT_FILE (ulimit -f) only applies to regular file writes, so the capped child can still emit a complete (empty) profile to /dev/null with no truncation. Author's local repro confirmed child exits 0 with no profraw.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
- Missing base.
|
Diagnosis of \mergeStateStatus: BLOCKED: |
|
Converged 2026-10-04 01:57:35 UTC: the ordinary protected merge accepted exact Current-main coverage remains a separate observation under #4978's existing delivery checkpoint. Historical gate reconciliation before convergence: Bounded gate reconciliation for exact head The collaborator-approval diagnosis in the current checkpoint is not established by the observed rule. Ruleset 18845973 has The exact-head Rust run and coverage run are successful; the queued Droid review is separate. Classic protection is unreadable through this integration (403), so this is not a complete enumeration of server requirements. No actual merge-server rejection was found in the public timeline. Do not change authors, protection, or rerun successful CI to address the speculative cause. Two review-record items remain for the existing owner: review 5403525319 is attached to the correct API head but its |
EffortlessSteven
left a comment
There was a problem hiding this comment.
review-pr record correction (exact head, author-comment)
Review 5403525319 named reviewed_head_sha: ff03a69a9e33454b50d249f338872f3ef840742f. That full SHA is wrong. The reviewed and only head is ff03a69a935a3982bc8043efa682477b1b024812. Its findings stand; this record supersedes its SHA line.
The ub-review verification questions (review 5403567301) get these dispositions:
- "No test proves /dev/null discards the profile under SIGXFSZ + ulimit -f." Accepted as a claim boundary, not a defect. The discriminating oracle is the hosted
rust-coveragejob on this exact head (run 37161733063, success). Before the fix, that job failed on every main push withinvalid instrumentation profile data (file header is corrupt)followed byerror: no profile can be merged. It failed the same way on #5109's full-ci run at 00:58Z today, on a base without this change. RLIMIT_FSIZE applies only to regular files, so a write to the/dev/nullcharacter device is not truncated. A unit-level test could not observe this, because the defect exists only inside the llvm-cov merge step. - "'Never inflates' is editorial." True by construction, not by measurement. The change only withholds the profiles of the two capped children. Withholding profile inputs can remove execution counts but cannot add any, so reported coverage can only stay the same or drop. No line-count delta is claimed.
reviewed_head_sha: ff03a69a935a3982bc8043efa682477b1b024812
integration_basis: main 2054d4db2 (test-only change to crates/ripr/tests/cli_smoke.rs; no conflict reported)
blocking_findings: none
refuted_or_stale_findings: Gemini return-type finding (refuted, thread resolved); prior review SHA line (corrected here)
proof_and_ci_observed: Rust gates + Ripr Rust Small Result success; rust-coverage success on this head
proof_or_review_missing: none for the claim; droid-review still queued (provider, not a finding)
disposition: REVIEW_READY
Generated by Claude Code
EffortlessSteven
left a comment
There was a problem hiding this comment.
reviewed_head_sha: ff03a69
integration_basis: Executed synthetic merge 12abd79, tree3939e9fa1fb397beb765e52086e26470834eceba, with parents2054d4db241fee6f4913cf81e09babcdc88fa9f5 + reviewed head. Later main a5499a6 was independently source-reviewed for the affected integration; that newer combined tree is not claimed executed.
claim_boundary: Preserve the two capped-child write-failure witnesses while preventing those children from contributing truncated LLVM profiles to the real coverage merge.
changed_surfaces_and_semantic_owners_inspected:
- Full one-file delta in crates/ripr/tests/cli_smoke.rs; run_size_limited, run_size_limited_init, spawn_command/probe_command, both capped callers and their assertions.
- Command::env scopes LLVM_PROFILE_FILE=/dev/null to the spawned Unix sh/exec-ripr child. Parent test-binary environment and other commands are unchanged.
- Original caps, failed-status checks, previous-byte preservation and staging cleanup remain intact. The report fixture still must exceed the cap.
blocking_findings: none
non_blocking_suggestions: none
refuted_or_stale_findings:
- Return-type objection is refuted by the actual spawn signature/caller conversions and completed owning tests; thread is resolved.
- The later ub-review's profile-isolation concern is covered by the actual instrumented coverage lane completing its merge with both owning tests passing. No extra unit experiment is needed for issue4978's stated end-to-end acceptance.
- No coverage-percentage or line-count delta is claimed. This source change withholds only the capped children's profile inputs; it does not add coverage inputs or exclude the parent test binary.
- Author review5403794362 now corrects the earlier full-SHA typo and dispositions both ub questions. This independent record names the actual full API head.
proof_and_ci_observed:
- Required run37161726258: worker111316418806 and Result111321455788 SUCCESS; preflight, tests, doctests and PR evidence passed.
- Artifact11287769484 is296532bytes, SHA256891a5f5007bff69f74a1ec3d80ba9508fbed5dffc21f5d331ba4e52b1b87f315. Its run-context and checkout log bind the merge above, Rust/Cargo1.95.0 and nextest0.9.146. JUnit contains11371 executed passes, zero failures/errors; native nextest separately reports2 skipped.
- Exact owning subjects init_that_cannot_finish_writing_keeps_the_previous_config and interrupted_report_write_keeps_the_previous_complete_report both passed in that JUnit.
- Coverage run37161733063 ran cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info at the same checkout using repository-pinned Rust1.95.0. Both owning tests passed in its343-pass cli_smoke binary. Profile merging and LCOV production completed.
- LCOV artifact11288665371 independently verifies at2631308bytes/SHA256eb0f2c6dc007e747448636552cbb0a25c5a244d7c838da47737e3ca68cfd6a81 and contains nonempty20582957-byte lcov.info.
- Since the tested base, the affected file's later-main changes are367 additive lines in unrelated worktree-navigation tests. The capped helpers/callers/spawner and coverage workflow are unchanged.
proof_or_review_missing: No remaining experiment for this bounded source claim. Droid output remains queued; classic-protection settings are unreadable through this integration, so the ordinary protected server gate remains authoritative.
residual_assumptions_and_non_claims: Unix test-harness repair only. No production CLI change, measured coverage improvement, Windows cap experiment, installed journey or release claim. The setting for unattributed Copilot PRs does not establish a collaborator-approval requirement with configured approvals=0; no actual server-rejection cause has yet been observed.
disposition: REVIEW_READY
Requested by Steven · project thread
Summary
rust-coveragehas failed on every main push since fix(cli): keep the existing config when ripr init cannot finish writing (#4883) #4887 (1eb54eeb27) merged.init_that_cannot_finish_writing_keeps_the_previous_config(added in fix(cli): keep the existing config when ripr init cannot finish writing (#4883) #4887) runsripr inittwice undersh -c "trap '' XFSZ; ulimit -f 1 && exec ripr ...". Because SIGXFSZ is ignored, the instrumentedriprchild exits normally. At exit it writes its LLVM profile intotarget/llvm-cov-target/, and the 512-byte file-size cap cuts that file short.llvm-profdata mergeruns in its default--failure-mode=any, so a single invalid input fails the whole merge witherror: no profile can be merged. That matches the CI signature exactly: two corrupt profraws with consecutive PIDs (the two sequentialsh→exec riprchildren;execkeeps the PID), then the merge error, while every test passes.ulimit -fchildren (this test and the olderinterrupted_report_write_keeps_the_previous_complete_report) now go through one helper,run_size_limited. It sets the child'sLLVM_PROFILE_FILE=/dev/null./dev/nullis not a regular file, so the cap does not apply to it, and the corrupt file is never written. No test is skipped or weakened, and every other process keeps its profile.Swarm / Source Boundary
Source-of-truth Links
Governing issue or accepted claim: #4978
Acceptance delta (one sentence):
cargo llvm-cov --workspace --all-features --lcovfinishes without profraw merge errors, and no test binary's coverage is dropped.Candidate Relationships
Candidate branch:
claude/coverage-profraw-4978. No stack parent, and no other PR for this claim (searched all states for4978).Scope
crates/ripr/tests/cli_smoke.rsonly (test harness).Scope Classification
Production delta: none.
Evidence/support delta: the coverage lane can merge profiles again.
Single acceptance criterion:
rust-coveragepasses on this PR head.Non-goals: tolerating corrupt profiles in the workflow (
--failure-mode), excluding test binaries from coverage, or changingcoverage.yml.Coverage honesty
The two size-capped
riprchildren can never produce a complete profile: their whole address space runs under the cap, so any profile they write is truncated. The only data lost is what those two capped children would have recorded. Lines that only they execute show as uncovered, which under-reports coverage and never inflates it (withholding profile inputs can remove counts, never add them; this is by construction, not a measured delta). Thecli_smoketest binary and every other spawnedriprstill write full profiles to the shared directory.Proof
Root-cause evidence:
b80ae3329ea9..1eb54eeb27(last green to first red) holds two commits: fix(rust): name the unresolved #[path] a changed file is only reached through (#4435) #4906 (analysis code only) and fix(cli): keep the existing config when ripr init cannot finish writing (#4883) #4887. fix(cli): keep the existing config when ripr init cannot finish writing (#4883) #4887 added thetrap '' XFSZ; ulimit -f 1init test. The olderulimit -f 1gap-ledger test (fix(output): publish report and pilot outputs atomically (#4542) #4589, already on the green baseline) does not ignore SIGXFSZ, so its child is killed mid-write before the profile is dumped, and no corrupt file appears.llvm-profdata(1.95.0 llvm-tools) on a small-Cinstrument-coveragebinary with a profile larger than 512 bytes:trap '' XFSZ; ulimit -f 1the runtime printsLLVM Profile Error: Failed to write file ...: File too large, the child exits 0, and a 512-byte profraw is left behind.llvm-profdata merge -sparse good.profraw truncated.profrawprintswarning: truncated.profraw: invalid instrumentation profile data (file header is corrupt)and thenerror: no profile can be merged(exit 1). Merginggood.profrawalone exits 0.LLVM_PROFILE_FILE=/dev/nulland the same cap, the child exits 0 and writes no profraw.cargo fmt --check cargo test -p ripr --test cli_smoke -- init_that_cannot_finish_writing_keeps_the_previous_config interrupted_report_write_keeps_the_previous_complete_reportResults on exact head
ff03a69a935a3982bc8043efa682477b1b024812:test result: ok. 2 passed; 0 failed.rust-coverage(run 37161733063): success. This is the discriminating oracle; unit tests pass with or without the fix.Ripr Rust Small Result(run 37161726258): success.cargo llvm-covandcargo xtask precommit(host capacity); the hosted lanes above cover them.Claim Boundary
After this PR: the coverage lane's profraw merge failure is explained and fixed at its source. Not claimed: the coverage percentage itself, or any other coverage-lane flake.
Rollback
Revert the single commit. The tests keep working; only the coverage lane would break again.
Static Language Check
killed,survived,untested,proven, andadequate. (No output change.)CI Economics
rust-coverage(fixed)Engineering Check
panic,unwrap,expect,todo, orunimplementedin tests.spawn_commandsite, andshwas already spawned there.🤖 Generated with Claude Code
https://claude.ai/code/session_01S5D7B2JxJ754s1p6ktir1Y