Skip to content

feat: edge captions written once per trunk - #104

Merged
endrix merged 1 commit into
mainfrom
feat/captions-once
Oct 24, 2026
Merged

endrix merged 1 commit into
mainfrom
feat/captions-once

Conversation

@endrix

@endrix endrix commented Oct 23, 2026

Copy link
Copy Markdown
Owner

What

Edges that leave one port together run along one line until they split, and so do edges that reach one port. Each edge wrote its carried label at its own midpoint, and the midpoints of such a bundle all fall on the shared line. On an NDF ASL unit with 23 dependencies, that stacked 23 copies of depends-on on one trunk.

clientBehavior.edgeCaptions: 'once' writes the label once per bundle. An edge leaves its caption out when an earlier edge (in model order) that leaves the same port, or reaches the same port, already writes the same text. Edges with other captions keep theirs, and so does an edge alone on its ports. The decision is made once per model root and reused for every edge (edge-caption-sharing.ts).

An edge whose caption is not written, whether shared or because captions are off, now says what it carries in its hover tooltip, as the flag's documentation already promised. The label-or-width rule moves to carriedTextOf, which the edge view and the sharing decision both use. true (the default) and false behave as before; 'once' is opt-in.

Tests

  • diagram-client/test/edge-caption-sharing.test.ts covers:
    • bundles leaving a port and bundles reaching one;
    • different captions and lone edges keeping theirs;
    • only captions actually written counting;
    • the label-or-width rule;
    • one decision per model root, made afresh for a new root;
    • the edge view's wiring.
  • Typecheck (5/5), neutrality (5/5) and all workspace tests (1236) pass.

Checked visually with scripts/render-svg, through ndf-ide, on pto-spec's expansion.asl (18 incoming and 5 outgoing depends-on edges, now one caption on each trunk, with defined-in kept) and expdif.asl.

https://claude.ai/code/session_01E8WfqKknDNN6xpNVcJL5K8

Edges that leave one port together run along one line until they part,
and so do edges that reach one port. Each edge wrote its carried label at
its own midpoint, and the midpoints of a bundle fall on the shared line: a
node with twenty edges of one type stacked twenty copies of one word.

`clientBehavior.edgeCaptions: 'once'` writes the label on the first edge,
in model order, of each such bundle: an edge leaves its caption out when
an earlier edge that leaves the same port, or reaches the same port,
already writes the same text (edge-caption-sharing.ts). Edges of other
captions keep theirs, and so does an edge alone on its ports. The decision
is made once per model root and kept for its edges.

An edge whose caption is not written, shared or because captions are off,
now says what it carries in its hover tooltip, as the flag's documentation
already promised. The label-or-width rule moves to `carriedTextOf`, used
by the edge view and the sharing decision alike. `true` and `false` are
unchanged.

Claude-Session: https://claude.ai/code/session_01E8WfqKknDNN6xpNVcJL5K8
@endrix
endrix merged commit 6e02ab9 into main Oct 24, 2026
1 check passed
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