Repository navigation
fix(ifc): profile-cut chains are written and meshed by a loop, the scene graph's host depth, wall-top parts, roof envelope points, mullion grid cells and space containment are bounded (#1845) - #1848
Merged
Conversation
…ene graph's host depth, wall-top parts, roof envelope points, mullion grid cells and space containment are bounded (#1845) Root causes, each fixed where it is: - emit_solid_shape and solid_mesh recursed down a boolean result's first operand, one level per profile cut: both now walk the chain in a loop, in the order recursion wrote and appended it. - build_scene_graph linked a host of any depth, recursed as deep as the chain and walked the chain from every element: an element more than MAX_HOST_DEPTH (16, storey_of's bound) hosts down hangs from its storey. - covered_pieces made every outline triangle's parts before checking the count (MAX_COVERED_PARTS, 32 x MAX_RISERS); embedded let each neighbour piece triple what was left (4 x MAX_RISERS, steps' own bound, and an early return once nothing is left). - envelope_slab_mesh capped its pieces but not their points (MAX_ENVELOPE_POINTS, 16 a piece). - partner_ends tested every end in a crowded cell (MAX_ENDS_PER_CELL, 64). - contain_in_spaces scanned every space of the model for each content and had no bound on outline tests: a per-storey index and a work budget. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
DrunkOnJava
marked this pull request as ready for review
November 12, 2026 23:07
5 of 6 tasks
DrunkOnJava
added a commit
that referenced
this pull request
Nov 12, 2026
…cells and space containment note their stop, so an export that reaches one says so (#1845) Each left its shape out or its element uncontained without a word. Each now calls budget::stopped, as #1849's readers do: the export's diagnostics list it under work_budget_reached, and rvt-ifc and rvt-gltf exit 3 unless --allow-partial. All six run on the export's own thread, inside the notes export_rvt_doc and run_export_with_limits_and_control open. The diagnostics doc and work_budget_stops say a count is how often a reader stopped on the open file (rvtReview's note on #1849). Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
DrunkOnJava
added a commit
that referenced
this pull request
Nov 13, 2026
…p writes streams whose names Windows refuses (#1845) (#1855) ## Summary Batch 4's CLI auditor read 9 of the 19 binaries. I read the other ten: gen-fixture, rvt-capabilities, rvt-diff, rvt-dump, rvt-elem-table, rvt-ifc-compare, rvt-schedule, rvt-schema, rvt-sheet and rvt-write. None can panic on a file. Two do the wrong thing with one: - **`rvt-write`** decoded a manifest's unpadded base64 wrong. An unpadded last group came out as three bytes whatever its length, and an `=` inside the text as zeros, so the stream was patched with bytes the manifest never gave. - **`rvt-dump`** stopped on Windows at a stream whose name holds a character Windows refuses in a file name or names a device. Two streams whose names became one file name wrote to the same file, so the later one replaced the earlier without a word. It also takes a follow-up of #1833: - **`partition_mep_systems` and `partition_curtain_materials`** verified the data object around every place a class word occurs, each with a full Adler-32 of its payload. That is quadratic on a crafted stream. They now read the stream's listed data objects instead (`memoised_partition_data_objects`), which give the same objects. - **The bounds #1848 put on wall tops, envelopes, mullion grid cells and space containment** left the shape out, or the element uncontained, without a word. Each now notes its stop, as #1849's readers do, so an export that reaches one is reported partial. - **A stop no longer blocks the export (Griffin, 2026-11-12).** Asked whether an export that trips one of the new stops should still be written, Griffin chose "Write it, with a warning". #1849 had made any stop refuse the whole export, so one stop on a dense curtain-wall grid would have blocked a real model. Now the export is written and the stop is named as a warning. Only a stream a resource limit kept from being read still makes it partial. This is the batch's fifth PR. ## Motivation Part of #1845. The scoreboard of batch 4 records the auditor's coverage gap. These two are what reading the rest found. ## Changes - `src/bin/rvt_write.rs` `decode_base64`: - `=` pads only the end, and a group of n characters (2 to 4) holds n − 1 bytes. - Text ending in a lone character is refused, as is an `=` inside it. - A padded manifest decodes as before. - `src/bin/rvt_dump.rs` `file_stem_for`, the file name each stream is written under: - A stream name's `<>"|?*` and control characters become `_`, as `/` does. - A device name Windows reserves (`CON`, `PRN`, `AUX`, `NUL`, `CONIN$`, `CONOUT$`, `COM0`–`9` and `LPT0`–`9`, the superscript `COM¹`–`³` and `LPT¹`–`³`, whatever follows the first `.`) takes a `_` in front. - A name another stream of the dump already has, compared without case as macOS and Windows file systems compare names, takes `~2`, `~3` and so on (rvtReview's two notes). - A trailing dot or space cannot end a file name, since `.decomp` or `.raw` follows it. - The cfb crate already refuses `\`, `:` and `!` in entry names (`direntry.rs` validates every name it reads), so no name leaves `--out`. - Revit's own stream names hold none of these and none collide, so their files keep their names. - `changelog.d/fixed/1845-cli-base64-and-dump-names.md`. - `src/research/partition_mep_systems.rs` and `src/research/partition_curtain_materials.rs`: each stream's objects of the wanted classes come from its listed data objects. - The loops keep their order, class first, then offset, since the first class and the last material read win. - The listing takes the first verified object, then the next past its end. A verified object inside another's payload would be missed, and the per-hit check would find it. A census of the local corpus finds none: RE1 Architecture, Electrical, Mechanical and Plumbing, Einhoven, rac_advanced 2024 and Core Interior hold 349,320 verified data objects, all of them listed. #1849 made the same change for the room parameters' owners, and its Measure moved no export. - `budget::stopped` at #1848's bounds: - `src/ifc/export_content/wall_tops.rs`: `wall_top_pieces` (the cut pieces or the pieces held past `4 × MAX_RISERS`), `wall_top_covered_parts` (`MAX_COVERED_PARTS`), and `wall_top_embedded_pieces` (the stub test's pieces past `4 × MAX_RISERS`). - `src/ifc/body_geometry.rs`: `envelope_pieces`, where the envelope's pieces, their points or its sides pass their caps. - `src/ifc/mesh_volume.rs`: `mullion_end_cells`, once per pass, where a grid cell holds more than `MAX_ENDS_PER_CELL` mullion ends. - `src/ifc/export_content.rs`: `space_containment`, past `SPACE_CONTAINMENT_BUDGET`. - All six run on the export's own thread, inside the notes `export_rvt_doc` and `run_export_with_limits_and_control` open. None runs on a saved-mesh worker, whose threads keep no notes. - `docs/export-diagnostics.md` names them and what each leaves out. With `ExportDiagnostics::work_budget_stops`, it says a count is how often a reader stopped on the open file, since an export made again adds the stops of a reader it runs again (rvtReview's note on #1849). - `changelog.d/security/1845-geometry-budget-stops.md`. - **38cbd20c, a stop is a warning:** - `ExportDiagnostics::is_partial` covers unread streams alone. `work_budget_stops` still lists the stops. - `rvt-ifc` and `rvt-gltf` print `warning: N reader(s) stopped at a work budget ...` with each reader, then write the model. `--allow-partial` and exit status 3 are for unread streams alone, and their help says so. - Python's `write_ifc` and `rvt_to_ifc` give a `RuntimeWarning` naming the stops (`warn_runtime`) and raise `ValueError` only for unread streams. - The MCP server's exports no longer refuse on a stop. Their notes say `Warning: <reader> stopped N time(s) ...`. - `docs/export-diagnostics.md`, `docs/python.md`, `python/rvt/__init__.pyi` and the 1833 and 1845 fragments follow. ## Testing - `rvt-write`: `tests/cli_real_files.rs` patches real files through the CLI with padded base64, which decodes the same. - The new decoding rule was checked in Python against its `base64` module: 1,200 padded and 1,200 unpadded random encodings round-trip, and `Q`, `QUJD=Q`, `Q=QQ` and `QUJDR` are refused. - No Rust test is added: the helper sits in a binary, whose unit tests CI does not run. - `rvt-dump`: no export changes. No file in the corpus has such a name. - Unfiltered Measure, timed, of `b6523d9c` against its merge-base `7693fc29` (samples, families, Nordic, Revit 2025, BIMcollab, rac_advanced, held-out): [43332394339](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43332394339). Rows registered before it ran: 1. Every `ifc.sha256` and `diagnostics.json` equals the base's, with no model missing either. A stop makes the export partial, and `rvt-ifc` then writes no model (exit 3), so a file that reached one of the new stops would show as a missing `ifc.sha256` and a diagnostics file gaining a `work_budget_reached` item, not as a moved export (rvtReview). One whose MEP system or curtain material came from an object outside the listing would move its export. 2. Timing: median head/base at or below 1.00 over the 2023 to 2027 samples, and no file above 1.03. 3. Peak memory is not judged from this run: Snowdon HVAC and Plumbing each land in one of two peaks run by run on the same code (rvtReview's control run 43329577007). - Unfiltered Measure, timed, of `c88338b1` (38cbd20 with main merged) against its merge-base `b411ca46`: [43349709171](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43349709171), with the same rows 1 to 3. No corpus file reaches a stop, so the warning path changes no export. - **43332394339, read against those rows: both hold.** 1. `ifc.sha256` is equal on 146 of 146 models and `diagnostics.json` on 121 of 121, with none missing and no `work_budget_reached` item in any. The scorer diff has only output the head alone writes. 2. Median head/base 0.994 (0.959 to 1.006) over the 29 samples of 2023 to 2027, none above 1.03. - Outside row 2's set, 2015 rac_advanced reads 1.038. On 2015 the change adds only a `budget::stopped` call that never fires, and the other 29 samples of 2015 to 2022 have a median of 1.006. No peak is more than 2% higher. - [ ] `tools/check-local.sh`: not run locally (no local builds); CI runs it - [x] `rustfmt --edition 2024 --check` ## Audit-honesty checklist - [x] No claim beyond what ships - [x] Changelog fragment - [x] No emojis or private paths ## Legal and contribution hygiene - [x] Apache-2.0; no Autodesk source ## Breaking changes None released. `rvt-write` refuses base64 text that ends in a lone character or holds `=` inside it, which it used to decode wrongly. A work-budget stop no longer makes an export partial: on `main` since #1849 it refused the export, a behaviour no release shipped. https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
This was referenced Nov 13, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Nov 13, 2026
… as its openings, so a crafted file cannot make a boolean chain deeper than Clone or Debug survives (#1845) (#1910) ## Summary A wall's edited elevation profile cuts its regions in the wall's body as a chain of boolean results, one level per region. This stops at 512: a wall with more keeps its regions as its openings (what a wall whose regions are not all solids already does) and has none cut in its body. ## Motivation The last open item of #1845 (after #1846 to #1848): the chain is written and meshed by a loop, but `SolidShape` is `Debug`, `Clone` and `Serialize` by derive and is dropped by the compiler's glue, each recursing over the chain. Measured on a 1 MiB thread (`probe_1845_boolean_chain_depth`, PR #1908, runs [43420945188](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43420945188) and [43422082815](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43422082815)): `debug` breaks at 3,072 levels, `clone` at 4,096, `drop` and `json` at 65,536; a profile of 4,096 curves can make 4,096 regions. My registered hypothesis (a 4,096-level chain survives all four) was wrong for `clone` and `debug`. Nothing in the export, glTF, scene graph or bindings clones or prints a model, so the hazard is a library consumer's. Rows and the reasoning against a balanced union are on [#1845](#1845 (comment)). ## Changes - `src/ifc/export_content/wall_profile.rs`: `MAX_BODY_CUTS` (512) and the check in `cut_profiles_from_bodies`. - `changelog.d/security/1845-body-cut-cap.md`. ## Testing Unit tests are banned in this repository, and no file or fixture here has a wall with more than 512 regions (`gen-fixture` makes scaffolds), so the changed path is not exercised end to end: - [x] Row 1 (registered on #1845): the unfiltered Measure ([43423122492](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43423122492), `31eb90b6` against `0c58ea68`) reads every export and every diagnostics file byte for byte as the base's: 146 of 146 and 121 of 121. No wall of the corpus has more than 512 cut regions. - [x] Row 2: the `same-project gates` check passes on `31eb90b6` (15 samples held to their earlier saves, and the Areas on 4 saves and on the 2021 save). - [ ] This PR's CI (I cannot build locally, so CI is the first compile of this change). - Not measured, and said so: a wall with more than 512 regions; the cap's effect on one is by reading (the existing `else { continue; }` of the same loop leaves a wall's regions as openings). ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR - [x] A user-visible change has its entry as a fragment under `changelog.d/security/` - N/A: no limitation resolved or introduced beyond the cap stated above - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files - N/A: no reverse-engineering finding ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content - [x] No new test fixtures ## Breaking changes None for any file here. A crafted file with more than 512 regions in one wall's profile writes that wall's body uncut, with its openings. ## Related issues Closes #1845 once row 1 holds.
DrunkOnJava
added a commit
that referenced
this pull request
Nov 13, 2026
…f up to a million boolean cuts on a 1 MiB stack, for the depth #1845 left unmeasured (#1908) ## Summary The probe behind #1910: `probe_1845_boolean_chain_depth` builds a chain of 1,024 to 65,536 boolean cuts by a loop and drops, clones, prints and serialises it on a thread of exactly 1 MiB (the viewer's wasm stack; a native thread stands in for it), in a child process for each so an overflow costs one line of output. No `src/` change, no export moves. ## Motivation #1845 item 2, after #1846 to #1848 wrote and meshed a boolean-cut chain by a loop: `SolidShape` is `Debug`, `Clone` and `Serialize` by derive and is dropped by the compiler's glue, and each recurses over the chain. The issue left open "whether that overflows the viewer's stack needs a build to say". Hypothesis, registered before the first run: a 4,096-level chain survives all four on 1 MiB. Result, which refutes it for two of the four (Measure [43420945188](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43420945188) and, at finer depths, [43422082815](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43422082815)): `drop` and `json` hold to 16,384 levels and break at 65,536; `clone` holds to 3,072 and breaks at 4,096; `debug` holds to 2,048 and breaks at 3,072. A profile of 4,096 curves can make 4,096 regions, one circle each. #1910 caps the regions cut in a wall's body at 512. ## Changes - `probes/examples/probe_1845_boolean_chain_depth.rs`. ## Testing - [x] This PR's CI (clippy over the probes crate is its compile; I cannot build locally): the fast jobs pass. - [x] Measure `-f probe=probe_1845_boolean_chain_depth -f probe_scorer=- -f models=einhoven -f base=none -f scorers=none`: read, posted on #1845 and written into the probe's doc. ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR (probe only) - [x] A user-visible change has its entry as a fragment under `changelog.d/`: none, a probe - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content - [x] No new test fixtures ## Related issues Refs #1845 (closed by #1910).
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
This takes #1845's classes 2 and 4: recursion depth a crafted file sets, and work with no cap before the allocation.
No real file should change; the Measure run checks that.
Motivation
Part of #1845 (classes 2 and 4; class 1 is #1846, class 3 #1847). Tendrils audit workers found these, a second worker confirmed each, and I re-read each against
main. The cut chain's verifiers marked it UNSURE:SKETCH_MAX_CURVEScaps it near 2,048 levels, and whether that overflows the viewer's stack needs a build. A loop removes the question.Changes
src/ifc/step_writer.rsemit_solid_shape,src/ifc/body_geometry.rssolid_mesh: aBooleanResultchain is walked down its first operand in a loop.src/ifc/scene_graph.rs: an element more thanMAX_HOST_DEPTH(16, the boundstep_writer::storey_ofalready follows) hosts below its storey hangs from its storey.src/ifc/export_content/wall_tops.rs:covered_piecesstops atMAX_COVERED_PARTS(1,024, 32 ×MAX_RISERS) parts, beforejoin_pieces, which is quadratic in them. The check after joining staysMAX_RISERS.embeddedstops at4 × MAX_RISERS, the boundstepsgives its own pieces, and returns as soon as nothing is left.src/ifc/body_geometry.rsenvelope_slab_mesh:MAX_ENVELOPE_POINTS(16 a piece at the piece cap). A sliver split adds points but no piece.src/ifc/mesh_volume.rspartner_ends: a grid cell holding more than 64 mullion ends is no evidence, and its ends count as continued by none.src/ifc/export_content.rscontain_in_spaces: each storey's spaces are indexed, where each content scanned the model's. The outline vertices tested are held toSPACE_CONTAINMENT_BUDGET(1e9, five times a storey of 1,000 rooms under 10,000 pieces); past it nothing is contained in a space.changelog.d/security/1845-depth-and-caps.md.Testing
Unfiltered Measure against the merge-base
8421e655on62ade122(samples, families, Nordic, Revit 2025, BIMcollab, rac_advanced, held-out): 43317002875.Not measured: the scene graph, which the viewer and the tree JSON read. No run hashes it. A real model's host chains are one or two deep.
No repro. Each needs a crafted file of thousands of elements. Each was verified by reading.
tools/check-local.sh: not run locally (no local builds); CI runs itReal files: the unfiltered Measure
Audit-honesty checklist
Legal and contribution hygiene
Breaking changes
None.
MAX_ENVELOPE_POINTSis a new public constant besideMAX_ENVELOPE_PIECES. The rest is private.https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge