Repository navigation
fix(formats)!: ElementIdRef is the class reference alone, without the spilled sub (#1101) - #1154
Merged
Merged
Conversation
… spilled sub (#1101) The schema grammar (schema_classes) reads a by-value reference as the type word 0e 00 00 00 and a u16 class reference, bit 15 meaning the class is defined inline after a zero u16. FieldType::decode read two more bytes as ElementIdRef's sub, but those belong to what follows: measured on the 2016, 2020, 2024 and 2026 sample families' page-stripped schemas, the next field's name length on 1,564 to 1,979 references, the zero pad before an inline definition on 213 to 253, and a class's GUID-list count on about 600. The same spill decided whether a reference to the root ElementId class read as ElementId or ElementIdRef { 0x14, .. }, which the walker's self-id search tells apart. ElementIdRef keeps referenced_tag only, with bit 15 cleared; a reference to tag 0x14 is always ElementId; encode writes the six bytes and its doc no longer claims a writer uses it. rvt-schema's JSON schema drops sub. Griffin chose to fix this before 1.0 (2026-10-30).
…ewer suppressed candidates
Owner
Author
|
Self-review with verification. Measure 41102077364 compared base=main against this head on every reference model, the office, the R2025 models, Autodesk's 2015 to 2027 samples and the family corpus: 380 files on each side.
Code. CI passed, including |
DrunkOnJava
enabled auto-merge (squash)
October 30, 2026 18:15
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
FieldType::ElementIdRef { referenced_tag, sub }becomesElementIdRef { referenced_tag }.subwas never part of the field: it read the two bytes after a six-byte class reference, which belong to whatever follows.referenced_tagnow has bit 15 cleared, and every reference to the rootElementIdclass reads asElementId. Closes #1101. Griffin chose on 2026-10-30 to fix it before 1.0.Motivation
The schema grammar the crate already reads with (
schema_classes, STE1200's, #154) gives a by-value reference as the type word0e 00 00 00and a u16 class reference, where bit 15 means the class is defined inline after a zero u16. Measured on the page-stripped schemas of the 2016, 2020, 2024 and 2026 sample families, the bytesFieldType::decoderead assubare:The last column is root-class references at a class's end followed by an inline structure. The grammar reader parses those too; my local scanner does not model them. In none of the four schemas is
subpart of the reference. The same spill decided whether a reference to tag 0x14 read asElementIdor asElementIdRef { 0x14, .. }.walker::find_self_id_fieldtells those apart in its third rule.Changes
src/formats.rs:ElementIdReflosessub.decodereads the six bytes, clears bit 15, and maps tag 0x14 toElementId.encodewrites six bytes. Its doc no longer claims a writer uses it (writer.rscopiesFormats/Latestbyte for byte, as the formats: an ElementIdRef's sub is the next field's name length on about 93% of references #1101 scope check found), and it says an inline definition is not reproduced.docs/schemas/schema-table.schema.json:ElementIdRefrequires onlyreferenced_tag.changelog.d/changed/element-id-ref.md.Testing
Unit tests are banned and none are added.
field_type_coverage(12-release family corpus) must keep every field outsideRESIDUALclassified.json_schema_contractsmust validatervt-schema --jsonagainst the edited schema.base=mainon every model shows whether any export moves through the walker's self-id choice. The result is added below before this PR is armed.Breaking changes
FieldType::ElementIdRef { referenced_tag, sub }→ElementIdRef { referenced_tag }, andrvt-schema --jsondropssub. Code that namessubstops compiling: drop it. Code that matchedElementIdRef { referenced_tag: 0x14, .. }seesElementIdinstead.