Skip to content

feat(migrate): faithful states, events and opaque behaviors in the v1 transformation census - #1037

Open
devin-ai-integration[bot] wants to merge 23 commits into
developfrom
feature/census-states-events
Open

devin-ai-integration[bot] wants to merge 23 commits into
developfrom
feature/census-states-events

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What and why

This closes the census group for states, events and opaque behaviours in the SysML v1 → v2 transformation census. Each row is now either faithful to OMG's SysMLv1Tov2 mapping (or a valid v2 equivalent of it) or deliberate, with the measured reason recorded.

Migrator

  • Opaque bodies. An OpaqueAction, OpaqueBehavior or FunctionBehavior body becomes rep language "<lang>" /* body */, which is OMG's TextualRepresentation, pairing bodies and languages by index. A translated body keeps its executable statements and now also keeps its source text. An untranslated body gets the representation instead of the old "body not migrated" comment. A body with no language stays a comment. A representation keeps the raw body, leading indentation included. Bodyless elements become plain usages or definitions and are reported as mapped.
  • Terminate pseudostates. They are written as action <name> terminate;, with incoming transitions targeting that action. Before this change they were written as a transition to done, which only ended the enclosing region.
  • Single-region composite states. These are written as OMG's parallel wrapper: state S parallel { …S's actions, deferrals, metadata… state <region> { entry; then A; … } }. Orthogonal regions are unchanged. The single region of a state machine is still flattened (see Candidate errata).
  • Time triggers. The existing accept after <duration> / accept at <instant> notation is the textual form of OMG's TimeTrigger structure, so those rows are recorded as faithful.

Lowering and runtime

  • parallelOwnedMember accepts @Meta { … } (prefix metadata) in a parallel state's body, as it already accepted metadata …;. Wrapped states with deferrals need this.
  • A composite state's region with no entry no longer fails to instantiate. On default entry, such a region counts as complete if it is left with no active child: either its stand-in sub-state is entered and nothing inside it starts, or it has no stand-in and no start. A composite whose regions are all complete in this way completes at once, which is PSSM Entering 004: the flattened form already did this, and the wrapper now keeps it. A region that a later transition or fork branch makes active must reach its final state before its owner completes. A running do-action, on the owner or on a region's stand-in, still defers completion, and the owner completes when that action ends. A first entry through a history with no record uses the same default-entry rule. Top-level machine regions with no start are still refused, and so is a region whose stand-in is itself parallel.
  • The former lowering refusals of a no-entry or fork-only region now assert the supported behaviour instead: tests renamed in lower/fork_plan_test.go, plus the PSSM referee classifier and docs.
  • Overlap: open PRs fix(runtime): interleave executors due at one instant move by move #850, fix(runtime): = values in action, calc, block and state bodies hold at all times #842 and fix(runtime): write-granular change triggers, unordered composite entry, entry-action transition effects #833 also touch internal/ir/lower/state_graph.go and state execution. This PR changes parallelOwnedMember and recordRegionInitials there, plus region entry and completion in the runtime.

Census

Totals (faithful / approximate / not implemented / deliberate), measured on develop at bc3333c11: 500 / 50 / 42 / 191 → 529 / 17 / 42 / 195.

Rows Before After
OpaqueAction_Mapping, OpaqueBehavior_Mapping, OpaqueBehaviorMembership_Mapping, OpaqueBehaviorSpecification_Mapping approximate ✅ faithful
all 22 TimeTrigger* rows approximate ✅ faithful
CommonPseudostate_Mapping, PseudoState_Mapping approximate ✅ faithful
Region_Mapping approximate ✅ faithful
TimeEvent_Mapping, ChangeEvent_Mapping, ChangeEventReturnParameter_Mapping, ChangeEventReturnParameterMembership_Mapping approximate ⛔ deliberate. OMG writes the event as a package-owned calculation, where expressions that name context features do not resolve. The expression stays inline at the trigger instead.

Candidate errata

  • OpaqueBehaviorSpecification_Mapping pairs body with language by index, so a body with no language is dropped. The migrator keeps it as a comment.
  • The pseudostate target is a plain StateUsage, which drops the kind: a choice becomes a waiting state, and a fork fires one transition. The migrator writes choice, junction and history as #StateMachines::<kind> state, fork and join as nodes, and terminate as action … terminate.
  • For a state machine with a single region, OMG writes a non-parallel state definition whose only sub-state (the region) has no entry into it, so nothing ever enters it. The migrator keeps that region flattened.

Specification basis

  • OMG SysML v1→v2 transformation (SysMLv1Tov2.xmi, 2025-02-01): Region, Pseudostate, OpaqueAction, OpaqueBehavior and TimeTrigger mapping classes.
  • PSSM 1.0 (ptc/18-11-06), Entering 004: a composite state whose region has no initial pseudostate completes on default entry.
  • UML 2.5.1 §14.2.3.4.5 / §14.2.3.5 (default entry, fork).
  • docs/project/spec-compliance.md has rewritten rows for region default entry and completion, and for fork-omitted regions.

How it was verified

  • Gates: go build ./..., go vet ./..., gofmt -l . (empty), OPENSYSML_REQUIRE_PSSM_SUITE=1 go test ./..., make lint, make docs-check, scripts/check-doc-ids.py, scripts/changelog.py check, census -check -require-xmi plus go test -C tools ./census/transformation, and TestPSSMSuiteMigration.
  • New tests:
    • Migration tests under tests/migrate for opaque representations, terminate and the wrapper (entry, nested transition, exit, connection points, state actions, deferrals, orthogonal regions, no-entry regions).
    • Conformance fixtures with trace goldens: state_parallel_region_without_entry_completes (the Entering 004 shape), state_parallel_region_without_entry_inactive, state_fork_only_region_entered_by_default, state_nested_fork_starts_outer_region_inactive, state_history_restores_inactive_parallel_region, state_transition_cross_region_inactive_wrapper, state_parallel_deferred_event, state_history_first_entry_inactive_region, state_parallel_stand_in_do_action_defers_completion, and the single-region wrapper fixture.
    • Robustness tests: TestRuntimeRobustnessInactiveRegion and TestRuntimeRobustnessParallelWrapperLeavesInnerRegionInactive.

PSSM

  • The referee is unchanged from develop bc3333c11 at 56 pass / 6 fail / 34 not-expressible / 7 differs-by-design. Entering 004 passes.
  • The migration ratchet:
mapped approximated unmapped skipped validation errors
develop bc3333c11 33,013 7,325 8,764 6 12
branch 33,086 7,329 8,759 6 12
  • Movements:
    • 3 terminate pseudostates move from approximated to mapped.
    • 6 initial-transition-effect activities (Entry 002-D, History 002-D, Junction 001, Junction 002, Standalone 002, Transition 023) move from unmapped to mapped. They newly report their contents, one of which is unmapped: an object flow whose target has no v2 name.
    • Opaque bodies are now reported as mapped.
    • In total: +73 mapped, +4 approximated, −5 unmapped, every element accounted for.

TMT 2024x (-migrate sysml -layout, then -validate, -compare-results -seed 1, analysis_report.py and HTML rendering). Develop at bc3333c11 can't migrate TMT on its own: since df6dc8876 (from #1033), a dependency or comment on a nested requirement usage is written with a feature chain, so the notation doesn't parse. #1051 fixes that. Both sides below include #1051: develop bc3333c11 + #1051 → this branch + #1051.

default: develop → branch -strict: develop → branch
mapped / approximated / unmapped 33,904 / 11,234 / 4,063 → 33,933 / 11,205 / 4,063 33,103 / 11,003 / 5,465 → 33,132 / 10,974 / 5,465
validation errors 0 → 0 0 → 0
runs attempted / completed / stopped / refused 41 / 31 / 10 / 21 → same 41 / 31 / 10 / 21 → same
comparable observables, exact / differ 142 / 14 → same; the differing list is identical 142 / 14 → same; the differing list is identical
diagrams laid out 1,242 / 1,347 → same 1,242 / 1,347 → same
HTML documents 104 → the same 104 files, with the same 14 failures as develop none declared → same

The only verdict movement in either mode is 29 elements from approximated to mapped: 14 FunctionBehavior and 15 OpaqueBehavior, whose bodies are now textual representations. No element becomes unmapped.

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/census-states-events.changed.md, not as an edit to CHANGELOG.md
  • 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

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

devin-ai-integration Bot and others added 14 commits October 4, 2026 23:20
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…tes-events

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

# Conflicts:
#	docs/project/sysml-v1-transformation-census-baseline.json
#	docs/project/sysml-v1-transformation-census.md
#	tests/corpus/testdata/pssm_migration_expected.txt
#	tests/migrate/migrate_test.go
#	tests/migrate/testdata/xmi/figures.golden.report.txt
#	tests/migrate/testdata/xmi/figures.mdzip.golden.report.txt
…ting

Co-Authored-By: jason.han <hanhuijun@gmail.com>
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 marked this pull request as ready for review October 10, 2026 03:45
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 9 commits October 10, 2026 03:52
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…g its owner

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

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

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

# Conflicts:
#	docs/project/pssm-referee-baseline.json
#	docs/project/spec-compliance.md
#	docs/project/sysml-v1-transformation-census-baseline.json
#	docs/project/sysml-v1-transformation-census.md
#	internal/exec/runtime/state_executor.go
#	internal/exec/runtime/state_region_entry.go
#	internal/ir/lower/fork_plan.go
#	internal/translate/migrate/migrate.go
#	internal/translate/migrate/names.go
#	tests/migrate/testdata/xmi/parking_usecases.golden.report.txt
…tes-events

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

# Conflicts:
#	docs/project/sysml-v1-transformation-census.md
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…y changes

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

This branch has not been deployed

No deployments
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