insipx/db integrity 2 corrupt classification - #4030
Conversation
|
Claude finished @insipx's task —— View job Code Review (2026-08-27 15:47 UTC)This PR effectively distinguishes database corruption from incorrect encryption keys. The implementation is clean and well-tested. A few observations: Error Message Inspection (sqlcipher_connection.rs:274)The corruption detection relies on string matching ( Minor concern: The Test CoverageThe test at line 477 ( Retryability ClassificationThe Performance & SecurityNo concerns. This is an error path change with no runtime overhead on the happy path. Minor Nitsqlcipher_connection.rs:272: The error log includes the full error from Summary: The implementation is sound. The string-matching detection is pragmatic given SQLite's error reporting. The comprehensive regression test and retryability assertion provide good coverage. No blocking issues. |
a57d7c8 to
4d80216
Compare
4d80216 to
6143d45
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## insipx/db-integrity-1-core #4030 +/- ##
=============================================================
Coverage ? 85.96%
=============================================================
Files ? 421
Lines ? 68854
Branches ? 0
=============================================================
Hits ? 59193
Misses ? 9661
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6143d45 to
f2f9934
Compare
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, self-contained fix that distinguishes corrupted encrypted databases from incorrect keys while preserving existing retry behavior. It changes only an error path, adds targeted regression coverage, and is fully within the author’s owned storage code. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
f2f9934 to
991b609
Compare
991b609 to
bfc4447
Compare
bfc4447 to
ddeebbc
Compare
ddeebbc to
44e1945
Compare
44e1945 to
affbd83
Compare
…lCipherKeyIncorrect EncryptedConnection::validate mapped every key-test failure to SqlCipherKeyIncorrect, so a corrupted-but-correctly-keyed database was indistinguishable from a wrong key at client open. Corruption-shaped failures (malformed/corrupt) now surface as the new non-retryable PlatformStorageError::DatabaseCorrupt. Wrong-key behavior is unchanged; the accompanying comment documents why the two remain ambiguous in general (plaintext-header setup makes wrong-key failure shapes data-dependent). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
affbd83 to
9859ebb
Compare
Stacked on #4029. A corrupted-but-correctly-keyed encrypted DB previously failed client-open as
SqlCipherKeyIncorrect("PRAGMA key or salt has incorrect value"), indistinguishable from a wrong key. Corruption-shaped validate failures now surface as the new non-retryablePlatformStorageError::DatabaseCorrupt; wrong-key behavior is unchanged, and the comment documents why the two remain ambiguous in general under plaintext headers. Includes a deterministic corruption regression test (truncate + byte-flip, 10/10) and a retryability assertion.🤖 Generated with Claude Code
https://claude.ai/code/session_01V1AXHNsnQmHW174i5rRUEb
Note
Add
DatabaseCorruptvariant toPlatformStorageErrorand detect corruption inEncryptedConnection::validateDatabaseCorrupt(String)to thePlatformStorageErrorenum and returnsfalsefromis_retryable()for this variant, classifying corruption as non-retryable.EncryptedConnection::validatein sqlcipher_connection.rs to inspect the PRAGMA/key validation error message; if it contains "malformed" or "corrupt" the error surfaces asDatabaseCorrupt, otherwise it remainsSqlCipherKeyIncorrect.SqlCipherKeyIncorrectfor a corrupt database will now seeDatabaseCorrupt; retry logic will no longer attempt retries on corruption errors.Macroscope summarized 9859ebb.