Repository navigation
fix(cli): rvt-write decodes unpadded base64 to its bytes, and rvt-dump writes streams whose names Windows refuses (#1845) - #1855
Merged
Conversation
… it holds (#1845) decode_base64 read every group as three bytes once the padding was gone, so an unpadded last group of two or three characters patched the stream with one or two zero bytes the manifest never gave, and an `=` inside the text decoded as zeros. Padding now pads only the end, a group of n characters holds n - 1 bytes, and text ending in a lone character is refused. A padded manifest decodes as before (the CLI test's encoder pads); 1,200 padded and 1,200 unpadded random encodings round-trip through the same algorithm in Python against its base64 module. Found by reading the ten binaries batch 4's CLI auditor did not reach. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
…ws refuses in a file name (#1845) A stream's name is the file's own, and rvt-dump wrote it as a file name with only `/` replaced. The cfb crate refuses `\`, `:` and `!` in entry names, so no name leaves --out, but `<>"|?*` or a control character failed the write on Windows and stopped the dump at that stream. They become `_` as `/` does; Revit's own stream names hold none, so their files keep their names. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
…ows accepts, device names and repeats included (#1845) From rvtReview's read of #1855. A stream named for a device Windows reserves (CON, NUL, COM1 and the like, whatever follows the first dot) failed or misbehaved as a file name: it takes a `_` in front. Two stream names that map to one file name (`a?b`, `a*b`, `a_b`, or names differing only in case on a case-insensitive file system) wrote the same file, the later replacing the earlier silently: a repeat takes `~2`, `~3` and so on, and the dump's listing names each stream's file. A trailing dot or space cannot end the file name, since `.decomp` or `.raw` follows it. Revit's own stream names hold none of these and none collide. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
…COM and LPT ports Windows reserves (#1845) rvtReview's note on #1855: the superscript ports are five bytes long, so the four-byte length test missed them. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
…rom the stream's listed data objects, not an Adler-32 of every object around each class-word hit (#1833) Verifying the object around every place its class word occurs cost a full Adler-32 of the payload per hit, quadratic on a crafted stream. The listed objects (memoised_partition_data_objects) are the same ones: a census of the local corpus (RE1 x4, Einhoven, rac_advanced 2024, Core Interior) finds 349,320 verified data objects, every one in the listing, none nested in another's payload. The loops keep their order, tag first, then offset, since the first class and the last material read win. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
…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
marked this pull request as ready for review
November 13, 2026 01:52
…itten, with a warning, and only an unread stream makes it partial (#1833, #1845) Griffin, 2026-11-12, asked whether an export that trips one of the new stops should still be written: "Write it, with a warning". #1849 had made any stop refuse the whole export (rvt-ifc and rvt-gltf exit 3 with no model, Python raised, the MCP server refused), so one stop on a dense curtain-wall grid would have blocked a real model. ExportDiagnostics::is_partial now covers unread streams alone. rvt-ifc and rvt-gltf print the stops as a warning and write the model; Python's write_ifc and rvt_to_ifc give a RuntimeWarning; the MCP server's notes name them. The diagnostics, the docs and the 1833 and 1845 fragments say so.
DrunkOnJava
added a commit
that referenced
this pull request
Nov 13, 2026
## Summary Release metadata for v0.20.0 (RELEASE.md, steps 4 to 7), cut from `main` at `925c482d` and merged with `main` up to `58395b62` (#1855, #1860, #1861, #1863, #1866, #1867 and #1868 among it): - every version file moves to 0.20.0 (`tools/release/bump_version.py`), and `CITATION.cff` is dated 2026-11-12; - the fragments under `changelog.d/` are assembled into a `[0.20.0]` section, with its introduction and "Upgrading from 0.19" (the work-budget bullet says a stop warns and the export is still written, as #1855 settled); - the README's release lines name v0.20.0; - Core Interior's two witness observations and verdicts, and the two synthetic IFC fixtures, are taken from CI's artifacts for `e10580d0`: only `witness_version`, the verdict hashes, the retired "Unmapped Revit unit identifiers" warning (RE-445) and an unset transparency (#1820) differ. Measured and rehearsed: - the comparison with 0.19.0 is in the section, from Measure runs [43357862138](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43357862138) (unfiltered, `58395b62` against `v0.19.0`'s `09b18bd3`: 49 of 146 exports move, 0 census regressions, 0 body regressions) and [43357979238](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43357979238) (timing: no file more than 3% slower except one that reads 0.98 in the earlier run of the same code, no peak higher by more than 2%, the samples of 2023 to 2027 at a median 0.76 times the peak memory). The release adds only notes, witness files, version strings and fixtures to `58395b62`, so a run of `main` is the run of the release; a run of this branch would move every export through the header's version string; - `publish.yml` rehearsal on `d9946f4b`: [43359414819](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43359414819) passed. Only the changelog changed since. **Why now.** `main` holds today's crafted-file and security fixes (#1815, #1831, #1833, #1845), and neither GlobalId move. #1850 is back in draft until the tag, and #1854's fix is #1859. Those two ship together in 0.21.0 (#1854 comment 6841360704). ## Testing - `python3 tools/release/changelog.py check` passes: no fragment is left. - `bump_version.py` checks the version files with the preflight's own `check_versions`. - The PII guard runs `release_preflight.py` on this PR. - Timing against 0.19.0 is in the section, from run 43357979238 on `58395b62`. ## Related issues Release 0.20.0. Milestone `0.20.0`.
DrunkOnJava
added a commit
that referenced
this pull request
Nov 13, 2026
…ble, not a ValueError (#1855) (#1880) ## Summary `docs/python.md`'s errors table still listed "a reader stopped at its work budget" among the causes of `ValueError`. Since #1855 (0.20.0), a work-budget stop is a `RuntimeWarning` and the export is still written. The same page's `write_ifc` section (line 136) and `python/rvt/__init__.pyi` already say so. This PR removes the clause from the `ValueError` row and adds a `RuntimeWarning` row. Found by batch 5's Python audit, finding 1 (confirmed by its verifier and by me against `rvt-py/src/lib.rs`, where a stop goes to `warn_runtime` and the `ValueError` covers unread streams only). ## Testing Docs only; no code or output changes, so no Measure. `rg -U 'work\s+budget'` over docs, python, rvt-py, rvt-mcp and src/bin finds no other place that says a stop refuses or raises.
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
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-writedecoded 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-dumpstopped 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_systemsandpartition_curtain_materialsverified 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 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 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 fix(research): pipe connectors, curve fields, room parameters and solids, sketch loops, empty faces, parameter bindings and family mesh checks are read through an index or under a work budget, so a crafted file cannot hang them (#1833) #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". fix(research): pipe connectors, curve fields, room parameters and solids, sketch loops, empty faces, parameter bindings and family mesh checks are read through an index or under a work budget, so a crafted file cannot hang them (#1833) #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.rsdecode_base64:=pads only the end, and a group of n characters (2 to 4) holds n − 1 bytes.=inside it.src/bin/rvt_dump.rsfile_stem_for, the file name each stream is written under:<>"|?*and control characters become_, as/does.CON,PRN,AUX,NUL,CONIN$,CONOUT$,COM0–9andLPT0–9, the superscriptCOM¹–³andLPT¹–³, whatever follows the first.) takes a_in front.~2,~3and so on (rvtReview's two notes)..decompor.rawfollows it.\,:and!in entry names (direntry.rsvalidates every name it reads), so no name leaves--out.changelog.d/fixed/1845-cli-base64-and-dump-names.md.src/research/partition_mep_systems.rsandsrc/research/partition_curtain_materials.rs: each stream's objects of the wanted classes come from its listed data objects.budget::stoppedat 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's bounds:src/ifc/export_content/wall_tops.rs:wall_top_pieces(the cut pieces or the pieces held past4 × MAX_RISERS),wall_top_covered_parts(MAX_COVERED_PARTS), andwall_top_embedded_pieces(the stub test's pieces past4 × 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 thanMAX_ENDS_PER_CELLmullion ends.src/ifc/export_content.rs:space_containment, pastSPACE_CONTAINMENT_BUDGET.export_rvt_docandrun_export_with_limits_and_controlopen. None runs on a saved-mesh worker, whose threads keep no notes.docs/export-diagnostics.mdnames them and what each leaves out. WithExportDiagnostics::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 fix(research): pipe connectors, curve fields, room parameters and solids, sketch loops, empty faces, parameter bindings and family mesh checks are read through an index or under a work budget, so a crafted file cannot hang them (#1833) #1849).changelog.d/security/1845-geometry-budget-stops.md.38cbd20, a stop is a warning:
ExportDiagnostics::is_partialcovers unread streams alone.work_budget_stopsstill lists the stops.rvt-ifcandrvt-gltfprintwarning: N reader(s) stopped at a work budget ...with each reader, then write the model.--allow-partialand exit status 3 are for unread streams alone, and their help says so.write_ifcandrvt_to_ifcgive aRuntimeWarningnaming the stops (warn_runtime) and raiseValueErroronly for unread streams.Warning: <reader> stopped N time(s) ....docs/export-diagnostics.md,docs/python.md,python/rvt/__init__.pyiand the 1833 and 1845 fragments follow.Testing
rvt-write:tests/cli_real_files.rspatches real files through the CLI with padded base64, which decodes the same.base64module: 1,200 padded and 1,200 unpadded random encodings round-trip, andQ,QUJD=Q,Q=QQandQUJDRare refused.rvt-dump: no export changes. No file in the corpus has such a name.Unfiltered Measure, timed, of
b6523d9cagainst its merge-base7693fc29(samples, families, Nordic, Revit 2025, BIMcollab, rac_advanced, held-out): 43332394339. Rows registered before it ran:ifc.sha256anddiagnostics.jsonequals the base's, with no model missing either. A stop makes the export partial, andrvt-ifcthen writes no model (exit 3), so a file that reached one of the new stops would show as a missingifc.sha256and a diagnostics file gaining awork_budget_reacheditem, not as a moved export (rvtReview). One whose MEP system or curtain material came from an object outside the listing would move its export.Unfiltered Measure, timed, of
c88338b1(38cbd20 with main merged) against its merge-baseb411ca46: 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.
ifc.sha256is equal on 146 of 146 models anddiagnostics.jsonon 121 of 121, with none missing and nowork_budget_reacheditem in any. The scorer diff has only output the head alone writes.budget::stoppedcall 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 itrustfmt --edition 2024 --checkAudit-honesty checklist
Legal and contribution hygiene
Breaking changes
None released.
rvt-writerefuses 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: onmainsince #1849 it refused the export, a behaviour no release shipped.https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge