fix(sql): walk into BEGIN;...COMMIT; transaction blocks (#2953) - #2955
fix(sql): walk into BEGIN;...COMMIT; transaction blocks (#2953)#2955amtulifra wants to merge 1 commit into
Conversation
…s#2953) tree-sitter-sql wraps a transaction in its own top-level transaction node instead of statement, so the extractor's root dispatch loop never reached it. Every table, view, function, and trigger defined inside a transaction was silently dropped with no error, and any REFERENCES pointing at one of those tables fell back to a sourceless stub instead of the real node. Route the transaction node through the existing generic walk, which already recurses into whatever children it finds.
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Formal verification. No changes could be formally verified in this run.
Graphify review — findings
Adds handling for top-level transaction nodes in extract_sql so statements inside BEGIN; ... COMMIT; blocks are walked instead of dropped (#2953). Covers it with a new test_sql_transaction_block_is_not_dropped verifying both tables, their source locations, and the FK edge are emitted.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 267 functions depend on the 105 functions this change touches.
Health — this change adds coupling hotspots:
- new:
dispatch_command()— 2 callers, 119 callees - new:
extract_sql()— 10 callers, 8 callees - new:
walk()— 1 callers, 8 callees - new:
test_poisoned_manifest_is_healed()— 0 callers, 6 callees
Verification — 267 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: 116 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify extract\_sql.
The verifier did not have enough to check extract\_sql, 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
· 4 more finding(s) on lines outside this diff (see the check run).
Fixes #2953 — SQL statements wrapped in BEGIN; ... COMMIT; transaction blocks were silently dropped, with zero nodes extracted and no error surfaced.
Root cause: tree-sitter-sql wraps a transaction block in its own top-level transaction node instead of statement. The extractor's root dispatch loop only walked children of type statement (plus a few special cases like ERROR), so transaction never matched and everything inside — tables, views, functions, triggers — was skipped. Any REFERENCES pointing at one of those tables also fell back to a sourceless stub instead of resolving to the real node, matching the "empty source_file/source_location" symptom described in the issue.
Fix: route transaction through the same generic walk() used everywhere else — it already recurses into whatever children it finds, so no new logic is needed, just letting the node through.
Test plan: