Grid layout: columnSpan corrupts cells, can crash editor

I’ve started using MCP Server heavily (amazing) and the design of a grid-layout based table was not able to be completed by what I think was a bug. The report was generated by Claude.ai:

Primary bug — setting layoutCell.columnSpan on a populated grid auto-appends phantom columns (observed 7→9) and re-assigns existing cells’ column into them, breaking alignment and overflowing the board.

  • Environment — Penpot 2.16.1, plugin API, grid via board.addGridLayout().

  • Minimal repro — a clean 3×2 snippet that distills the confirmed real case (with the note that the real incident was a 7-column table → 9).

  • Expected vs actual.

  • Secondary bug — remediation (removeColumn / re-assigning layoutCell.column on out-of-range cells) hangs the runtime and crashes the editor tab — i.e. no safe programmatic recovery.

  • Workaround — the transparent-grid + background-stripes-behind technique we landed on.

  • Minor related observationbringToFront() was a no-op in a no-layout board while setParentIndex(n) worked.

  • Suggested fix — clamp columnSpan/rowSpan to existing tracks (no side-effects on other cells), and harden grid reconciliation so recovery can’t hang.

Superseded by MCP/API Issue list