Repository navigation
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
Conversation
… 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.
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'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_implrefined each edge up to 100,000 points beforeface_indexedcounted the ring, andplane_regions_tileearcut the parent's ring and every region's with no cap and tested each region vertex against every parent vertex. Nowring_impltakes 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_edgelimits the edge's refinement to what is left and refuses asplanar face budget exceededwhere the face's points ran out, the parent's ring and the regions' share one such budget, andregions_tilecharges 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_implandrefined_plane_edgetake alimit;ring_points_withis the running count (an edge's first point is the last of the one before it);plane_regions_tileandregions_tiletake the face's work counter, whichface_indexednow makes before the regions are tested;regions_tile_withinisregions_tilewith 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 existingregions_tiletests 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_withandregions_tile_within(neither reads a file). Verified end to end on real files:cargo fmt, clippy with-D warnings, the two new tests and the existingregions_tileones).bd39ef77againstmaine8a99d03(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.sha256of all 126 exports identical, no census line differs, and noplanar face budget exceededon 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 gatesand the semantic check on the measured commit;full / CI passedon the final headAudit-honesty checklist
changelog.d/security/.Legal and contribution hygiene
Breaking changes
None.
Related issues
Fixes #1770. Refs #1748, #1768, #1740.