Repository navigation
feat(ir): program package with graph-local ids; lower assigns ids and origins - #2137
Open
devin-ai-integration[bot] wants to merge 6 commits into
Open
devin-ai-integration[bot] wants to merge 6 commits into
devin-ai-integration[bot] wants to merge 6 commits into
Conversation
Declare the execution-owned identity every lowered record will carry: the per-graph dense id types, NodeKind, Origin (document, span, path, kind word, name) with the String rendering today's messages use, and GraphID as a type whose encoder is not written yet. The package reads no syntax; the layering test registers it in the ir layer and forbids program -> syntax/ast. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
There was a problem hiding this comment.
Devin Review found 2 findings. Devin automatically fixed all 2 findings.
Fixed by Devin (2)
- Case flow nodes lack correct IDs — assignIDs now runs after addCasePerformNodes/addCaseStatementRuns in caseSteps; regression test TestAssignIDs_CaseFlowCoversNodesAddedAfterLowering.
- Declared regions lose document and owner — assignRegionIDs falls back to declaredIn[region] as regionScope does; regression test TestAssignIDs_RegionOriginsCarryDocumentAndOwner.
…raphs Every node of an ActionGraph and every state, region, pseudostate and transition of a StateGraph gets a dense id in declaration order, an Origin naming it the way messages do, and a Provenance mapping the ids back to the declarations. Additive: no consumer reads the new fields yet. Pins: ids dense, in order, deterministic across two lowerings, Origin.Path unique per graph, and Origin.String() equal to nodeDescription over every action node of the conformance fixtures. Co-Authored-By: jason.han <hanhuijun@gmail.com>
An unstated case flow gains its performed actions and statement runs after lowerActionFlow returns, so the ids are assigned once those are in place. Co-Authored-By: jason.han <hanhuijun@gmail.com>
A region written in the machine's own body records its scope in declaredIn, not regionScopeOf, so its origin lost the document and owner. A terminate usage is a terminate node. Co-Authored-By: jason.han <hanhuijun@gmail.com>
This was referenced Nov 11, 2026
This branch has not been deployed
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.
What and why
Step 1 of the execution-owned IR migration (
docs/internals/execution-ir-design.md, "Migration as a stack of pull requests", row 1). Today a lowered graph's identity is the AST pointer of each record; this step adds the identity the later steps move the executors onto, without changing any consumer.internal/ir/program: the per-graph dense id types (NodeID,EdgeID,StmtID,ExprID,StateID,RegionID,PseudoID,TransID; zero is "none"),NodeKind,Origin(document, span, path, kind word, name, docs) whoseString()renders whatnodeDescriptionrenders today, andGraphIDdeclared as a type — its encoder is a later step. The package reads no syntax:tests/hygiene/layering_test.goregisters it in theirlayer and forbidsprogram → syntax/ast.lowerassigns an id to every record it already builds and keeps the back-map beside the graph:ActionGraph.ID,Origins,Kinds,Provenance;StateGraph.ID,Origins,RegionID/RegionOrigins,PseudoID/PseudoOrigins,TransID/TransOrigins,Provenance. Additive: nothing removed, no behaviour change, no consumer reads the new fields yet.Origin.ElementandOrigin.Docsare declared but left empty bylower: no identity table or source-text model exists at lowering time; a later step fills them where one does.How it was verified
internal/ir/programunit tests:Origin.String()table,NodeKindnames,GraphIDzero.lowerunit tests (identity_test.go): ids dense, in declaration order, deterministic across two lowerings,Origin.Pathunique per graph, for action graphs and for the four state-graph tables; the cyclic-specialization error path still returns an id-bearing graph.TestOriginStringMatchesNodeDescription(runtime):Origin.String()equalsnodeDescription(node)over every action node (5,618) of every fixture underinternal/exec/runtime/testdata/conformance/, block graphs included.go build ./...,go vet ./...,gofmt -l .empty,make lint,go test ./...(three packages hit the 10m default under the suite's own load —cmd/sysml,tests/codegen,tests/export— and pass when run alone;TestEmbeddedSnapshotIsCurrentfailed once on a stale gitignoredstdlib.snapshotand passes once regenerated),go test -count=1 ./tests/corpus -run 'TestTrainingExamples|TestPilotCorpora'with both corpora downloaded,go test ./tests/hygiene,go test -C tools ./..., the two-line comment check.TestGoldenand every ratchet are untouched.Checklist
make testandmake lintpass locallymake docs-countsrun if a gate count moved — none movedF4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/559734afe3dd4a7ea2db7fc21f2c1f72
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/559734afe3dd4a7ea2db7fc21f2c1f72?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work