Skip to content
Source
Sign inSign up
TanStack/db

test: add contract-led observer and client history oracles #1813

Send to my agent
ClosedKyleAMathews(GitHub profile, opens in a new tab) opened this issue 0 comments

Goal

Turn the existing observer/client lifecycle examples into generated histories without copying the production dispatch queue or replacing valuable focused regressions. Follow-up to #1808; related framework boundary: #1623.

The ordinary observer tests already distinguish FIFO reentrant publication, bootstrap versus wholesale delivery, listeners joining during dispatch, stale ready callbacks, disposal and hydration. A broad command generator alone would not define which outcomes are legal.

Plan

  1. Extract the existing contracts into an event/observation table before changing tests. Map each law to an existing lifecycle/conformance owner; extend that owner when it fits.
  2. Use a small per-listener reference ledger: which publications a listener is eligible for, observed rows, and lifecycle state. Do not model the implementation's queue structure.
  3. Generate bounded subscribe/unsubscribe/dispose/publication histories, with nested publication and listener failures at explicit boundaries. Distinguish initial delivery from later deltas.
  4. Compare direct reads and rows reconstructed by each eligible listener after every public boundary. Check exact delivery multiplicity and ordering where specified; do not impose a total order where the contract allows alternatives.
  5. Keep stale data, readiness, errors, and source authority separate. Establish hydration/stale-ready rules from existing contracts before combining them with reentrant delivery.

Acceptance

  • Fixed and random runs, shrinking, exact seed/path replay, and executed transition coverage.
  • Deliberate faults rejected: dropped peer delivery after a listener throws, duplicate bootstrap, stale-ready publication after disposal, and reentrant publication delivered out of FIFO order.
  • Existing examples are retained or mapped to a preserved oracle obligation.
  • API wording, framework-specific wiring, and native boundaries remain focused tests where a generated model adds no authority.
  • No new runtime contract inferred merely to make the model simpler. Reproduce any runtime bug before proposing a separate narrow fix.

This is a scoped conversion opportunity from the ordinary-test scan, not a newly confirmed production defect.

  1. tannerlinsley closed this

Sign in to join this conversation.