structuralIdentity merges distinct RegExp values with reference-valued lastIndex
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 22/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- javascript, typescript
- Domaine
- data-engineering
Piste de recherche
Start with packages/db-ivm/src/hashing/hash.ts, where structuralIdentity and equalHashValues treat RegExp lastIndex differently. Reproduce with the snippet in the issue, then add a reference-valued lastIndex witness to the structural-identity oracle and exercise the groupBy path. Done when the two values stay separate in groupBy and the existing hash tests still pass.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Bug
D2 equality treats RegExp lastIndex as a header compared with ===, but structuralIdentity recursively encodes that header. Separate reference-valued headers with the same contents therefore produce one defined identity for unequal values.
import {
equalHashValues,
structuralIdentity,
} from './packages/db-ivm/src/hashing/hash.ts'
const a = /a/g
const b = /a/g
a.lastIndex = Object.freeze({ x: 1 })
b.lastIndex = Object.freeze({ x: 1 })
Object.freeze(a)
Object.freeze(b)
console.log(equalHashValues(a, b)) // false
console.log(structuralIdentity(a) === structuralIdentity(b)) // true
JavaScript permits assigning an object to lastIndex; TypeScript's RegExp declaration models only the usual numeric value. The witness remains after both values and headers are frozen. hash.ts explicitly allows any lastIndex value in the header.
Impact
groupBy uses the defined structural identity as a prefix key. A real D2 aggregate over the two values above reported one distinct contribution where D2 equality distinguishes two. The two values also have equal structural hash digests, so returning undefined from structuralIdentity alone does not establish a correct groupBy fallback.
Test gap and repair boundary
The structural-identity oracle currently generates only numeric lastIndex values. The hash-identity oracle also limits its RegExp grammar. Add reference-valued headers to an independent model and a direct helper witness, then exercise the receiving groupBy path. The production fix should preserve the law that a shared defined identity implies D2 equality and that D2-unequal contributions stay separate. This is a pre-existing defect found while reviewing PR #2153; that PR only repairs the oracle's nested-array normal form.
- Langage dominant
- TypeScript
- Étoiles
- 3.9k
- Forks
- 277
- Merge moyen
- 22 h 54 min
- PR mergées (30 j)
- 236
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de TanStack/db
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 12/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 8/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 5/100
TanStack/db#2186 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
query-db: a Query refetch that joins a loader's refetch acquisition does not report shifted pagesOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 8/100
TanStack/db#2185 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de TanStack/db
Issues similaires
-
bug priority: P2
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
mattermost/compass-design#106 ·
Les mainteneurs répondent en général sous 1 jour
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:other issue-rating: 🦞 diamond lobster P2
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
openclaw/openclaw#176671 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
nordcraftengine/nordcraft#1400 ·
Les mainteneurs répondent en général sous 1 jour