Repository navigation
test(layout_migration): pin that a partly stored legacy item blocks the scope-wide erase - #311
Conversation
|
Warning Review limit reached
This review includes 1 billable file and costs up to $0.25. Or wait 57 minutes for your next included review. View limit details
Comment |
…he scope-wide erase cleanup only erases a legacy tree wholesale when export reports nothing incomplete. No test covered that guard: dropping it let erase run on a tree still holding part of a chunked item. The new test makes the legacy engine report one incomplete item and panic on erase.
05c5ea3 to
aecb071
Compare
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): test(layout_migration): pin that a partly stored legacy item blocks the scope-wide erase. Test-only change that pins the cleanup guard deciding between a wholesale legacy erase and per-id forgets. Per the PR description, `cleanup` erases a legacy tree wholesale only when its export lists nothing as incomplete; otherwise it forgets moved items one by one. The PR adds a wrapper engine whose export reports one partly stored item and whose `erase` panics, plus a test asserting cleanup finishes with `Phase::Cleaned` without ever calling `erase`. No production code changed per the description and diffstat (1 file, 78 additions). Review snapshot
Completeness: Complete What changedAdds a test-only `PartlyStored` wrapper around `ReferenceEngine` in `cleanup_tests.rs` that delegates the engine methods but overrides `export` to push a synthetic `incomplete` id and overrides `erase` to panic. Adds test `a_partly_stored_legacy_item_blocks_the_scope_wide_erase`, which stores five facts into the wrapped legacy engine, runs `cleanup`, and asserts `state.phase == Phase::Cleaned` and that the legacy tree's texts are empty, demonstrating moved items were forgotten by id rather than erased scope-wide. No production behavior 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.
cleanuperases a legacy tree wholesale only when its export lists nothing as incomplete. Otherwise it forgets the moved items one by one. No test pinned that guard.The new test uses a legacy engine whose export reports one partly stored item, and whose
erasepanics. Cleanup must finish (Phase::Cleaned) through per-id forgets, without ever callingerase.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-tools --lib a_partly_stored_legacy_item_blocks_the_scope_wide_erase:let mut can_erase = !shared;(the!found.partialterm dropped): FAILED, panicking at the erase call. The file was restored by copy.Tests
New
a_partly_stored_legacy_item_blocks_the_scope_wide_erase, plus thePartlyStoredwrapper engine it needs.Documentation
Not needed (test only).
Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description