Skip to content

fix(migrate): find item flow ends through the parts and blocks a tool names; let state usages inherit past views - #1025

Merged
HuiJun merged 2 commits into
developfrom
devin/1791544054-migrate-itemflow-block-ends
Oct 9, 2026
Merged

HuiJun merged 2 commits into
developfrom
devin/1791544054-migrate-itemflow-block-ends

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

What and why

Migrating a Cameo SysML v1 model (a Scanning Electron Microscope, 41 diagrams) left 16 of its 19 unmapped elements as «ItemFlow»s and rendered its state machine diagram empty. Both come from how Cameo writes a model, not from the model being malformed.

  • internal/translate/migrate/migrate.go — itemFlow only accepted an InformationFlow whose informationSource/informationTarget were the realizing connector ends' roles (the ports). Cameo writes a flow drawn between parts with the parts or the blocks typing them as source and target, and a flow at the owner's own port with the owner block. endStandsFor now matches the source/target against each end's resolved path (segs): its role, any part on the path, the type of either, or the connector's owner when the end is the owner's own port. Direction still follows source → target regardless of end order, and the flow properties are still looked up on the end's actual role. The unmapped note for a flow naming neither end now says what was tried. On the SEM model: 19 → 7 unmapped (the remaining 4 flows name parts whose ports carry no flow property, 2 are Interactions, 1 a DependencyMatrix).
  • internal/ir/lower/state_inheritance.go — a migrated state machine diagram becomes a view inside the state def. loweredElsewhere did not list views, viewpoints, renderings or metadata, so a state s : ThatDef failed with "the view usage … cannot be inherited by the state", the whole state graph was dropped, and every layout annotation for the view warned "does not draw … as a node". Those members are not state content and are now passed over like a comment or a nested definition. On the SEM model this also took strict-validation warnings from 46 to 23.
  • docs/reference/sysml-v1-migration.md row for ItemFlow updated; two changes/unreleased/*.fixed.md fragments.

Specification basis

SysML v1.6 §9.3.2.6 ItemFlow (an ItemFlow is realized by a connector; its item properties/flow properties are those of the connector ends' types) — the change only widens which v1 encodings of the source/target are recognised, the v2 output (flow of X from a.p to b.q, KerML/SysML v2 §7.13) is unchanged. No row in docs/project/spec-compliance.md moves.

How it was verified

  • New TestItemFlowEndsMayBeThePartsOrBlocksOnTheConnector (tests/migrate/relations_test.go): block-typed ends, owner-port end, and a flow naming neither end stays unmapped with the new note.
  • New TestToStateGraphTypedStateUsageSkipsInheritedViewsAndMetadata (internal/ir/lower/state_inherited_test.go): a state def with view, viewpoint, rendering, @Note and metadata … about still lowers through a typed usage with its substates.
  • go test ./internal/ir/... ./internal/exec/runtime ./internal/translate/... ./internal/check/... and make lint pass; scripts/changelog.py check passes.
  • By hand: re-migrated the SEM .mdzip; output validates with -validate -strict, 0 errors; the state view now renders its states and transitions.

Checklist

  • make test and make lint pass locally (focused go test on the touched trees + make lint; full make test runs in CI)
  • 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
  • baselines regenerated and make docs-counts run if a gate count moved (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/dbff7ccc1454416fb497412e51cf5513
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/dbff7ccc1454416fb497412e51cf5513?variant=devin
Requested by: @HuiJun

An «ItemFlow» whose source and target are the parts on the realizing
connector's ends, the blocks typing them, or the connector's owner at its
own port — as Cameo writes a flow drawn between parts — now flows between
the ports those ends name instead of being left as a comment.

lower: a view, viewpoint, rendering or metadata member of a state def is
not state content, so a usage typed by it inherits past it instead of
failing to lower, which left migrated state diagrams empty.

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

Copy link
Copy Markdown
Contributor Author

Runtime verification

SEM migration and restored state rendering

Tested the freshly built CLI against the supplied Cameo SEM archive.

  • Migration exits 0: 1124 elements — 957 mapped, 160 approximated, 7 unmapped (4 ItemFlows naming parts whose ports carry no flow property, 2 Interactions, 1 DependencyMatrix).
  • Independently checked all 12 newly emitted flows against the source XMI: direction (informationSource → informationTarget) and port flow-property endpoints match.
  • Strict validation: 0 errors, 23 warnings, exit 0.
  • DOT/text/Mermaid/PlantUML now contain states and transitions; the lowered SEM graph has 28 vertices and 27 transitions.
🔴 Pre-change binary (4cb3d63) 🟢 This branch
Empty SEM state rendering Restored inherited states and transitions

Caveats: the pre-existing junction layout warning remains (the node exists; its migrated coordinates are not applied). Default positioned DOT omits 22 unpositioned nodes; -render-unplaced strip includes them. External Mermaid/PlantUML image engines were not exercised.

Adversarial and regression checks
  • Reversed connector ends and part → owner endpoints emit correctly directed flows; a flow naming an element on neither end stays explicitly unmapped with the expanded note.
  • A typed state usage inherits a/b and a → b past view, viewpoint, rendering and metadata members.
  • An unsupported inherited action still reports "cannot be inherited".
  • Notation diff vs. the pre-change migration: 12 emitted flows plus revised comments for the four remaining unmapped ItemFlows, nothing else; only the 16 ItemFlow report records change.

Testing session

devin-ai-integration[bot]

This comment was marked as resolved.

… given a direction

Two same-typed parts at same-typed ports let a flow from the block to the
port type stand for either end; only the ends' roles may then tell them
apart, and when they cannot the flow is left as a comment instead of
taking the connector's end order.

lower: a parallel state def's views, viewpoints, renderings and metadata
are no regions, so a usage typed by it lowers as an ordinary one does.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun merged commit cf5451a into develop Oct 9, 2026
26 checks passed
@HuiJun
HuiJun deleted the devin/1791544054-migrate-itemflow-block-ends branch October 9, 2026 12:33
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