Skip to content

refactor(redis): centralize miss and timestamp validation - #153

Open
lan17 wants to merge 1 commit into
codex/issue-145-miss-reasonsfrom
codex/miss-invariant-cleanup
Open

refactor(redis): centralize miss and timestamp validation#153
lan17 wants to merge 1 commit into
codex/issue-145-miss-reasonsfrom
codex/miss-invariant-cleanup

Conversation

@lan17

@lan17 lan17 commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Summary

Small, behavior-preserving cleanup of the miss-classification implementation, following the review on #146 (review).

  • Tie the runtime miss-reason guard to CacheMissReason using an exhaustive private map and own-key lookup.
  • Reuse one internal nonnegative safe-integer timestamp predicate for frame encoding, write-timestamp assertions, core frame-age validation, and observed-watermark validation.
  • Re-export the existing CacheMissReason type from dialcache/redis-protocol for adapter authors.
  • Remove a duplicated README statement and clarify the existing distinction between local TTL absence and a retrieved but logically expired Redis frame, plus the internal stale-recovery disposition type.

Scope and compatibility

Validation remains at its existing call sites and in its existing order. The miss taxonomy, read-result shapes, timestamp domain, error precedence, refill fencing, metrics, and Redis commands are unchanged. The validation helpers are package-private; the only public addition is the type-only re-export.

This deliberately excludes miss-union redesign, automatic timestamp defaulting, new skip telemetry, legacy decoder removal, and unrelated micro-optimizations. Untrusted adapter results are still normalized at the core boundary.

Dependency

Stacked on #146, which remains unchanged. The base branch is codex/issue-145-miss-reasons, so this PR shows only the cleanup (9 files, 47 insertions and 14 deletions).

After the prerequisite merges, rebase this cleanup onto main and retarget it before merging. No merge or release is performed by this change.

Validation

Node.js 22.22.0:

  • corepack pnpm install --frozen-lockfile
  • corepack pnpm check: typecheck, 655 unit tests with coverage, ESM/CJS build, declarations, and packed-package checks passed.
  • corepack pnpm test:integration: 143 passed; 2 local GLIDE Cluster tests skipped because announced container IPs are not host-routable.
  • Added reason-guard prototype-key/non-string cases, timestamp-boundary cases, and packed ESM/CJS type-export checks.
  • Independent review found no issues. An in-memory compiler probe confirmed that adding a reason requires updating the production guard map.
  • git diff --check passed.

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