Skip to content

test(server): characterize SQL/JS predicate parity — ne crashes handleSub, like diverges#6

Open
grrowl wants to merge 2 commits into
feat/ssrfrom
advisor/003-predicate-parity
Open

test(server): characterize SQL/JS predicate parity — ne crashes handleSub, like diverges#6
grrowl wants to merge 2 commits into
feat/ssrfrom
advisor/003-predicate-parity

Conversation

@grrowl

@grrowl grrowl commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Executes plan 003 from the advisor audit. Characterization tests only — and they found real divergence. The failing cases are marked it.fails (suite stays green; they'll loudly flip the moment a fix lands).

Confirmed divergences

  1. P1 — ne crashes the DO's handleSub; the client hangs forever. sql-compiler.ts accepts ne in its operator floor, but @tanstack/db's compileSingleRowExpression throws QueryCompilationError: Unknown function: ne — from compilePredicate via subs.add, outside the UnsupportedPredicateError catch. No reset is sent, no snap-end arrives.
  2. MED — like membership depends on connection timing. SQLite LIKE is ASCII-case-insensitive; @tanstack/db's like evaluator is case-sensitive. "HELLO" is in the snapshot under like "hello%" but excluded from deltas.

eq, gt, not(eq), in were verified to agree on NULL semantics across both paths (including the null-vs-omitted spelling variants).

Next (maintainer decision + ADR — deliberately not in this PR)

  • Guard compilePredicate failures in handleSub (send reset).
  • Resolve the operator floor: plan 003's Maintenance notes sketch options; (a) an in-tree SQLite-semantics row evaluator for the supported floor keeps SQL the source of truth.

🤖 Generated with Claude Code

grrowl and others added 2 commits June 11, 2026 20:24
Two divergences confirmed (plan 003):

1. `ne` — accepted by sql-compiler.ts COMPARATORS but rejected by
   @tanstack/db compileSingleRowExpression ("Unknown function: ne").
   The subscription hangs: the client never receives snap-end.
   Operator floor is inconsistent across the two evaluators.

2. `like` — SQLite LIKE is case-insensitive for ASCII (default);
   @tanstack/db is case-sensitive. "HELLO" matches LIKE "hello%"
   in the snapshot path but not in the delta path. Clients diverge
   by connection timing.

4 cases verified passing (eq, gt, not(eq), in) — NULL three-valued
logic is mirrored by toBooleanPredicate for those operators.

Failing cases are marked it.fails() so the suite stays green while
the divergences are visible. Fix needs a maintainer decision + ADR
(see plan 003 Maintenance notes for options).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tive cases

The helper was defined but only called from case 1 (ne), which is
unreachable because snapshotMembers times out first on the ne crash.
Wire it into cases gt, not(eq), and in — each using a third uniquely-named
room (pp-gt-delta-explicit, pp-not-delta-explicit, pp-in-delta-explicit) —
and assert the omit-spelling and explicit-null-spelling delta members agree,
naming the spelling mismatch in the failure message (plan 003 step 2).

Also soften the always-emit comment in deltaMembers from "the assertion
below surfaces it" (incorrect — a missing d frame is currently silent)
to "currently silent here; see STOP condition in plan 003".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant