Skip to content

fix(research): a planar face's points are counted as each edge of its rings is read and its regions' tests are charged to its work, so a hostile face is refused before it is built (#1770) - #1788

Merged
DrunkOnJava merged 1 commit into
mainfrom
fix/1770-planar-budgets
Nov 11, 2026

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

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:

  • Fast CI green on the head (cargo fmt, clippy with -D warnings, the two new tests and the existing regions_tile ones).
  • Unfiltered Measure of the head bd39ef77 against main e8a99d03 (43104964413, with the held-out pairs; rows registered on Planar faces: the point and work budgets of #1768 do not cover an edge's refinement before its ring is counted, or a face with regions #1770 before the run, comment 6806613726, 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

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

… rings is read and its regions' tests are charged to its work, so a hostile face is refused before it is built (#1770)

#1748 counted a planar face's points after each ring was built, which was after every edge
of it had been refined up to 100,000 points, and charged nothing for a face with regions:
plane_regions_tile earcut the parent's ring and each region's with no cap and tested every
region vertex against every parent vertex.

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, and refined_plane_edge limits the
edge's refinement to what is left, refusing as `planar face budget exceeded` where the
face's points, not the edge's own budget, ran out. The parent's ring and the regions' share
one such budget, and regions_tile charges the vertex tests (a region's vertices times the
parent's) to the face's work counter, which face_indexed now makes before the regions are
tested. The budgets' values are #1748's. Two failure-first tests of the pure helpers
(ring_points_with, regions_tile_within), each killing the mistakes it names.
@DrunkOnJava
DrunkOnJava merged commit 3abb42f into main Nov 11, 2026
65 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1770-planar-budgets branch November 11, 2026 22:44
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: the point and work budgets of #1768 do not cover an edge's refinement before its ring is counted, or a face with regions

1 participant