Skip to content

fix(avi-1765): name YAML/JSON document nodes after their file - #257

Merged
jeremiepas merged 1 commit into
mainfrom
fix/AVI-1765-yaml-json-document-node-ids
Nov 13, 2026
Merged

jeremiepas merged 1 commit into
mainfrom
fix/AVI-1765-yaml-json-document-node-ids

Conversation

@jeremiepas

Copy link
Copy Markdown
Owner

Follow-up to #256 (already merged). Same defect class, one more node type.

The bug

A tree-sitter document node — the root of every YAML and JSON file — has no identifier child, so nodeIdentifier fell through to extractIdentifier and returned Nothing. That gives the node id "", and since per-file extractions are merged by id, every YAML and JSON file in a corpus collided on that one id and a single node survived for the whole graph.

This is exactly the collision #256 fixed for Perl package, PHP/C# namespace and C#/Java fields. It was missed because that PR's verification corpus contained only PHP/Perl/C#/Kotlin/Java sources, so it reported "0 empty-id nodes" and the class looked closed.

How it was found

Re-running the change's own task 4.4 check against a real repository instead of the hand-made fixture. On Apache Fineract:

YAML/JSON files in the repo 92
Document nodes in graph.json 1

The survivor is a docker-compose file; the other 91 are simply absent from the graph.

The fix

A document is its file, so document joins moduleTypes and is named after the file like program / source_file. Its kind stays Document.

Tests

graphos-test: 1664 examples, 1 failure, 4 pending (82 s). The failure is the unrelated AVI-1440 TypeScript case. Run with --skip "small random graphs" — see below.

Two pre-existing issues this does not address

  1. cabal test all does not terminate on main — BoundedDeltaCommunitySpec.hs:224, "delta update equals full rebuild on small random graphs (property)". Reproduced on bare main with all branch changes stashed. CI's test job on the openspec: bunch-real-projects — dependencies, cap delta, D4 scope #254 merge ran 2h37m before I stopped checking.
  2. .json is in no fecCode/fecDoc category, so the pipeline never detects JSON files — its grammar and defaultExtractors entry are unreachable in a real run. Adding it would change graphs for every repo (lockfiles, fixtures, vendored data), so it wants a deliberate decision rather than a silent inclusion here.

Consequence for existing graphs

Any graph.json built before this commit under-represents YAML/JSON. Repos already rebuilt with #256 (Fineract was rebuilt at 15:23 today) need another pass if their YAML/JSON files matter.

A tree-sitter `document` node has no identifier child, so `nodeIdentifier`
fell through to `extractIdentifier` and every YAML and JSON file in a corpus
shared the node id "" — they collided on merge and one survived for the whole
graph.

This is the same empty-id collision fixed for Perl `package`, PHP/C#
`namespace` and C#/Java fields in the previous commit; the fixture corpus
carried no YAML or JSON, so it reported "0 empty-id nodes" and the class
looked closed. Rerunning the task 4.4 check on Apache Fineract found it: 92
YAML/JSON files, 1 Document node in the graph.

A `document` is its file, so it joins `moduleTypes` and is named after the
file like `program` / `source_file`.

Tests: two YAML files no longer share a node id, and the empty-id regression
guard now covers the yaml and json grammars alongside perl/php/csharp/java/cpp.

graphos-test: 1664 examples, 1 failure, 4 pending (82 s), the failure being
the unrelated AVI-1440 TypeScript case; run with `--skip "small random
graphs"`, the property that does not terminate on main either.
@jeremiepas
jeremiepas merged commit 8b1c8fa into main Nov 13, 2026
8 of 9 checks passed
@jeremiepas
jeremiepas deleted the fix/AVI-1765-yaml-json-document-node-ids branch November 13, 2026 19:40
@jeremiepas
jeremiepas restored the fix/AVI-1765-yaml-json-document-node-ids branch November 13, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant