fix(sqlite-native): keep truncate cache coherent#4637
Conversation
PR Review: fix(sqlite-native): keep truncate cache coherentPR #4637 | SummaryThis PR fixes two cache coherence bugs in
Code Quality and CorrectnessFix 1 is correct and complete. The reordering of
Fix 2 is correct. The WASM parity is maintained for the retain boundary. The WASM VFS has no in-process read cache (it is async and relies on the host KV layer), so Fix 2 has no TypeScript counterpart to update. This asymmetry is architectural, not a bug. Style and Convention Compliance
Test CoverageNo regression tests were added. Given the subtlety of both bugs (Fix 1 only triggers for exact-multiple sizes; Fix 2 only manifests when the same connection reads after a non-aligned truncation), a targeted regression test would be valuable. Suggested scenario:
The existing VFS test suite would be the appropriate place for this coverage. VerdictBoth fixes are logically correct and well-targeted. The formula change aligns with the existing KV deletion logic in the same function and the WASM VFS counterpart. The cache update after last-chunk truncation closes a real stale-read window. Adding a regression test for the non-chunk-aligned truncate + cached-read path is recommended but not a blocker. |
4079bac to
459dd12
Compare
4303e83 to
60882a2
Compare
459dd12 to
d7b2c43
Compare
5f174d0 to
c75356d
Compare
d7b2c43 to
6c17fae
Compare
93f25d2 to
e993f2c
Compare
d13eb68 to
797b692
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: