Skip to content

feat(layout): add safe incremental --only-new placement - #19

Merged
eisber merged 4 commits into
mainfrom
takeover/pr-14-layout-only-new
Sep 8, 2026
Merged

eisber merged 4 commits into
mainfrom
takeover/pr-14-layout-only-new

Conversation

@eisber

@eisber eisber commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Supersedes #14 because its fork branch was deleted and could not be updated in place.

Includes the original config layout --only-new feature plus takeover fixes:

  • treat any block missing Px, Py, Px2, or Py2 as unpositioned
  • stack variable-height blocks without overlap
  • preserve a horizontal grid gap between layers
  • remove the canonically duplicated Unicode LFS fixture
  • update recursive XML helpers for strict Clippy on Rust 1.91
  • add regression coverage for incomplete coordinates and tall same-layer blocks

Validated in Docker with Rust 1.91:

  • cargo fmt --check --all
  • cargo clippy --workspace -- -D warnings
  • cargo build --workspace --release
  • cargo test --workspace --release
  • CLI reproduction confirms existing coordinates remain unchanged, partial coordinates are repaired, tall blocks do not overlap, warnings clear, and a second run is byte-identical

tobsch and others added 4 commits September 8, 2026 18:44
`config layout` currently re-arranges the whole page (grid_layout). After
`config add`, new blocks land without coordinates while the rest of the page is
already laid out by hand — re-running the full layout throws that hand-work away.

Add `--only-new`: position ONLY blocks that have no `Px`, leaving every
already-positioned block byte-identical. New blocks are placed with a
Sugiyama-style layered layout so they flow left→right along their wiring:

- layer = longest path over the sub-DAG of new blocks (predecessors that are
  themselves new)
- order within a layer by barycenter of predecessor rows (fewer crossings)
- coordinates snapped to the 96-unit editor grid, anchored in the free area to
  the right of the page's existing content

Motivation: clears the "missing canvas layout — Loxone Config will repair this
block on first save and may drop wires" warning without disturbing the existing
diagram. Verified on a real 500-block config: 9 added logic gates placed in
clean layers, 498 positioned blocks unchanged, `config validate` 0 errors.

Adds `incremental_layout()` + two unit tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1TT6BSmf3uXakmtfexfDt
Treat blocks with any missing canvas coordinate as unpositioned, stack variable-height blocks without overlap, and remove the duplicate Unicode-normalized LFS fixture.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove unused self receivers from recursive XML traversal helpers so strict Clippy passes on Rust 1.91.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use array chunks and Option::filter as required by the current stable Clippy used in CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@eisber
eisber force-pushed the takeover/pr-14-layout-only-new branch from 03c18d8 to d6401ac Compare September 8, 2026 17:54
@eisber
eisber merged commit c432401 into main Sep 8, 2026
11 of 12 checks 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.

2 participants