almostintuitive opened a new pull request, #4439:
URL: https://github.com/apache/iggy/pull/4439

   ## Which issue does this PR address?
   
   Relates to #4438
   
   ## Rationale
   
   CONTRIBUTING asks that a bug found with an agent comes with failing tests 
first, and the fix after the direction is agreed on the issue. This PR adds 
only the tests. It does not include a fix.
   
   ## What changed?
   
   After rolling crash-restarts under load, a restarted partition replica can 
need state transfer and never finish it, while it keeps serving its stale 
prefix (#4438). Three separate livelocks cause this. This PR adds one 
deterministic test per livelock. Each test is marked `#[ignore = "#4438: 
..."]`, so default CI stays green and `--ignored` runs them. Each test has a 
`TODO(#4438)` with the suggested fix direction.
   
   - 
`iggy_partition::tests::given_commit_max_advanced_during_the_pull_when_installing_should_land_and_leave_the_tail_to_repair`:
 `install_state_transfer` refuses an offer below the receiver's `commit_max` 
even when its sequencer is below the offer, so the install would erase nothing. 
Fails today with `StaleTransfer { commit_op: 1, commit_min: 4 }`.
   - 
`poll::completion_tests::given_the_primary_offer_when_this_replica_ratcheted_its_view_alone_should_accept_it`
 (shard crate): drives `on_partition_state_transfer_target` with the group 
primary's descriptor (view 20, higher `commit_max`) at a replica whose log view 
is 11 but whose own view reached 58 through elections nobody heard. The gate 
compares against `view()` and refuses the offer, so the session is never 
accepted.
   - 
`iggy_partition::tests::given_a_resident_leading_edge_above_durable_end_when_the_window_is_longer_than_a_chunk_should_refuse_commit_floor`:
 the first repair chunk is resident and its first batch starts above the 
recovered durable end, but the window spans more than one chunk. 
`complete_repair` returns `InProgress` instead of `FloorRefused`. The next 
chunk is requested only when the commit walk advances, which the refused floor 
prevents, so the replica never escalates to state transfer.
   
   The partition-descriptor test sits next to the existing metadata-descriptor 
test in `poll/completion_tests.rs`, because that module already has the 
owner-shard harness for calling a descriptor handler.
   
   ## Local Execution
   
   - Passed, with the expected failures. Toolchain 1.99.0 from 
`rust-toolchain.toml`, in a Linux container.
     - `cargo test -p partitions -p shard --lib -- --ignored <the three 
tests>`: all three fail, at the assertions above.
     - With the three suggested fixes applied locally (not part of this PR), 
all three pass.
     - `cargo test -p partitions --lib`: 435 passed, 5 ignored (3 existing, 2 
new). 
`partition_storage::tests::a_removal_cut_short_leaves_the_marker_in_place` 
fails on unmodified `master` too when run as root, because root ignores the 
directory mode. I ran the suite with that test skipped.
     - `cargo test -p shard --lib`: 113 passed, 1 ignored (new).
     - `cargo fmt --all --check` and `cargo clippy -p partitions -p shard 
--all-targets --all-features -- -D warnings` are clean.
   - Pre-commit hooks: ran the hooks that apply to the changed files (license 
headers with HawkEye 7.0.1, trailing whitespace, trailing newline, binary 
artifacts, typos, skills, cargo fmt) by calling their scripts directly. All 
pass. I did not run the workspace-wide `cargo clippy` pre-push hook, only 
clippy on the two touched crates.
   
   ## AI Usage
   
   1. Claude (Claude Code).
   2. Investigation of the reproduction logs, the root-cause analysis, the 
tests and this write-up.
   3. Each test was run on `master` and fails at the assertion for its 
livelock. Each one passes with its suggested fix applied, so it tracks the bug 
and not its setup. The fixes were also checked in the real-process reproduction 
described in #4438. A review pass using the `team-review-slim` charter was run 
on the diff (one combined reviewer, not the full four-expert run, since the 
change is test-only).
   4. Yes.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to