Skip to content
Source
Sign inSign up
TanStack/db

test(electric): verify compiled predicate meaning against backend results #1814

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

Goal

Add semantic checks where compiler/request snapshots only prove the text stayed the same. Follow-up to #1808 and the existing integration portfolio in #772; reuse that infrastructure rather than introducing another generic adapter model.

First slice: Electric predicate compilation

  • Inventory which current snapshot tests already have an independent semantic counterpart in the adapter/conformance suites.
  • Specify a small compatible predicate/value domain, including nulls, quoted strings, Boolean combinations, and supported comparisons. State exclusions and SQL three-valued logic explicitly.
  • Generate finite row worlds and predicates; compare the production compiler's actual emitted query executed by the matching backend with a separately specified finite evaluator.
  • Preserve snapshot tests for quoting, parameter binding, unsupported-expression errors and stable wire syntax. Semantic equality does not establish safe quoting.
  • Calibrate with wrong bound values, lost predicates, incorrect null handling, and swapped comparison direction.
  • Report backend/SDK versions and executed cells. A mock interpreter consuming original IR is not evidence that emitted SQL is correct.

Later adapter boundary work

Use the same law/owner inventory to identify real SDK and native-storage gaps. Add provider-specific legal schedules to existing oracles, with captured or documented SDK contracts. Do not generate impossible SDK traces or replace durability/worker/IPC tests with callback mocks. Keep unexecuted service/device gates visibly separate from passing local models.

The desired result is a few independent semantic checks, not universal serialization, an all-adapter state machine, or new production abstractions. This issue proposes investigation and tests; it does not claim a newly reproduced adapter defect.

  1. tannerlinsley closed this

Sign in to join this conversation.