Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta
#2,140 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
Meio dia
Facilidade para iniciantes
58/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
databases, testing-qa

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.
Linguagem predominante
TypeScript
Estrelas
3.9k
Forks
272
Merge médio
1d 1h
PRs com merge (30d)
235

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TanStack/db

Todas as issues de TanStack/db

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.