Skip to content

fix(workflows): handle path segments whose port is a container's collection port - #1023

Merged
sfmskywalker merged 2 commits into
mainfrom
claude/fix-breadcrumb-container-segments
Sep 12, 2026
Merged

sfmskywalker merged 2 commits into
mainfrom
claude/fix-breadcrumb-container-segments

Conversation

@sfmskywalker

Copy link
Copy Markdown
Member

Closes #1018.

The defect, reproduced

Selecting an activity by id through the path the instance viewer uses (SelectActivityByActivityIdAsyncGetPathSegmentsAsync) crashed the designer when the activity sat inside a container that is not a flowchart, such as a BpmnProcess. The server's path-segments endpoint names such a segment's port after the container's reflected child-list property, PortName = "Activities". That comes from PropertyBasedActivityResolver over Container.Activities. No port provider yields that port, so:

  • GetEmbeddedActivity resolved it through the embedded-port path and called AsObject() on the activities JSON array, throwing InvalidOperationException;
  • GetBreadcrumbItems did ports.First(...) on a port that does not exist.

What changed

Both changes are in DiagramDesignerWrapper.razor.cs:

  • A segment whose port names a collection property on the container (its own list of child activities) now resolves to the container itself, instead of going through an embedded-port lookup. The children stay reachable through that list. Descriptor-declared embedded ports (If.Then, a flowchart in a sequence) resolve as before.
  • Breadcrumb building no longer throws. When no descriptor port matches the segment's port, the crumb falls back to the activity's display name, as the issue asked.

Verification

cd src/modules/Elsa.Studio.Workflows.Designer/ClientLib && npm run build
dotnet build Elsa.Studio.sln --configuration Release
dotnet test src/modules/Elsa.Studio.Workflows.Tests --configuration Release --no-build --framework net10.0   # 337/337

BreadcrumbCollectionPortSegmentTests stubs the path segments in the exact shape elsa-core's endpoint returns and selects through the instance-viewer path. It fails before the fix with InvalidOperationException and passes after, confirmed independently by the spec reviewer.

Review: one iteration on the standards and spec axes. Recorded as won't-fix: the breadcrumb fallback is deliberately generic, as the issue asked; and a private helper's doc comment has no <summary> tag, which the XML-doc rule only requires on public members.

🤖 Generated with Claude Code

…ection port

The instance viewer's journal selects nested activities by node id through
DiagramDesignerWrapper.SelectActivityByActivityIdAsync, which fetches path
segments from elsa-core's path-segments endpoint. For an activity nested
inside a Flowchart or BpmnProcess container, that endpoint reports the hop
with PortName set to the container's own "Activities" collection property
rather than a named embedded port, which no port provider declares -- so
resolving it threw before the segment could become a container to display
or a breadcrumb to draw. Treat a collection-port segment as the container
itself, and never throw while building a breadcrumb for an unmatched port.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

Safe to merge.

Summary

  • This update fixes navigation into nested workflow activity collections. Collection-valued path segments now resolve to their owning container, breadcrumbs fall back to the container name when no descriptor port matches, and the regression test verifies selection of the nested child’s bound BPMN element.

Reviews (2) · Last reviewed commit: "test(workflows): assert the actual selec..."

…readcrumb collection-port test

The fixture used an empty BPMN scope, so the BPMN designer never mounted a
canvas and the final SelectActivityByActivityIdAsync call was a silent no-op
-- the test asserted only the displayed container and breadcrumb, and would
still pass with selection missing or wrong. Give the process a minimal
process payload binding the child activity to a BPMN element, and assert the
selectBpmnElement JS interop invocation targets that element.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sfmskywalker
sfmskywalker merged commit 5b4a0ab into main Sep 12, 2026
10 checks passed
@sfmskywalker
sfmskywalker deleted the claude/fix-breadcrumb-container-segments branch September 12, 2026 08:49
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.

DiagramDesignerWrapper may throw on backend-returned path segments inside containers

1 participant