You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
structuralIdentity merges distinct RegExp values with reference-valued lastIndex #2192
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.
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.
Activity