feat(cam-clear): plan_rings_region coupled walk and cut ordering #139

Merged
patman merged 4 commits from patman/island-plan-region into patman/island-collision 2026-08-24 02:25:49 +00:00 AGit
Owner

Island lane I-e2. pub fn plan_rings_region: the coupled outer/island front walk, collision termination, seed via to_stock, interleave_islands cut ordering, flatten to RingPlan; four new refusals (IslandTooCloseToWall, IslandMergeUnsupported, ChannelResidualUnswept, CollisionQueryFailed — all tested, incl. both ChannelResidualUnswept arms). zero_islands_consistency pins reduction to plan_rings on islandless pockets. KNOWN v1 LIMIT (deliberate, documented): the flagship centered-island fixture REFUSES today — a channel-closing terminal ring fully encircles the seed and the entry machinery declines single-segment circles; the entry fix is the heart of I-f. plan_rings re-expression also deferred to I-f. Opus review PASS.

Island lane I-e2. pub fn plan_rings_region: the coupled outer/island front walk, collision termination, seed via to_stock, interleave_islands cut ordering, flatten to RingPlan; four new refusals (IslandTooCloseToWall, IslandMergeUnsupported, ChannelResidualUnswept, CollisionQueryFailed — all tested, incl. both ChannelResidualUnswept arms). zero_islands_consistency pins reduction to plan_rings on islandless pockets. KNOWN v1 LIMIT (deliberate, documented): the flagship centered-island fixture REFUSES today — a channel-closing terminal ring fully encircles the seed and the entry machinery declines single-segment circles; the entry fix is the heart of I-f. plan_rings re-expression also deferred to I-f. Opus review PASS.
feat(cam-clear): plan_rings_region coupled walk and cut ordering
Some checks failed
CI / build-test (pull_request) Failing after 4s
4cdbc58b60
Second half of the island-aware orchestration layer
(docs/superpowers/island-clearing-design.md, step I-e / ID-1, ID-10). Adds
the public entry point `plan_rings_region(&NestedRegion, &ClearParams) ->
Result<RingPlan, ClearError>`, the coupled walk that drives the collision
primitives from the previous commit, the cut ordering that splices island
chains into execution order, and the end-to-end fixtures. `RingPlan` keeps
its frozen flat shape (ID-12), so cam-drive and cam-viz consume island
passes with no downstream change.

What it adds:

- `plan_rings_region` itself. It validates the outer wall (with
  `NonConvexPocket` scoped to the outer boundary only, ID-8 — a region with
  holes is never simply connected), seeds via `region.to_stock()` so the
  already-island-aware `largest_inscribed_circle` places the seed clear of
  every island (ID-10), builds every island's encirclement family up front
  via `island_family` (I-d), checks the depth-0 keep-out against the depth-0
  limit curve, then walks the outer family one `solve_ring` step at a time,
  probing collisions against every front after each step.
- The coupling schedule, read explicitly as index-lockstep rather than equal
  numeric stepover, and documented as such since the design's own text is
  qualitative here. Every front keeps its own already-certified per-step
  bisection — `solve_ring` for the outer wall, `island_family`'s own solver
  for islands — and the walk advances one step of every still-growing front
  per round, probing collisions at that round index. A literal shared
  numeric stepover across geometrically unrelated fronts cannot reuse that
  existing, already-verified per-front machinery, and reusing it verbatim is
  exactly what makes the zero-island case reduce to the same call sequence
  `plan_rings` makes.
- `interleave_islands`, the ID-10 cut order: each island's chain is spliced
  in immediately before, in execution order, the outer pass bounding its
  channel, so a prior-pass envelope exists for every pass. It takes the
  entry block length explicitly rather than inferring the mapping from list
  lengths, because `plan_rings`'s flat pass-to-family-index correspondence
  only holds when the entry block is a single pass — bridge passes and the
  entry family both lengthen it.
- Three more `ClearError` variants (ID-11): `IslandTooCloseToWall` (the
  island's untouched depth-0 keep-out already overlaps the wall's own
  depth-0 limit curve, so the tool cannot fit even for the shallowest pass),
  `IslandMergeUnsupported` (a case-3 off-center merge), and
  `ChannelResidualUnswept` (a front that never reached the outer front or
  another island, so ID-6's coverage argument does not apply and a genuine
  residual cannot be shown swept).
- A post-walk residual check that scans each still-unfrozen island's own
  precomputed loops forward for the last one still disjoint from the final
  outer ring. Same gouge-safety concern as the in-walk clamp: the island's
  family was grown with zero awareness of the outer wall, so a later loop
  can cross the final ring outright, not merely touch it.

Invariants: no emitted pass ever comes within `tool_radius` of an island —
the lane's CRITICAL invariant; every pass stays inside the outer wall's
tool-center limit curve; frozen fronts stay collision-checked, so the outer
walk cannot shrink through an island that merely stopped growing; the
zero-island path is bit-for-bit identical to `plan_rings`. Island passes are
reported, never target-gated: `certified_error` is stamped `Angle::ZERO`,
the same not-applicable convention `RingPlan` already uses for the entry
pass and the degenerate plunge.

Tests: `zero_islands_consistency` (bit-for-bit against `plan_rings` on a
circular and a rounded-rect pocket); `single_island_centered_e2e` and
`channel_close_is_core_reached` (a deep-annulus and a fast concentric
channel close, both accepted as core-reached);
`c_merge_refused_off_center` and `two_islands_disjoint_e2e`
(`IslandMergeUnsupported`, the latter also confirming two independently
built fronts do not interfere with each other);
`island_too_close_to_wall_refused`; `no_gouge_checked`; and the
`no_gouge_and_containment_oracle` proptest over random single-island
configurations, which asserts gouge safety and limit-curve containment at
dense per-pass samples whenever a plan is produced.

Build-time finding, flagged for I-f: a fully-encircling terminal ring — a
concentric island whose whole annulus has closed — still spans the entire
pocket, since offsetting a circle changes its radius but never its center.
`max_distance_to_contour` from the seed is therefore dominated by that
ring's own diameter rather than the annulus width, and the pre-existing
single-seed entry machinery correctly refuses with
`PlungeCoverageUnattainable` (`EntryFamily::reconstruct` also declines: the
terminal ring is a single-segment circle, not an all-clamped polygon). That
is a v1 completeness gap in the entry path, not a collision-classification
failure, and not a gouge-safety problem — nothing unsafe is ever emitted.
The two channel-close tests assert the refusal is specifically
`PlungeCoverageUnattainable` and never `IslandMergeUnsupported`, which is
what proves the channel close was accepted as core-reached before the
separate, pre-existing entry limitation took over.

The `no_gouge_and_containment_oracle` proptest runs 64 cases rather than
24: it only produces a *plan* on a small minority of draws, so at 24 the
success path — the branch that actually checks gouge safety — was barely
sampled. `circle_at` now lives in the previous commit, which is its first
consumer.

Co-authored-by: patman-assist <patrick-ai@kgroo.co>
chore: normalize comments
Some checks failed
CI / build-test (pull_request) Failing after 4s
e5b45066a0
Co-authored-by: patman-assist <patrick-ai@kgroo.co>
style: rustfmt --edition 2024 drift fix
Some checks are pending
CI / build-test (pull_request) Waiting to run
d7188601d4
Reformats files that predate the runner's current rustfmt; no code changes.

Co-authored-by: patman-assist <patrick-ai@kgroo.co>
merge: sync patman/island-collision into island-plan-region
All checks were successful
CI / build-test (pull_request) Successful in 8m42s
80a5a6efa2
I-e preamble resolved to the normalized banner plus this branch's cut-order note.

Co-authored-by: patman-assist <patrick-ai@kgroo.co>
patman merged commit 5ace42ac67 into patman/island-collision 2026-08-24 02:25:49 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
patman/KGROO!139
No description provided.