Skip to content

TigerStyle: add verify_invariants() to CommandExecutor #9

@nerdsane

Description

@nerdsane

Context

Found during code review of bitmap implementation (commit e9be18b).

Problem

CommandExecutor has no verify_invariants() method. Data structure types like SDS and sorted sets have them, but the executor itself does not verify its aggregate state after mutations. This means:

  • data and expirations maps could diverge silently
  • access_times could contain stale entries
  • key_count field could drift from data.len()

Suggested Invariants

impl CommandExecutor {
    #[cfg(debug_assertions)]
    fn verify_invariants(&self) {
        // Every key with expiration must exist in data
        for key in self.expirations.keys() {
            debug_assert!(self.data.contains_key(key));
        }
        // access_times should be subset of data keys
        // (with allowance for recently-expired keys)
    }
}

Call after every mutation in debug builds.

Severity

Low — design improvement, pre-existing gap across all executor ops.

Found By

TigerStyle review agent (Design observation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions