Repository navigation
test(clazel): accept 'cannot write' for a truncated hostile renderer - #20
Merged
Merged
Conversation
…r a truncated frame A truncated-frame renderer exits at once, so the host races it: reading the closed socket logs 'closed its socket'; a Commit write to the already-exited process fails and logs 'cannot write'. Both reap the renderer and tell the kernel; the Commit-only and kernel-forgot checks still apply. Other kinds keep their single expected outcome. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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 a flaky test that failed
Verify (base, macOS)on #10. That PR only addsclazel-der, which this test doesn't touch.hostile_renderers_are_killed_and_well_behaved_ones_are_unaffected(crates/clazel/tests/adversarial.rs) expected every hostile renderer to end with "closed its socket". The test sent renderer 32 a Truncated frame, and that renderer ended with "cannot write":Cause
hostile::attack(crates/clazel-renderer/src/hostile.rs:296-305) writes the frame and returns at once forKind::Truncated, so that renderer exits immediately. Every other kind waits to be cut off.crates/clazel/src/lib.rs:157-163), which races that exit:RendererExitedto the kernel.crates/clazel/tests/host.rs:108-116already accepts both outcomes for a stub that exits immediately, for the same reason.Fix
For the Truncated kind only, the test now accepts either wording, with a comment explaining the race. Every other kind keeps its single expected outcome. Every other assertion is unchanged:
exitedline carries the right seed and kind;So a hostile renderer that wasn't cut off, or was sent more, still fails the test.
Results
cargo test -p clazel, strict clippy,cargo fmt --all --checkandcargo xtask checkpass.clazel-sys, so no audit is needed.Needs Alex's OK to merge.
🤖 Generated with Claude Code