Skip to content

Bound the wall step cut's walk so the offsetter always returns (WOR-878) - #419

Merged
kcjonson merged 1 commit into
mainfrom
fix/WOR-878-wall-offsetter-terminates
Nov 16, 2026
Merged

kcjonson merged 1 commit into
mainfrom
fix/WOR-878-wall-offsetter-terminates

Conversation

@kcjonson

Copy link
Copy Markdown
Owner

WOR-878. geometry::resolveWallBands on main does not return for some chains of short walls. The render cache calls it on every construction edit and navigation on every construction version change, so in the game it is a freeze.

Introduced by PR 417 (WOR-865). Found by a reviewer running this file in a harness with walls shorter than any earlier sweep used.

The input

Millimetres, h the half-thickness: (0,0)-(110,207) h75, (110,207)-(474,182) h100, (474,182)-(487,371) h75, (487,371)-(400,406) h150. Before PR 417 it is rejected with TrimOverrunsSegment. On main it hangs; reproduced in the real build.

Cause

PR 417's retry re-resolves the junctions beside a failed band, drawing a two-wall join as a step whenever the two walls point more than 90 degrees apart, which includes nearly square corners. The step code walks the thinner wall's trim a millimetre at a time until its corner clears the thicker wall's cap line: while (!clearOfCap(trim)) ++trim;. For the near-straight joins the step code was written for, the corner moves away from the line and the walk ends. For a near-square corner the cap line, which runs between two rounded points, can lean off square by more than the walls lean off 90 degrees; the corner then runs along the line or toward it and never clears.

Fix

The walk, and the line-crossing jump before it, stop at the thinner wall's length. trim strictly increases toward that bound, so the loop ends. A trim at the wall's length fails trimmedBand, so the graph is rejected, as it was before the retry existed. Only results that were rejections or hangs change. The retry is still a single pass.

How checked

  • WallProperties.ShortMixedChainReturns: the input above returns TrimOverrunsSegment. On main the same test runs until killed.
  • WallProperties.ShortMixedChainsRejectOrTile: 4,000 seeded chains of 3 to 5 walls with 20 to 420 mm legs and mixed thicknesses all return (13 of them hang on main), and each is either rejected or passes the tiling checks.
  • With the old loop restored, a 40,000-input run of the same sweep found 77 inputs that never cleared; all were this loop. With the fix the slowest input takes 0.3 ms.
  • WallProperties.NearStraightRetryKeepsEveryAcceptedJoin (about 160,000 inputs against a copy of the pre-retry logic) passes untouched: accepted layouts are unchanged.
  • geometry-tests 493 passed, sim-tests 1202 passed, world-sim-tests 61 passed.

Can the game produce such walls

The wall tool refuses a segment under 500 mm, but that checks only the drawn segment. A T-junction splits its host wall at the joining point with no length check, and the vertex snap radius is 0.4 m, so a join 0.4 to 0.5 m from a wall's end leaves a piece under 500 mm. The dev walls verb skips validation and takes any length.

Not fixed here

The retry steps two-wall joins that are nowhere near straight. With this fix they no longer hang, but in a 40,000-input run 5 of 11,982 non-folding chains that the pre-retry code rejected now resolve with geometry that fails the tiling checks (a junction vertex past the miter bound, or a 3.6 mm cap gap), at corners about 100 to 105 degrees apart. Narrowing the retry to near-straight joins is a separate change and follows.

Perf: none on layouts that resolve. On the retry path the walk is bounded by the thinner wall's length in millimetres.

The step walks the thinner band's corner until it clears the thicker band's cap, whose line runs between two rounded points. Where the retry steps a nearly square corner, that line can lean off square by more than the bands lean off 90 degrees apart, so the corner runs along it and never clears. The walk now stops at the thin segment's length, where the band is gone and the graph is rejected, as it was before the retry.
Copilot AI balanced review requested due to automatic review settings November 15, 2026 17:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@kcjonson
kcjonson merged commit a174adb into main Nov 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants