Summary
TestBackend in crates/gossip-scanner-runtime/src/git_persistence.rs currently exposes set_fail_on_get_call which only fires for single-key get calls. The multi_get implementation reads state.kv directly without incrementing get_call_count, so the load_watermarks error path (which goes through multi_get) cannot be fault-injected from downstream crates using the test-support feature.
Proposed change
Add a set_fail_on_multi_get_call(call_no: usize) / clear_fail_on_multi_get_call() pair to TestBackend (with a matching multi_get_call_count: usize and fail_on_multi_get_call: Option<usize> field on TestBackendState) that fires an injected TestBackendError when the internal monotonic counter reaches call_no.
Alternatively, the multi_get override could be removed from TestBackend entirely so it delegates to the default get-loop implementation, sharing the existing fail_on_get_call hook — though this changes observable call-count semantics for tests that already use set_fail_on_get_call.
Motivation
This enables downstream integration tests (e.g., in scanner-engine-integration-tests) to cover the load_watermarks backend-error path deterministically, closing the remaining untestable read branch in GitPersistenceAdapter.
Context
Identified in PR #365 (feature/seen-bitmap-crash-recovery). Deferred from that PR as out of scope — crash-recovery tests for commit_finalize only go through single-key get calls.
Requested by: @ahrav
PR reference: #365 (comment)
Summary
TestBackendincrates/gossip-scanner-runtime/src/git_persistence.rscurrently exposesset_fail_on_get_callwhich only fires for single-keygetcalls. Themulti_getimplementation readsstate.kvdirectly without incrementingget_call_count, so theload_watermarkserror path (which goes throughmulti_get) cannot be fault-injected from downstream crates using thetest-supportfeature.Proposed change
Add a
set_fail_on_multi_get_call(call_no: usize)/clear_fail_on_multi_get_call()pair toTestBackend(with a matchingmulti_get_call_count: usizeandfail_on_multi_get_call: Option<usize>field onTestBackendState) that fires an injectedTestBackendErrorwhen the internal monotonic counter reachescall_no.Alternatively, the
multi_getoverride could be removed fromTestBackendentirely so it delegates to the defaultget-loop implementation, sharing the existingfail_on_get_callhook — though this changes observable call-count semantics for tests that already useset_fail_on_get_call.Motivation
This enables downstream integration tests (e.g., in
scanner-engine-integration-tests) to cover theload_watermarksbackend-error path deterministically, closing the remaining untestable read branch inGitPersistenceAdapter.Context
Identified in PR #365 (feature/seen-bitmap-crash-recovery). Deferred from that PR as out of scope — crash-recovery tests for
commit_finalizeonly go through single-keygetcalls.Requested by: @ahrav
PR reference: #365 (comment)