Skip to content

docs(persistence): add sync comment to AofRecord and improve recovery clarity - #165

Merged
kacy merged 1 commit into
mainfrom
refactor/idiomatic-rust-pass-pr3
Feb 17, 2026
Merged

docs(persistence): add sync comment to AofRecord and improve recovery clarity#165
kacy merged 1 commit into
mainfrom
refactor/idiomatic-rust-pass-pr3

Conversation

@kacy

@kacy kacy commented Feb 17, 2026

Copy link
Copy Markdown
Owner

summary

two targeted clarity improvements to the persistence layer, no behavior changes.

aof.rs — sync comment on AofRecord

AofRecord has three match arms per variant that must be kept in sync: tag() (the tag byte), estimated_size() (capacity hint), and to_bytes() (actual serialization). there was no comment making this explicit. added a block comment on the impl explaining the constraint and the requirement that tag byte values are never reused. this makes it harder for a future contributor to add a variant and miss one of the three arms.

recovery.rs — warn on non-integer INCR replay

apply_incr was silently leaving a key's value unchanged when it encountered a non-integer during AOF replay. this meant that a corrupt or unexpected value in the AOF would produce no observable signal — the replay would succeed and the resulting keyspace would be silently wrong. now emits tracing::warn! so operators see the issue in logs.

also added a comment on the TTL filtering step explaining that TTLs are preserved as-is during replay, that keys which expired during downtime are filtered at this point, and that keys with remaining TTL will be lazily evicted on first access.

what was tested

  • cargo build -p ember-persistence — clean
  • cargo test -p ember-persistence — 67 tests pass, 0 failures
  • cargo fmt --check -p ember-persistence — no formatting issues
  • manual verification: started server with AOF enabled, wrote keys, restarted server, verified keys restored correctly

… clarity

aof.rs
- add a block comment on AofRecord impl explaining that tag(), estimated_size(),
  and to_bytes() must stay in sync when adding a variant. makes the
  constraint explicit for future contributors rather than leaving it implicit.

recovery.rs
- apply_incr: emit tracing::warn! when a value cannot be parsed as an integer
  during replay. previously this silently left the old value unchanged, giving
  operators no signal that the AOF contains unexpected data.
- recover_shard_impl: add comment explaining TTL handling during recovery —
  that expired keys are filtered here and remaining-TTL keys are lazily evicted
  on first access after startup.
@kacy
kacy merged commit b0356e3 into main Feb 17, 2026
7 checks passed
@kacy
kacy deleted the refactor/idiomatic-rust-pass-pr3 branch February 17, 2026 23:33
kacy added a commit that referenced this pull request Feb 19, 2026
… clarity (#165)

aof.rs
- add a block comment on AofRecord impl explaining that tag(), estimated_size(),
  and to_bytes() must stay in sync when adding a variant. makes the
  constraint explicit for future contributors rather than leaving it implicit.

recovery.rs
- apply_incr: emit tracing::warn! when a value cannot be parsed as an integer
  during replay. previously this silently left the old value unchanged, giving
  operators no signal that the AOF contains unexpected data.
- recover_shard_impl: add comment explaining TTL handling during recovery —
  that expired keys are filtered here and remaining-TTL keys are lazily evicted
  on first access after startup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant