Skip to content

feat(graph): add Zig tags.scm — call edges for the breadth tier - #201

Draft
Frankie-Xu wants to merge 2 commits into
trailhq:mainfrom
Frankie-Xu:feat/zig-tags-scm
Draft

feat(graph): add Zig tags.scm — call edges for the breadth tier#201
Frankie-Xu wants to merge 2 commits into
trailhq:mainfrom
Frankie-Xu:feat/zig-tags-scm

Conversation

@Frankie-Xu

@Frankie-Xu Frankie-Xu commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Zig (.zig) is already on the breadth-tier registry, but had no tags.scm, so the node-kind walker minted const Point = struct { … } as kind variable (variable_declaration matches (^|_)(var|…)) and emitted no call edges. Named test "…" { } decls were skipped entirely.
  • Add src/graph/queries/zig.scm with shapes confirmed against the tree-sitter-wasm zig grammar AST:
    • @definition.functionfn / pub fn (function_declaration)
    • @definition.structconst Name = struct { … }
    • @definition.function — named test "…" { } (string_content)
    • @reference.callcall_expression (helper(n) and p.local())
  • Left untagged (drop-not-guess): unnamed test { }, const p = Point{ … } (struct_initializer, not a type), enum/union.
  • Independent of the OCaml PR — branched from origin/main, not stacked. Same pattern as Dart (fix(graph): index Dart top-level functions, consts, and call edges #153). Will conflict with feat(graph): add OCaml tags.scm — call edges for the breadth tier #200 on the one generic.ts comment line; after both merge that exception should go away.

Fixes #197.

Test plan

  • node --import tsx --test test/generic-extract.test.ts — Zig fixture: run → helper, named test → helper; unnamed test { } is not a symbol
  • npm run build
  • npm test (884/884)

The tracking issue is NanoNets#198; the previous commit message still names NanoNets#197.

Co-authored-by: Cursor <cursoragent@cursor.com>
github-actions Bot added a commit that referenced this pull request Aug 24, 2026
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🌱 graft blast radius

1 area changed → 4 areas can be affected. 11 dependent symbols, depth 2.

flowchart TB
  A0(("Dependency Graph<br/>7 symbols"))
  A1(("CLI Engine<br/>2 symbols"))
  A2(("LSP Enrichment<br/>1 symbol"))
  A3(("MCP Tools<br/>1 symbol"))
  classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
  class A0,A1,A2,A3 reached;
Loading
Can be affected Symbols Nearest hop Reached from
Dependency Graph 7 src/graph/build.ts:L1-L404 build.ts — imports, depth 1 Generic Graph
CLI Engine 2 src/cli.ts:L1-L1033 cli.ts — imports, depth 2 Generic Graph
LSP Enrichment 1 src/graph/lsp/enrich.ts:L1-L141 enrich.ts — imports, depth 1 Generic Graph
MCP Tools 1 src/mcp/tools.ts:L1-L339 tools.ts — imports, depth 2 Generic Graph
All 11 dependent symbols, grouped by area

Dependency Graph — 7 symbols in 7 files

  • src/graph/build.ts:L1-L404 — build.ts (imports, depth 1)
    21: import { extractGeneric, genericLangOf, warmGenericGrammars } from "./generic.js";
  • src/graph/check.ts:L1-L190 — check.ts (imports, depth 1)
    24: import { extractGeneric, genericLangOf, warmGenericGrammars } from "./generic.js";
  • src/graph/container.ts:L1-L209 — container.ts (imports, depth 1)
    25: import { loadWasmLanguage, parseWasm, type TsNode } from "./generic.js";
  • src/graph/source-files.ts:L1-L94 — source-files.ts (imports, depth 1)
    15: import { genericLangOf, genericExtensions } from "./generic.js";
  • src/graph/fingerprint.ts:L1-L185 — fingerprint.ts (imports, depth 2)
  • src/graph/refresh.ts:L1-L270 — refresh.ts (imports, depth 2)
  • src/graph/workspace.ts:L1-L509 — workspace.ts (imports, depth 2)

CLI Engine — 2 symbols in 2 files

  • src/cli.ts:L1-L1033 — cli.ts (imports, depth 2)
  • src/engine.ts:L1-L155 — engine.ts (imports, depth 2)

LSP Enrichment — 1 symbol in 1 file

  • src/graph/lsp/enrich.ts:L1-L141 — enrich.ts (imports, depth 1)
    17: import { genericLangOf } from "../generic.js";

MCP Tools — 1 symbol in 1 file

  • src/mcp/tools.ts:L1-L339 — tools.ts (imports, depth 2)
Test signal per changed area — 1 –

Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.

  • Generic Graph — 1 test file changed here: test/generic-extract.test.ts
31 test suites also reference this code

31 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.

  • test/ask-index.test.ts
  • test/ask.test.ts
  • test/container-extract.test.ts
  • test/covers.test.ts
  • test/graph-enrich-pending.test.ts
  • test/graph-go.test.ts
  • test/graph-incremental.test.ts
  • test/graph-invariants.test.ts
  • test/graph-java.test.ts
  • test/graph-languages.test.ts
  • test/graph-php.test.ts
  • test/graph-posix-paths.test.ts
  • test/graph-python.test.ts
  • test/graph-r-classes.test.ts
  • test/graph-r-phase3.test.ts
  • test/graph-r-phase4.test.ts
  • test/graph-r-phase5.test.ts
  • test/graph-r.test.ts
  • test/graph-references.test.ts
  • test/graph-refresh.test.ts
  • …11 more

⚠️ 1 changed file not in the graph (src/graph/queries/zig.scm) — no parser claims the extension, or the index predates the file.

graft blast · origin/main...HEAD · depth 2 · 3 changed files

Open the interactive graph → — click an area to see its dependent symbols at file:line.

github-actions Bot added a commit that referenced this pull request Aug 25, 2026
github-actions Bot added a commit that referenced this pull request Aug 25, 2026
@Frankie-Xu
Frankie-Xu marked this pull request as draft August 26, 2026 09:49
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.

ocaml/zig: no tags.scm — symbols come from the node-kind walker fallback, call edges are absent

1 participant