Skip to content

feat(analysis): write the graphs export from the lowered graphs by id - #2264

Merged
HuiJun merged 3 commits into
developfrom
feat/ir-analysis-sweep-off-tree
Nov 18, 2026
Merged

HuiJun merged 3 commits into
developfrom
feat/ir-analysis-sweep-off-tree

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Part of the "consumers off the tree" step of the execution-IR migration (docs/internals/execution-ir-design.md): the analysis packages stop reading the syntax tree behind the lowered graphs, so that the later step can delete the tree-typed fields without touching them.

Stacked on #2257 (#2249, #2252 and #2253 have merged). Merge order: #2257 → this; it is retargeted to develop when #2257 lands.

  • internal/exec/analysis/modelform: the graphs export numbers an action vertex by lower.FlowNode, a state vertex by program.VertexRef and a region by program.RegionID, and reads the graphs through their id-addressed accessors and expression tables. It no longer imports internal/syntax/ast.
  • internal/ir/lower: what a record does not yet say is answered by id from the tree lower still holds, in graph_sites.go: a declaration's Site (kind label, name, span) and Extent, a Trigger's shape, StatementAt, PerformedBy, FootprintOf/ControlIDs; plus Valued, ExprEntry.Extent, StateGraph.PseudoIDs, CompositeIDs and StateScope. These are additive; no tree field is removed.
  • tests/hygiene: internal/exec/analysis, internal/exec/analysis/modelform and internal/exec/sweep may no longer import internal/syntax/ast. The first and the last already did not, and read no tree-typed field of a lowered graph, so they change in no other way.

Behaviour is unchanged: the export's bytes and its refusals are the same.

Two things the move made visible, both kept as they were and now pinned by tests:

  • A node declared by a block of a node's body (if n > 0 { action inner : Work; }) is a node of the block's flow, not of the enclosing graph. The export still lists it among the graph's vertices, by its kind, name, span and what it performs, and nothing else.
  • A graph is still refused with graphs: elements of one graph cannot be ordered: a vertex is reached only while it is written when a node's footprint converges on a node outside the graph's own, as a body block stating its own fork and join does (conformance model action_body_flow_fork_join). Whether that refusal should become an export is left for a separate change.

Not in this change: internal/exec/analysis/record keeps its syntax/ast import. It reads symbol declarations, not lowered graphs.

How it was verified

  • Differential over the export: GraphsOf + MarshalGraphs for every action and state declaration of every model under internal/exec/runtime/testdata/conformance, internal/exec/smt/testdata, examples/ (downloaded corpora included) and the analysis test data, 11,508 behaviors, comparing the SHA-256 of the bytes or the error text between the base head and this one: no difference.
  • New tests: graphs_block_test.go (the block node and the refusal above; both also pass on the base head) and internal/ir/lower/graph_sites_test.go (the new accessors).
  • go build ./..., go vet ./..., gofmt -l . (empty), make lint, go test ./... with the training, pilot and specification-example corpora required (140 packages ok), go test -C tools ./..., go test ./tests/hygiene, make docs-counts, make spec-compliance-check, make changelog-check, make wasm-check.
  • Pilot execution differential: 514 cases, agree 229, disagree 38, nondeterministic 0, equal to the committed record. pilot-xpect -check: 432 files, 1299 agree, 30 disagree.
  • Size: the gzipped browser REPL build is 16,340,108 bytes (budget 16,400,000; 16,312,572 on the base head); core 7,483,247 (7,600,000); engine 11,095,503 (11,200,000). This change moves no budget and touches nothing under tests/wasm.
  • go run -C tools ./cmd/pilot-diff -check fails identically on develop 0abb3aa; re-recorded by chore(baselines): re-record the pilot differential for the KerML declaration keyword error #2323. pilot-apijson-diff -check and derived-census -check -require-exporter pass; nothing is re-recorded here.
  • benchstat, n=10, against the base head: REPLEvalExpr 6.751 ms → 6.860 ms (, p=0.529); GRPCEvaluate 13.93 µs → 13.93 µs (); ConnectEvaluateHTTP 124.4 µs → 118.5 µs (−4.78%, p=0.043); bytes and allocations per op unchanged.

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md (nothing user-visible changes)
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build) (none moved)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/f0e5153d16b3428e96fddec893eb225e
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/f0e5153d16b3428e96fddec893eb225e?variant=devin
Requested by: @HuiJun


🟢 Devin Review found nothing to fix · View findings

Devin Review

modelform numbers an action vertex by lower.FlowNode, a state vertex by
program.VertexRef and a region by RegionID, and reads the 7a accessors and the
expression tables; what a record does not yet say (a declaration's site and
extent, a trigger's shape, what a node performs) lower answers by id from the
tree it still holds. The export's bytes and refusals are unchanged.

exec/analysis, exec/analysis/modelform and exec/sweep may no longer import
syntax/ast.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Base automatically changed from feat/ir-smt-solve-off-tree to develop November 17, 2026 11:19
@HuiJun
HuiJun added this pull request to the merge queue Nov 17, 2026
Merged via the queue into develop with commit e1c574b Nov 18, 2026
32 checks passed
@HuiJun
HuiJun deleted the feat/ir-analysis-sweep-off-tree branch November 18, 2026 02:09
@devin-ai-integration devin-ai-integration Bot mentioned this pull request Nov 25, 2026
3 tasks done
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.

1 participant