[storage] Expand CRC Fix Scope#3839
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
commonware-mcp | 6177fca | May 20 2026, 07:11 AM |
Benchmark resultsTip ✅ PASSED: No benchmark exceeded the regression threshold. Benchmark comparison table
Baseline commit(s): |
Deploying monorepo with
|
| Latest commit: |
6177fca
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://daabbf19.monorepo-eu0.pages.dev |
| Branch Preview URL: | https://expand-crc-fix.monorepo-eu0.pages.dev |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fb29647. Configure here.
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## codex/append-resize-crc-fallback #3839 +/- ##
=================================================================
Coverage 95.73% 95.74%
=================================================================
Files 473 473
Lines 192765 192841 +76
Branches 4676 4672 -4
=================================================================
+ Hits 184548 184630 +82
+ Misses 6645 6642 -3
+ Partials 1572 1569 -3
... and 6 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
have added this extension of the fix to my PR (plus some other stuff). |

#3837 fixes the original same-page partial shrink case: an already-persisted partial tail can be resized to a shorter partial length without making the page unrecoverable if the CRC rewrite is interrupted.
This PR covers the related cases that #3837 does not cover: shrink targets that land inside a page which was previously full, and therefore was not represented by
partial_page_state.Concretely, this adds crash-safety for:
PAGE_SIZE->453 * PAGE_SIZE->PAGE_SIZE + 45Those target pages already have valid CRC records on disk, but #3837's protected path only ran when the target page was the current persisted partial tail. Without this PR, the fallback path can later rewrite the landing page as a padded partial page; if that write partially lands before the shorter CRC is durable, recovery can reject the landing page and truncate to the previous page boundary.
This PR fixes that by reading and validating the target page to recover the CRC record that actually committed it, then using the same two-phase CRC transition for any shrink whose target has nonzero partial bytes. If later physical pages need to be truncated first, that truncation is synced before the landing page's shorter CRC is staged.
The implementation also removes the now-unreachable later partial-tail reload path: after the CRC-safe
partial_bytes > 0branch returns, the remaining resize path is page-aligned shrink only.Testing:
just test -p commonware-runtime resize_same_page_shrink_survives_interrupted_crc_stage resize_same_page_shrink_survives_interrupted_crc_invalidation resize_full_page_to_partial resize_multi_page_to_partial.