Skip to content
Source
Sign inSign up
TanStack/db

Revalidate deferred subquery literal semantics: undefined and empty records #2337

OpenKyleAMathews opened this issue 1 comment
KyleAMathewscommented

Problem and evidence

The retained release-scope record preserves P11/P12: raw undefined becomes null, and selected empty records disappear. Root/QueryRef runtime coverage recorded 18 RED comparisons, the correlated receiver 72, and the source-public type receiver 280. These are historical results, not new executions on current main.

The record remains present on main c5ad6ad5a782ff04e9157bdef69399f2b5ba813b. This follow-up was retained during release preparation but did not have a dedicated issue. First determine which failures still reproduce; do not infer current behavior from the historical counts.

Preserved owner

Restore the complete dependent slices named in the record, including:

  • packages/db/tests/query/subquery-literal-value-oracle.ts and its driver.
  • subquery-literal-correlated-oracle.ts, driver, factories and runner.
  • subquery-literal-types-oracle.ts, support and runner.
  • The appended literal slice of subquery-user-value-oracle.test.ts.

The accepted source snapshot is identified in the record as local branch codex/rc-oracle-followup, commit db38b4e009146af53e46aeeef3206269f5968af8, with the snapshot manifest hash. That is a preserved local source, not a claim that a public branch exists.

Work and acceptance

  1. Revalidate the accepted literal-value law and restore the exact model/driver/receiving slices before editing production.
  2. Reproduce surviving failures on current main, separating explicit undefined, missing properties, null, empty records and absent joined rows.
  3. Preserve root, QueryRef, correlated and source-public type checkpoints and all positive controls.
  4. Repair each surviving class with generated distinguishing cases, measured reach, parent RED, repaired GREEN and a hostile mutant rejected at the intended comparison.
  5. Update the coverage map with bounded results and any remaining limits.

Runtime and type evidence are separate. #2187 concerns literal RefProxy values on a remote wire; it is not this local literal-value report.

  1. Fresh revalidation on origin/main baabf57a0f110d57ad9bb7b81148466b18fbe0d1 confirms this issue should remain open, with a narrower runtime result than the historical record.

    I restored the complete accepted test-only literal model/driver/factory/runner slices from local snapshot db38b4e009146af53e46aeeef3206269f5968af8. That snapshot is a retained local Git object, not an assumed public branch. These are restored follow-up tests against unchanged current-main production, not tests already registered on native main. All 158 DB/IVM source files match the frozen Git tree; executed DB/IVM modules resolve to that same checkout.

    Fresh checkpointAuthored historiesPassingIntended failures
    Root/QueryRef runtime68608
    Correlated runtime27224032
    Source-public types34060280

    The runtime failures are raw undefined and mixed reference/undefined arrays. Each reaches all three source cuts, through both record positions and root/QueryRef paths; correlated receivers also cross toArray, array/singleton materialize, and Collection facades. The first public-value comparison sees null where the independent model requires undefined.

    For a seeded source row { id: 1, optional: undefined }, this public selection illustrates the surviving behavior:

    const selected = new Query().from({ row: source }).select(({ row }) => ({
      id: row.id,
      raw: undefined,
      explicit: new IR.Value(undefined),
      mixed: [row.id, undefined],
      source: row.optional,
      nil: null,
      empty: {},
      nestedEmpty: { child: {} },
    }))
    const live = createLiveQueryCollection({ query: selected, getKey: row => row.id })
    await live.preload()
    // raw === null; mixed is [1, null]
    // explicit === undefined; source === undefined; nil === null
    // empty is {}; nestedEmpty is { child: {} }

    An additional LEFT-join probe preserves an absent joined field as undefined; an unselected property remains absent. The shared histories separately cover source missing properties, own undefined, null and later present values.

    Empty-record runtime update: all 60 retained empty-record histories now pass (raw, nested and explicit-IR empty records across the complete retained standalone/correlated grammar), as do 20 empty-array controls, at all three cuts. This establishes that those retained runtime cases no longer reproduce; it does not close every runtime/type path involving empty records.

    Separate static result: 40 histories still lose raw-nullish precision and 272 still expose unwanted metadata in contextual-input/propagated-inline types, with 32 overlapping. All 340 authored consumers compile without diagnostics before the type-law comparisons. All 55 type controls pass. Runtime success does not discharge those type failures.

    Every declared reach state executes once: 204 standalone receiving, 102 callback, 3,264 correlated and 2,550 type syntax/admission/marker states. All runtime checker/freedom controls and six relational neighbors pass. The full final run is 804 tests: 484 pass / 320 intended assertion failures, using Node 24.19.0, Vitest 4.1.12 and TypeScript 5.9.3. Initial dependency/config setup failures were recorded separately and supply no reproduction credit.

    No production repair or whole-issue closure is claimed. Remaining scope includes broader mixed-expression admission, sparse arrays, descriptors/symbols, arbitrary recursion, packed/installed declaration emission and provider/framework receiving paths. #2187 remains a separate remote-wire concern.

Sign in to join this conversation.