Conversation
Greptile SummaryThis PR fixes CAS corruption reuse by validating on-disk file length against Confidence Score: 5/5Safe to merge — small, targeted fix with a regression test and no logic issues found. No P0 or P1 issues found. The length-check-after-write, remove-and-retry, and fallback error path are all correct. The stored_file_matches_metadata refactor is semantically equivalent to the original. The regression test directly exercises the truncated-entry repair path. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix(store): repair truncated CAS entries" | Re-trigger Greptile |
9f29a96 to
206edfc
Compare
Summary
Why
A discussion report showed a valid npm tarball failing package validation with an empty
package.jsonparse error. The upstream tarball and integrity for@babel/helper-string-parser@7.27.1are valid, which points to reuse of a stale zero-byte or truncated CAS file during import.Validation
cargo fmt --checkcargo test -p aube-store test_import_bytes_repairs_truncated_existing_cas_entrycargo test -p aube-storecargo clippy -p aube-store --all-targets -- -D warningsNote
Medium Risk
Touches CAS import and cache-staleness detection paths; incorrect size checks or rewrite logic could cause unnecessary rewrites or new I/O errors during installs, but changes are localized and covered by a regression test.
Overview
Prevents reuse of truncated/zero-byte CAS files by verifying on-disk byte length against the expected
StoredFile.sizeand treating mismatches as stale.import_bytesnow rechecks the stored file length after creation, and if it’s wrong it deletes and rewrites the CAS entry (failing with a detailed I/O error if the second attempt is still wrong). A new regression test seeds an empty CAS file and asserts that a subsequent import repairs it.Reviewed by Cursor Bugbot for commit 206edfc. Bugbot is set up for automated code reviews on this repo. Configure here.