Repository navigation
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
Conversation
…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.
This was referenced Nov 11, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 exceededbefore 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_ringsare 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 (thermesamples, 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 throughplanar_points_with(a checked sum, so a count cannot wrap round), andPLANAR_WORK_BUDGET(250,000,000), one counter for the face thatface_indexedmakes andplane_mesh(so each outer ring, and the second try after a split) andsplit_pinched_rings(every pair of points of a ring it compares) charge; a face past either is refused withplanar 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_withinandsplit_pinched_rings(none reads a file). Verified end to end on real files:full / CI passedon the final headmain(43085010038, heada64259e7, kept underrefs/archive/2026-11-11/cited/a64259e74535, basemainat5e3ac5b0): 126 exports identical on both sides (ifc.sha256), the held-out pairs, the Revit 2025 models and every sample among them; no model'ssaved_mesh_refusalsholdsplanar face budget exceeded;same-project gatespass. 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.8c52bb52; comment 6805416476): 126 exports identical again, noplanar face budget exceededon any model,same-project gatesand the semantic check pass. The head after it (b0cb80a5) differs from8c52bb52by a type alias in the test module, which clippy'stype_complexityasked for.retain_boundary_pointsdid for one (Measure 43082109644 and 43083431385, 69 models, the held-out pairs left out; the build is kept underrefs/archive/2026-11-11/scratch/1748-planar-points): 2,308 points on Snowdon Towers Architectural, 2,006 on thermesamples, 546 onrac_basic, 464 on the offices, 128 or fewer on every other model; work 14,597,894 on thermesamples, 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.Audit-honesty checklist
changelog.d/security/.Legal and contribution hygiene
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).