Repository navigation
fix(semantics): state-body then after a state is a TransitionUsage owning its succession - #2133
Open
devin-ai-integration[bot] wants to merge 7 commits into
Open
devin-ai-integration[bot] wants to merge 7 commits into
devin-ai-integration[bot] wants to merge 7 commits into
Conversation
… fix/state-then-transition-usage
…ning its succession
A state body's `then x;` after a state is a TargetTransitionUsage (SysML v2.1
§8.2.2.18.1, §8.2.2.18.3): a TransitionUsage the state owns, which owns the
SuccessionAsUsage to its target through an OwningMembership. Symbols, the
semantic model, the RDF/API JSON writers and the notation reader now agree;
every transition owns its succession the same way and answers `succession`.
`then done { … }` is admitted a body (§8.2.2.17.8). Compliance rows added
with the pinned edition's clauses; baselines re-recorded after adjudication.
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)".
|
…icity back targetTransitionText now prefixes the target with the bounds the owned succession's target end states, so `then [2] busy;` survives the round trip. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…nsition-usage Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential.md # internal/syntax/ast/succession.go
…nsition-usage Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential/index.json # tests/export/testdata/convert/then_after_members.golden.ttl.sha256
2 of 6 tasks
…nsition-usage Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential/index.json # docs/project/api-json-differential/pilot-validation/06-Individual and Snapshots/6-Individual and Snapshots.sysml.json # docs/project/api-json-differential/pilot-validation/10-Analysis and Trades/10c-Fuel Economy Analysis.sysml.json # internal/semantic/metamodel/derived_census_baseline.json # internal/semantic/metamodel/derived_census_records.tsv # internal/translate/export/testdata/structure_differential_expected.txt # tests/export/testdata/convert/then_after_members.golden.ttl.sha256
This branch has not been deployed
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
Merge order
Merge after #2121 (
fix/then-succession-member). This branch was cut fromdevelopwith #2121 merged in and builds on it; once #2121 lands,developis merged back here so the diff shows only this change.What this fixes
Follow-up to the audit of #2121 against the pinned specification (SysML v2.1 Beta 2, KerML 1.1 Beta 2) and the pinned pilot (
scripts/pilot-pin.sh: tag2026-09, artifact 0.63.0). Each finding was re-verified against the spec text, the pinnedSysML.xtextand the pilot'sexport-jsonbefore changing anything.1. State-body
then x;after a state is aTransitionUsage(fixed)SysML §8.2.2.18.1
StateBodyItem(BehaviorUsageMember (TargetTransitionUsageMember)*), §8.2.2.18.3TargetTransitionUsage : TransitionUsage, §7.18.3.state idle; then running;is aTransitionUsagethe state owns through aFeatureMembership, which owns theSuccessionAsUsageto its target through anOwningMembership(TransitionSuccessionMember). #2121 reflected and wrote it as aSuccessionAsUsageof the state.ast.IsStateTargetTransitionnames the form (after a state; not afterentry/do/exit, not member-attached);SuccessionAdmitsBodyuses it.buildDeclbuilds such an edge as an anonymous action-usage symbol whoseDeclaresTransition()is true; records carryNodeTransition(Symbol.NodeKind).metaclassisTransitionUsage, the implicit baseActions::transitionActions; every transition (this form andtransition …/accept …) owns its succession as a synthesized part (ExpressionTransitionSuccession) reflected asOwningMembership → SuccessionAsUsage, answered assuccession, withrelatedFeature= source state, target state. The query leg reads these throughOwnedRelationships.TransitionUsage(sysx:transitionSyntax "target") owning its succession with two ends,sysml:sourcethe preceding state andsysml:target; the notation reader writesthen x;/then x { … }back (the body is the transition'sActionBody).entry; then idle;(EntryTransitionMember) andthen state off;/then part p2;(SourceSuccessionMember) staySuccessionAsUsage(§8.2.2.9.3, §8.3.13.6; KerML §8.3.4.5.4).Pilot evidence (
export-json,state def Mach { entry; then idle; state idle; then running; … then state off; }):FeatureMembership → SuccessionAsUsage(entry),FeatureMembership → StateUsage(idle),FeatureMembership → TransitionUsage { Membership ⇒ idle, OwningMembership → SuccessionAsUsage(relatedFeature idle, running), FeatureMembership → transitionLink },FeatureMembership → SuccessionAsUsage(then state off); a namedtransition t first off accept Sig then idle;owns its succession the same way.Tests:
semantics/state_then_transition_test.go(metaclass, memberships,relatedFeature,succession, nested state body),parser/succession_body_admitted_test.goTestIsStateTargetTransition,tests/export/behavior_test.goTestStateMembersRoundTrip(then idle;,then idle { … },entry; then idle;,then state busy;),reflective_transition_kinds_test.gonow also expects the transition's succession membership.2. Connector ends and
relatedFeature(approximate; known limitation)No branch or open PR covers⚠️ in both compliance areas.
fix/succession-connector-ends-related-features; issue #2068 stays open. Not done here: the succession shorthand still owns no end features (TargetSuccession'sSourceEndMember/ConnectorEndMember, §8.2.2.17.8; KerML §8.3.4.5.3 derivesrelatedFeaturefrom them; the pilot exports both asReferenceUsages underEndFeatureMemberships).relatedFeaturestays derived from the members thethenis written between: since #2143 a bareentry;performs an anonymous action, soentry; then idle;now answers (that action,idle), whilethen assign …;remains unanswered because the statement has no element on the symbol side (pre-existing, outside #2121). Recorded as3.
SuccessionAdmitsBodyandthen done { … }(fixed)then done { … }derives fromTargetSuccession UsageBody(§8.2.2.17.8) and now admits its body; the comment/test that attributed a body after a state in a state body toActionTargetSuccessionnow says it is theActionBodyofTargetTransitionUsage.4. Compliance map (fixed)
Rows added in⚠️ for the ends) and ⚠️ ), with the pinned edition's clauses: SysML §8.2.2.17.1/.8, §8.2.2.9.3, §8.2.2.18.1/.3, §8.3.13.6; KerML §8.3.4.5.3/.4. Changelog fragment
13-action.md(owned body-lessSuccessionAsUsage,15-state-machine.md(state-bodythenmetaclass ✅; successions' owned endschanges/unreleased/state-then-transition-usage.fixed.md.Known limitations
thenshorthand own no end features;relatedFeatureis unanswered where an end is a statement (then assign …;) — Successions lose their related features unless named; transition successions, action-node ends and body-declared connection ends have none #2068.first x then y;in an action body has noSuccessionAsUsagesymbol;if x then a;/else b;after adecidehave no membership on the symbol side (pre-existing, noted by the audit; the bareentry;case is closed by fix(symbols,semantics,export): a bareentry;,do;orexit;performs the anonymous empty ActionUsage its StateSubactionMembership owns — the symbol structure, the semantic model, the query leg and the RDF writer state it, both readers take it back, as the pilot exports it #2143).then done;although its production admits a body: it has no insertion point for one (thedoneis declared between the keyword and the;), stated as such ininlineAnnotationAdmitted.then x;after a non-behavior member in a state body (entry; attribute a; then idle;), which the pinned grammar does not admit and the pilot fails to parse, is classified as aTargetTransitionUsage, following the parser's existing leniency.Baselines moved
internal/translate/export/testdata/structure_differential_expected.txt(pilot-corpora root): six state-bodythensuccessions becomeTransitionUsages; their synthesized successions are now mapped by the differential (TransitionUsage::succession).tests/export/testdata/convert/then_after_members.golden.ttl.sha256:state def Switch { entry; attribute pressed; then idle; … }is written as aTransitionUsage.internal/semantic/metamodel/derived_census_baseline.json/derived_census_records.tsv(derived-census -update): element and implied counts rise in every root because each transition now owns its succession and that succession's implied base; no rule verdict moves.Specification basis
SysML v2.1 Beta 2: §8.2.2.18.1
StateBodyItem/TargetTransitionUsageMember, §8.2.2.18.3TargetTransitionUsage : TransitionUsage, §7.18.3; §8.2.2.17.1ActionBodyItem, §8.2.2.17.8ActionTargetSuccession/TargetSuccession UsageBody; §8.2.2.9.3SourceSuccessionMember; §8.3.13.6SuccessionAsUsage. KerML 1.1 Beta 2: §8.3.4.5.3Connector(relatedFeaturefromconnectorEnd), §8.3.4.5.4Succession. Rows added indocs/project/spec-compliance/02-detailed-semantic-compliance-map/13-action.mdand15-state-machine.md(sources; the combined page is not committed).How it was verified
gofmt -l .(empty),go build ./...,go vet ./...,make lint(staticcheck + gosec) clean.go test ./...green (the runtime, smt, codegen, cmd/sysml and tests/export packages re-run with-timeout 45mafter hitting the 10m default under load);go test -count=1 ./tests/hygienegreen.TestSymbolStructureMatchesGraphStructurere-recorded with-update-structure-differentialafter adjudication (above).go run -C tools ./cmd/pilot-apijson-diff -checkmoved three pilot files (AssignmentTest,6-Individual and Snapshots,10c-Fuel Economy Analysis): theStateDefinition.ownedConnection/ExhibitStateUsage.nestedConnectionrows leave present-different for indeterminate, as the state no longer owns thethensuccession as a connection and the transition's synthesized elements are unkeyable; re-recorded with-update;go test -C tools ./referee/apijsongreen.python3 scripts/spec_compliance.py check,python3 scripts/changelog.py check,python3 scripts/check-doc-ids.pyclean.Checklist
make testandmake lintpass locallychanges/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)F4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/646cfbd400b24080a168f29eb053ccd9
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/646cfbd400b24080a168f29eb053ccd9?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work