AST pass explodes data .json into orphan key-nodes (CODE_EXTENSIONS includes .json) — 561 isolated nodes on a real repo
Summary
detect.CODE_EXTENSIONS includes .json (detect.py, the big extension set), so the AST/structural pass treats every JSON file as code and emits every JSON key as its own node. On repos where .json is data — eval fixtures, config, datasets, manifests — this floods the graph with orphan key-nodes and near-duplicate communities that swamp the real structure.
Observed (graphifyy 0.8.36, Windows, real repo)
A Python CLI repo (~200 files) with ~40 data .json files (eval cases.json/eval.json pairs, two plugin manifests, one test fixture):
| with .json as code | .json excluded | |
|---|---|---|
| nodes | 1819 | 1170 |
| communities | 114 | 73 |
| isolated nodes | 561 | 2 |
- One repeated key (
prompt_inputs_spec) appeared as 214 occurrences in the AST extraction (0 in the LLM semantic pass). - ~30 near-identical communities formed, one per eval suite, each holding just that file's keys (
generation,target,cases_file,num_cases, …). - The report's "Knowledge Gaps" then flags 561 isolated nodes / 735 weakly-connected — reads like a codebase problem but is purely extraction noise.
Workaround
.graphifyignore with *.json (works — both detect() and the post-commit hook honor it). But it costs the LLM pass's concept extraction from those files too, and .graphifyignore shadowing .gitignore per-directory means re-listing everything else.
Suggested fixes (any of)
- Treat data-shaped
.jsonasdocumentrather thancode— or only AST-extract manifest-style json the resolver actually understands (package.json,tsconfig.json, lockfiles are already skipped). - A config knob to reclassify extensions per-repo (e.g.
json: document/json: skip). - Cheapest guard: warn in the report when a single
.jsonyields N+ key-nodes with no cross-file edges — silent flooding is the painful part.
Happy to provide the full before/after graph.json pair if useful.
Fixed in HEAD (commit a37672f). Added _is_config_json() which identifies config/manifest JSON by filename (package.json, tsconfig.json, .eslintrc.json, deno.json, etc.), compound suffix (*.tsconfig.json, *.eslintrc.json), or top-level key probe (dependencies, extends, $ref, compilerOptions). Data JSON files (top-level arrays, generic key/value files) are now skipped by the AST pass and left for the LLM semantic pass instead. package.json dependency edges and tsconfig.json extends chains continue to work. Smoke tested on fresh install. Shipping in the next release.