Add query planner diagnostics and regression reproductions - #134
Conversation
a00bf84 to
ea74da5
Compare
7bad797 to
7c06c6e
Compare
Second semantic audit — additional regressions addedAfter the initial seven planner regressions were isolated, I did one more semantic pass over the query pipeline before treating this PR as the reproduction baseline. That pass found several additional, independently testable correctness gaps, and the PR now captures them without applying production fixes. Additional confirmed defect families
I also tested a suspected sibling case involving querying one component of a compound primary key. That live query currently returns the correct result set, so I did not classify it as a bug; the test remains as a passing positive regression guard. Test structure addedThe additional coverage is intentionally split across three boundaries:
That gives the follow-up repair PR much better localization than a single end-to-end red test. Final verified baselineFinal squashed head:
The same 25 browser test names fail on all four browser engines; there are no browser-specific extra failures. Some defect families intentionally have both a direct truth-law test and a live reproduction, so 25 failing browser tests are not being claimed as 25 separate root causes. No production query fix is included here. This comment and the updated PR description are the checkpoint: merge the reproductions/diagnostics first, then drive these contracts green in the follow-up bug-fix work. IndexedDB compatibility remains intentionally scoped to IndexedDB 2.0; IndexedDB 3.0 draft behavior is not used as an assumption or workaround. |
Purpose
This PR intentionally does not fix the reproduced query-engine defects. It establishes a stronger semantic-test boundary and structured query-planner observability first, so the follow-up repair work can make independently proven red regressions turn green.
The final branch is a single commit on top of
masterand retains IndexedDB 2.0 as Magic IndexedDB's supported compatibility contract. IndexedDB 3.0 is still draft and is not used as a correctness assumption or workaround.Structured planner diagnostics
When Magic IndexedDB debug mode is enabled, the JavaScript query pipeline now records a passive structured trace for the most recent query. The trace does not participate in planning decisions.
It records:
single-index,compound-index,cursor);Browser tests consume the structured object directly rather than parsing console text. This is intentionally a lightweight last-query development probe, not concurrent correlated telemetry.
Initial reproduced planner defects
The first audit established seven regressions:
ANDcan lose intersection semantics;Take/pagination can reconverge as undefined cursor condition sets;StartsWithbranches can be rewritten into an incorrect physicalIn/anyOfquery;Second semantic audit
A broader semantic pass added regression coverage for additional confirmed defect families:
(A=1 && B=2) || (A=3 && B=4)can be reconstructed as independent value sets and admit cross-pairs.StartsWithcan be sent to a case-sensitive IndexedDB prefix lookup, while ordinary C# string equality can acquire different semantics on the cursor path.OrdinalIgnoreCaseprefix can be discarded as contradictory.Containsset can collapse to an empty filter and return the entire table instead of no rows.true && P == Pandtrue || P == true.DateTime.Dateboundaries: non-equality comparisons can compare the original timestamp against target midnight instead of whole-day boundaries; unit contracts also coverDate != target.string.Equals, and collection-propertyContainscurrently emit operation tokens that do not match the canonical JS evaluator vocabulary.Any/Allpreprocessing visitor throws on empty sequences instead of applying the standard false/true identities.["a|b", "c"]and["a", "b|c"].A suspected sibling issue involving a live query on one component of a compound primary key did not reproduce. That query currently returns the correct result set, so the test is retained only as a positive semantic guard and is not listed as a bug.
Testing layers
The expanded coverage deliberately separates three kinds of proof:
This lets a follow-up fix distinguish "translation was wrong", "a transformation changed truth", and "physical execution changed semantics" rather than treating every failure as an opaque browser mismatch.
Browser coverage
The regression suites run on:
The macOS open/registration and CRUD/streaming suites remain separate controls and stay green.
Verified final red baseline
Validation on final one-commit head
7c06c6e0produced the intended result.Core validation
Restore, package-version checks, clean NuGet packing, and package-content verification all pass.
The semantic unit/contract suite is intentionally red:
Those 11 failures are only the newly corrected semantic contracts: operation vocabulary/case sensitivity,
.Dateboundaries, and emptyAny/Allbehavior. There are no compile or harness failures.Browser validation
The same 25 test names fail on every browser engine. There are no Chromium-only, Firefox-only, or WebKit-only semantic failures and no unrelated browser failures. Several defect families intentionally have both a direct transformation-law test and a live end-to-end reproduction, so 25 failing tests should not be interpreted as 25 independent root causes.
Representative reproduced outputs include:
true || P: expected 44 rows, actual 15;true && P: expected 15 rows, actual 0;"a|b|c"de-dup identity.Expected CI state
This PR is intentionally red. The red tests are the deliverable: they prove the pre-existing behavior before repair work begins. Build/package infrastructure and unrelated test surfaces remain healthy.
The follow-up bug-fix work should use this merged baseline and drive these semantic regressions green without weakening or deleting the contracts.