fix(storage): propagate clock error in applied_at_ms (TD-08)#456
Merged
intendednull merged 1 commit intoApr 28, 2026
Merged
Conversation
migration insert used `.unwrap_or(0)` on `SystemTime::now` duration. clock pre-1970 means `applied_at_ms = 0` lands in schema_version, silent. rest of crate returns `anyhow::Result`, so just `?` it. only one site in the storage crate, no helper needed. test: extend `schema_version_table_exists_after_open` to read back `applied_at_ms` and assert > 0. pins behaviour against the legacy `0` fallback under normal clock. error-branch test would need time mocking the crate doesn't have, out of scope. TD-08, refs #254
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
what
migration insert in
crates/storage/src/store.rsdid:clock pre-1970 ->
applied_at_ms = 0silently lands inschema_version. rest of crate hands backanyhow::Result. mismatch.fix
.map_err(anyhow::Error::from)?on theduration_since. function already returnsanyhow::Result<()>, the?just falls through.only one call site in the storage crate (grep clean). no shared helper, one line plus comment.
test
extended
schema_version_table_exists_after_open. now reads backapplied_at_msalongsideversionand asserts every row hasapplied_at_ms > 0. pins behaviour off the legacy0fallback under normal clock.error-branch test (clock pre-1970) would need
SystemTimemocking infra the crate does not have today. out of scope for this issue. comment in test notes that.storage tier (lowest covering this insert path).
verify
storage is native-only (rusqlite + tokio in
Cargo.toml), no wasm check.Refs #254
Generated by Claude Code