Skip to content

fix(sqlite-native): delete metadata before chunk range#4638

Open
NathanFlurry wants to merge 1 commit into04-12-fix_sqlite-native_keep_truncate_cache_coherentfrom
04-12-fix_sqlite-native_delete_metadata_before_chunk_range
Open

fix(sqlite-native): delete metadata before chunk range#4638
NathanFlurry wants to merge 1 commit into04-12-fix_sqlite-native_keep_truncate_cache_coherentfrom
04-12-fix_sqlite-native_delete_metadata_before_chunk_range

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Copy Markdown
Member Author

NathanFlurry commented Apr 13, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude
Copy link
Copy Markdown

claude Bot commented Apr 13, 2026

The ordering fix is correct: deleting metadata before chunks is the safer crash-safety posture. If a crash occurs after metadata is deleted but before chunks are removed, the chunks become orphaned but no reader will follow a dangling reference to missing data. The reverse ordering (old behavior) leaves a valid metadata key pointing to deleted chunks, which risks corruption on the next read. This PR fixes the Rust side but leaves the TypeScript WASM VFS with the original chunk-first ordering. The fix needs to be applied there too to satisfy the required parity and close the same crash-safety gap on the WASM path. The template body was left blank. A one-line note on why the order matters would help reviewers. The Rust change itself is a sound fix. Two gaps to address: (1) WASM VFS still deletes chunks before metadata - needs the same reordering to maintain required VFS parity. (2) PR description was left blank.

@NathanFlurry NathanFlurry marked this pull request as ready for review April 13, 2026 05:18
@NathanFlurry NathanFlurry force-pushed the 04-12-fix_sqlite-native_delete_metadata_before_chunk_range branch from 12c0baa to 61b5457 Compare April 13, 2026 05:38
@NathanFlurry NathanFlurry force-pushed the 04-12-fix_sqlite-native_keep_truncate_cache_coherent branch 2 times, most recently from 459dd12 to d7b2c43 Compare April 13, 2026 05:50
@NathanFlurry NathanFlurry force-pushed the 04-12-fix_sqlite-native_delete_metadata_before_chunk_range branch from 61b5457 to bc7e3d7 Compare April 13, 2026 05:50
@NathanFlurry NathanFlurry force-pushed the 04-12-fix_sqlite-native_keep_truncate_cache_coherent branch from d7b2c43 to 6c17fae Compare April 13, 2026 07:03
@NathanFlurry NathanFlurry force-pushed the 04-12-fix_sqlite-native_delete_metadata_before_chunk_range branch from bc7e3d7 to 49fae2b Compare April 13, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant