Repository navigation
Conversation
…ment CREATE ENTITY places an entity without an @position on dmlayout.GridSlot, but view entities, external entities and entities imported from a contract kept the old single-row formula, whose 150px step is narrower than an entity box. All three now take the next grid slot after the entities the module already holds; the contract import also counted only its own entities before. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… collide The default grid has a fixed row pitch, but a box is as tall as its attribute list, so an entity with many attributes runs into the one below it. The flag moves just the entities whose estimated boxes (or an annotation) collide, to the nearest free spot, and keeps every other position. Deterministic and idempotent: a second run reports no overlapping entities. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…centre dmlayout treated an entity's Location as the centre of its box (citing RelativeMiddlePoint, which is the microflow-object field). Studio Pro 11.12.5 draws an entity's Location as the box's top-left corner: entities created at the same Y with 4, 30 and 45 attributes share one top edge. Plan therefore placed every box half its size lower and further right than planned, and a tall box ran into a short one under it; the overlap check missed the same collisions. Both now measure from the corner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor Issues
What Looks Good
RecommendationApprove. The PR successfully addresses the layout overlap issues and position convention problems with thorough testing, clear documentation, and proper validation. The implementation follows project conventions and maintains backward compatibility where appropriate (explicit Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
Closes #1479.
There are three commits, and each one stands on its own.
1. fix: view, external and contract-imported entities use the grid placement
create view entity(cmd_entities.go) andcreate external entity/create external entities from(cmd_odata.go) used the oldX: 100 + n*150, Y: 100row. So did contract imports (cmd_contract.go).dmlayout.GridSlot(existing + created), so the count includes the entities the module already holds. An explicit@Positionis still honoured.mdl/executor/entity_default_position_test.go, and there is a findings record.2. feat:
mxcli layout --only-overlapping [--dry-run]dmlayout.ResolveOverlaps(dm)returns anOverlapPlan{Pairs, Moves}.boxSizeestimates asPlan.layoutplumbing:--module,--dry-runand the Marketplace skip. The docs section is indocs-site/src/tools/domain-model-layout.md.3. fix: an entity's position is the top-left corner of its box, not its centre
dmlayout's package comment said a position is the box's centre and citedRelativeMiddlePoint. That is the microflow-object field. A domain-model entity storesLocation, and Studio Pro draws it as the top-left corner.Planadded half a box to every position, so a tall box stacked above a short one could run into it.Plan,entityRectandnearestFreenow measure from the corner, and the docs line saying "the coordinate is the box's centre" is corrected.Location, read as a top-left corner, puts them.boxSizeestimates of 160 wide and 34 + 16 × attributes stay, because they are slightly generous.TestResolveOverlaps_TopLeftConventionFixturesizes boxes independently with the measured geometry rather thanboxSize, so it can't simply agree with the code's own convention.TestPlan_TallEntityAboveShortOneDoesNotOverlap.Evidence
Studio Pro 11.12.5, scratch module with 16 entities. Attribute counts are 2 to 50, and the module includes a view entity and an entity with an explicit
@Positionfar away. Entities were created with no position.--dry-run: listed 4 collisions and 4 moves.The first version of commit 2 assumed a centred position. In Studio Pro it still left two overlaps, and that is how commit 3 was found.
Unit tests: all 26 in
mdl/dmlayout, plus thecmd/mxclilayout tests, pass on Windows.go vetandgofmtare clean.Linux (
golang:1.26.6-bookworm, ANTLR 4.13.2, as in CI):make grammar build test check-mdl check-findings check-conformance check-migration-reference lint-goall pass.🤖 Generated with Claude Code