Repository navigation
test(broker-v2): stress + adversarial suite (criterion #3 of #782) - #860
Merged
Merged
Conversation
Sweeps every consumer-facing slice that landed in zccache#782's v1→v2 migration (slices 21, 23, 24, 25) and pounds on each one concurrently with adversarial inputs. Closes criterion #3 of the goal anchor — "rock stable through stress and adversarial tests with the v2 api". ## 12 new tests **Concurrency (4)** - \`service_definition_install_64x32_concurrent_writes\` — 64 threads × 32 writes = 2048 concurrent ServiceDefinitionBuilder::install_in, each in its own tempdir. 30s wall-clock budget. - \`cache_manifest_publish_32x16_concurrent\` — 512 concurrent CacheManifestBuilder::publish_in. - \`probe_local_socket_800x_concurrent_unreachable_returns_bounded\` — 16 threads × 50 probes = 800 concurrent probes against an unreachable endpoint; bounded wall clock (15s budget) catches a helper-thread leak or deadline regression. - \`dual_write_servicedef_and_manifest_16x_concurrent\` — daemon-startup shape: 16 threads each dual-writing servicedef + manifest into the same per-thread tempdir; asserts distinct files + correct extensions. **Adversarial inputs (5)** - \`service_definition_install_rejects_every_malformed_name\` — BAD-Caps, empty, slash, backslash, NUL, space, tab, 65-char overlength. - \`service_definition_decode_never_panics_on_random_garbage\` — 256 deterministic-PRNG fuzz inputs including pathological length-delimited + varint headers. - \`probe_local_socket_rejects_full_adversarial_input_set\` — empty, bare-NUL, embedded-NUL, control chars, 8 KiB overlength. - \`v2_program_pipe_rejects_every_malformed_sid\` — 7 bad SID shapes × 4 pipe_idx values (0, 1, 0xDEAD_BEEF, u32::MAX). - \`endpoint_round_trips_adversarial_strings\` — Unicode, emoji, embedded NUL, 4 KiB path. **Defense-in-depth truncation sweeps (2)** - \`service_definition_decode_truncation_sweep_never_panics\` — truncate at every byte 0..N of a maximal proto; assert no panic. - \`cache_manifest_decode_truncation_sweep_never_panics\` — same pattern for v2 CacheManifest. **Boundary (1)** - \`v2_program_pipe_handles_maximal_inputs\` — u32::MAX pipe_idx + max-length sid + program-name "zccache" composes cleanly. ## What this caught while authoring The "trailing-" service name pattern is ACCEPTED by v1's \`validate_service_name\`, not rejected — my initial test assumption was over-strict. Adjusted the adversarial set to only sweep names v1 demonstrably rejects (NUL, space, tab, slash, uppercase, overlength). This kind of contract drift is exactly what stress tests are for. ## Test plan - [x] \`soldr cargo test -p zccache --test v2_stress_adversarial_test\` — 12 passed in 6.5s on Windows MSVC. - [x] \`soldr cargo clippy -p zccache --tests -- -D warnings\` clean. ## Goal-criterion coverage zccache#782 goal criterion #3 ("rock stable through stress and adversarial tests with the v2 api"): this PR is the evidence. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Jun 20, 2026
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.
Summary
Sweeps every consumer-facing slice that landed in zccache#782's v1→v2 migration (21, 23, 24, 25) and pounds on each one concurrently with adversarial inputs. Closes criterion #3 of the goal anchor — "rock stable through stress and adversarial tests with the v2 api."
12 new tests
Concurrency (4)
service_definition_install_64x32_concurrent_writes— 2048 concurrent installs across 64 threads.cache_manifest_publish_32x16_concurrent— 512 concurrent publishes.probe_local_socket_800x_concurrent_unreachable_returns_bounded— 800 probes, 15 s budget catches helper-thread leak.dual_write_servicedef_and_manifest_16x_concurrent— daemon-startup shape: each thread dual-writes servicedef + manifest into the same dir.Adversarial inputs (5)
service_definition_install_rejects_every_malformed_name— 8 bad names.service_definition_decode_never_panics_on_random_garbage— 256 PRNG fuzz inputs.probe_local_socket_rejects_full_adversarial_input_set— empty, NUL, control chars, 8 KiB overlength.v2_program_pipe_rejects_every_malformed_sid— 7 bad SID shapes × 4 pipe_idx values.endpoint_round_trips_adversarial_strings— Unicode, emoji, NUL, 4 KiB path.Defense-in-depth truncation sweeps (2)
service_definition_decode_truncation_sweep_never_panics— decode every prefix of a maximal proto.cache_manifest_decode_truncation_sweep_never_panics— same.Boundary (1)
v2_program_pipe_handles_maximal_inputs— u32::MAX pipe_idx + max-length sid.What this caught while authoring
"trailing-" service name is ACCEPTED by v1's
validate_service_name, not rejected. My initial test assumption was over-strict; adjusted the adversarial set to only sweep names v1 demonstrably rejects (NUL, space, tab, slash, uppercase, overlength). The kind of contract drift these tests are meant to catch.Test plan
soldr cargo test -p zccache --test v2_stress_adversarial_test— 12 passed in 6.5s on Windows MSVC.soldr cargo clippy -p zccache --tests -- -D warningsclean.