fix(ts): preserve declarations after import type arguments - #3185
fix(ts): preserve declarations after import type arguments#3185hopstreax wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 2 advisory finding(s) below merit a look before merge.
Formal verification. No changes could be formally verified in this run.
Graphify review — findings
Fixes silent symbol loss in TypeScript/TSX files where import(...) types inside call-expression type arguments (e.g. f<typeof import("mod")>()) trip up tree-sitter's parser, whose error recovery otherwise absorbs subsequent declarations into a malformed comparison expression. extract_js and extract_vue now run _normalize_ts_import_types over the source before parsing, rewriting the offending import(...) to a same-byte-length type identifier so declarations after the expression are extracted while source locations and offsets stay exact. The normalization is a no-op (returns None) when no import( appears, and any read failure falls back to unmodified parsing.
Worth a look
- TypeScript import-type normalization skips legal whitespace before '(' —
graphify/extract.py:1285· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
- Normalizer skips valid whitespace before import-type parentheses —
graphify/extract.py:1286· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 1677 functions depend on the 228 functions this change touches.
Health — this change adds coupling hotspots:
- new:
extract()— 502 callers, 42 callees - new:
_rebuild_code()— 98 callers, 50 callees - new:
extract_js()— 85 callers, 4 callees - new:
extract_xaml()— 19 callers, 17 callees - new:
dispatch_command()— 2 callers, 122 callees - new:
_get_extractor()— 26 callers, 6 callees - new:
run_pipeline()— 8 callers, 13 callees - new:
collect_files()— 17 callers, 6 callees - …and 23 more — each is listed as a finding
Verification — 1677 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 1520 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify extract\_js.
The verifier did not have enough to check extract\_js, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
Could not verify: Could not verify extract\_vue.
The verifier did not have enough to check extract\_vue, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
· 1 grounded finding(s) anchored inline below; 30 more finding(s) on lines outside this diff (see the check run).
| @@ -1271,13 +1313,21 @@ def extract_python(path: Path) -> dict: | |||
| def extract_js(path: Path) -> dict: | |||
There was a problem hiding this comment.
extract_js()
85 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
Summary
Fixes #3154.
TypeScript
import(...)types used as explicit call-expression type arguments, such as:were incorrectly parsed by tree-sitter as comparison expressions. The resulting recovery could swallow declarations later in the file, causing them to be missing from Graphify's extracted graph.
What changed
import(...)types inside explicit TypeScript call-expression type arguments..ts,.tsx,.mts, and.ctsextraction.Validation
6 passed— dedicated TypeScript: animport(...)type used as an explicit type argument is a syntax error, dropping symbols after it #3154 regression tests163 passed— relevant TypeScript/JavaScript extractor tests815/815files processed successfully during a Graphify rebuild