Skip to content

fix(layout): make room only for what follows an inserted node, keep the rest of a hand-made drawing in place - #119

Merged
dominikhorn93 merged 1 commit into
mainfrom
dominikhorn93/cli-inbound-delivery-verschiebung
Oct 28, 2026
Merged

dominikhorn93 merged 1 commit into
mainfrom
dominikhorn93/cli-inbound-delivery-verschiebung

Conversation

@dominikhorn93

Copy link
Copy Markdown
Member

Summary

A splice into a hand-made drawing pushed every shape right of the insertion line, like the modeler's space tool. Rows that neither follow the new node nor stand in its way moved too: a task added after "Abweisung melden" on a rejection path moved the parallel join, "Einlagerung gemeldet" and "Ware eingelagert" on the main path above it by 150 px. Now only the end event of the rejection path moves.

The local push

  • PlacementObstacles.pushSet decides what moves. That is what follows the new node beyond the line: along the drawn flows and boundary paths, with boundary events, sub-process content, associated annotations and data, and the groups around them. It also takes, in turn, what a pushed shape or the new node would come close to, sweep over (a line it would jump over) or put on a line. SpaceTool takes this set as push. Beyond the line only listed shapes move, and only connections touching a changed shape bend.
  • SpaceTool.capGrowth: pools and lanes, with or without a pool, grow only as far as their content now reaches and keep their margin.

What the narrower push needs, because other rows no longer move along

  • A new flow that would enter a drawn node left of its source (no loop) moves that node and what follows it right of the source (NeighbourPlacer.pushBehind). This applies to connect and to every placement in a batch. A merge whose successor lies left of a predecessor is pulled when it led forward into it.
  • A batch measures the gap and row spacing the way the same ops do as single commands: flows that a later op re-ends count at their old ends (NodePlacer.drawnEnds). The old global push had hidden a 4 px batch/single difference here.

Fixes for what the narrower push exposed. Each was built and reviewed on its own and measured on the edit benchmark.

  • CrossingRepair no longer lays a hand-drawn line along other drawn lines to save a crossing.
  • A kept association that a new node or its label touches is routed again (EdgeRouter.touchesFresh; also after LabelRefresh). An association docks on the cheapest segment of its flow.
  • LabelPlacer takes a spot that is clear for the one-line text bpmn-js draws before it falls back to the wrapped box.
  • RowChooser: a trial route through a label costs 100 instead of 60 (LABEL_HIT).

Two further attempts at the row-opening cost were dropped: one broke batch parity, the other made other runs worse.

Edit benchmark (764 runs, against main at b998c7d): 70 runs better, 11 worse. Runs adding crossings 105 -> 87, median share of moved nodes 30 % -> 26 %, E1 (insert a task): runs adding crossings 11 -> 2. The soft budgets hold. Of the 11 worse runs:

  • 8 add nothing to the input. Main resolves problems already in the input by moving unrelated shapes and routing their lines again (artifacts__01 E1/E7, controlflow__s19 E8/E9, subproc__s19-lanes-loop-3 E1/E7, agent__anno1 E9, agent__o2c.e3 E9).
  • agent__claim.nodata / .plain E7: "Send rejection" now stays, and a boundary event's label touches it.
  • artifacts__16-annotations-events-loop E9: one crossing more than main (20 vs 15).

The docs (docs/layout.md), the CLI guide (AgentGuide.ts) and the plugin skill describe how room is made now.

Checklist

  • npm run typecheck passes
  • npm run gate passes (2,389 tests, layout regression 370 of 370, fuzz 0 errors / 0 warnings, iso within the budget of main)
  • src/report/guide.ts and the matching page in docs/ are updated (only if a command, option or output changed)
  • PR title is a changelog-worthy Conventional-Commit summary

Not run: the live-engine tests (no Camunda engine running).

Linked issue

None.

🤖 Generated with Claude Code

…st of a hand-made drawing in place

A splice into a hand-made drawing used to push every shape right of the
insertion line, like the modeler's space tool, so rows that neither follow
the new node nor stand in its way moved too (a task added to a rejection
path moved the parallel join and the end of the main path above it).

The incremental layout now pushes only what follows the new node beyond the
line (along the drawn flows and boundary paths, with boundary events,
content, associated artifacts and groups) and what that would come close to,
sweep over or put on a line, in turn. SpaceTool takes the set as `push`;
pools and lanes (with or without a pool) grow only as far as their content
reaches. Because other rows no longer move along, a new flow that would
enter a drawn node left of its source (no loop) now moves that node and what
follows it right of the source, a merge whose successor lies left of a
predecessor is pulled when it led forward into it, and a batch measures the
gap like the same ops as single commands.

Fixes for what the narrower push exposed, each measured on the edit
benchmark:
- the crossing repair no longer lays a hand-drawn line along other drawn
  lines to save a crossing
- a kept association that a new node or its label touches is routed again,
  and an association docks on the cheapest segment of its flow
- shape and flow labels take a spot that is clear for the one-line text
  bpmn-js draws, before falling back to the wrapped box
- a trial route through a label costs more when a row is chosen

On the 764 runs of the edit benchmark against main: 70 runs better, 11
worse (10 of them keep problems of the input that main resolved by moving
unrelated shapes), runs adding crossings 105 -> 87, median share of moved
nodes 30 % -> 26 %; layout-regression score unchanged at 370.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@dominikhorn93
dominikhorn93 merged commit a6b8447 into main Oct 28, 2026
8 checks passed
@dominikhorn93
dominikhorn93 deleted the dominikhorn93/cli-inbound-delivery-verschiebung branch October 28, 2026 10:47
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