Skip to content

fix(research): a planar face holding more than 10,000 points, or whose boundary search takes more than 250 million steps, is refused, and no export of 126 moves (#1748) - #1768

Merged
DrunkOnJava merged 5 commits into
mainfrom
fix/1748-planar-face-budget
Nov 11, 2026
Merged

DrunkOnJava merged 5 commits into
mainfrom
fix/1748-planar-face-budget

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

A planar face whose rings hold more than 10,000 points in all, or whose boundary search and ring split would do more than 250 million units of work between them (counted for the face in all, its outer rings and the second try after a split sharing it), is refused as planar face budget exceeded before earcut or the searches can run away, and its element keeps its box. Earcut, retain_boundary_points (for each point earcut leaves out, every triangle edge tested against every boundary edge: the cube of a face's points where a ring is mostly collinear points) and, since #1740, split_pinched_rings are super-linear in a face's points, and a file can give each edge of a ring up to 100,000 of them. The largest planar face of the corpus holds 2,308 points (Autodesk's Snowdon Towers Architectural, 4.3 times under the points budget) and the most work any one call of the boundary search asks is 14,597,894 (the rme samples, 17 times under the work budget, about two seconds of one face at it): no export of the 126 changes (126 identical on both sides, the held-out pairs, the Revit 2025 models and every sample among them) and no refusal is new.

Motivation

#1748, found by rvtDevelop's read of #1740. The issue asks for a points budget before earcut and retain_boundary_points; the diagnostic found that a points budget alone does not bound the time (2,308 points can be minutes of the boundary search where its points are collinear), so the search is budgeted in the work it does as well.

Changes

  • src/research/native_saved_mesh.rs: PLANAR_FACE_POINT_BUDGET (10,000) checked as each ring of a planar face is read through planar_points_with (a checked sum, so a count cannot wrap round), and PLANAR_WORK_BUDGET (250,000,000), one counter for the face that face_indexed makes and plane_mesh (so each outer ring, and the second try after a split) and split_pinched_rings (every pair of points of a ring it compares) charge; a face past either is refused with planar face budget exceeded. Five failure-first tests of the pure helpers: the points budget at its edge and where a count would wrap round, the boundary search refused at a small budget and, at the real one, putting every point back with the square's area, a second call on the face's counter refused where one alone fits, and a ring of a unique prefix and lobes refused at a small budget and split at the real one.
  • changelog.d/security/1748-planar-face-budget.md.

Testing

Unit tests are banned in this repository except a few failure-first tests of pure helpers: five, for planar_points_with, retain_boundary_points_within and split_pinched_rings (none reads a file). Verified end to end on real files:

  • full / CI passed on the final head
  • Unfiltered Measure of the first head against main (43085010038, head a64259e7, kept under refs/archive/2026-11-11/cited/a64259e74535, base main at 5e3ac5b0): 126 exports identical on both sides (ifc.sha256), the held-out pairs, the Revit 2025 models and every sample among them; no model's saved_mesh_refusals holds planar face budget exceeded; same-project gates pass. Rows registered on Planar faces: bound a face's points before earcut, retain_boundary_points and the pinched-ring search, which are super-linear in a hostile ring #1748 before the run (comment 6804936562): rows 1 to 3 held.
  • The same run on the head after rvtDevelop's read, which counts the work for the face in all and charges the ring split to it (43088503271, head 8c52bb52; comment 6805416476): 126 exports identical again, no planar face budget exceeded on any model, same-project gates and the semantic check pass. The head after it (b0cb80a5) differs from 8c52bb52 by a type alias in the test module, which clippy's type_complexity asked for.
  • The budgets come from two diagnostic builds of the planar path that printed each model's largest planar face and the most work retain_boundary_points did for one (Measure 43082109644 and 43083431385, 69 models, the held-out pairs left out; the build is kept under refs/archive/2026-11-11/scratch/1748-planar-points): 2,308 points on Snowdon Towers Architectural, 2,006 on the rme samples, 546 on rac_basic, 464 on the offices, 128 or fewer on every other model; work 14,597,894 on the rme samples, 4,451,767 on the timber office at permit, 3,650,486 on Snowdon Towers Architectural. The held-out pairs are read by the Measure above: a face over a budget would have moved an export.
  • Not timed: no export of the corpus reaches either budget, so no path that runs changes; the added work is one comparison per edge test of the boundary search.

Audit-honesty checklist

  • A user-visible change has its entry as a fragment under changelog.d/security/.
  • No emojis, no private paths in committed files.
  • Not a reverse-engineering finding: no report; the evidence is above.

Legal and contribution hygiene

  • Apache-2.0. No Autodesk proprietary source, internals or NDA material.
  • No new test fixtures.

Breaking changes

None.

Related issues

Fixes #1748. Refs #1740, #1732; #1770 holds the two ways to a planar face outside these budgets (an edge's refinement before its ring is counted, and a face with regions).

…used before earcut and the boundary search run (#1748)

Earcut, retain_boundary_points and split_pinched_rings are super-linear in a face's points and a hostile file can give each edge of a ring up to 100,000. The rings' running total is checked as each is read; the budget's value is set from the corpus's largest planar face.
…rk as well as its points, and both budgets are set from the corpus (#1748)

The largest planar face of the corpus holds 2,308 points and asks 14,597,894 steps of retain_boundary_points; the budgets are 10,000 points (4.3 times) and 250 million steps (17 times, about two seconds of one face). The work is counted as the function runs, so a face of collinear points that earcut leaves out cannot take the cube of its points; a face over a budget keeps its box and says planar face budget exceeded.
…ts outer rings and the second try after a split, and the ring split is charged to it (#1748)

The boundary search kept its count per call, so a face of many outer rings, or one tried again after a split, could ask the budget again for each; and the search for a ring that visits a vertex twice was uncounted and cubic in a ring of many lobes. One counter now runs through plane_mesh and split_pinched_rings, and a face that runs out says planar face budget exceeded on either try.
@DrunkOnJava
DrunkOnJava merged commit e5b2515 into main Nov 11, 2026
36 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1748-planar-face-budget branch November 11, 2026 19:58
DrunkOnJava added a commit that referenced this pull request Nov 11, 2026
… rings is read and its regions' tests are charged to its work, so a hostile face is refused before it is built (#1770) (#1788)

## Summary

A planar face's points are now counted as each edge of its rings is
read, and the tests of a face with regions are charged to its work,
instead of after its rings are built. #1748 refused a face of more than
10,000 points or 250 million units of work, but `ring_impl` refined each
edge up to 100,000 points before `face_indexed` counted the ring, and
`plane_regions_tile` earcut the parent's ring and every region's with no
cap and tested each region vertex against every parent vertex. Now
`ring_impl` takes the points the face's rings may still hold and counts
each edge as it is read (the graph's own points before any is copied),
`refined_plane_edge` limits the edge's refinement to what is left and
refuses as `planar face budget exceeded` where the face's points ran
out, the parent's ring and the regions' share one such budget, and
`regions_tile` charges a region's vertices times the parent's to the
face's work counter. The budgets' values are #1748's, and no corpus face
reaches either (the largest planar face holds 2,308 points).

## Motivation

#1770, found by rvtDevelop's read of #1768: its two ways to a planar
face outside the budgets.

## Changes

- `src/research/native_saved_mesh.rs`: `ring_impl` and
`refined_plane_edge` take a `limit`; `ring_points_with` is the running
count (an edge's first point is the last of the one before it);
`plane_regions_tile` and `regions_tile` take the face's work counter,
which `face_indexed` now makes before the regions are tested;
`regions_tile_within` is `regions_tile` with the budget given. Two
failure-first tests of the pure helpers (`ring_points_with`: the count
at its limit, an edge's first point not counted twice, an edge of one
point or none, a count that wraps round; `regions_tile_within`: the work
counted for the face and not each call, and a refusal for the budget
told from a ring that does not tile), each killing the mistakes it names
(checked on four mutants of the helpers); the existing `regions_tile`
tests are unchanged but for the counter they pass.
- `changelog.d/security/1770-planar-budget-before-build.md`.

## Testing

Unit tests are banned in this repository except a few failure-first
tests of pure helpers: two, for `ring_points_with` and
`regions_tile_within` (neither reads a file). Verified end to end on
real files:

- [x] Fast CI green on the head (`cargo fmt`, clippy with `-D warnings`,
the two new tests and the existing `regions_tile` ones).
- [x] Unfiltered Measure of the head `bd39ef77` against `main`
`e8a99d03`
([43104964413](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43104964413),
with the held-out pairs; rows registered on #1770 before the run,
[comment
6806613726](#1770 (comment)),
read in the comment after): `ifc.sha256` of all 126 exports identical,
no census line differs, and no `planar face budget exceeded` on either
side of the 101 models that report diagnostics (the other 25 keep counts
only, so there the identical exports are the evidence).
- [ ] `same-project gates` and the semantic check on the measured
commit; `full / CI passed` on the final head
- Not timed: no path that runs changes beyond one comparison per edge
and one product per region.

## Audit-honesty checklist

- [x] A user-visible change has its entry as a fragment under
`changelog.d/security/`.
- [x] No emojis, no private paths in committed files.
- [x] Not a reverse-engineering finding: no report; the evidence is
above.

## Legal and contribution hygiene

- [x] Apache-2.0. No Autodesk proprietary source, internals or NDA
material.
- [x] No new test fixtures.

## Breaking changes

None.

## Related issues

Fixes #1770. Refs #1748, #1768, #1740.
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.

Planar faces: bound a face's points before earcut, retain_boundary_points and the pinched-ring search, which are super-linear in a hostile ring

1 participant