Repository navigation
fix(rvt-dump): write exactly the bytes the parsers read - #291
Merged
Merged
Conversation
rvt-dump inflated every stream without stripping Revit's per-page checksum trailers. A multi-page stream either failed outright (Snowdon Towers' Global/ElemTable was reported as "no gzip magic found") or lost every gzip member straddling a page boundary (that file's Partitions/68 came out 10.5 MB short), and partitions were joined with 16-byte 0xFF separators, so dump offsets never matched the scanners' or the reports'. Non-partition streams now go through prepare_stream_for_inflate before inflating; Partitions_NN.decomp is RevitFile::inflated_partition verbatim, with the gzip member count printed. Empty, uncompressed and failed streams are reported as such. tests/rvt_dump_cli.rs pins byte equality with the library view on the tier-1 fixture and, corpus-gated, on 2024_Core_Interior.rvt (ElemTable 1,057,030 bytes).
DrunkOnJava
enabled auto-merge (squash)
September 22, 2026 20:14
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_02bf09d8-ee72-40be-a04f-b63b2d9559c7) |
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
rvt-dumpnow writes exactly the bytes the parsers read. Before this, multi-page streams failed or lost data, and partition offsets never lined up with the offsets used by the scanners and by thereports/write-ups.Motivation
rvt-dumpis the reverse-engineering entry point: dump the streams, then hex-dump or diff them. It inflated every stream without stripping Revit's per-page checksum trailers (65,249-byte pages carrying a 64,896-byte payload). That caused three problems:Global/ElemTable(275,077 bytes stored) failed to inflate and was reported as "no gzip magic found".Partitions/68lost every gzip member that straddled a page boundary and came out 10.5 MB short (431,609,166 bytes including separators, against 442,153,012 real).0xFFseparators, so no offset in a dump matchedRevitFile::inflated_partition.Changes
src/bin/rvt_dump.rs:compression::prepare_stream_for_inflate(page-aware) before inflating.Partitions_NN.decompisRevitFile::inflated_partitionverbatim, and the gzip member count is printed.tests/rvt_dump_cli.rs(new): byte equality with the library view on the tier-1 fixture. Corpus-gated on2024_Core_Interior.rvt: every partition matches and ElemTable is 1,057,030 bytes, the length the parser reads.Testing
cargo test --profile ci --test rvt_dump_cli --test cli_ergonomicswithRVT_PROJECT_CORPUS_DIR(9 passed)cargo clippy --all-targets --all-features -D warnings,cargo +1.85.0 check --all-targets(MSRV)rvt-elem-table), andPartitions/68dumps 442,153,012 bytes in 4,604 membersAudit-honesty checklist
Legal and contribution hygiene
CONTRIBUTING.md)CLEANROOM.md)Breaking changes
Partitions_NN.decompno longer contains 16-byte0xFFseparators between gzip members. Offsets now match the library and the reports.Note
Medium Risk
Changes decompression semantics and partition
.decomplayout (offset compatibility improves but old separator-based tooling breaks); behavior is regression-tested against the library view.Overview
rvt-dumpnow emits the same decompressed bytes the library parsers consume, instead of raw gzip inflation that ignored Revit’s paged-stream framing.Non-partition streams go through
compression::prepare_stream_for_inflatebefore inflate;Partitions/*useRevitFile::inflated_partitiondirectly, so.decompoutput is a straight concatenation of gzip members with no 16-byte0xFFseparators (breaking change for anyone who relied on the old layout). CLI logging distinguishes empty, not compressed, and inflate-failed streams, and prints gzip member counts when relevant.tests/rvt_dump_cli.rsrunsrvt-dumpon the tier-1 fixture and (whenRVT_PROJECT_CORPUS_DIRis set) on Core Interior, asserting partition dumps match the library andGlobal_ElemTable.decomplength matches the ElemTable header. CHANGELOG documents the fix.Reviewed by Cursor Bugbot for commit 6bc6198. Configure here.