test: promote the hand-rolled seam fault stubs into the testkit fakes - #1846
Conversation
…it fakes The engine suites hand-rolled 16 seam-trait stubs across four files for seams the testkit already fakes, so a fault mode reached one suite only and coverage drifted per file. The fault modes move onto the kit's fakes: a transport that acks and discards a PUT or parks a GET, a floor store that faults a commit, spends a raise budget or misreports a raise, and a snapshot cache that parks a read or serves fixed ciphertext. Two decorators that filled a held-record slot across a load become one fake, and the scripted Adopter and the split-write floor backing join the kit. Every assertion stands unchanged.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe testkit now provides shared fault-injection fakes for adopter, floor-store, record-store, and snapshot-cache seams. Engine tests replace local seam implementations with these fakes while preserving their existing assertions. ChangesShared engine test fakes
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to The shared test fakes preserve the intended fault-injection coverage without an identified behavioral regression. The change is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
What changed
The engine suites hand-rolled 16 seam-trait stubs across four files, for seams the testkit
already fakes. A fault mode written into one suite reached no other suite, so the set of faults
each seam is tested against was a per-file accident. This promotes every stub onto the kit's
fakes and deletes the hand-rolled copies.
New fault modes on the existing fakes:
InMemoryRecordStore::drop_puts— ack every PUT and retain nothing, so a confirm re-resolvereads no record.
InMemoryRecordStore::stall_gets— park every GET, the shape of a name no source answers for.InMemoryFloorStore::fail_floor_commits— failcommit_floorsbefore it touches a key, atransactional backing's all-or-nothing abort.
InMemoryFloorStore::fail_floor_raises_after— spend a raise budget, then fail every raise, soone leg of a multi-floor advance faults.
InMemoryFloorStore::skew_reported_raises— report a raise above the floor it settles on, theshape a non-monotonic counter would take.
InMemorySnapshotCache::stall_gets,serve_fixed_ciphertextandvalues.New fakes:
SlotFillingRecordStore— one decorator for the two identical copies that filled a held-recordslot before a delegated GET.
SplitWriteFloorStore— a backing with nocommit_floorsoverride, so an advance runs theseam's non-atomic default. This is the negative control the atomic-commit suite contrasts
against, and it cannot be a fault mode on
InMemoryFloorStore, which commits atomically.ScriptedAdopterwithAdoptVerdict— the scripted adoption-gate verdict plus the sequences itwas handed.
No
impl RecordTransport,impl FloorStore,impl SnapshotCacheorimpl Adopterremains incrates/engine/tests/. Every assertion in the four suites stands exactly as written: thepromotion moves the fault, not the assertion.
Verification
cargo test -p cipherbox-engine— all suites pass,vault_settings56,net36,bin_index22,
floor_atomic3.cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings.cargo check -p cipherbox-wasm --target wasm32-unknown-unknown.pnpm lint:tracker-refs.Body checks / follow-ups filed
four files, not 12 across three;
crates/engine/tests/bin_index.rswas unlisted; the twoslot-filling decorators are one shape; the split-write backing is a distinct fake. The file
contention note against test: promote the published-account fixture into the engine testkit #1121 is void, because test: promote the published-account fixture into the engine testkit #1121 is closed.
defect:
crates/engine/src/net/resolve.rskeeps a private#[cfg(test)]adopter in its ownunit tests. It is a unit fixture inside the module under test, not a cross-suite stub, so it is
out of this scope.
Closes #1297.
Summary by CodeRabbit
Note
Promote hand-rolled test seam fault stubs into
testkitfakesScriptedAdopter,InMemoryFloorStorefault controls,InMemoryRecordStorefault controls,InMemorySnapshotCachefault controls, andSplitWriteFloorStore/SlotFillingRecordStoreadaptersInMemoryFloorStoregains commit-failure injection, cross-key raise budgets, and reported-value skew;InMemoryRecordStoregainsdrop_puts(PUT succeeds but stores nothing) andstall_gets(GET parks forever);InMemorySnapshotCachegains fixed-ciphertext and GET-stalling modesScriptedAdopterprovides scripted adoption verdicts (accepted, trust rejection, equal-sequence rejection) with shared sequence-observation state across cloned handlesMacroscope summarized 167e065.