Skip to content

fix(semantics): a succession's related features are what its owned ends reference - #2311

Merged
HuiJun merged 22 commits into
developfrom
fix/succession-ends-owned
Nov 19, 2026
Merged

HuiJun merged 22 commits into
developfrom
fix/succession-ends-owned

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

What and why

A succession's relatedFeature, sourceFeature and targetFeature were derived from the members a then is written between, not from the ends the succession owns, so they were unanswered wherever a neighbour had no element standing for it (then assign …;, then terminate;), and an action body's two-ended first a then b; had no SuccessionAsUsage symbol at all.

This change:

  • reads relatedFeature / sourceFeature / targetFeature from the succession's owned end features for every then form of an action or state body, a two-ended first a then b; and a transition's own succession (semantics/annotations.go ConnectorRelatedFeaturesByEnd, EndReferencedFeature; semantics/succession_ends.go successionEndReference);
  • makes an action body's unguarded first a then b; the SuccessionAsUsage its owner owns, with two EndFeatureMemberships whose ends each own the ReferenceSubsetting of the feature written (symbols/builder.go buildBehaviorDecl; export element ids in export/element_ids.go recordSuccessionEnds);
  • makes a bare assign, terminate or perform statement the action usage its owner owns (AssignmentActionUsage, TerminateActionUsage, PerformActionUsage), the way a bare send already was, so the successions around it relate it.

It does not redo #2278 (owning the ends of positional then), now on develop, or #2259 (the exporter's related-element derivation for positional then).

Specification basis

  • KerML 1.1 §8.3.4.5.3 deriveConnectorRelatedFeature: relatedFeature = connectorEnd.ownedReferenceSubsetting->select(s | s <> null).subsettedFeature; sourceFeature/targetFeature are its first and remaining members.
  • SysML v2.1 §8.2.2.17.8 TargetSuccession (MultiplicitySourceEndMember 'then' ConnectorEndMember), §8.2.2.9.3 SourceSuccession, §8.2.2.18.3 TransitionSuccession (EmptySourceEndMember ConnectorEndMember), §8.2.2.17.1 ActionBodyItem (a SuccessionAsUsage member for first a then b;, AssignmentNode, TerminateNode, PerformActionUsage); pinned SysML.xtext has the same productions.
  • SysML v2.1 §7.17.2: the source of a then shorthand is the nearest preceding occurrence lexically.

Where the spec and the pilot differ in emphasis, the spec decided: an EmptySourceEndMember owns no ReferenceSubsetting, so the strict OCL would leave a positional succession with one related feature. §7.17.2 states which occurrence that source end stands for, so the end's reference is answered from it as an implied one, and the source end is not reported as owning a ReferenceSubsetting. The pilot's export-json agrees: target ends carry an ownedReferenceSubsetting, empty source ends do not, and relatedFeature still lists both.

Rows moved (source files under docs/project/spec-compliance/02-detailed-semantic-compliance-map/):

What the audit got wrong: it described both rows as one remaining gap. The owned-ends half was already covered by #2278; what remained was the derivation, the two-ended form and the statement nodes — and the control statements, which the audit did not mention, keep the action row from being ✅.

How it was verified

Tests added (fail on develop, pass here), internal/semantic/semantics/succession_ends_owned_test.go:

  • TestThenSuccessionRelatesStatementActions — then perform, then assign, then terminate;
  • TestTwoEndedFirstThenIsAnOwnedSuccession — first a then b;, named succession s first b then c;, start/done, a target multiplicity;
  • TestSuccessionRelatedFeaturesAreItsEndsReferences — state-body then, transition first … then …, a triggered transition;
  • TestSuccessionAtAControlStatementIsUnanswered — pins the control-statement limitation;
  • TestSuccessionWithAChainedEndIsUnanswered — first a then obj.child; and transition first off then on.deep; are unanswered, not the chain's last step; first a.k then obj; (a succession usage with written ends) answers its chain feature.

then_succession_member_test.go TestThenSuccessionRelatedFeatures now expects the two formerly unanswered rows to be answered.

No parser or runtime code changed, so no new parser golden, conformance fixture, trace or robustness case: the forms involved are already locked there (tests/parser/testdata/parse/, internal/exec/runtime/testdata/conformance/action_body_*), and those suites pass unchanged.

Gates on this head: gofmt -l . empty, go build ./..., go vet ./..., make lint, python3 scripts/spec_compliance.py check, python3 scripts/changelog.py check, tests/hygiene. With the training, pilot and spec-example corpora required: tests/export, tests/corpus (sweep and round trips), internal/translate/export, internal/doc/..., tests/codegen, internal/exec/smt passed before the final merge of develop; the full go test ./... and pilot-apijson-diff -check on the merged head are noted in a comment once finished.

Baselines moved by this change (beyond those #2278 moves)

Baseline Movement Why
tests/export/testdata/convert/end_binding_bodies.golden.ttl.sha256 30 Turtle lines added The attribute w in the body of first a1 then a2 { … } is now owned by a succession usage and gets the implied Multiplicity member its sibling in succession first a1 then a2 { … } already had.
internal/ir/view/testdata/state-forms-tree.*.golden one row added do action { assign flame := true; } lists the assignment action usage the do action owns.
internal/ir/view/testdata/state-forms-most.*, state-forms-running-most.* "5 node(s) … left undrawn" → 6 The same assignment usage, counted.
internal/translate/export/testdata/structure_differential_expected.txt matched +609 / unmatched −609 over the five roots Statement actions and two-ended successions now have a symbol the graph element matches. Connector::relatedFeature/sourceFeature/targetFeature: equal +56, symbol-missing −3; Type::feature different −135, Usage::nestedAction different −74, Behavior::step different −6. New disagreements come only with the newly matched elements and follow class-wide gaps already in the file: Membership::memberElementId symbol-missing +255 and Feature::isConstant symbol-extra +258 (anonymous features), Element::ownedElement different +24 and ownedRelationship +30 (bodies of the newly matched statement actions, not traced one by one).

The chained-end fix moved structure_differential_expected.txt once more: in examples and examples/pilot-corpora, two successions each with a chained target move from different (the symbol named the last step, the graph the chain feature) to symbol-missing on Connector::relatedFeature, and with them every property counted for those two elements (equal/different −2, symbol-missing +2 per property).

tests/corpus/testdata/training_examples_expected.txt is untouched.

Dry merges

Merge of develop after #2278 landed

Merges of develop (508d0fab4a, then after #2359 and #2263 landed, last d332e73fbf). The generated families were resolved by taking develop's side and re-running each recorder; only the two compliance rows were merged by hand, and pilot-differential-baseline.json and tests/corpus/testdata/training_examples_expected.txt are identical to develop. Against develop this PR moves:

  • derived_census_baseline.json: elements / implied of six roots; derived_census_records.tsv: 776 rule-root lines over 136 rules, all in the ours.* columns, no pilot.* figure;
  • structure_differential_expected.txt (the successions and statement action usages that are now elements, and the chained ends reported symbol-missing);
  • tests/export/testdata/convert/end_binding_bodies.golden.ttl.sha256;
  • the api-json family, the corpus ratchets and the parser goldens do not move.

Two tests that develop gained failed on the merged tree and are fixed here:

  • TestTransitionReflectsItsEffectMetaclassAndEnds: TransitionUsage::source and ::target are the featureTarget of the succession's ends (SysML v2.1 deriveTransitionUsageSource, deriveTransitionUsageTarget; KerML 1.1 deriveFeatureFeatureTarget), the last step of a chained end, while the chained succession's relatedFeature stays unanswered (semantics/annotations.go successionEndFeatureTargets, semantics/reflective_transitions.go transitionSuccessionEnd).
  • TestDrawioRoundTrip (route on action-swimlanes): a two-ended first a then b; is now an element a draw.io reroute can target, and the @Route it writes into the succession's UsageBody annotates the succession (ast/metadata.go DeclaredMetadata; TestTwoEndedFirstThenBodyMetadataAnnotatesTheSuccession).

Checklist

  • make lint passes locally; the Go suites of the touched layers pass on the merged head
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface
  • Changelog entry added as changes/unreleased/succession-related-features-from-ends.fixed.md
  • baselines regenerated where a gate moved, each adjudicated above
  • No internal work-item labels in the body, docs, or changelog

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/01bb4e8690d64dbdace1ab877ee9eaba
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/01bb4e8690d64dbdace1ab877ee9eaba?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 10 commits November 15, 2026 16:13
…ition owns its two end features — a bare `entry;` or an unnamed action before it, with or without a multiplicity — on the native walk and in the RDF conversion, as the notation grammar's TargetSuccession declares them and the pilot exports them

A positional `then x;` whose source carried no multiplicity owned no ends on
either leg, so Type::endFeature, Connector::relatedFeature and
SuccessionAsUsage::ownedRelationship answered one way for `first a then b;`
and another for `then b;`. SuccessionMintsEnds and the writer now mint the
two EndFeatureMemberships for every `then` succession however its source is
reached. The state-machine compliance row for a state body's succession ends
moves to Faithful; four Turtle goldens, the structure differential, the
derived census and the api-json differential are re-recorded and adjudicated
(no pilot column moves; the rows that grow are pre-existing families on the
new carriers).

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…urce end comes from

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
… the owned ends; relatedFeature derivation stays on its own approximate row

Co-Authored-By: Nicolas Rouquette <nicolas.f.rouquette@jpl.nasa.gov>
…action usage its owner owns

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ccession-ends-owned

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…tional succession owns no ends

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

An action body's two-ended `first a then b;` is the SuccessionAsUsage the action owns, with two
EndFeatureMemberships; relatedFeature, sourceFeature and targetFeature are read from a succession's
ends (KerML 1.1 8.3.4.5.3) for every `then` form and for a transition's own succession.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…nds-native' into fix/succession-ends-owned

Co-Authored-By: jason.han <hanhuijun@gmail.com>

# Conflicts:
#	docs/project/spec-compliance/02-detailed-semantic-compliance-map/13-action.md
@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 Bot and others added 3 commits November 15, 2026 21:06
…atures unanswered

An end written as a feature chain references the chain Feature it owns, not the chain's last step.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…s-owned

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…sion ends

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

Brings in #2259 (positional then source in the RDF conversion); the four Turtle golden digests both sides moved are re-recorded by tool (go test ./tests/export -update); census, structure and api-json differentials reproduce.

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/positional-then-succession-ends-native November 15, 2026 21:58
Base automatically changed from fix/positional-then-succession-ends-native to fix/declared-end-feature-membership-native November 17, 2026 00:19
Base automatically changed from fix/declared-end-feature-membership-native to develop November 17, 2026 02:27
devin-ai-integration Bot and others added 7 commits November 17, 2026 18:51
…s-owned

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…t of its succession's ends

A chained end leaves the succession's relatedFeature unanswered, but TransitionUsage::source and
::target read the featureTarget of the end (SysML v2.1 deriveTransitionUsageSource/Target), the
last step of the chain.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…e succession

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…s-owned

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…an action, not the succession

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…s-owned

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun added this pull request to the merge queue Nov 18, 2026
devin-ai-integration Bot added a commit that referenced this pull request Nov 19, 2026
…family-complete

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Merged via the queue into develop with commit 19a9be9 Nov 19, 2026
32 checks passed
@HuiJun
HuiJun deleted the fix/succession-ends-owned branch November 19, 2026 06:26
devin-ai-integration Bot added a commit that referenced this pull request Nov 19, 2026
devin-ai-integration Bot added a commit that referenced this pull request Nov 19, 2026
…elop's owned succession ends

Clean develop reproduces its own baseline; the ten cells move only on the
combined tree, where #2311's owned succession ends are also listed among the
synthesized members this branch adds.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration Bot added a commit that referenced this pull request Nov 19, 2026
…s owned succession ends

Clean develop reproduces its own census; the pilot-validation rows (and one
pilot-examples, one training row) move only on the combined tree, where the
succession ends #2311 owns are also members this branch synthesizes.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
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