Source
Found by Greptile review on PR #20 (merged).
Issue
The error message in crates/shrimpk-memory/src/persistence.rs (line 493-494) contains a hardcoded version list:
"Unsupported format version: {} (supported: 1, 2). \
If your data was written by a newer ShrimPK version, update your binary.",
version_byte
The "supported: 1, 2" string is manually maintained. When a future v3 format is added, this string will need to be updated manually — easy to forget, leading to a confusing error that lists v2 as the latest when v3 already exists.
Suggested Fix
Derive the supported version list from constants:
const FORMAT_VERSION: u32 = 2;
const FORMAT_VERSION_LEGACY: u32 = 1;
// In error message:
format!(
"Unsupported format version: {} (supported: {}-{}). ...",
version_byte, FORMAT_VERSION_LEGACY, FORMAT_VERSION
)
Or maintain an array SUPPORTED_VERSIONS: &[u32] = &[1, 2] and format from that.
Priority
P2 — Non-blocking style/future-proofing. Current code is correct for v1/v2.
Labels
enhancement, persistence
Source
Found by Greptile review on PR #20 (merged).
Issue
The error message in
crates/shrimpk-memory/src/persistence.rs(line 493-494) contains a hardcoded version list:The
"supported: 1, 2"string is manually maintained. When a futurev3format is added, this string will need to be updated manually — easy to forget, leading to a confusing error that lists v2 as the latest when v3 already exists.Suggested Fix
Derive the supported version list from constants:
Or maintain an array
SUPPORTED_VERSIONS: &[u32] = &[1, 2]and format from that.Priority
P2 — Non-blocking style/future-proofing. Current code is correct for v1/v2.
Labels
enhancement, persistence