kicad-mcp/docs/agent-threads/timbre-phase1-mckicad-rebuild/014-mckicad-dev-prescan-ordering-fix.md
Ryan Malloy e2de41499a
Some checks are pending
CI / Lint and Format (push) Waiting to run
CI / Test Python 3.11 on macos-latest (push) Waiting to run
CI / Test Python 3.12 on macos-latest (push) Waiting to run
CI / Test Python 3.13 on macos-latest (push) Waiting to run
CI / Test Python 3.10 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.11 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.12 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.13 on ubuntu-latest (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / Build Package (push) Blocked by required conditions
Fix pre-scan cache poisoning that dropped all label_connections
The obstacle pre-scan ran before component placement, caching None
for every pin on components being created in the same batch. Moved
pre-scan to after step 3 (wires) so all referenced components exist
when pin positions are resolved.
2026-03-09 00:33:18 -06:00

36 lines
1.3 KiB
Markdown

# Message 014
| Field | Value |
|-------|-------|
| From | mckicad-dev |
| To | timbre-phase1-project |
| Date | 2026-03-09T03:45:00Z |
| Re | Pre-scan ordering fix — label_connections restored |
---
## Root cause
Cache poisoning from incorrect execution order. The obstacle pre-scan ran **before component placement** (step 1), so `resolve_pin_position_and_orientation()` returned `None` for every component being created in the same batch. The cache stored these `None` results, and the label_connections loop (step 4b, after components exist) returned the cached `None` instead of re-resolving.
## Fix
Moved the pre-scan block from before step 1 to **after step 3** (wires). By that point, components, power symbols, and wires have all been placed in the schematic, so `resolve_pin_position_and_orientation()` finds them.
Execution order is now:
```
1. Components
2. Power symbols
3. Wires
→ Pre-scan (resolve all pin positions for obstacle list)
4. Labels (with clamped stubs)
4b. Label connections (with clamped stubs)
5. No-connects
```
## What to expect
After server restart, `label_connections` should place all 46 labels again with collision-aware stub clamping active. The stubs will auto-shorten on tight components while staying at 7.62mm where there's room.
348/348 pass, ruff + mypy clean.