Skip to content

test(cli): keep size-limited ripr children from corrupting coverage profiles (#4978) - #5170

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/coverage-profraw-4978
Oct 4, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
claude/coverage-profraw-4978

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Summary

  • Fixes the root cause of ci(coverage): diagnose the October 10 profraw recurrence while preserving the accepted repair #4978: rust-coverage has 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) runs ripr init twice under sh -c "trap '' XFSZ; ulimit -f 1 && exec ripr ...". Because SIGXFSZ is ignored, the instrumented ripr child exits normally. At exit it writes its LLVM profile into target/llvm-cov-target/, and the 512-byte file-size cap cuts that file short. llvm-profdata merge runs in its default --failure-mode=any, so a single invalid input fails the whole merge with error: no profile can be merged. That matches the CI signature exactly: two corrupt profraws with consecutive PIDs (the two sequential sh→exec ripr children; exec keeps the PID), then the merge error, while every test passes.
  • Fix: both ulimit -f children (this test and the older interrupted_report_write_keeps_the_previous_complete_report) now go through one helper, run_size_limited. It sets the child's LLVM_PROFILE_FILE=/dev/null. /dev/null is 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

  • swarm-only CI, runner, routing, source-of-truth, or agent-operating surface (fix for the advisory coverage lane, made in a test harness)

Source-of-truth Links

Governing issue or accepted claim: #4978
Acceptance delta (one sentence): cargo llvm-cov --workspace --all-features --lcov finishes 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 for 4978).

Scope

  • crates/ripr/tests/cli_smoke.rs only (test harness).

Scope Classification

  • Docs/spec/test-only evidence package

Production delta: none.

Evidence/support delta: the coverage lane can merge profiles again.

Single acceptance criterion: rust-coverage passes on this PR head.

Non-goals: tolerating corrupt profiles in the workflow (--failure-mode), excluding test binaries from coverage, or changing coverage.yml.

Coverage honesty

The two size-capped ripr children 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). The cli_smoke test binary and every other spawned ripr still write full profiles to the shared directory.

Proof

Root-cause evidence:

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_report

Results on exact head ff03a69a935a3982bc8043efa682477b1b024812:

  • Local (rustc 1.95.0, Linux): both named tests passed, test result: ok. 2 passed; 0 failed.
  • Hosted rust-coverage (run 37161733063): success. This is the discriminating oracle; unit tests pass with or without the fix.
  • Hosted Rust gates and required Ripr Rust Small Result (run 37161726258): success.
  • Not run locally: full cargo llvm-cov and cargo 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

  • Static output avoids killed, survived, untested, proven, and adequate. (No output change.)

CI Economics

  • LEM impact: n/a
  • Workflows touched: none
  • Advisory lanes affected: rust-coverage (fixed)
  • Required lanes affected: none

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • No new process-spawn surface: it reuses the harness's single spawn_command site, and sh was already spawned there.

🤖 Generated with Claude Code

https://claude.ai/code/session_01S5D7B2JxJ754s1p6ktir1Y

…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
@EffortlessSteven EffortlessSteven added the coverage Run coverage lanes and upload coverage artifacts. label Oct 3, 2026 — with Claude
@EffortlessSteven EffortlessSteven self-assigned this Oct 3, 2026
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 31687401-8797-4b06-a0b8-a106f9a8200b
📥 Commits

Reviewing files that changed from the base of the PR and between 2054d4d and ff03a69.

📒 Files selected for processing (1)
  • crates/ripr/tests/cli_smoke.rs
🔗 Linked repositories identified

CodeRabbit 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

  • Tests
    • Updated the size-limited write test to discard coverage output from its child process.

Walkthrough

The size-limited test child now runs through run_size_limited, which sets LLVM_PROFILE_FILE to /dev/null. The size-limited initialization and write test use this helper.

Changes

Size-limited test execution

Layer / File(s) Summary
Route size-limited child through helper
crates/ripr/tests/cli_smoke.rs
The size-limited initialization and write test use run_size_limited. The helper sets LLVM_PROFILE_FILE to /dev/null when it spawns sh.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to ff03a

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)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Title check ✅ Passed The title clearly and concisely identifies the test change and its purpose: preventing size-limited children from corrupting coverage profiles.
Description check ✅ Passed The description provides detailed scope, rationale, acceptance criteria, proof, claim boundaries, and rollback information. Some template sections, including Policy Impact and Spec-Test-Code Traceabil…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the capped child’s trail,
No profile spills into the shared file.
The helper sets the path to null,
The test runs on, its output dull.
I twitch my nose and hop away.

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist 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.

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.

Comment thread crates/ripr/tests/cli_smoke.rs Resolved

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

review-pr (exact head, author-comment)

Findings

  • No blocking findings. Non-blocking: the LLVM_PROFILE_FILE=/dev/null redirect is only proven by the hosted rust-coverage lane, 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 ulimit finds only the two sites routed through run_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

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 3, 2026 23:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T00:01:15.426800Z ff03a69 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@EffortlessSteven
EffortlessSteven enabled auto-merge (squash) October 4, 2026 00:00

@github-actions github-actions 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.

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.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Diagnosis of \mergeStateStatus: BLOCKED:
All required CI checks have passed (\Ripr Rust Small Result\ SUCCESS), all review threads are resolved, and the branch is clean.
The blocker is repository ruleset 18845973 parameter
equire_extra_approval_for_unattributed_changes: true: commit \ f03a69a9\ is authored by \Claude noreply@anthropic.com\ while the PR author is @EffortlessSteven. GitHub requires an approving review from a repository collaborator for unattributed author commits before convergence.

EffortlessSteven commented Oct 4, 2026 •

Copy link
Copy Markdown
Member Author

Converged 2026-10-04 01:57:35 UTC: the ordinary protected merge accepted exact ff03a69a935a3982bc8043efa682477b1b024812 as e18ff4abecc98fb43028f266d86ed09d17c373c9, with no bypass or protection/author changes. Author review 5403794362 corrected the SHA and dispositioned the later verification questions; independent review 5403831496 verified the narrow source claim and actual native/coverage receipts. The listed review-record items below are resolved. The queued advisory Droid did not prevent the server from merging.

Current-main coverage remains a separate observation under #4978's existing delivery checkpoint.


Historical gate reconciliation before convergence:

Bounded gate reconciliation for exact head ff03a69a935a3982bc8043efa682477b1b024812:

The collaborator-approval diagnosis in the current checkpoint is not established by the observed rule. Ruleset 18845973 has required_approving_review_count: 0, require_last_push_approval: false, no required code-owner review, and resolved-thread enforcement. GitHub documents the extra-approval option for unattributed Copilot PRs and explicitly says, “This setting has no effect if the ruleset requires zero approvals.” Primary documentation. Different PR/commit authors alone therefore do not identify this blocker.

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 reviewed_head_sha text names a different full SHA; and the later verification review needs an explicit disposition against the actual coverage evidence. Once exact-head review and current integration are reconciled, the ordinary expected-head protected merge path can reveal any actual unmet server constraint. This comment is a gate/source-record correction, not an independent full source-acceptance claim.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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:

  1. "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-coverage job on this exact head (run 37161733063, success). Before the fix, that job failed on every main push with invalid instrumentation profile data (file header is corrupt) followed by error: 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/null character device is not truncated. A unit-level test could not observe this, because the defect exists only inside the llvm-cov merge step.
  2. "'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 EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

@EffortlessSteven
EffortlessSteven merged commit e18ff4a into main Oct 4, 2026
61 of 62 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/coverage-profraw-4978 branch October 4, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coverage Run coverage lanes and upload coverage artifacts.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants