Skip to content

feat(lower): name the nodes and vertices of the lowered graphs by id - #2253

Merged
HuiJun merged 4 commits into
developfrom
feat/ir-graph-ids
Nov 16, 2026
Merged

HuiJun merged 4 commits into
developfrom
feat/ir-graph-ids

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

What and why

Step 7a of the execution-owned IR (docs/internals/execution-ir-design.md, "Migration as a stack of pull requests"). Step 7 moves the consumers outside the runtime off the syntax tree, but the lowered graphs named their nodes, states and vertices by declaration only, so a consumer could reach an id only by first reading the tree-typed field that step 8 deletes. This pull request gives the graphs the id-addressed side; it changes no consumer.

Merge order: #2249 → #2252 → this. The base is feat/ir-expr-semantic-residues (#2252) and moves to develop as those land.

Added, in internal/ir/lower:

  • ActionEdge.SourceID/TargetID, ObjectFlow.SourceID/TargetID, PinBinding.NodeID/OtherNodeID (program.NodeID).
  • Transition.SourceRef/TargetRef (program.VertexRef) and Transition.OwnerID; EntryTransition.TargetID/ViaID; StateBehavior.OwnerID.
  • graph_ids.go: id-indexed access to the tables. For a flow: EdgesOf, IncomingOf, FlowsOf, BodyOf, FeaturesOf, AcceptOf, SubflowOf, StatementRun, BlockNodesOf, InitialID, ConcurrentIDs, StartIDs, FinalIDs, EnclosingNodeID. For a machine: StateIDs, StateIDOf, MachineID, VertexOf, InitialID, ParentOf, StateRegion, RegionsOf, TopRegionIDs, RegionOwnerOf, RegionInitialOf, RegionStateOf, HiddenRegion, Hidden, ParallelState, BehaviorsOf, AttributesOf, BehaviorFeatures, TransitionsOf, EntryTransitionsOf, RegionEntryTransitions, PseudostateOwnerOf, PseudostateRegionOf, TerminateOwnerOf.

Every id is the one the step-1 identity tables assigned (ActionGraph.ID, StateGraph.ID/RegionID/PseudoID/TransID); there is no second numbering. The fields are stamped at the end of assignIDs (and, for the bindings a performer writes through the feature it performs, where PerformedPinBindings builds them), and the accessors read the existing tables through Provenance.

On the id fields beside the tree fields. This is the additive pattern step 1 and 6b-3 used. It is not a parallel structure in the sense of AGENTS.md §4: the tree-typed side is scheduled for deletion in step 8 (row 8 of the design's table), and nothing copies IR back into a tree field.

The design document records the re-measured scope of step 7 and its split (7a–7f).

How it was verified

  • TestLoweredGraphIDs (internal/exec/runtime/graph_ids_test.go) lowers every action and state machine of the execution-conformance models, nested and block flows included, and checks that each tree-typed node, state, region, pseudostate and vertex a record or table names has a non-zero id counterpart that round-trips to the same element, and that each accessor answers what the tree-keyed table answers. With the stamping disabled it fails on every edge, transition, entry transition and behavior. TestPerformedPinBindingIDs checks the same for performed pin bindings.
  • go build ./..., go vet ./..., gofmt -l . (empty), make lint, go test ./... with the training, pilot and specification-example corpora required, go test ./tests/hygiene, go test -C tools ./..., make docs-counts, make spec-compliance-check, make wasm-check, make changelog-check.
  • Pilot execution differential: 514 cases, agree 229 · kind-only 1 · order-only 0 · disagree 38 · differs-by-design 5 · pilot-unevaluated 167 · pilot-silent 24 · pilot-error 7 · ours-error 10 · ours-undetermined 17 · both-error 16 · nondeterministic 0, equal to the committed record. pilot-xpect -check passes.
  • benchstat, n=10, alternating prebuilt binaries, against the base:
benchmark base head
REPLEvalExpr 7.235 ms ± 18% 7.163 ms ± 6% ~ (p=0.190)
GRPCEvaluate 14.55 µs ± 59% 15.40 µs ± 10% ~ (p=0.353)
ConnectEvaluateHTTP 126.5 µs ± 5% 127.9 µs ± 5% ~ (p=0.684)

Allocations per operation are identical (123 / 144 / 224); bytes per operation show no significant difference.

What moved. One ratchet: coreGzipBudget in tests/wasm/core_test.go rises from 7,450,000 to 7,500,000 bytes. The base builds sysml-core.wasm at 7,446,293 bytes gzipped, 3,707 under the old budget; this change adds 5,237 (7,451,530). No conformance expectation, golden trace, view golden, corpus baseline, wire format or snapshot format moves.

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 — none: no user-visible change, as for the earlier steps of this migration
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

🟢 Devin Review found nothing to fix · View findings · Follow Devin's work

Devin Review

Step 7a of the execution-owned IR. Beside each node, state and vertex a
lowered record names by declaration it now names the id the step-1
identity tables assigned: SourceID/TargetID on ActionEdge and ObjectFlow,
NodeID/OtherNodeID on PinBinding, SourceRef/TargetRef/OwnerID on
Transition, TargetID/ViaID on EntryTransition, OwnerID on StateBehavior,
with id-indexed accessors over the graph tables. No consumer changes; step
8 removes the tree side.

The sysml-core size budget rises to 7,500,000 bytes: the build is
7,451,380 bytes gzipped, 5,087 over the base's 7,446,293.

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

PerformedPinBindings builds its bindings outside the graph's own binding
slices, so they left lowering with zero NodeID and OtherNodeID. The ids are
now set where each binding is built, from the performed graph's identity
table.

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

@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 found 1 finding. Devin automatically fixed it.

Fixed by Devin (1)
  • Missing identities on performed-action bindings — PerformedPinBindings now sets NodeID/OtherNodeID where each binding is built, from the performed graph's identity table; TestPerformedPinBindingIDs covers it.

View findings in Devin Review · Follow Devin's work

Devin Review

devin-ai-integration Bot and others added 2 commits November 15, 2026 14:35
…into feat/ir-graph-ids

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

# Conflicts:
#	tests/wasm/core_test.go
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Base automatically changed from feat/ir-expr-semantic-residues to develop November 15, 2026 19:44
@HuiJun
HuiJun added this pull request to the merge queue Nov 15, 2026
Merged via the queue into develop with commit 03e8e12 Nov 16, 2026
30 checks passed
@HuiJun
HuiJun deleted the feat/ir-graph-ids branch November 16, 2026 00:01
@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