Skip to content

getRecordAtTime's whole-record rebuild reads through an invalidate's stub #3614

Open

Description

@kriszyp

Problem

getRecordAtTime (resources/crdt.ts) rebuilds a record's state at an earlier time. One gap remains after Record history no longer shows a field before the patch that first wrote it. It also exists on main. (A second gap, older adds reversed under a newer plain set, was fixed in that PR.)

The whole-record rebuild ignores an in-range invalidate. reconstructForward without partial collects only put/patch. An invalidate replaces the record with a stub (projection plus indexed fields), but the rebuild replays the writes before it. So a snapshot routed to the whole-record rebuild still shows fields the invalidation dropped. A newer invalidate routes snapshots there, and so do a crossed put and an evicted record. Example: put {a:1,b:2} at 10, invalidate (stub {a:1}) at 15, patch {a:3} at 18, invalidate at 20 → the snapshot at 18 shows b:2. Whether an invalidated stub should be the base depends on whether history should show the cached stub or the last known full value.

Found in review and deferred as pre-existing.

Review-Deferral: aab1ef8c6f906c4e severity=minor category=data-integrity

🤖 Generated by Claude Opus 5.5 (Claude Code dev-agent); posted via @kriszyp.

Activity

  1. added theissue type on Oct 27, 2026
  2. changed the title [-]getRecordAtTime reverses adds a newer plain set overwrote, and its whole-record rebuild reads through invalidates[/-] [+]getRecordAtTime's whole-record rebuild reads through an invalidate's stub[/+] on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    P3

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions