Repository navigation
fix(formats): a char field is 1 byte and a short field 2, not 2 and 4 (#1196) (RE-325) - #1315
Merged
Merged
Conversation
DrunkOnJava
marked this pull request as ready for review
November 4, 2026 03:40
DrunkOnJava
enabled auto-merge (squash)
November 4, 2026 03:40
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
A
Formats/Latestdescriptor with base byte 2 (the C++char) is 1 byte in an instance and base byte 3 (short) is 2;FieldType::decodegave them 2 and 4, and the walker read the first as au16. 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
FieldTypechanges 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 thestd::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.rsis untouched.src/walker.rs:read_field_by_type/write_field_by_typeread and write a0x02primitive as au8and a0x03primitive as ani16; a0x02vector 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_bodyandRecord::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 indocs/format.md,docs/extending-layer-5b.md,docs/container-wire-format-2026-04-21.mdand a correction note indocs/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.
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.-f base=main -f nordic=true -f r2025=true -f samples=true -f holdout=true -f families=true, head3084c431againstmainat5aa4da77): 124 items; everyifc.sha256,diagnostics.json,info.json,info.exit,schema.txtand scorer output is byte-identical, and the scorer diff is empty. Nothing moves in an export. Held-out models: counts only, nothing quoted.tools/check-local.sh's gates run in CI (no local builds in this checkout)Audit-honesty checklist
0x03is a deprecated 4-byte alias seen in 2016 to 2018 only is corrected indocs/format.mdanddocs/format-reconnaissance.md(kept, with a correction note).changelog.d/fixed/.03 10 00 00(short[3]) arrays are stillUnknownin the scan (they sit in an empty-named composite the scan never files); not changed.probes/examples/and reportRE-325;docs/format-reconnaissance.mdcarries a dated correction.Legal and contribution hygiene
CLEANROOM.md).Breaking changes
None to the API.
FieldType::Primitive'ssizefor kinds 2 and 3 changes value (2 to 1, 4 to 2).Related issues
Refs #1196 (RE-323, #1309).