Skip to content

[Feat]: Rule reporting winding (zigzag) sequence flows #32

Description

@emaarco

Summary

A layout rule (flow-zigzag) that reports a sequence flow which reverses on itself and keeps bending instead of reaching its target directly. Decides purely on DI coordinates, scoped per BPMNPlane.

Motivation

Readers follow a flow fastest when it makes steady progress to its target. Agents / auto-layout often emit loop-backs that wrap and then stair-step home with redundant corners. The XML review looks clean and the connection is valid; only the drawn diagram shows the snake.

Proposed Solution

A monotone flow (never doubling back on either axis: a straight line, an L, a Z, or a staircase) is always fine, however many bends it has. A flow that reverses direction gets a small budget of bends for the wrap (maxWrapBends, default 3); beyond that it is reported. Self-loops are skipped (always a full wrap).

Includes a correctness requirement: the monotonicity check (isMonotonePath) must use the same axis tolerance as the orthogonality check. Otherwise a near-orthogonal rung (within flow-orthogonal's tolerance, e.g. ~4px drift over ~170px) is misread as a direction reversal, and a clean monotone staircase is falsely flagged. Fix: judge each segment by its dominant axis and ignore minor-axis drift.

Wire as error in plugin:@miragon/rules/all and non-blocking warn in both recommended-for-modeling and recommended-for-automation.

Acceptance Criteria

  • Rule implemented + wired into all presets, docs page, valid/invalid fixtures
  • No false positive on a near-orthogonal monotone staircase (tolerance aligned with flow-orthogonal)
  • Each branch adds/modifies only the code it needs
  • Verify gate green (typecheck, lint, format, knip, lint:deps, test, build, test:distro)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions