Files
ARCADIA-Studio/harness/experiments/placement-clearance-20260925/implementation.md
T

2.6 KiB

Bounded flat clearance repair candidate

Own module: crates/oa-core/examples/auto_layout_probe/clearance.rs in research worktree. Pure repair(&Project, Id) -> Result<Project, ModelError>; no compilation/execution by implementation agent. Parent owns CLI, test execution, final original-to-final route metadata reconstruction, and integration. Input routes, authored sizes/anchors and semantic records are untouched by this function.

Freeze total X/Y orders by initial coordinate then placement ID. Reject initial actual-node overlaps. For every disjoint pair, retain its original gap on one existing separating axis (deterministic X before Y); preserve adjacent start order on both axes. For a diagnosed singleton blocked lead, strengthen the corresponding outward-facing owner/blocker boundary separation to PORT_STUB + CLEARANCE + explicit1-unit margin, currently31. Reject ambiguous endpoint sets, noncardinal blocked leads and constraints opposing frozen order. Solve acyclic longest-path lower bounds from frozen initial coordinates, so movement is positive and constraints only strengthen.

Reproject after each adjustment and before success: identity/topology and every effective node size must remain unchanged. Diagnostic uses actual reselected automatic ports, not frozen engine ports. Four adjustments maximum; unresolved or non-strengthenable failures reject. Bound256nodes/1024edges,100000-unit span per axis, and10000000 charged work units (including conservative16 endpoint-pair/node allowance per diagnostic round). Nested/folded/omitted/Scenario input is rejected. Errors drop a private clone and cannot mutate the input.

This is deliberately conservative: fixed-axis pair gaps may propagate movement farther than necessary; opposite side changes may make constraints impossible under the frozen order. Size-changing automatic capacity redistribution is rejected rather than silently accommodated. Work accounting bounds explicit pair/constraint/diagnostic scan allowance, not wall-clock time or all projection internals. Empty lead incompatibilities prove only the router's necessary lead guard, not obstacle-free complete paths, label clearance, readability or adoption. No heuristic nudges, engine tuning or production changes are included.

API inspected: routing::lead_incompatibilities(Project, Diagram, ProjectedView) returns actual singleton candidates and inflated blocker identities. Stub containment is diagnostic-only and is not substituted for the existing lead guard. Parent should retain all rejected cases and evaluate full route/label results independently after successful repair.