Repository navigation
feat(formats)!: classify the residual Formats/Latest field encodings, and show Revit 2027's flagged fields hold no instance bytes (#1196) (RE-323) - #1309
Merged
Conversation
…agged fields' instances (#1196) (RE-323)
…its proposed layout and prints the clipped windows (#1196)
…lagged i32 of the schema, and read a field's type past the scan window (#1196) (RE-323) FieldType gains PointerArray (0e 13, GEdge's three face/edge arrays) and PointerContainer (0e 53, 0e 54), appended to the non-exhaustive enum; Flagged takes byte 2 = 0x04 (VarExpr::m_refCt). The scan now decodes a field's type from the stream rather than from its class's 4,096-byte scan window, which clipped ZoningAppInfo::first to two bytes. The walker reads the new variants as it read them when they were Unknown.
…d fail on a residual entry that no longer decodes Unknown (#1196) (RE-323) The scan files a class's fields after an inline class definition under that inline class (GEdge's under GInfo, VarSketchDimObj's under VarSketchObj, VarExpr's under VarFunction), so the residual names it gives are not the classes that declare the fields. tests/field_type_coverage.rs now also reads each schema with schema_registry and keeps RESIDUAL_GRAMMAR by the declaring classes; RESIDUAL shrinks to the three fields RE-323 could not classify.
… twelve; the probe counts the flagged fields the scan misses (#1196) (RE-323)
…d Revit 2027's flagged fields (#1196)
DrunkOnJava
marked this pull request as ready for review
November 4, 2026 02:09
DrunkOnJava
enabled auto-merge (squash)
November 4, 2026 02:09
Owner
Author
|
Automated Claude Code review (the maintainer's review agent; it read the code, the gate and the probe artifacts): no blocking items. The field-type coverage gate is not loosened: each of the 11 names it drops now decodes to a typed encoding, and a new |
11 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Nov 4, 2026
…#1196) (RE-325) (#1315) ## Summary A `Formats/Latest` descriptor with base byte 2 (the C++ `char`) is 1 byte in an instance and base byte 3 (`short`) is 2; `FieldType::decode` gave them 2 and 4, and the walker read the first as a `u16`. The native graph decoder had them right. This measures the widths from instance bytes and corrects the classifier, the walker and the docs (RE-325). ## Motivation #1196. RE-323 (#1309) found the native decoder reading base 2 as 1 byte and base 3 as 2 and decoding 97,000 of 97,005 Revit 2027 records with them, but nobody had shown, field by field, that instances take those widths. Layer 4c `FieldType` changes need byte evidence from the corpus. ## Changes - `probes/examples/probe_re325_scalar_widths.rs`: the census of every base-2 and base-3 grammar field and of the scan's reading of them, the slot types of the `std::pair< A, B >` classes, the instances in complete native graphs (value ranges, byte-blob signatures) and the same records decoded again with the schema's base bytes rewritten to other widths, every field at once and one at a time. - `src/formats.rs`: `Primitive { kind: 0x02 }` is 1 byte, `{ kind: 0x03 }` 2 (`scalar_size`); docs. No other classification moves; `tests/field_type_coverage.rs` is untouched. - `src/walker.rs`: `read_field_by_type` / `write_field_by_type` read and write a `0x02` primitive as a `u8` and a `0x03` primitive as an `i16`; a `0x02` vector or container (a byte blob) is read whole with its count instead of leaving its payload to be read as the next fields. - `src/research/native_document.rs`: `Options::keep_body` and `Record::body` (off by default) so a probe can decode a record's bytes under another reading of the schema. - `reports/element-framing/RE-325-scalar-widths.md`, `changelog.d/fixed/1196-scalar-widths.md`, and the corrected widths in `docs/format.md`, `docs/extending-layer-5b.md`, `docs/container-wire-format-2026-04-21.md` and a correction note in `docs/format-reconnaissance.md`. ## Testing Unit tests are banned: none added. The probe is the test, run through Measure on Autodesk's 58 sample projects (Revit 2015 to 2027) and the 13 family files; runs and counts are in the report. - [x] Verified end to end on real Revit files: Measure 41762248491 (families), 41762555375, 41762559148, 41762563120 (samples), probe commit `6f099c91`. The 58 projects (13 releases) hold 402,652 native records with an instance of a base-2 or base-3 field; 402,293 decode without the extensible-storage catalog (the other 359, in the 2024 projects, need it) and every one of those (683,250 instances of 20 fields) is read completely at 1 and 2 bytes. `FieldType`'s widths (2, 4) read 65 of them (those whose only instances are empty byte buffers); base 3 at 1 or 4 bytes reads 393,581 and leaves exactly the 8,712 that hold a base-3 instance; each of the 20 fields rewritten alone to another width leaves none of its non-empty records whole. 13,407 PNGs end with their IEND chunk at the declared count, one byte per element. - [x] Identity (Measure 41765290302, `-f base=main -f nordic=true -f r2025=true -f samples=true -f holdout=true -f families=true`, head `3084c431` against `main` at `5aa4da77`): 124 items; every `ifc.sha256`, `diagnostics.json`, `info.json`, `info.exit`, `schema.txt` and scorer output is byte-identical, and the scorer diff is empty. Nothing moves in an export. Held-out models: counts only, nothing quoted. - [x] `tools/check-local.sh`'s gates run in CI (no local builds in this checkout) ## Audit-honesty checklist - [x] Docs reflect the state after this PR; the old claim that `0x03` is a deprecated 4-byte alias seen in 2016 to 2018 only is corrected in `docs/format.md` and `docs/format-reconnaissance.md` (kept, with a correction note). - [x] Changelog fragment under `changelog.d/fixed/`. - [x] Limitation recorded: `03 10 00 00` (`short[3]`) arrays are still `Unknown` in the scan (they sit in an empty-named composite the scan never files); not changed. - [x] No emojis; no private paths. - [x] Reverse-engineering finding: probe under `probes/examples/` and report `RE-325`; `docs/format-reconnaissance.md` carries a dated correction. ## Legal and contribution hygiene - [x] Apache-2.0 - [x] Clean-room declaration: the evidence is public byte observations (the schema's own type names and instance bytes of Autodesk's redistributable sample files and the maker families), no Autodesk or ODA SDK source, disassembly or NDA material (`CLEANROOM.md`). - [x] No fixtures added. ## Breaking changes None to the API. `FieldType::Primitive`'s `size` for kinds 2 and 3 changes value (2 to 1, 4 to 2). ## Related issues Refs #1196 (RE-323, #1309).
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
Classifies 11 of the 14 names the residual list held (the encodings
FieldType::decodeleftUnknownin every release), shows that Revit 2027's flagged runtime-state fields occupy no instance bytes, and leaves three fields unclassified with the reason measured. The coverage gate stays at 100% of the remainder and now also reads each schema with the exact grammar.Motivation
Refs #1196 (it stays open for the three fields below). The residual list was 9 to 12 fields per release; Revit 2027 added 339 flagged fields whose instance bytes RE-264 had not measured.
Changes
src/formats.rs:FieldType::PointerArray(0e 13) andFieldType::PointerContainer(0e 53,0e 54) appended to the non-exhaustive enum;Flaggedtakes byte 2 = 0x04 (VarExpr::m_refCt,04 00 04 00); the scan decodes a field's type from the stream instead of from its class's 4,096-byte scan window, which clippedZoningAppInfo::firstto two bytes (0e 00).src/walker.rs: the new variants read asUnknowndid, so no walk changes.docs/schemas/schema-table.schema.json: twoFieldTypebranches.tests/field_type_coverage.rs:RESIDUALshrinks from 14 names to 3; a second list, keyed by the classes the exact grammar (schema_registry) says declare the fields, holds the grammar'sUnknownfields to account; both lists fail on an entry that no longer decodesUnknown.probes/examples/probe_re323_residual_field_encodings.rs,reports/element-framing/RE-323-residual-field-encodings.md, a changelog fragment and the docs that quoted "9 to 12".Testing
Unit tests are banned in this repository: none added. Measured end to end on real files with the probe; it checks every instance of each residual field against its proposed layout (the native graph decoder consumes the whole record body, every non-null pointer token resolves to an object of the record).
tools/check-local.shpasses: no local build here (the repository's rule for this machine); fmt run locally, the rest is CI's.VarExpr::m_refCt,VarSketchConstrObj::m_constrElems,VarSketchObj::m_params: 138,477, 58,876 and 93,092 instances on 2018 to 2027, same. 2027's flagged fields: 97,000 of 97,005 records of the five sample projects end exactly at their body's last byte with the 339 fields skipped as zero-width, 110 of them in classes the records hold; the other 5 fail on a size budget.41757335670(-f base=main -f nordic=true -f r2025=true -f samples=true -f families=true -f scorers=none, head 1a8427d; later commits add only the report and PR text): results in RE-323 section 8 and the PR conversation when it finishes.Audit-honesty checklist
changelog.d/changed/.ClassDefinitionRef::m_refhas no instance,VarParam::m_pSubst's 31,705 instances are all null pointers, which two layouts read alike, andVarSketchDimObj::m_dimValuehas none.probes/examples/and the dated report underreports/element-framing/.Legal and contribution hygiene
Breaking changes
FieldTypegains two variants (the enum is#[non_exhaustive], so a downstreammatchalready has a wildcard) and theschema-tableJSON schema gains twoanyOfbranches, which the semver gate counts as breaking. A field that decodedUnknown(or, on one 2026 field, was clipped) now decodes as one of them;rvt-schemaJSON output changes for those fields only. The title carries!for that.Screenshots or output samples
Not applicable (no IFC or UI output changes); the measured tables are in the report.
Related issues
Refs #1196