Repository navigation
fix: keep the overflow fixture child out of the profile writer (#275) - #278
Merged
Merged
Conversation
The scoped-parent fixture's finite overflow child exited right after its final byte. The runner kills the group as soon as it reads that byte, so in instrumented builds the kill could land inside the child's exit-time LLVM profile write and leave a truncated raw profile. The overflow child now idles until the runner kills it. Instrumented builds also run three profile-boundary controls through the real SystemCommandRunner: a completed write stays valid, a write interrupted at a runtime write boundary is truncated, and the fixture's held child never starts a write. Every produced profile is parsed strictly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
@codex review |
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. |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #275.
Problem
Post-merge main CI for
7eb98e1failed only inrust-metrics(run 40427010240). Every instrumented test passed, but strict LLVM profile merging rejected one raw profile. Its retained bytes are a valid v11 header followed by data sections cut off at 4096 of the 21800 declared bytes. The metadata identifies thecommand_runnertest binary.The scoped-parent fixture ran a finite
emit stdout 4194305child under a 4 MiB cap. The runner fails on the overflow byte and SIGKILLs the process group. The child exits right after writing that byte, and in instrumented builds its exit handler may already be writing the raw profile. The kill can therefore land mid-write. No trace exists from the hosted run, so this PR does not claim that this exact interleaving produced that file. It shows the interleaving is reachable and removes it.Change
held. It emits 4 MiB + 1 bytes, then idles until the runner kills it, so it never enters its exit-time profile writer. The 4 MiB cap assertion still fails RED if the cap is ignored: the child would then hit the deadline and returnTimedOutinstead ofFailed. Product runner code, the output cap, deadlines, group cleanup and the other fixture modes are unchanged.tests/command_runner/profile.rs): compiled only undercfg(coverage)(set by cargo-llvm-cov) on Linux and macOS. Each helper uses the runtime's public__llvm_profile_set_file_objectto send its own raw profile through afopencookie/funopenstream, so every runtime write is a traced boundary. The final byte goes through the realSystemCommandRunner.run_with_optionswith a 4 MiB cap:written: the profile is fully written before the final byte, then the helper is killed. The profile parses Complete.interrupted: the helper exits normally, and the exit-time writer releases the final byte right after the header write. The kill lands inside the runtime's write, and the file is Truncated against its own header's declared size. This is the deliberate negative control.held: runs the fixture'sheld()exactly at the cap, so only the deadline ends it (TimedOut). No write may start and no profile may exist. Ifheld()exits, the runner returnsOkand the control fails.released()probe.unexpected_cfgsnow declarescfg(coverage)so clippy-D warningsaccepts the gate.The control helpers send only their own profiles to scratch. Production profiles under
llvm-cov-target, coverage scope, thresholds and failure-retention strictness are unchanged.Evidence (local, macOS aarch64, pinned
nightly-2026-10-22+ cargo-llvm-cov 0.9.1)command_runnerpasses:written: eventswrite 0 152 … written, 30632 B, Completeinterrupted:write 0 152,release 152, 152 B, Truncated (declared 30632)held:TimedOut, events["diverted"], no profileheld()exit after emitting fails theheldcontrol deterministically (NonevsSome(TimedOut), exit 101). Restored, it passes.llvm-profdata merge -sparse(exit 0).cargo fmt --all --check,cargo clippy --workspace --all-targets --locked -- -D warnings(plus provider tests with--cfg coverage),cargo test --workspace --locked, andscripts/tests/test_rust_metrics.py(13 OK).Acceptance Criteria
Definition of Done
ab7e8caa475713cd9ef020cba96f2bdda7ec41d1.Hosted validation
The Linux metrics job ran the controls once:
writtenFailed, 55 msinterruptedFailed, 53 ms; trace endswrite 0 152,release 152heldTimedOut, 1,001 ms; onlydivertedeventThe unchanged strict merge and comparison passed with
failures: []. Base7eb98e1c801c20472cd4944dea8cc7697918bedfand candidateab7e8caa475713cd9ef020cba96f2bdda7ec41d1have identical measured production totals: 20,642/23,450 lines, 88.025586%, and 2,945/3,692 branches, 79.767064%; all 1,790 production function measurements remain in scope. The artifact was downloaded and verified against SHA-256f0fafe947aabc30494717b7b4da73ed1cd3a9c3eabddfeabcefa16c0be718a51.These controls establish mechanism reachability and remove the fixture's exit/kill race. They do not reconstruct the historical signal sequence of the original 4,096-byte failure. That evidence remains preserved.