Repository navigation
test(import): pin the checkpoint when the one-by-one fallback stops - #312
Conversation
When the engine refuses a bulk store because of an item, the importer stores the batch one item at a time. If a later item then fails with a non-skippable error, the checkpoint must stay on the last item actually stored. No test covered that path. The scripted engine gains a mode that refuses every bulk store and goes unavailable after N single stores.
|
Warning Review limit reached
This review includes 1 billable file and costs up to $0.25. Or wait 54 minutes for your next included review. View limit details
Comment |
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): test(import): pin the checkpoint when the one-by-one fallback stops. Test-only change that adds a `DownAfter(usize)` mode to the scripted test engine and a test pinning the importer's checkpoint when the one-by-one fallback stops on an unavailable engine. No pushed-delta comparison was available. Review snapshot
Completeness: Complete What changed`Mode::DownAfter(usize)` is added to the test engine, refusing every bulk store as invalid to force the one-by-one fallback and answering `Unavailable` after a configurable number of single stores; `Scripted` gains a `singles` counter for that. A new test imports with 60 legacy documents and `DownAfter(5)`, asserting 5 items stored and the checkpoint at `d004` so a resume cannot skip an unstored item. No production code or API changes. Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Summary
Test only. When the engine refuses a bulk store because of one item, the importer stores that batch one item at a time. If a later item then fails with a non-skippable error (for example the engine going unavailable), the import stops. Its checkpoint must stay on the last item actually stored, so the resume doesn't skip anything. The code does this today, but no test covered the fallback path.
The scripted test engine gets one more mode,
DownAfter(n). It refuses every bulk store as invalid, which forces the one-by-one fallback. Afternsingle stores it answersUnavailable.Related issue
None. Found in an edge-case audit (a coverage gap; the behaviour is correct).
API or behavior changes
None.
Validation
Commands actually run, with their outcome:
cargo fmt --all -- --check. rustfmt--check(edition 2024) passed on the touched file. CI runs the full check.cargo clippy --all-targets --all-features -- -D warnings. Left to CI.cargo build --all-targets --all-features. Left to CI.cargo test -p tinymemory-integrations --features legacy-import --test legacy_importer a_failure_in_the_one_by_one_fallback_checkpoints_the_last_stored_item:outcome.checkpointto the failing item: FAILED,left: Some("d005"),right: Some("d004"). Restored by copy.Tests
New
a_failure_in_the_one_by_one_fallback_checkpoints_the_last_stored_item. With 60 legacy documents andDownAfter(5), 5 items are imported and the checkpoint isd004.Documentation
Not needed (test only).
Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description