Skip to content

fix(formats): strip Formats/Latest's checksum pages and read the whole schema (#410) - #412

Merged
DrunkOnJava merged 1 commit into
mainfrom
fix/formats-page-strip
Sep 27, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
fix/formats-page-strip

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #410. Completes the Formats/Latest half of #151.

What changes

  • compression::is_checksum_paged_stream includes Formats/Latest, so every reader of the schema (RevitFile::schema, the walker, the partition scanner, rvt-analyze, the diagnostics) inflates it page-stripped.
  • formats::parse_schema scans the whole stream. SCHEMA_SCAN_LIMIT stays as a constant for parse_schema_with_scan_limit, which the probe uses to show the old 64 KB window.
  • diagnose_formats_latest_integrity reports ok only when the stripped stream's gzip CRC32 and ISIZE trailer verifies, uncertain (RVT_FORMATS_MULTIPAGE_UNVERIFIED) when it inflates but does not verify, incomplete when it does not inflate. Accepting the strip on that condition is rosejn's idea from feat(parser): add native model attributes and geometry extraction #255.

Evidence

examples/probe_schema_page_strip.rs (rewritten) over the 11 sample families and the project corpus:

  • Checksums. The stream ends in a real gzip trailer. After the strip it verifies on all 23 files measured; unstripped it fails on all 23.
  • Cross-file identity. Stripped, every file of one release inflates to the byte-identical schema: 2023 (4 files) bce7907b…, 2024 (5) 0bfb947b…, 2025 (8) c964f9aa…. Unstripped, a family and a project of the same release differ.
  • What the parser reads (classes / fields / unclassified):
first 64 KB (before) whole stream, unstripped whole stream, stripped (after)
2016 family 498 / 1,402 / 0 1,718 / 4,890 / 200 3,490 / 9,932 / 10
2024 family, Core Interior, Snowdon 395 / 1,114 / 0 1,354–1,612 / 3,454–4,217 / 221–590 4,126 / 11,562 / 9
2026 family 349 / 1,061 / 0 1,715 / 3,862 / 443 4,285 / 12,144 / 10

Across the 11 releases: 122,107 fields (before: 13,570). The 64 KB cap was hiding drift, not "binary object data".

  • No output change. IFC exports of Core Interior, the four RE1 models, Einhoven and Snowdon Towers are identical before and after, GlobalIds and header timestamps aside. Both Core Interior OctetProof verdicts replay PASS with three matches; the rvt-rs observations are refreshed because they no longer carry the "multipage integrity uncertain" warning.
  • rvt-inspect --json now reports checksum_tail_stripping: enabled, integrity_status: ok for Formats/Latest on the 2026 family and Core Interior.

Tests changed, not added

  • tests/field_type_coverage.rs inflated with the unstripped call; it now uses the gated one and fails on any Unknown field outside a listed residual of 14 fields (9 to 12 per release: 0e 04, 0e 13, 0e 53, 0e 54 pointer and collection modifiers, a 0a kind, 04 00 04 00). The old "zero Unknown" gate held only because it saw 64 KB.
  • tests/checksum_page_framing.rs and the compression unit tests pinned Formats/Latest as ungated; they now assert it round-trips through the strip, and that a stream without a verifying trailer is uncertain.

Checks

  • tools/check-local.sh: passed (204 suites) before the trailer check; compression tests, clippy and the corpus-gated checksum_page_framing, json_schema_contracts, field_type_coverage, support_matrix rerun after it.
  • All 48 integration test binaries with RVT_SAMPLES_DIR and RVT_PROJECT_CORPUS_DIR set: passed.

Public claims corrected

README, docs/support-matrix.json, docs/compatibility.md, docs/status.md, ROADMAP.md: the schema figures, and RE-20's note that Level is absent from the schema, which was an artifact of the 64 KB scan (Level is class 2422 of Revit 2024's schema; storeys already come from element records, so nothing else changes).

Follow-ups

Legal and contribution hygiene


Note

Medium Risk
Changes core decompression for every schema consumer; behavior is gated by trailer verification and broad tests, but wrong strip logic would affect all class/field introspection downstream.

Overview
Formats/Latest is inflated with the same checksum-page strip as Partitions and Global streams, fixing silent drift past ~140 KB that made unstripped inflation look valid while corrupting the tail. Production paths that already call inflate_stream_at (e.g. RevitFile::schema, walker, probes) therefore get the full, release-consistent schema instead of a truncated or garbage tail.

Schema parsing and CI gates move to the whole stream: parse_schema scans all decompressed bytes (64 KB limit kept only via parse_schema_with_scan_limit for comparisons). field_type_coverage inflates through the gated path, expects ~122k fields corpus-wide, and allows a documented RESIDUAL set of 9–12 unclassified encodings per release. diagnose_formats_latest_integrity marks integrity ok when the stripped member’s gzip CRC32/ISIZE verify, otherwise uncertain with RVT_FORMATS_MULTIPAGE_UNVERIFIED; witness JSON drops the old multipage warning.

Docs and README correct prior “100% field classification” and “Level absent from Formats” claims (artifacts of the 64 KB window). IFC exports on measured corpora are unchanged.

Reviewed by Cursor Bugbot for commit eb6f20b3f73e8b68884f9dab7a69326d72328cc4. Configure here.

@cursor

cursor Bot commented Sep 27, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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_07ef7b8e-8344-48ba-a719-d62b05958d0e)

DrunkOnJava added a commit that referenced this pull request Sep 27, 2026
… printable from rvt-capabilities --matrix (#404) (#413)

Closes #404.

## What changes

- **README top**: one statement of what rvt-rs is (a reader, measured
model by model, not a converter), a table of what you can rely on per
input (2024/2025 projects, 2026, 2023 and earlier, families), and
typical uses. Separates `main` from the latest release (v0.2.0) and
points at `[Unreleased]`.
- **Stale README rows fixed**: "on real project files the walker only
recovers HostObjAttr ... proxies", "rectangular profiles only", "no
curved, sloped or B-rep geometry", "Export IFC produces the scaffold
(not typed elements)", "openings ✓" (they are the door's box, #227),
"`rvt-ifc` scaffold by default" (the mode is an acceptance bar, not a
decode limit).
- **`docs/supported-profile.md`** rewritten for BIM users: four levels
(opened, elements identified, geometry, properties), per-input and
per-category tables with the measured figures, what an approximation
looks like in the output, and how to report a problem without sharing
the building.
- **`docs/status.md`**: a short current summary; the long per-finding
narrative is kept under "Finding history" (later paragraphs win); its
hand-maintained capability table is replaced by the support matrix; the
roadmap no longer says "0.2.0 release hold, crate 0.1.x".
- **One capability source**: `rvt-capabilities --matrix` (`-f text` or
JSON) prints `docs/support-matrix.json` from any build
(`rvt::capability::SUPPORT_MATRIX_JSON`), so the 54-row matrix, not a
separate 8-row manifest, is what a user sees. The default
`rvt-capabilities` output is unchanged.

## Checks

- `cargo fmt --check`, `cargo clippy --all-targets --all-features -D
warnings`.
- `support_matrix`, `binary_inventory`, `json_schema_contracts` (with
the family corpus): pass.
- `rvt-capabilities --matrix -f text` prints 54 capabilities;
`rvt-capabilities --matrix` parses as JSON with 54.

Every figure quoted is one the README's measured tables or the support
matrix already carry. #412 updates the schema figures separately;
whichever lands second rebases.

## Legal and contribution hygiene

- [x] Apache-2.0; documentation and a CLI flag only.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation and a read-only CLI flag only; no decode, export, or
runtime behavior changes.
> 
> **Overview**
> Unifies **what rvt-rs claims it can do** across the README,
`docs/status.md`, and `docs/supported-profile.md`, and makes
**`docs/support-matrix.json`** the single machine-readable source
(`SUPPORT_MATRIX_JSON` in `src/capability.rs`).
> 
> The **README** now leads with a reader (not universal converter)
story, a **per-input reliability table** (2024/2025 vs older releases vs
families), typical uses, and **`main` vs v0.2.0** / `[Unreleased]`. It
**corrects outdated capability rows** (typed 2024/2025 elements from
partition records, partial geometry/openings, viewer IFC on recent
projects, `rvt-ifc` modes as quality gates).
> 
> **`supported-profile.md`** is rewritten for BIM users: four levels
(opened → elements → geometry → properties), measured geometry/property
tables, and how diagnostics and export modes behave.
> 
> **`status.md`** adds a short current summary, labels the long
narrative **Finding history**, **drops the hand-maintained capability
table** in favor of the support matrix + `rvt-capabilities --matrix`,
and **updates the roadmap** (v0.2.0 shipped, v0.3.0 drafted).
> 
> **`rvt-capabilities --matrix`** prints the full 54-row matrix as JSON
or human-readable text; default manifest output is unchanged.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4b41be5. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…e schema (#410)

Formats/Latest is stored in checksum pages like the database streams but
was inflated without the strip, so it drifted after about 140 KB while
still decoding cleanly, and schema parsing stopped at 64 KB to keep the
drift out. Stripped, its gzip CRC32 and ISIZE verify on all 23 files
measured (they fail unstripped on all 23) and every file of one release
inflates to the byte-identical schema. rvt-rs now reads all of it: 4,126
classes and 11,562 fields on Revit 2024 instead of 395 and 1,114. The
integrity diagnostic reports ok only when the trailer verifies, as #255
proposed. IFC output is unchanged on every corpus file.

Credit: STE1200 (Discussion #112) for the page layout and grammar, rosejn
(#255) for accepting the strip on a verifying trailer.
@DrunkOnJava
DrunkOnJava force-pushed the fix/formats-page-strip branch from eb6f20b to 86551d1 Compare September 27, 2026 20:09
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) September 27, 2026 20:09
@DrunkOnJava
DrunkOnJava merged commit 630f140 into main Sep 27, 2026
21 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/formats-page-strip branch September 27, 2026 20:11
DrunkOnJava added a commit that referenced this pull request Sep 27, 2026
… definition ordinal (#154, #223) (RE-76) (#416)

Part of #154; answers #223. Report:
`reports/element-framing/RE-76-schema-class-tags.md`. Probe:
`examples/probe_re76_schema_class_tags.rs`.

## What changes

- `formats::schema_classes` / `RevitFile::schema_classes`: the
`Formats/Latest` grammar, reading the whole page-stripped stream (#410)
and giving every class its serialization tag, the definition ordinal (12
first, one more per top-level or inline definition; inline references
repeat their tag, so a misread stops the parse). Bounded nesting, no
panics on hostile input.
- `PartitionElementRecord::class_tag`: the `u16` at `+0x4a`.
- Every record-backed element gets `RevitClass` in
`RvtElementRecordGeometry`.

## Evidence

| | classes | stopped |
|---|---|---|
| 2016 family | 3,792 (tags 12..3803) | end of stream |
| Core Interior, Snowdon (2024) | 4,492 (12..4503) | end of stream |
| RE1 Architecture (2025) | 4,600 (12..4611) | end of stream |
| 2026 family | 4,690 (12..4701) | end of stream |

Every record of ten categories resolves, to the class a BIM user
expects: walls `SWall` / `ArcWall` / `FaceWall`, floors `Floor`, rooms
`RoomElem`, roofs `ProfileRoof`, stairs `StairsElement`, ceilings
`Ceiling`, families `FamilyInstance` or, for type symbols,
`FamilySymbol`. Independent check: Snowdon's 32 `ArcWall` records are
exactly the 32 walls RE-75 found storing an arc (24 exported).

`RevitClass` on export: Core Interior 970 of 970, RE1 Architecture 85 of
85, Snowdon Towers 6,081 of 6,081. The only other IFC change is that
property. Both Core Interior verdicts replay PASS with refreshed rvt-rs
observations (+970 `IFCPROPERTYSINGLEVALUE`).

## Not changed

`SchemaTable.tag`, `class_tag_map` and the `Global/Latest` walker still
use the `u16` after each class name, which is the base-class reference;
moving them changes the walker's input and stays in #154.

## Checks

`tools/check-local.sh` (205 suites) and all 48 corpus-gated integration
test binaries before rebasing onto #412's squash; after it, fmt and
`support_matrix`, `field_type_coverage`, `json_schema_contracts`,
`element_records_2025` with the corpora.

## Legal and contribution hygiene

- [x] Apache-2.0. Grammar and the `+0x4a` reading credited to STE1200
(Discussion #112, public Apache-2.0 scripts), `+0x46` to jakobhirn-bit
(same thread), ordinal numbering also in rosejn's #255. Implemented
independently in Rust; no Autodesk or ODA material.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches core partition decode and IFC property emission; schema
grammar parsing is new surface area but fail-closed on parse errors and
does not alter geometry or GlobalId behavior.
> 
> **Overview**
> **Adds Revit-native class names to record-backed elements** by parsing
`Formats/Latest` with a grammar that assigns each class a
**serialization tag** (definition ordinal from 12 upward), then
resolving the `u16` at partition element record **`+0x4a`** against that
table.
> 
> New **`formats::schema_classes`** / **`RevitFile::schema_classes`**
expose the class list; **`PartitionElementRecord::class_tag`** carries
the raw tag. During MVP decode, **`attach_revit_classes`** maps tags to
names like `SWall`, `ArcWall`, `FaceWall`, `Floor`, `FamilyInstance`,
and `FamilySymbol`. IFC export writes a **`RevitClass`** text property
on each element’s geometry property set (Core Interior +970
`IFCPROPERTYSINGLEVALUE`; witness hashes refreshed).
> 
> **`SchemaTable.tag`**, **`class_tag_map`**, and the
**`Global/Latest`** walker are **unchanged**—they still use the `u16`
after each class name (base reference), not the definition ordinal.
> 
> Docs: CHANGELOG, support-matrix row `element-record-revit-class`,
RE-76 report, and **`probe_re76_schema_class_tags`** example.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
48bd6505a45516c332d763d9d8f775a043894875. 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.

Formats/Latest is inflated without the page strip; the schema drifts after ~140 KB in every file and parsing stops at 64 KB to hide it

1 participant