Skip to content

fix(semantics): type a transition's effect as declared and derive its source and target - #2274

Merged
NicolasRouquette merged 5 commits into
fix/declared-end-feature-membership-nativefrom
feature/transition-effect-perform-action
Nov 16, 2026
Merged

NicolasRouquette merged 5 commits into
fix/declared-end-feature-membership-nativefrom
feature/transition-effect-perform-action

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

What and why

Two gaps in the reflection of a TransitionUsage, both on the compliance row "A transition's trigger, guard and effect are its owned features through TransitionFeatureMemberships" (docs/project/spec-compliance/02-detailed-semantic-compliance-map/17-expression-evaluation.md):

  • Effect metaclass. symbols/builder.go defineTransitionEffect built every effect that is not a send as a plain ActionUsage. The new effectActionKind gives the effect the kind its declaration writes: do action e / do action e : A { … } → PerformActionUsage, do assign … → AssignmentActionUsage, do send … → SendActionUsage (unchanged), do perform … → PerformActionUsage. A braced do { … } writes no PerformActionUsageDeclaration and stays a plain ActionUsage. The kind is read by the symbol table, the query @type and the reflective metaclass, so effectAction istype SysML::PerformActionUsage now holds.
  • source / target. semantics/reflective_transitions.go transitionElements answered reflective feature is not derived for both. transitionSource and transitionTarget now derive them: the member of the source Membership (or, for a chained first a.b, the chain's last feature) and the target feature of the transition's succession, each kept only when it is an ActionUsage. Where the succession does not carry the target end, transitionTargetEndpoint takes the vertex the written target names by endpoint resolution, as the source side already does; that reaches a target nested in a sibling state (transition t first a then inner; with inner declared inside state b), which reflected as empty before the review fix.

The row stays ⚠️ Approximate; it is not flipped to ✅. Verifying the row against the grammar turned up three further divergences inside the same claim, each larger than this change and each now named in the row's limitation text:

  1. A guarded succession — succession s first a if g then b; and an action body's if g then a; / else b; — is a TransitionUsage (SysML.xtext GuardedSuccession, GuardedTargetSuccession), yet reflects no owned membership, guardExpression, succession, source or target.
  2. A chained source transition first a.b then c reflects no OwningMembership for the chain feature the transition owns (SysML.xtext TransitionSourceMember).
  3. The parser rejects two effect forms EffectBehaviorUsage allows: the reference form do a and do accept S (expected an action after 'do').

Specification basis

  • SysML v2.1 §8.2.2.18.3 (transition textual notation): EffectBehaviorUsage : ActionUsage = EmptyActionUsage | TransitionPerformActionUsage | TransitionAcceptActionUsage | TransitionSendActionUsage | TransitionAssignmentActionUsage, with TransitionPerformActionUsage : PerformActionUsage = PerformActionUsageDeclaration ( '{' ActionBodyItem* '}' )?. Pinned grammar (2026-09.1): SysML.xtext EffectBehaviorUsage → PerformedActionUsage = {SysML::PerformActionUsage}.
  • SysML v2.1 §8.3.18.9 TransitionUsage: deriveTransitionUsageSource (the featureTarget of the source feature, as an ActionUsage), deriveTransitionUsageTarget (the featureTarget of the succession's target feature, as an ActionUsage), succession = the first owned member that is a Succession.
  • §8.3.18.8 TransitionFeatureMembership (unchanged behaviour, the row's subject).

The pilot was used only to confirm: the pinned JSON exporter writes PerformActionUsage / SendActionUsage / AssignmentActionUsage for the three declared effect forms and the state usages as source / target for the same probe model.

How it was verified

New tests, failing on develop (effect is ActionUsage; source/target not derived) and passing here:

  • internal/semantic/semantics/reflective_transition_ends_test.go TestTransitionReflectsItsEffectMetaclassAndEnds — eight transitions: declared action effect, typed effect with a body, send, assign, braced body, no effect, chained source, target nested in a sibling state.
  • internal/semantic/symbols/action_node_kind_test.go TestBuildClassifiesTransitionEffectsByTheirDeclaration.
  • Conformance meta_transition_feature_kinds: effectIsPerformed, sourceIsIdle, targetIsBusy, targetIsNotIdle.

Baselines that moved, each read before re-recording (both in the first commit; the review fix moved none):

  • tests/export/testdata/convert/state_machine.golden.ttl.sha256 — two lines added on one element: the effect active_to_off::stop (do action stop : Warm), already written as sysml:PerformActionUsage with isComposite false, now also carries sysml:isVariable true and sysml:mayTimeVary true. That is Usage::mayTimeVary for a referential action owned by an occurrence; the pilot exports isVariable: true, mayTimeVary: true for the same construct.
  • internal/translate/export/testdata/structure_differential_expected.txt — in the three corpus roots whose lines moved (examples, examples/pilot-corpora, examples/spec-examples; tests/testdata and examples/sysml-v2-training are unchanged), the symbol-backed structure now agrees with the graph-backed one on more elements: every moved line (Feature::isComposite, Usage::isReference, Usage::usage, Namespace::member/membership, Type::feature/featureMembership/inheritedFeature/inheritedMembership/endFeature) moves counts from different or symbol-missing to equal (for example Feature::isComposite: equal 12538 → 12545, different 26 → 19 under examples). No bucket moved the other way.
  • No movement: the api-json differential (go run -C tools ./cmd/pilot-apijson-diff -check reproduces the baseline), the corpus sweep and round-trip, the training/pilot/spec-example gates.

Gates run on the first commit: gofmt -l . (empty), go vet ./..., go build ./..., make lint, python3 scripts/spec_compliance.py check, python3 scripts/changelog.py check, python3 scripts/check-doc-ids.py, make docs-counts, go test -count=1 over ./internal/semantic/..., ./internal/check/..., ./internal/ir/..., ./internal/exec/runtime, ./tests/hygiene, ./tests/export, and, with OPENSYSML_REQUIRE_TRAINING_CORPUS, OPENSYSML_REQUIRE_PILOT_CORPORA and OPENSYSML_REQUIRE_SPEC_EXAMPLES set, ./tests/corpus and ./internal/translate/export.

Re-run on the review fix (which touches only reflective_transitions.go and its test): gofmt -l . (empty), go vet ./..., go build ./..., go test -count=1 over ./internal/semantic/..., ./internal/exec/runtime and ./tests/hygiene.

The current head merges develop. One file conflicted, state_machine.golden.ttl.sha256, because develop moved the same digest: its output is 6033 lines, and this branch's output over it is 6035, the difference being exactly the two isVariable / mayTimeVary lines described above (the two full outputs were diffed before re-recording). structure_differential_expected.txt merged without conflict and reproduces. Re-run on this head: gofmt -l . (empty), go vet ./..., go build ./..., python3 scripts/spec_compliance.py check, python3 scripts/changelog.py check, go test -count=1 over ./internal/semantic/..., ./internal/exec/runtime, ./tests/export, ./tests/hygiene and, with the three require variables set, ./internal/translate/export. The corpus sweep and the api-json differential were not re-run locally on this head; CI ran them green on it.

Not green locally and not caused by this change: internal/workspace/libs TestEmbeddedSnapshotIsCurrent and examples TestSelfModelLibraryMatchesImplementation report a stale stdlib.snapshot; the former fails identically with this branch's two implementation files reverted, the latter reports the same stale-snapshot error. The full go test ./... was not completed locally (cmd/sysml and tests/codegen ran past the 10-minute package timeout on this machine).

Stacking and merge provenance

This PR is stacked on #2268 (fix/declared-end-feature-membership-native), itself on #2266, by git merge --no-ff of each predecessor's exact head (no rebase, no cherry-pick): 3134ebccc8 merges #2268's head 82ec554ce4; 222f44ac00 merges the branch's own earlier develop merge a311f40868, whose content the stack already carried, so that merge moves no file. The baselines the stack merge moved were re-recorded by the repository tools only (go test ./tests/export -update, -update-structure-differential, derived-census -update -require-exporter); the full gate (go build, go vet, gofmt -l, go test -count=1 ./..., the tools suite, make lint, derived-census -check -require-exporter, pilot-apijson-diff -check, pilot-diff -check, changelog-check) is green on 222f44ac00.

Attribution of every line the stack merge moved, read against a dump of each side (OPENSYSML_STRUCTURE_DIFFERENTIAL_DUMP):

Checklist

  • make test and make lint pass locally — make lint passes; make test not completed locally, see above
  • 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/18ad47adf36f44e9b6824a4472f9678d
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/18ad47adf36f44e9b6824a4472f9678d?variant=devin
Requested by: @NicolasRouquette


🟢 Devin Review found nothing to fix · View findings · Follow Devin's work

Devin Review

… source and target

A transition effect written with a PerformActionUsageDeclaration is a
PerformActionUsage and a `do assign` an AssignmentActionUsage (SysML v2.1
§8.2.2.18.3 EffectBehaviorUsage), where both were a plain ActionUsage.
TransitionUsage::source and target are derived per §8.3.18.9.

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
@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

The target read only the succession's related feature, which does not reach a
vertex the endpoint resolution accepts; fall back to that resolution, as the
source already does.

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>

@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

Re-records state_machine.golden.ttl.sha256: develop's output plus this branch's two lines (isVariable, mayTimeVary on the perform effect).

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
@devin-ai-integration
devin-ai-integration Bot changed the base branch from develop to fix/declared-end-feature-membership-native November 16, 2026 05:49
devin-ai-integration Bot and others added 2 commits November 16, 2026 05:50
…e/transition-effect-perform-action

Stacks this change on #2268 (82ec554), itself on #2266 and develop at #2261. The state-machine Turtle golden digest, the structure differential and the derived census are re-recorded by tool under the merged code. Beyond what each side moves alone, the two interact on a transition's effect PerformActionUsages: six effects now agree with the graph on Feature::isComposite and Usage::isReference, two Type::endFeature 'symbol unsupported' rows resolve and one appears, and the census's Namespace, Type and Usage rows move by two to seven values on the same carriers with the pilot column unchanged. The api-json and pilot differentials reproduce unchanged.

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…m-action' into feature/transition-effect-perform-action

Brings the branch's own develop merge together with its stack merge onto #2268; the state-machine Turtle golden digest and the baselines are re-recorded by tool under the merged code.

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
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