camunda / camunda/c8ctl-plugin-model
layout.ts reimplements bpmn-auto-layout's top-level layout instead of depending on it
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Summary
c8ctl-plugin-model ships its own from-scratch BPMN layout engine (src/layout.ts, ~318 lines: BFS/topological column assignment, fixed element sizing table, edge waypoint computation) instead of depending on bpmn-auto-layout, the existing bpmn.io library that solves the same problem. The current layout is not just duplicated — it's bad. We just confirmed that a single-child subprocess positions the child task with its left edge flush against the subprocess wall (zero visible padding), because CHILD_PAD=50 is the distance to the center of the first element, not its edge. That kind of off-by-half-width error wouldn't survive in a library with real test coverage.
Where the two do and don't overlap
- Top-level process layout (start events, tasks, gateways, end events from flow topology): duplicated, and our version is worse.
- Sequence flow waypoints: duplicated.
- Subprocess/ad-hoc-subprocess expanded children layout: genuinely additive —
bpmn-auto-layoutexplicitly doesn't support this, its README says "Sub-processes will be laid out as collapsed sub-processes". We need custom code here regardless of what we do with the root-level layout. - Boundary events on nested hosts: also additive, fixed in #25.
Proposal
Adopt bpmn-auto-layout for the root-process layout pass and keep only the genuinely novel parts — subprocess/AHSP child layout and boundary-event positioning for nested hosts — as custom code layered on top. bpmn-auto-layout already exports a layoutProcess(xml) entry point; if a full XML round-trip per command turns out to be too slow there are lower-level hooks to reach for.
Benefits:
- Deletes ~half of
layout.ts(the duplicated, buggy half) and replaces it with a tested, maintained library. - Stops us from having to fix layout bugs that bpmn-auto-layout has already fixed.
- Shrinks the custom surface to the one area that actually needs to be custom, which also makes the remaining code easier to get right (the subprocess child padding bug would be trivially visible if it weren't buried in 300 lines of other layout logic).
If bpmn-io/bpmn-auto-layout#137 lands upstream and they add AHSP support, the custom surface shrinks further — but that's upside, not a prerequisite.
Related
- #23 / #25: boundary-event containment and positioning bug — lives entirely in the custom portion of
layout.ts. - bpmn-io/bpmn-auto-layout#137: upstream AHSP layout support.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/layout.ts and read bpmn-auto-layout's layoutProcess(xml) entry point. Separate the duplicated root-process layout and sequence-flow work from the custom subprocess/AHSP child layout and nested boundary-event positioning, using #23 and #25 for related behavior. Done means root layout delegates to the library while the custom nested-host behavior remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100