Skip to content

Hydration oracle: observer shows no rows after cleanup, restart, and a new write (granular mode) #2334

Open

Description

@KyleAMathews

Summary

A random campaign of live-query-observer-hydration-oracle.property.test.ts found a counterexample in CI. It reproduces on main at a2c3854c3 and at a3c4d0676. It still reproduces after a merge of 9be51e037 (#2333). This report does not establish whether production or the oracle's model is wrong.

Counterexample

CI run: https://github.com/TanStack/db/actions/runs/41516335355/job/125520732865 (PR #2302, which does not change this oracle or the observer).

{ seed: 2087400494, path: "4:0:2:3", endOnFailure: true }
Counterexample: [{"mode":"granular","seed":[],"events":[{"type":"attach"},{"type":"ready"},{"type":"write","key":"b","version":0},{"type":"cleanup"},{"type":"restart"},{"type":"write","key":"b","version":0}]}]
AssertionError: ... "step":5}: expected [] to deeply equal [ [ 'b', +0 ] ]
    at check (tests/live-query-observer-hydration-oracle.property.test.ts:314:51)

The history attaches a granular observer with no hydration seed and marks the Collection ready. It writes row b, cleans the Collection up, restarts it, and writes row b again. After the last write, the model expects the observer view to show b. The view shows no rows.

Reproduce

This property is not in the oracle-config.ts path-replay registry, so the replay environment variables do not select it. Pin the seed in the random campaign (generated histories refine the hydration model with a random or replayed seed): replace oraclePropertyOptions(100) with { seed: 2087400494, path: '4:0:2:3', endOnFailure: true }. Then run from packages/db:

pnpm exec vitest run tests/live-query-observer-hydration-oracle.property.test.ts --coverage.enabled=false --typecheck.enabled=false -t "random or replayed seed"

Next step

Determine which account fails: the observer after a cleanup and restart, or the model's expected rows for a restarted Collection. Keep this trace as a replay of the shared model and comparison. The property's absence from the path-replay registry is a separate coverage-map limit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions