Feature/v1.3.0: Trust procedural control flow - #3
Merged
Conversation
Ships the first vertical slice of Workstream B: mixed one-line and block IF/WHILE forms now parse into a single control-flow AST so the diagram shows true branching whether a body uses a single statement or a BEGIN/END block. - tests/dialects/tsql.ts: add mixed one-line + block IF and WHILE graph fixtures (yes/no branches, loop back-edges, done exits) - tests/dialects/db2.ts: add DB2 mixed THEN/block IF graph fixture - tests/boundary.ts: add T-SQL and DB2 mixed-IF statement-range fixtures - examples/dbo.v130_demo.sql: add runnable mixed control-flow demo - docs/v1.3.0-implementation-plan.md: record remaining v1.3.0 slices - docs/PR_NOTE_1.3.0.md, docs/RELEASE_NOTE_1.3.0.md: release notes - README.md: bump to v1.3.0 references and baseline counts - package.json: bump version to 1.3.0 - dist: rebuild generated artefacts Correctness gate green: typecheck, build, test:file, golden 164/164 (was 159), fuzz 400/400, ui 13/13, local-only check, dist committed in sync.
Finish the v1.3.0 "Trust procedural control flow" milestone: mixed IF/WHILE already in one AST; this adds labelled/GOTO hardening, cursor query graphs, DB2 ATOMIC rollback scope, extended summarise, and E/F parity fixtures. - types/dialects: label, GOTO and loop-control carry source spans + tokens; BEGIN ATOMIC tracked as a rollback scope - ir: unresolved targets render an "Unresolved label" node plus a region-scoped goto_unresolved warning; DB2 ATOMIC emits BEGIN ATOMIC · rollback scope and Implicit rollback terminal; summarise extends to GRANT/WAITFOR/KILL/OPEN/CLOSE/FETCH/DEALLOCATE; DB2 FOR cursor reads captured; control tokens attributed as resolved - lineage: cursor queries (DECLARE ... CURSOR FOR, FOR ... CURSOR FOR) join the query graph - tests: unresolved-target and ATOMIC graph fixtures for tsql/db2/plpgsql plus v1.3.0 diagnostics/span/query-graph/summarise/export-parity assertions - docs: PR/RELEASE notes and README updated; example demonstrates the new outcomes; dist rebuilt in sync Correctness gate green: typecheck, build, test:file, golden 181/181 (was 164), fuzz 400/400, ui 13/13, mermaid checksum, local-only check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
proc>flow v1.3.0 — Trust procedural control flow
Release date: 2026-08-06
This release delivers the Trust procedural control flow milestone from
ROADMAP.md (Workstream B in full). Procedural control flow is
now resolved and verified end to end: mixed
IF/WHILEforms parse into asingle AST, labelled loop-control and
GOTOare validated with source spans,cursor queries join the query graphs, and DB2
ATOMICblocks carry a rollbackscope. Workstream B ships complete, plus the E procedural diagnostics and the F
export-parity fixtures each construct requires.
What's new
Mixed one-line + block
IF/WHILE(one AST)A procedure may freely mix single-statement and block bodies for the same
control construct and still produce one consistent AST:
IF cond SELECT …;andIF cond BEGIN … END ELSE …— including a one-lineIFnested inside anIF-block branch.WHILE cond SET @i = @i + 1;andWHILE cond BEGIN … IF … END.IF … THEN … ELSE BEGIN … END; END IF;mixed forms.Every condition branches
yes/no, loop bodies wire back to the loopcondition, and block exits flow to the next statement.
Labelled loop-control and
GOTOhardeningGOTO,LEAVE/EXIT/CONTINUE/ITERATEand bare labels now carry sourcespans, so a diagram node selects the exact keyword in the editor.
(forward
GOTOstays supported).goto_unresolvedwarning with correctregion scope and a valid span, and draws an explicit "Unresolved
label" node instead of silently dropping control flow.
GOTOstill produces a dottedgotoedge to the label.Cursor queries in query graphs
DECLARE … CURSOR FORand DB2FOR … CURSOR FORqueries now appear inQuery structure view: the source table behind the cursor is shown as a
source node.
FORcursor reads are now captured at object level too).
DB2
ATOMICblock rollback scopeBEGIN ATOMICrenders aBEGIN ATOMIC · rollback scopemarker; unhandled orEXIT/UNDO-handler exits route to an
Implicit rollback · ATOMIC blockterminal rather than continuing to the next statement.
CREATE PROCEDURE … BEGIN ATOMIC … ENDis preserved.BEGIN NOT ATOMICandATOMIC/NOTstay ignored syntax for tokenattribution.
Extended statement labels (
summarise)GRANT/REVOKE/DENYnow summarise toGRANT … ON <object>.WAITFOR,KILL, and cursor operationsOPEN/CLOSE/FETCH/DEALLOCATEget concise labels (e.g.
FETCH FROM c) instead of full statement text.E procedural diagnostics and F export parity
goto_unresolvedis region-scoped with a valid span (E).ATOMICmarker) is covered bytoMermaid+toDrawioexport-parity tests: well-formed draw.io XML withprovenance/kind metadata, and a
flowchartMermaid definition (F).Attribution
GOTO, and label tokens are now attributed as resolved, so thecorpus's unresolved-token rate drops instead of rising with the new fixtures.
What's unchanged
re-labelling is the DB2
FETCH NEXT FROM c INTO …window now readingFETCH FROM cunder the cursor-opssummariserule (edges untouched).1.1.0/1.2.0 are unchanged.
Files changed
src/types.d.ts—BlockNode.atomic;span/tokson label, goto,loop-control nodes
src/dialects.ts—BEGIN ATOMICtracking; label/GOTO/loop-controlspans + token capture
src/ir.ts— atomic block rollback scope; unresolved-label nodes;goto_unresolveddiagnostic; extendedsummarise; DB2FORcursor reads inbuildObjectIR; attribution of control tokenssrc/lineage.ts—queryTokensBehindCursor; cursor queries collected intobuildObjectQueryGraphtests/dialects/{tsql,db2,plpgsql}.ts— unresolved-target, span, and DB2ATOMICgraph fixturestests/tests.ts— v1.3.0 assertion block (diagnostics, spans, cursor querygraphs,
summarise, export parity)examples/dbo.v130_demo.sql— full control-flow demodocs/PR_NOTE_1.3.0.md,docs/RELEASE_NOTE_1.3.0.md,docs/RELEASE_NOTE_v1.3.0.md— release notesREADME.md,package.json— v1.3.0 references and versiondist/— generated artefacts rebuilt to match sourcesVerification
npm run typecheck— passesnpm run build— passesnpm run test:file— passesdist/committed in syncDeferred (per roadmap)
See RELEASE_NOTE_v1.3.0.md for the release summary
and README.md for usage.