Repository navigation
feat(engine): run state machines and actions on the clock (advance), with a clocked hero scene - #1777
Merged
Merged
Conversation
Move the advance-aware state and action runs from the gRPC service into the runtime (StateOutcomeAdvancedBy, ActionOutcomeAdvancedBy, ExecuteActionAdvancedBy) so sysml-grpc and sysml-engine share one implementation, and read advance from the engine's JSON request mirrors with the service's validation. 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)".
|
The hero gains a "Mission phases on the clock" tab that renders #state:MissionSequence::MissionPhases and runs it on the engine with advance 400000 (or 800000 through a variant), replaying the recorded trace with each record's clock instant. LandingModel gains a machine shape for state views beside the part-shaped composition, and a Go test pins the scene's snapshot. Co-Authored-By: jason.han <hanhuijun@gmail.com>
… the clocked scene Co-Authored-By: jason.han <hanhuijun@gmail.com>
…gger when a variant changes the program Co-Authored-By: jason.han <hanhuijun@gmail.com>
This was referenced Oct 30, 2026
4 of 6 tasks
devin-ai-integration Bot
added a commit
that referenced
this pull request
Oct 30, 2026
…at they are equal Co-Authored-By: jason.han <hanhuijun@gmail.com>
HuiJun
added a commit
that referenced
this pull request
Oct 31, 2026
* docs(perf): account for every merge up to develop cf16528 in the 0.12.0 record The export rows are re-probed a second time at d01e4f4 (#1774: bytes and allocations equal to 5e0322e's on every row), the runtime, gRPC and REPL rows re-run six interleaved rounds at 1e34d9d against cc1d477 (#1777: nothing moved, bytes and allocations equal, the tests/perf binary's peak resident set within spread), the whole-binary element-ID probe repeated, and the candidate named as develop cf16528 with the SHA each row set was measured at. Co-Authored-By: jason.han <hanhuijun@gmail.com> * docs(perf): say what InstantiateWarmModel's #1777 figures are, not that they are equal Co-Authored-By: jason.han <hanhuijun@gmail.com> * docs(perf): re-check the load rows at develop 9a4ffcd and name #1784's cost #1784 (Usage::mayTimeVary over the effective isComposite) is on the semantics path every load runs: six interleaved rounds against cc1d477 show the load rows +1.5 % bytes and +4.7–4.8 % allocations per element loaded (ImportValues/nested up to +13 % allocations), the runtime, instantiation and parser rows unchanged, sec/op unresolved; the record names the merge as the cause, not fixed here, and the candidate as develop 9a4ffcd. Co-Authored-By: jason.han <hanhuijun@gmail.com> * docs(perf): re-probe the export rows at develop e022cbc after #1783 The RDF export fix touches internal/translate/export only, so the record re-runs the export rows (WriteAPIJSON, ConvertAPIJSON/32 and /128, the element-ID query, the Turtle export) six interleaved rounds at e022cbc against d01e4f4, names develop e022cbc as the candidate and keeps the #1784 load findings as reported. Co-Authored-By: jason.han <hanhuijun@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: jason.han <hanhuijun@gmail.com>
richetl
pushed a commit
to richetl/OpenSysML
that referenced
this pull request
Nov 3, 2026
….0 record The export rows are re-probed a second time at d01e4f4 (Open-MBEE#1774: bytes and allocations equal to 5e0322e's on every row), the runtime, gRPC and REPL rows re-run six interleaved rounds at 1e34d9d against cc1d477 (Open-MBEE#1777: nothing moved, bytes and allocations equal, the tests/perf binary's peak resident set within spread), the whole-binary element-ID probe repeated, and the candidate named as develop cf16528 with the SHA each row set was measured at. 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
ExecuteStateRequest.advanceandExecuteActionRequest.advanceare in the proto and honoured bysysml-grpc, but the in-browser engine's JSON mirrors (JExecuteStateRequest,JExecuteActionRequest) lacked the field, sosysml-enginealways ran a machine to quiescence and an action to completion. The Node client already sendsadvance; only the engine ignored it. The homepage hero needed a run that stops mid-way to show a clocked state machine, which is whatadvanceis for.Engine
StateOutcomePerformedBy:(*Context).StateOutcomeAdvancedBy,ActionOutcomeAdvancedByandExecuteActionAdvancedBy(withruntime.ErrNotCompleted, formerly the grpc package's).run_options.godelegates to them, so the service and the engine share one implementation and the two request mirrors cannot drift on this field.JExecuteStateRequest.advanceandJExecuteActionRequest.advanceare read by the engine with the service's validation (finite, non-negative, otherwiseInvalidArgument).seed,drawsandclock_stepstay out of the engine's mirrors: they did not fall out of this change (the engine serves no exploring schedule and has no draw policy plumbing), so they are left for their own change.Hero (
editors/vscode/src/landing,overrides/home.html)phases), renders#state:MissionSequence::MissionPhasesfromexamples/runtime-showcase/mission-sequence.sysml. Run callsExecuteStateon the engine withperformerSymbolId: MissionSequence::mission,advance: 400000,trace: true, then replays the trace the engine recorded: each state lit as its entry record comes, the token travelling each fired transition, the status line reading the clock from the records (t = 9,000 s · transition: prelaunch -> translunarCoast (event: time)), ending with the engine's answer: the states visited,finalTime, and whether the last state visited is the machine's final state.advance: 800000: the path continues throughtransEarthCoastandrecoveredtodone, which the trace puts at t = 702,000 s.LandingModelgains amachineshape for a state view (LandingMachine: the states by name, lifted out of thestate defbox;LandingStatekeeps kind andinitial) beside the part-shaped composition, so a state is not bent into a part.TraceRecordcarries the record'stime;JourneyRunthe run'sfinalTime.SceneProgramgains{kind: "clock", symbol, performer, advance}and aSceneVariantmay carry its ownprogram(programOf); the shell exposesprogramand summarizes a machine as "7 states, 7 transitions".data-osml-debug-events), and a scene-specific hint shows. The.is-livelighting now also applies to a machine's state boxes (osml-state).editors/vscode/src/landing/phases.jsonis pinned bytests/wasm/landing_phases_test.go(TestLandingMissionPhasesModel), which also checks the view's states and transition labels, the mission's instantiation, and the two clocked runs the scene offers.Landing order with #1778 (
feat/execute-action-trace-events, which addstrace/eventstoExecuteAction): this PR lands first. A dry merge of #1778's head onto this branch conflicts ininternal/exec/runtime/context.go,internal/frontend/engine/{engine,json}.goandinternal/frontend/grpc/{run_options,service}.go; the resolution is mechanical and was built and tested locally (tests/wasm, tests/grpc, internal/frontend/grpc green on the merged tree): thread #1778'sevents []runtime.MessagethroughExecuteActionAdvancedBy/ActionOutcomeAdvancedBy/startActionAdvancedBy(callingDeliverEventsbeforeAdvance), keep both new JSON fields, and haverunActionpickExecuteActionWithEventsorExecuteActionAdvancedBybyadvance. #1778 should mergedevelopafter this lands and apply that resolution; neither branch is rebased.How it was verified
tests/wasm/engine_advance_test.go:MissionSequence::MissionPhasesperformed byMissionSequence::missionwithadvance: 400000answersstatesVisitedprelaunch, translunarCoast, lunarOrbit, onSurface,finalTime400000 and transition records at t=9000, 279000, 379000;advance: 800000reachesrecoveredthendoneat t=702000; withoutadvancethe machine runs through its clock todoneat t=702000; every answer is byte-equal to the service's. An action run for 2 s stops short of its wait at t=5 and says so, run for 10 s completes;advance: -1is refused asInvalidArgumenton both methods.tests/wasm/landing_phases_test.gopins the scene's snapshot and the two clocked runs;editors/vscodeunit tests covermachineModel,stateIdOf,runClock(performer/advance/trace on the wire,finalTimekept, a failed run's partial trace),programOfand the three-scene chooser.execute_state_exhibited_performance_performer("advance": 20) and theinternal/frontend/grpcrun-option tests stay green through the refactor../bin/sysml -quiet -instantiate MissionSequence::mission -state MissionSequence::mission -advance 400000 examples/runtime-showcase/mission-sequence.sysmlends inonSurfacewaiting on t=457000;-advance 800000reports "State machine completed"; the engine answers the same states and instants.go build ./...,go vet ./...,gofmt -l .(empty),go test ./...all packages ok (four heavy packages — cmd/sysml, internal/exec/runtime, internal/exec/smt, tests/codegen — hit the 10-minute timeout only while the browser run and the Node tests shared the machine, and passed re-run alone);staticcheckclean on the touched packages;cd editors/vscode && npm run build && npm run typecheck && npm test(449 pass, 0 fail);cd client/node && rm build/wasm/sysml-wasm.wasm && npm run build && npm test(471 pass, 0 fail, 1 skipped as on develop).ExecuteState ran MissionPhases on mission for 400,000 s in 31 ms: prelaunch → translunarCoast → lunarOrbit → onSurface. The clock stopped at t = 400,000 s with the machine still in onSurface.; with the variant on,… → transEarthCoast → recovered → done. The clock stopped at t = 800,000 s; the machine completed when a transition reached done at t = 702,000 s.; the Debug panel steps the records with their instants; editingafter 9000 [s]to5000redraws and the first transition reads t = 5,000 s; the stack and mass scenes still run; Download PNG savesmission-phases.png; no console errors beyond the theme's two api.github.com 403s.Checklist
make testandmake lintpass locallyadvancechanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build) — no gate count movedF4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/5da68ef994984c60bf6057a840223710
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/5da68ef994984c60bf6057a840223710?variant=devin
Requested by: @HuiJun