Repository navigation
SWF(bug): fix OwningMembership for a trigger's named payload - #2425
Merged
Merged
Conversation
The payload a trigger names (`accept x : Sig`) was two symbols: the one the transition's scope declares and a ReferenceUsage synthesized for the accept. OwningMembership(x) answered the synthesized one's membership, whose member is not x, and x read as an ItemUsage the transition owned. The accept's payload parameter is now the declared symbol: a ReferenceUsage the accept owns through its ParameterMembership. Co-Authored-By: jason.han <hanhuijun@gmail.com>
The payload reads as a ReferenceUsage, which takes no implicit [1..1] by metaclass, so the conversion stopped writing the Multiplicity it owns. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…pt-payload-owning-membership
…ger payload Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
The payload is declared as an item usage, so it took Items::Item as a type beside the one it declares (`accept x : ScalarValues::Integer`). Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ayload Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
There was a problem hiding this comment.
Devin Review found 3 findings. Devin automatically fixed all 3 findings.
Fixed by Devin (3)
- Spurious item type on data payloads — Reproduced: accept x : ScalarValues::Integer read Items::Item as a second type. withUsageBases now skips a named trigger payload; TestNamedTriggerPayloadTakesNoUsageBase covers it.
- Three-line identity helper comment — Comment cut to two lines.
- Three-line payload predicate comment — Comment cut to two lines.
devin-ai-integration Bot
added a commit
that referenced
this pull request
Nov 20, 2026
One pilot-corpora cell moves on the combined tree (OwningMembership:: ownedMemberElementId, one more differing pair) where #2425's trigger payload ownership meets this branch's synthesized memberships. Co-Authored-By: jason.han <hanhuijun@gmail.com>
6 tasks done
6 tasks done
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
OwningMembership(x)for the payload a transition's trigger names (accept x : Sig) now returns a membership that ownsx, not a second, synthesized payload.Reported by Devin Review on
internal/semantic/semantics/reflective_memberships.go(landed with #2411). The model held two symbols for one element:xitemUsage, namedxreferenceUsage, unnamedExprExpressionPayloadOwningMembership(x)special-casedxby recursing intoOwningMembership(parts.payload), so it answered the synthesized payload'sParameterMembership: non-nil, the rightelementId, but its member was notx. The existing test only asserted non-nil.That special case was a symptom patch over the duplication, so the fix removes the duplication instead:
transitionPartsOfuses the symbol the transition's scope declares as the accept's payload; it synthesizes one only for an unnamed payload (accept Sig).ReferenceUsageowned by the accept through aParameterMembership, and no longer a member the transition owns.OwningMembershiploses its special case;isTriggerPayloadcompares symbols, not declarations.[1..1]Multiplicity, which it used to get from reading as anItemUsage.Items::Itemas a second type beside the one it declares (accept x : ScalarValues::Integer).TestNamedTriggerPayloadTakesNoUsageBasecovers it.ResolveElementstill resolves the@idthe tree writes for the payload (<transition>__@trigger__x) to the declared symbol, which is filed under the accept while its name sits in the transition.Specification basis
SysML.xtext
TriggerAction/PayloadParameterMember/PayloadParameter: the payload parameter is oneReferenceUsageowned by the trigger'sAcceptActionUsagethrough aParameterMembership, named or not. No compliance row moves.How it was verified
Failing test first.
TestTransitionTriggerPayloadTypingReadsOncenow asserts the membership's member isx, thatxis the accept'spayloadParameter, that the transition does not own it, and that it is aReferenceUsage.On the base, with only the test change:
On this branch:
Try it:
go test -count=1 ./internal/doc/queryexec -run TestTransitionTriggerPayloadTypingReadsOnce -vNo regression in what the conversion writes:
TestGoldenConversionspasses unchanged, so the Turtle for every fixture, the payload's Multiplicity included, is byte-identical.TestElementIdentityIsTheTreesIDAndRoundTripscovers the@idround trip.Gate on this head, with the training, pilot and specification-example corpora present and required:
gofmt -l .empty,go build ./...andgo vet ./...clean,go test -timeout 45m ./...140 packages ok and 0 failed,go test -C tools ./...35 packages ok and 0 failed,make lintpassed, andderived-census -check -recorded-pilotanddoc-counts -checkreproduce.Not run locally: the
-racesuite (make test), and the Java-backed checks (Xpect oracle, cross-MDK suite, derived-property differential). CI ran those three on the first head of this PR and they passed; the commits since only narrow the payload's types back to what the base wrote.Baselines moved: structure differential and derived census
derived_census_records.tsv, re-recorded withgo run -C tools ./cmd/derived-census -update -recorded-pilot(our columns only; the pilot's stay as recorded). 20 records move, all the same way: five rules (Element::name,Membership::memberElementId,Membership::memberName,OwningMembership::ownedMemberElementId,OwningMembership::ownedMemberName) on four roots each gain values with carriers unchanged, for exampleElement::nameon pilot-examples 5355 → 5368 with a value. None loses one.structure_differential_expected.txt, re-recorded with-update-structure-differentialon this tree. 15 cells move, matched/unmatched is unchanged on every root. 14 improve, because the symbol side now answers the payload's name and memberships as the graph does (for example pilot-corporaElement::namedifferent 18 → 5).One cell worsens: pilot-corpora
OwningMembership::ownedMemberElementId, different 31 → 32 (equal 7236 → 7248, symbol-missing 14171 → 14158). 13 memberships that had no symbol-side answer now have one; 12 agree and 1 differs.The one that differs is in
sysml-examples/Simple Tests/StateTest.sysml, where two unnamed transitions each declareaccept s : Sig.SymbolStructure.ElementIdentitygives members of two unnamed sibling transitions the same id, so the first payload's membership reads the second payload's id. This collision predates this change: the same file already reports it on the base for the twodo action Dmembers (StateTest__S___404__D_om: graph #StateTest__S___404__D, symbol #StateTest__S___407__D). The payload joins it only because it is now a declared symbol. The query leg (ElementIDOf) gives the two payloads distinct, correct ids. Fixing the collision is a separate change and is not in this PR.Base
This branch contains #2002's head
9d19bbe589(which contains #2414), merged once, because the baseline is re-recorded on top of theirs. The diff of this PR alone isgit diff 9d19bbe589...HEAD.Checklist
make lint,go test ./...andgo test -C tools ./...pass locally;make test(-race) was not run locallychanges/unreleased/accept-named-payload-one-element.fixed.mddoc-counts -checkis currentImplemented in session Fix OwningMembership for an accept payload
Review with Devin · Open in Devin Desktop