Skip to content
Source
Sign inSign up
TanStack/db

fix(db-ivm): preserve Temporal group key identity #1919

MergedKyleAMathewsmerged 7 commits intomain fromrefs/pull/1919/headmerged by KyleAMathews

Showing 7 changed files with 243 additions and 0 deletions (loading 4).

x
0 of 7 viewed, 7 left
5 additions and 0 deletions.changeset/fix-temporal-group-keys.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/db-ivm': patch
+---
+​
+Keep distinct Temporal values in separate `groupBy` groups and prevent plain objects with Temporal tags from sharing those groups.
221 additions and 0 deletionsdocs/contributing/oracle-reviews/bug-11-temporal-group-keys.mdAdded
View file
@@ -0,0 +1,221 @@
+# Temporal group-key oracle review
+​
+## Reviewed state and contract
+​
+- Base: `33a194941c8d51f8f98babb999fef2987dd6ff8b` (`origin/main`).
+- Reviewed executable head: `6d3e58ec`.
+- Owner: `packages/db-ivm/tests/temporal-group-key-oracle.test.ts`.
+​
+The user confirmed that db-ivm `groupBy` must keep different Temporal values in
+different groups. This repair uses db-ivm's established hash key domain: a
+Temporal kind and its string representation identify a key. The oracle checks
+the public grouped result after one input batch. It covers the eight Temporal
+kinds recognized by hashing, with two different values and matching fresh
+values for each kind. The model counts those descriptors in a plain Map.
+​
+The original serializer treated each Temporal value as an empty plain object.
+On the base commit, a public `groupBy` of January 15 and June 15 PlainDates
+emitted one group with count 2. The new oracle failed at that public checkpoint
+for all eight kinds: it observed one count-2 group where it expected two
+count-1 groups. Eight matching-value controls passed. A direct serialization
+control also failed because a Temporal value and `{}` both encoded as `{}`.
+​