Skip to content

feat(migrate): a strict migration refers to no OpenSysML library; -portable inlines the ones a default migration does - #1032

Merged
HuiJun merged 8 commits into
developfrom
fix/strict-migration-self-contained
Oct 10, 2026
Merged

HuiJun merged 8 commits into
developfrom
fix/strict-migration-self-contained

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

What and why

A SysML v1 migration under -strict is documented as output "an interchange partner could read", but it still referred to OpenSysML's own libraries: MigrationMetadata::SynthesizedName/StandIn/LibraryNameAvoided markers, #StateMachines::<kind> pseudostates, @Stochastic::Probability, DocumentQueries documents, @DiagramLayout geometry, Simulation::*, RandomFunctions::uniform and OpenSysMLMathFunctions::quotient/ceiling. A tool shipping only the standard library — the pilot implementation, or a modeling tool built on it such as CATIA Magic — fails on every one of them: on a 1124-element Cameo model the pilot reports thousands of unresolved-reference and knock-on type errors, none of them about the model.

Under -strict the migrator now writes nothing such a tool cannot resolve. Where the standard has a form, that is written and reported approximated where it loses something; where it has none, the construct is refused with a report line:

  • the three MigrationMetadata name markers become comments (// names the migration made up: a, b); the report carries the same information
  • choice/junction → plain state x; with the pseudostate's guarded transitions (Approximated); shallowHistory/deepHistory and the transitions into and out of them → Unmapped
  • a decision node's branch probability → then b; // probability 0.25 (Approximated, noted on the edge whether or not its guard migrated)
  • a duration constraint over an interval → a fixed wait of the midpoint when both bounds are literal numbers (Approximated), refused otherwise
  • Java / over whole numbers → RealFunctions::floor((x - x % y) / y); Math.ceil → -RealFunctions::floor(-x) (both exact)
  • «Document» and «DiagramTable»/«InstanceTable» → Unmapped with a /* not migrated: ... */ comment; a Monte Carlo analysis is written as the ordinary analysis without its Simulation::MonteCarlo generalization (Approximated); a simulation configuration's run settings → a comment in place of @Simulation::Configuration
  • views carry no DiagramLayout geometry (noted on the view's report entry when a layout was available)

The one OpenSysML reference a strict migration keeps is the deferral encoding's @MigrationMetadata::DeferredEvent / #MigrationMetadata::DeferredKeeper: the encoding itself is standard notation, the runtime and lowering read those annotations to schedule the deferral, and a tool that does not know them reads the state as written. This is documented as the exception.

The default (non-strict) migration is byte-for-byte unchanged on the SEM model and every fixture.

-portable is the other route to a file such a tool loads, for the default migration: it leaves what is written unchanged and appends the OpenSysML library packages the output refers to — every package named as the first segment of a qualified name, and every one those refer to in turn (MOSA pulls in DocumentQueries) — after the model, under a comment saying so. A standard library package is written as a library package, which a file of one's own may declare (the pilot warns on the former); a KerML library (RandomFunctions, OpenSysMLMathFunctions) is written in its SysML spelling, its functions as calc defs, and one whose words are KerML's alone (StateActivity) is left referenced with a report line. The report's summary names the packages inlined (inlined 5 OpenSysML library package(s): DiagramLayout, DocumentQueries, MigrationMetadata, StateMachines, Stochastic) and the JSON report lists them under libraries. -strict -portable composes: whatever a strict migration still refers to (the deferral annotations) is inlined. The flag is a CLI/Go-API option (Options.Portable); the gRPC MigrateRequest does not carry it yet.

Specification basis

No new clause: -strict already promised notation of the pinned production. ModelingMetadata, RealFunctions::floor and % are KerML/SysML v2 standard library (SysML v2 1.0 Kernel Function Library, Semantic Library). No row in docs/project/spec-compliance.md moves.

How it was verified

  • New TestStrictMigrationRefersToNoOpenSysMLLibrary in tests/migrate migrates every testdata/xmi/*.xmi fixture under Options{Strict: true} and fails on any line naming an OpenSysML library package (read from the library directory, so a new library is covered automatically), the deferral annotations excepted. TestStrictProbabilityNoteReachesAnEdgeWhoseGuardIsNotMigrated pins the report note on a weighted edge whose guard is kept as a comment.
  • New TestPortableMigrationInlinesTheLibrariesItRefersTo migrates every fixture under Options{Portable: true} and checks that each OpenSysML package the model part names is appended exactly once as a library package (none marked standard), is accounted for in Report.Libraries and the summary, that nothing is appended when nothing is referenced, that the output still validates, and that a default migration accounts for no libraries; TestPortableMigrationSpellsAKerMLLibraryInSysML pins RandomFunctions arriving as calc def uniform; package-level tests pin the transitive case (MOSA → DocumentQueries), the refused KerML-only library and a package merely named like a library.
  • Strict expectations updated where the output deliberately changed (TestStrictPropertyProbabilityUsesOnlyLiteralDefaults, the choice/junction/history state tests, the deferred-signal tests, TestDiagramNotesDoNotNameOmittedVertices); a shared wantMadeUp helper accepts either marker spelling.
  • go test ./tests/migrate/ ./internal/translate/... ./cmd/..., go vet, gofmt -l, make man-check, scripts/changelog.py check, scripts/check-doc-ids.py all green.
  • By hand: the SEM model migrated with -portable (views and all) validates in the pinned pilot batch validator on its own with 0 errors and 0 warnings, and under sysml -validate with no errors; so does -strict -portable.
  • By hand and by an end-to-end run against a binary built from develop: the 1124-element Cameo SEM model migrated with -strict has zero extension references, loads under sysml -strict -validate with no errors, and validates in the pinned pilot batch validator with the standard library alone (0 errors, 0 warnings), where the develop binary's strict output fails; its default migration is byte-identical to develop's and still validates with the extension library; -render-all writes the same 33 views from either; deferral replay in the strict output still runs.

Checklist

  • make test and make lint pass locally (the packages touched; staticcheck is not installed on this machine, CI runs it)
  • 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; packaging/man/man1/sysml.1 regenerated for the -strict and -portable usage text)
  • 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

Under -strict the migrator writes nothing a tool shipping only the standard
library cannot resolve: the MigrationMetadata name markers become comments,
a choice or junction a plain state, a branch probability a comment, an
interval wait its midpoint, Java's whole-number quotient and ceiling the
standard floor, a view carries no DiagramLayout geometry, and a history
pseudostate, a document, a table or a Monte Carlo analysis is refused with a
report line. The deferral encoding keeps its MigrationMetadata annotations.
The default migration is unchanged.

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 Bot and others added 2 commits October 9, 2026 18:16
…s not migrated; docs say a Monte Carlo analysis is approximated

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…is not migrated

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

Copy link
Copy Markdown
Contributor Author

Runtime verification (binary built at 9c22c3b, compared with one built from develop at 4e70d6a)

Strict output of a 1124-element Cameo model (SEM)
  • -migrate sysml -strict: 954 mapped, 161 approximated, 9 unmapped; the notation names no OpenSysML library package.
  • sysml -strict -validate: 0 errors (9 duplicate-import warnings, as on develop).
  • Pilot batch validator with the standard library alone: passes. The develop binary's strict output fails the same validator (unresolved MigrationMetadata, DiagramLayout, Stochastic, StateMachines, DocumentQueries types and their knock-on errors); a deliberately broken file fails it too, so the pass is not vacuous.
develop strict output under the pilot this branch's strict output
develop strict output fails the pilot strict output validates
Regression controls
  • Default (non-strict) SEM output is byte-identical between the two binaries; the pilot accepts it only with the extension library, as before.
  • -render-all writes the same 33 views from strict and default output; strict views carry no canvas geometry.
  • 12 fixtures (plant_states, documents, montecarlo, simconfig, ui_stimuli, meter, reactor, tables, weighted_decision, accept_via_context_port, deferral, mission) migrate under both binaries × both modes; default notation and reports are byte-identical, every strict output validates natively.
  • Strict deferral still runs in the REPL: Alarm/Beep buffered in Busy, replayed through Alarmed → Done, buffers cleared, no stale replay on the second visit.
  • Strict arithmetic rewrites execute correctly (Ceil(2.1) = 3, Ceil(-2.9) = -2; meter quotients and remainders unchanged); a [1, 8] interval wait becomes 4.5 with its midpoint note.

Found by this run and fixed in 3f39a59: a weighted edge whose guard is kept as a comment reported the guard only, not that its probability is written as a comment. Not exercised at runtime: strict choice pseudostates and non-literal interval waits (unit tests cover both).

devin-ai-integration[bot]

This comment was marked as resolved.

… strict documents and layouts are accounted for

A strict migration writes a choice or junction as a plain state, whose
transitions compete, so its else branch is now guarded by the negation
of the other outgoing guards, or written unguarded with a report line
when one of them is not a v2 expression. A document a strict migration
refuses is refused before its content is planned, so the report holds
no mapped rows for views and paragraphs no Document carries. A strict
migration still joins layout records to the views they match, counting
the geometry it omits instead of reporting the views missing.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun marked this pull request as ready for review October 9, 2026 19:24
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits October 9, 2026 20:55
…rict mode writes; omitted geometry counts no stream supplementation

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…utput refers to

A migration under -portable is one self-contained file: every OpenSysML
library package its notation names by qualified name, and every one those
refer to in turn, follows the model as a library package (a KerML library
in its SysML spelling), so the file loads where only the standard library
ships. What the migration writes is otherwise unchanged; the report names
the packages inlined.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration devin-ai-integration Bot changed the title feat(migrate): a strict migration refers to no OpenSysML library feat(migrate): a strict migration refers to no OpenSysML library; -portable inlines the ones a default migration does Oct 9, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

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

This comment was marked as resolved.

…egenerate the manual page

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun merged commit 83a7824 into develop Oct 10, 2026
26 checks passed
@HuiJun
HuiJun deleted the fix/strict-migration-self-contained branch October 10, 2026 01:06
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