Skip to content

check: B53 CLI tests without faults (scratch, do not merge) - #650

Closed
DrunkOnJava wants to merge 2 commits into
mainfrom
check/b53-without-faults
Closed

DrunkOnJava wants to merge 2 commits into
mainfrom
check/b53-without-faults

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Scratch: B53's tests on main's binaries, to see which pass before the red record is made. Deleted afterwards.


Note

Low Risk
Test and CI manifest changes only; no production CLI or library behavior is modified.

Overview
Adds B53 end-to-end CLI coverage via new integration target cli_real_files, which runs six shipped binaries (rvt-elem-table, rvt-history, rvt-analyze, rvt-diff, rvt-ifc-compare, rvt-write) against real family/project corpora (RVT_SAMPLES_DIR, RVT_PROJECT_CORPUS_DIR) and asserts JSON/output contracts (record counts, release ordering, self-diff identity, IFC compare exit codes, write round-trip). Tests skip when corpus paths or specific project files are missing.

Registers cli_real_files under the cli class in tools/ci/test-targets.txt so CI and the local gate run the new target alongside existing CLI tests.

Reviewed by Cursor Bugbot for commit c195f55. Configure here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Write test uses CRC gzip decoder
    • Replaced native_document::read_single (flate2 GzDecoder) with compression::inflate_stream_at so post-write verification matches rvt-write’s truncated-gzip decode path.

Create PR

Or push these changes by commenting:

@cursor push ff8df26909
Preview (ff8df26909)
diff --git a/tests/cli_real_files.rs b/tests/cli_real_files.rs
--- a/tests/cli_real_files.rs
+++ b/tests/cli_real_files.rs
@@ -301,7 +301,9 @@
     }
     let stream = "Formats/Latest";
     let mut rf = rvt::RevitFile::open(&source).expect("open source");
-    let decoded = rvt::native_document::read_single(&mut rf, stream).expect("decode source stream");
+    let source_raw = rf.read_stream(stream).expect("read source stream");
+    let decoded =
+        rvt::compression::inflate_stream_at(stream, &source_raw, 0).expect("decode source stream");
     let dir = scratch("write");
     let manifest = dir.join("patches.json");
     let patches = serde_json::json!({
@@ -325,8 +327,10 @@
         ),
     );
     let mut written = rvt::RevitFile::open(&target).expect("open written file");
+    let written_raw = written.read_stream(stream).expect("read written stream");
     assert_eq!(
-        rvt::native_document::read_single(&mut written, stream).expect("decode written stream"),
+        rvt::compression::inflate_stream_at(stream, &written_raw, 0)
+            .expect("decode written stream"),
         decoded,
         "{stream} decodes to other bytes after the round trip"
     );

You can send follow-ups to the cloud agent here.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c195f55. Configure here.

Comment thread tests/cli_real_files.rs Outdated
assert_eq!(
rvt::native_document::read_single(&mut written, stream).expect("decode written stream"),
decoded,
"{stream} decodes to other bytes after the round trip"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write test uses CRC gzip decoder

Medium Severity

The rvt-write check re-reads the patched Formats/Latest stream with native_document::read_single, which runs GzDecoder and rejects the CRC-less truncated gzip that rvt-write actually emits. Writer verification uses bare inflate_at, so a successful identity patch can still fail this assertion on main.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by learned rule: #160/#151: production inflate strips page trailers

Reviewed by Cursor Bugbot for commit c195f55. Configure here.

@DrunkOnJava

Copy link
Copy Markdown
Owner Author

The fault-free run found B69; recorded in #653.

@DrunkOnJava DrunkOnJava closed this Oct 4, 2026
@DrunkOnJava
DrunkOnJava deleted the check/b53-without-faults branch October 4, 2026 16:25
DrunkOnJava added a commit that referenced this pull request Oct 4, 2026
…uses a patch spanning a checksummed page (B53, B69) (#653)

B53: tests/cli_real_files.rs gives rvt-elem-table, rvt-history,
rvt-analyze, rvt-diff, rvt-ifc-compare and rvt-write their first
real-file checks (family corpus and RE1 Architecture with Revit's
export). Red with one injected fault per binary on draft #648 (run
37213954071); the outputs are in the test commit.

B69: without faults (draft #650, run 37213958029) the rvt-write test
failed on main: an identity patch of a family's Formats/Latest exited 0
and the stream read back as 'unexpected end of file'. Revit stores these
streams in 65,249-byte pages, each ending in a 353-byte checksum rvt-rs
cannot compute, and the reader strips one at every full page. The writer
now refuses (Error::WriteRefused) a patch whose stored bytes reach a
full page, instead of writing a stream no reader can decode.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes core write-path behavior for common streams and adds broad CLI
corpus tests that gate CI when corpora are present.
> 
> **Overview**
> **rvt-write (B69)** now **refuses** patches whose framed stored bytes
would reach a full **65,249-byte checksummed page** on paged streams
such as `Formats/Latest` and `Global/Latest`, returning
**`Error::WriteRefused`** (`write refused: ...`) **before** any output
file is touched. Patches are framed up front via
**`framed_patch_bytes`**, so a refusal cannot leave a “success” file
whose stream no longer decodes.
> 
> **Testing (B53)** adds **`tests/cli_real_files.rs`**, running
**`rvt-elem-table`**, **`rvt-history`**, **`rvt-analyze`**,
**`rvt-diff`**, **`rvt-ifc-compare`**, and **`rvt-write`** end-to-end on
the family/project corpora (with skips when fixtures are missing). The
**`rvt-write`** case identity-patches those two streams and asserts
either a clean read-back with unchanged other streams, or a page-related
refusal with no output file.
> 
> The user guide documents the page limit;
**`tools/ci/test-targets.txt`** registers **`cli_real_files`** under the
**cli** CI class.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
7ed09d3. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant