Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

db-ivm structural-identity oracle model treats nested deep nodes as distinct

未关闭
#2,140 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
58/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript

调研方向

Start in packages/db-ivm/tests/structural-identity-oracle.property.test.ts, in the test "agrees with D2 value identity for independent values" and the model's normal(spec) function. Confirm the counterexample by running the test with the seed and path from the issue, then make the model agree with equalHashValues for nested deep nodes without changing equalHashValues or structuralIdentity. Done when the named replay passes, the property passes at 2000 runs, and the counterexample is kept as a fixed case.

由索引模型根据 Issue 内容生成。

描述

Summary

The db-ivm structural-identity oracle fails at random in CI. The failing assertion is the oracle's own sanity check, so the defect is most likely in the oracle's model, not in equalHashValues or structuralIdentity.

Failure

packages/db-ivm/tests/structural-identity-oracle.property.test.ts, test "agrees with D2 value identity for independent values":

Property failed after 1888 tests
{ seed: -956497647, path: "1887", endOnFailure: true }
Counterexample: [{"k":"deep","depth":6,"v":{"k":"leaf","i":3}},{"k":"deep","depth":3,"v":{"k":"deep","depth":3,"v":{"k":"leaf","i":3}}}]
AssertionError: model vs equalHashValues: expected true to be false

It failed CI on #2127, which does not change db-ivm.

Reproduce

The property calls fast-check directly, so the oracle replay environment variables do not reach it. Add the seed and path to the options, then run the test:

{ numRuns: 2000, seed: -956497647, path: `1887` }

On main (bbbf017ef) it fails at the first run with the same counterexample.

Analysis

Both specs build the same value: a leaf nested six levels deep. deep(6, leaf) and deep(3, deep(3, leaf)) produce equal structures, so equalHashValues returns true. The model's normal(spec) gives different strings for the two specs, so the model predicts false. The model normalizes the spec, not the built value, so it does not see that nested deep nodes compose.

Suggested fix

  • Make normal collapse nested deep nodes (sum their depths) before it serializes, or compute the model from the built value's shape.
  • Add the counterexample as a named replay.
  • Route this property through the shared oracle config, so that TANSTACK_DB_ORACLE_SEED and TANSTACK_DB_ORACLE_PATH can replay it.
主要语言
TypeScript
星标
3.9k
派生
272
平均合并
1 天 21 分钟
30 天内合并 PR
241

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/db 的其他 Issue

查看 TanStack/db 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。