Repository navigation
feat(migrate): a strict migration refers to no OpenSysML library; -portable inlines the ones a default migration does - #1032
Merged
Conversation
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>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…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>
Contributor
Author
Runtime verification (binary built at 9c22c3b, compared with one built from
|
develop strict output under the pilot |
this branch's strict output |
|---|---|
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-allwrites 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;meterquotients and remainders unchanged); a[1, 8]interval wait becomes4.5with 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).
… 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
marked this pull request as ready for review
October 9, 2026 19:24
…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>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…egenerate the manual page Co-Authored-By: jason.han <hanhuijun@gmail.com>
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
A SysML v1 migration under
-strictis documented as output "an interchange partner could read", but it still referred to OpenSysML's own libraries:MigrationMetadata::SynthesizedName/StandIn/LibraryNameAvoidedmarkers,#StateMachines::<kind>pseudostates,@Stochastic::Probability,DocumentQueriesdocuments,@DiagramLayoutgeometry,Simulation::*,RandomFunctions::uniformandOpenSysMLMathFunctions::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
-strictthe 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:MigrationMetadataname markers become comments (// names the migration made up: a, b); the report carries the same informationchoice/junction→ plainstate x;with the pseudostate's guarded transitions (Approximated);shallowHistory/deepHistoryand the transitions into and out of them → Unmappedthen b; // probability 0.25(Approximated, noted on the edge whether or not its guard migrated)/over whole numbers →RealFunctions::floor((x - x % y) / y);Math.ceil→-RealFunctions::floor(-x)(both exact)/* not migrated: ... */comment; a Monte Carlo analysis is written as the ordinary analysis without itsSimulation::MonteCarlogeneralization (Approximated); a simulation configuration's run settings → a comment in place of@Simulation::ConfigurationDiagramLayoutgeometry (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.
-portableis 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 (MOSApulls inDocumentQueries) — after the model, under a comment saying so. Astandard library packageis written as alibrary 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, itsfunctions ascalc 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 underlibraries.-strict -portablecomposes: whatever a strict migration still refers to (the deferral annotations) is inlined. The flag is a CLI/Go-API option (Options.Portable); the gRPCMigrateRequestdoes not carry it yet.Specification basis
No new clause:
-strictalready promised notation of the pinned production.ModelingMetadata,RealFunctions::floorand%are KerML/SysML v2 standard library (SysML v2 1.0 Kernel Function Library, Semantic Library). No row indocs/project/spec-compliance.mdmoves.How it was verified
TestStrictMigrationRefersToNoOpenSysMLLibraryintests/migratemigrates everytestdata/xmi/*.xmifixture underOptions{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.TestStrictProbabilityNoteReachesAnEdgeWhoseGuardIsNotMigratedpins the report note on a weighted edge whose guard is kept as a comment.TestPortableMigrationInlinesTheLibrariesItRefersTomigrates every fixture underOptions{Portable: true}and checks that each OpenSysML package the model part names is appended exactly once as alibrary package(none markedstandard), is accounted for inReport.Librariesand the summary, that nothing is appended when nothing is referenced, that the output still validates, and that a default migration accounts for no libraries;TestPortableMigrationSpellsAKerMLLibraryInSysMLpinsRandomFunctionsarriving ascalc def uniform; package-level tests pin the transitive case (MOSA→DocumentQueries), the refused KerML-only library and a package merely named like a library.TestStrictPropertyProbabilityUsesOnlyLiteralDefaults, the choice/junction/history state tests, the deferred-signal tests,TestDiagramNotesDoNotNameOmittedVertices); a sharedwantMadeUphelper 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.pyall green.-portable(views and all) validates in the pinned pilot batch validator on its own with 0 errors and 0 warnings, and undersysml -validatewith no errors; so does-strict -portable.develop: the 1124-element Cameo SEM model migrated with-stricthas zero extension references, loads undersysml -strict -validatewith no errors, and validates in the pinned pilot batch validator with the standard library alone (0 errors, 0 warnings), where thedevelopbinary's strict output fails; its default migration is byte-identical todevelop's and still validates with the extension library;-render-allwrites the same 33 views from either; deferral replay in the strict output still runs.Checklist
make testandmake lintpass locally (the packages touched; staticcheck is not installed on this machine, CI runs it)changes/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (none moved;packaging/man/man1/sysml.1regenerated for the-strictand-portableusage text)F4,K5) in the body, docs, or changelogLink 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