Skip to content

fix(view): draw only the redefining succession on a lifeline that redefines an inherited one - #2669

Open
HuiJun wants to merge 2 commits into
developfrom
fix/sequence-redefined-inherited-succession
Open

HuiJun wants to merge 2 commits into
developfrom
fix/sequence-redefined-inherited-succession

Conversation

@HuiJun

@HuiJun HuiJun commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

A sequence rendering drew two succession arrows on a lifeline that redefines a named succession it inherits: the inherited one and the one redefining it. It now draws only the redefining succession there. Lifelines that merely inherit the succession still draw it.

inheritedOrders (internal/ir/view/sequence.go) reads an order a type states onto every shown lifeline specializing that type. It checked that the lifeline holds the two events, but not that the succession stating the order is still a member of the lifeline. The redefining succession is collected as an order of its own, so both were drawn. The reading is now skipped when memberFor(lifeline, succession) is another feature, the same masking MembersOf applies and that the events already go through. This covers ordinary specialization, a lifeline typed by a definition that redefines, a lifeline further down the chain, an unnamed redefinition, and a succession over events held by reference subsetting. A member-attached then, which has no succession usage to redefine, is unchanged.

Model (spec.sysml, validates cleanly):

package P {
    item def Ping;
    part server { event occurrence a; event occurrence b; }
    part source {
        event occurrence sent;
        event occurrence got;
        succession s first sent then got;
    }
    part client :> source {
        succession s2 :>> s first sent then got;
    }
    message ask of Ping from client.sent to server.a;
    message reply of Ping from server.b to client.got;
}

sysml -render '#sequence' -render-form mermaid spec.sysml, arrows only (n5 is client, n3/n4 are sent/got of source):

Before (develop) After
n5-)n1: ask of Ping
n5--)n5: s
n5--)n5: s2
n2-)n5: reply of Ping
n3--)n4: s
n5-)n1: ask of Ping
n5--)n5: s2
n2-)n5: reply of Ping
n3--)n4: s

Reference subsetting (ref part observer ::> source { succession s first sent then got; }, part client :> observer, source { succession s2 :>> s first sent then got; }; n6 is client):

Before (develop) After
n6-)n1: ask of Ping
n6--)n6: s
n6--)n6: s2
n2-)n6: reply of Ping
n3--)n4: s
n6-)n1: ask of Ping
n6--)n6: s2
n2-)n6: reply of Ping
n3--)n4: s

Specification basis

A succession usage is a feature, and a feature redefined by a feature of a type is not among that type's inherited memberships (KerML Type::inheritedMemberships, which removes redefined features), so the redefined succession does not hold on the redefining lifeline. No row in docs/project/spec-compliance/ moves.

How it was verified

  • Two new tests in internal/ir/view/sequence_inherited_test.go, written first and failing on develop with the extra original arrows:
    • TestSequenceRenderingDropsAnInheritedSuccessionTheLifelineRedefines: the redefining lifeline, a lifeline specializing it, a sibling that only inherits (keeps original), and the declaring usage itself.
    • TestSequenceRenderingDropsARedefinedSuccessionOverReferenceSubsetEvents.
  • The CLI renders above, plus by hand: a definition redefining the succession with a usage typed by it, and an unnamed succession :>> s ...; each draws one arrow on the redefining lifeline and s on a plain inheritor.
  • go build ./... and go vet ./... in the root and tools modules, gofmt -l, make lint, go test -race ./internal/ir/view, and go test over the packages that render views (./examples ./internal/doc/... ./internal/ir/... ./internal/check/passes/diagram ./internal/frontend/{repl,lsp,grpc,jupyter} ./cmd/sysml).
  • Not run locally: the full make test suite and the corpus sweeps.

Try it: make build-sysml && bin/sysml -render '#sequence' -render-form mermaid spec.sysml

Checklist

  • make test and make lint pass locally (make lint and the packages listed above; not the full suite)
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md) (none describes this case)
  • 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) (none moved)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

Software Factory opened this PR for Jason
Implemented in session Drop redefined inherited successions from sequence views
Review with Devin · Open in Devin Desktop


devin-ai-integration Bot and others added 2 commits November 26, 2026 02:47
…efines an inherited one

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

Copy link
Copy Markdown
Contributor

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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 findings. Devin automatically fixed all 2 findings.

Fixed by Devin (2)
  • Missing succession on selectively exposed lifelines — Confirmed: a leaf inheriting a redefining succession from a usage the view does not show lost the order. It now reads the redefining succession's own order. Fix is committed locally (3f36674403) with a test; the push is held for the merge lane and lands with the next push.
  • Missing succession with inherited ends — Confirmed with succession s2 :>> s;: no arrow was drawn. The redefining succession is now read over the nearest ends it inherits, under its own name. Fix is committed locally (3f36674403) with a test; the push is held for the merge lane and lands with the next push.

View findings in Devin Review · Follow Devin's work

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

QA: PASS

Tested head aa3becf629 against base develop at the merge base bad216b4fd, with bin/sysml built from each.

Recorded run: base vs head

The fix

Flow Base Head
part client :> source { succession s2 :>> s first sent then got; } client draws s and s2 client draws s2 only
Declared SequenceView (-render P::exchange) and -render-all extra client.sent -> client.got: s gone; other :> source and source still draw s
Text, Mermaid, PlantUML, D2 the diff in each form is that one arrow
Lifeline typed by a definition that redefines, lifeline further down the chain, redefinition chain (s3 :>> s2 :>> s), diamond, unnamed redefinition, redefines keyword, redefinition over reference-subset events inherited arrow drawn beside the redefining one redefining one only
Redefinition with reversed ends (s2 :>> s first got then sent) false "successions form a cycle (s, s2)" notice, declaration order no notice, messages ordered by s2
The two new tests in sequence_inherited_test.go fail pass

Unchanged, base and head byte-identical

  • Inherit-only lifelines, :> without redefinition, a succession that subsets rather than redefines, member then, redefined events with an inherited succession, a private succession.
  • Two inherited successions named s with one redefined: the other is still drawn.
  • Sweep of 1,779 .sysml files under internal, tests, examples and docs that hold events, messages, successions or sequence views, each rendered as a sequence in the four forms plus -render-all: 8,895 results, no difference. One base result differed once under load and was identical on 12 reruns of each side.

Past fixes in the touched area (head)

With #2661

#2661 (private event inheritance) is still open, so it is not in this base. Merged locally onto this head it conflicts in internal/ir/view/sequence.go (inheritedOrders, the same lines) and in sequence_inherited_test.go. With both sides kept (this PR's guard, then #2661's orderedOn calls) the sequence tests of both PRs pass and the fixtures above render as on this head, except that an inherited private succession is no longer drawn, which is #2661's behaviour. Whichever merges second needs that resolution.

Hosted CI

20 passed, 0 failed, 13 skipped (the client, editor, PDF and derived-property jobs).

Not run

-race, the full make test, and the gRPC/LSP clients beyond their Go render tests. The Tim Weilkiens rows on projects, checksums and typing are outside the touched area and were not rerun.

No failures, so no failure screenshots.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

QA: pass

Head aa3becf6291f10a0efb14731a370ca18faab4f5c against develop bad216b4fd11ad77e9e6172b70e5d52947e3cf93 (an ancestor of the head; develop has since moved to 6f13c63949, which was not tested). Detached worktrees at both; nothing pushed.

Gates on the head

Check Result
go build ./..., go vet ./..., gofmt -l . clean
go test -race ./internal/ir/view/... ./internal/doc/... ./internal/frontend/... pass, with one note below
go test -pgo=off ./... (all packages) and go test -C tools ./... pass
Corpus gates with training, pilot, spec-example, PSSM, pilot-library-XMI and OMG JSON schema downloaded and their OPENSYSML_REQUIRE_* set: TestTrainingExamplesSemanticErrors, TestPilotCorporaDiagnostics, TestSpecExamplesDiagnostics, TestPSSMSuiteMigration, TestPilotLibraryXMI pass, none skipped
TestExamplesSweepCommitted, TestExamplesSweepCorpora over the whole corpus (no subset) pass
make test-queue SHARDS="corpus-sweep-committed corpus-sweep-corpora export-corpus export-examples" pass

Note on the race run: in the combined command internal/frontend/grpc hit the default 10-minute package timeout (in TestValidateInstanceOfAValidObjectHolds, with the other packages competing for the CPUs). Run alone, go test -race -count=1 ./internal/frontend/grpc passes on the head in 514 s and on develop in 560 s, so the package sits at the edge of the default timeout on this machine on both sides; this PR does not touch it.

go test -count=1 ./tests/corpus -run TestCorpusRoundTrip matches no test on either side; the corpus round trip is asserted by the two TestExamplesSweep* tests above.

Failing-first

With only internal/ir/view/sequence_inherited_test.go from the head applied to develop, both new tests fail on the extra original arrow, and both pass on the head:

  • TestSequenceRenderingDropsAnInheritedSuccessionTheLifelineRedefines
  • TestSequenceRenderingDropsARedefinedSuccessionOverReferenceSubsetEvents

Sequence renders, develop against head

bin/sysml -render '#sequence' -render-form text|mermaid <model> on both builds, and the same model through the REPL. Text and Mermaid forms move together in every case.

Named succession redefined; one further specializer; one plain inheritor

package P {
    item def Ping;
    part server { event occurrence a; event occurrence b; event occurrence c; event occurrence d; }
    part source {
        event occurrence sent;
        event occurrence got;
        succession s first sent then got;
    }
    part client :> source { succession s2 :>> s first sent then got; }
    part heir :> client;
    part other :> source;
    message m1 of Ping from client.sent to server.a;
    message m2 of Ping from server.b to client.got;
    message m3 of Ping from heir.sent to server.a;
    message m4 of Ping from server.b to heir.got;
    message m5 of Ping from other.sent to server.c;
    message m6 of Ping from server.d to other.got;
}
 messages:
   client.sent -> a: m1 of Ping
-  client.sent -> client.got: s
   client.sent -> client.got: s2
   b -> client.got: m2 of Ping
   heir.sent -> a: m3 of Ping
-  heir.sent -> heir.got: s
   heir.sent -> heir.got: s2
   b -> heir.got: m4 of Ping
   other.sent -> c: m5 of Ping
   other.sent -> other.got: s
   d -> other.got: m6 of Ping
   sent -> got: s

Mermaid: the same two lines go (n7--)n7: s, n8--)n8: s); n9--)n9: s for the plain inheritor stays.

A definition stating the order onto several usages (part def Node with s; part def Special :> Node with s2 :>> s; n1, n2 : Node, n3 : Special, n4 :> n3): the head drops n3.sent -> n3.got: s, n4.sent -> n4.got: s and Special.sent -> Special.got: s; n1, n2 and Node keep s; each of n3, n4, Special keeps exactly s2.

Anonymous redefinition (part client :> source { succession :>> s first sent then got; }): the head drops client.sent -> client.got: s and keeps the unnamed client.sent -> client.got; other :> source keeps s.

Events themselves redefined

part mid :> source {
    event occurrence sent2 :>> sent;
    event occurrence got2 :>> got;
    succession s2 :>> s first sent2 then got2;
}
part client :> mid;
part midB :> source { event occurrence sent3 :>> sent; event occurrence got3 :>> got; }
part inheritor :> midB;
part half :> midB { succession s4 :>> s first sent3 then got3; }
   client.sent2 -> a: m1 of Ping
-  client.sent2 -> client.got2: s
   client.sent2 -> client.got2: s2
   b -> client.got2: m2 of Ping
   inheritor.sent3 -> a: m3 of Ping
   inheritor.sent3 -> inheritor.got3: s
   b -> inheritor.got3: m4 of Ping
   half.sent3 -> a: m5 of Ping
-  half.sent3 -> half.got3: s
   half.sent3 -> half.got3: s4

Redefinition chain and a reversing redefinition (mid has s2 :>> s, leaf :> mid has s3 :>> s2, rev :> source has r :>> s first got then sent, and source also has t first got then done): the head draws only s2 on mid, only s3 on leaf (develop drew s, s2 and s3 there), and only r on rev. Develop also drew rev.sent -> rev.got: s against rev.got -> rev.sent: r and reported successions form a cycle (s, t, r); with the inherited reading gone the head reports no cycle. The un-redefined t is still drawn on all three lifelines.

Unchanged, as expected: a model with no redefinition, a member-attached then succession, an explicit sequence view over the redefining model's direct-usage form.

Existing models: every .sysml/.kerml under examples/, docs/, tests/testdata/ and internal/ir/view/testdata/ rendered one file at a time (1,043 files) and one directory at a time (298 directories, the #sequence pseudo-view plus every declared sequence view, e.g. OpenSysMLViews::actionExecution), in text and Mermaid: stdout and exit status are identical between develop and head for all of them. stderr is identical too, except that internal/ir/view/testdata/regions-usages.sysml printed its diagram-layout-unplaced warning on one build and not the other in the sweep; re-run three times on each build, both print the same stderr, so the difference does not come from this change.

Re-merge over #2661

A scratch merge of develop + #2661's head a8de29d727 + 84bb1a0365 conflicts in inheritedOrders and in sequence_inherited_test.go. Resolved by keeping both sets of tests and placing the skip ahead of #2661's lines:

if read[[2]int{i, at}] || !r.specializes(shown[lifeline], o.within) {
	continue
}
// A succession the lifeline redefines is read there as the one redefining it.
if o.succession != nil && r.memberFor(shown[lifeline], o.succession) != o.succession {
	continue
}
from, fromDrawn := r.orderedOn(lifeline, shown[lifeline], o.from)
to, toDrawn := r.orderedOn(lifeline, shown[lifeline], o.to)
undrawn := !fromDrawn || !toDrawn

With that resolution go build, go vet ./internal/ir/view and go test -count=1 ./internal/ir/view/... ./internal/doc/... pass, including #2661's private-event tests and both new tests here. Every model above renders byte-identically to this head. A model that combines the two (a private event in the type whose succession is redefined) differs from this head only by #2661's own change, and differs from #2661's head only by the removed inherited arrows on the redefining lifelines.

Not covered

  • The full suite ran without -race (the race detector ran on the three package trees above); make test as a whole was not run.
  • The queue-tier sweep shards run over the construct-cover subset by design; the full-corpus sweep was run separately without -race.
  • The Reference-FMU gate and the PDF toolchain tests were not provisioned and skip.
  • Renders were compared as text and Mermaid source; no SVG/PNG output was inspected.

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