Skip to content

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
developfrom
fix/state-then-transition-usage
Open

devin-ai-integration[bot] wants to merge 7 commits into
developfrom
fix/state-then-transition-usage

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Merge order

Merge after #2121 (fix/then-succession-member). This branch was cut from develop with #2121 merged in and builds on it; once #2121 lands, develop is 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: tag 2026-09, artifact 0.63.0). Each finding was re-verified against the spec text, the pinned SysML.xtext and the pilot's export-json before changing anything.

1. State-body then x; after a state is a TransitionUsage (fixed)

SysML §8.2.2.18.1 StateBodyItem (BehaviorUsageMember (TargetTransitionUsageMember)*), §8.2.2.18.3 TargetTransitionUsage : TransitionUsage, §7.18.3. state idle; then running; is a TransitionUsage the state owns through a FeatureMembership, which owns the SuccessionAsUsage to its target through an OwningMembership (TransitionSuccessionMember). #2121 reflected and wrote it as a SuccessionAsUsage of the state.

  • ast.IsStateTargetTransition names the form (after a state; not after entry/do/exit, not member-attached); SuccessionAdmitsBody uses it.
  • Symbols: buildDecl builds such an edge as an anonymous action-usage symbol whose DeclaresTransition() is true; records carry NodeTransition (Symbol.NodeKind).
  • Semantic model: metaclass is TransitionUsage, the implicit base Actions::transitionActions; every transition (this form and transition …/accept …) owns its succession as a synthesized part (ExpressionTransitionSuccession) reflected as OwningMembership → SuccessionAsUsage, answered as succession, with relatedFeature = source state, target state. The query leg reads these through OwnedRelationships.
  • Writers: the RDF/API JSON writer emits a TransitionUsage (sysx:transitionSyntax "target") owning its succession with two ends, sysml:source the preceding state and sysml:target; the notation reader writes then x; / then x { … } back (the body is the transition's ActionBody).
  • entry; then idle; (EntryTransitionMember) and then state off; / then part p2; (SourceSuccessionMember) stay SuccessionAsUsage (§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 named transition 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.go TestIsStateTargetTransition, tests/export/behavior_test.go TestStateMembersRoundTrip (then idle;, then idle { … }, entry; then idle;, then state busy;), reflective_transition_kinds_test.go now also expects the transition's succession membership.

2. Connector ends and relatedFeature (approximate; known limitation)

No branch or open PR covers fix/succession-connector-ends-related-features; issue #2068 stays open. Not done here: the succession shorthand still owns no end features (TargetSuccession's SourceEndMember/ConnectorEndMember, §8.2.2.17.8; KerML §8.3.4.5.3 derives relatedFeature from them; the pilot exports both as ReferenceUsages under EndFeatureMemberships). relatedFeature stays derived from the members the then is written between: since #2143 a bare entry; performs an anonymous action, so entry; then idle; now answers (that action, idle), while then assign …; remains unanswered because the statement has no element on the symbol side (pre-existing, outside #2121). Recorded as ⚠️ in both compliance areas.

3. SuccessionAdmitsBody and then done { … } (fixed)

then done { … } derives from TargetSuccession 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 to ActionTargetSuccession now says it is the ActionBody of TargetTransitionUsage.

4. Compliance map (fixed)

Rows added in 13-action.md (owned body-less SuccessionAsUsage, ⚠️ for the ends) and 15-state-machine.md (state-body then metaclass ✅; successions' owned ends ⚠️), 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 changes/unreleased/state-then-transition-usage.fixed.md.

Known limitations

Baselines moved

  • internal/translate/export/testdata/structure_differential_expected.txt (pilot-corpora root): six state-body then successions become TransitionUsages; 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 a TransitionUsage.
  • 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.3 TargetTransitionUsage : TransitionUsage, §7.18.3; §8.2.2.17.1 ActionBodyItem, §8.2.2.17.8 ActionTargetSuccession / TargetSuccession UsageBody; §8.2.2.9.3 SourceSuccessionMember; §8.3.13.6 SuccessionAsUsage. KerML 1.1 Beta 2: §8.3.4.5.3 Connector (relatedFeature from connectorEnd), §8.3.4.5.4 Succession. Rows added in docs/project/spec-compliance/02-detailed-semantic-compliance-map/13-action.md and 15-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 45m after hitting the 10m default under load); go test -count=1 ./tests/hygiene green.
  • TestSymbolStructureMatchesGraphStructure re-recorded with -update-structure-differential after adjudication (above).
  • go run -C tools ./cmd/pilot-apijson-diff -check moved three pilot files (AssignmentTest, 6-Individual and Snapshots, 10c-Fuel Economy Analysis): the StateDefinition.ownedConnection / ExhibitStateUsage.nestedConnection rows leave present-different for indeterminate, as the state no longer owns the then succession as a connection and the transition's synthesized elements are unkeyable; re-recorded with -update; go test -C tools ./referee/apijson green.
  • python3 scripts/spec_compliance.py check, python3 scripts/changelog.py check, python3 scripts/check-doc-ids.py clean.

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/<slug>.<section>.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/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

Devin Review

devin-ai-integration Bot and others added 2 commits November 11, 2026 06:49
…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>
@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 November 11, 2026 09:11
devin-ai-integration Bot and others added 2 commits November 11, 2026 09:21
…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>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

…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
…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

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