Repository navigation
feat(elem-table): read the owner ElementId every record carries (#152) (RE-31) - #294
Merged
Merged
Conversation
… (RE-31) The run of 0xFF bytes detect_layout anchors on is not a marker. It is an ElementId field whose unset value is all 0xFF: a u32 at +0 on the 28-byte 2023 layout, a u64 at +4 on the 40-byte 2024 layout. On 2024_Core_Interior.rvt it is set on 22,368 of 26,425 records, and every value is a declared ElementId (id density 0.198). On Snowdon Towers it is 29,131 of 29,177 at density 0.019, and on Einhoven 338 of 338. The element's own partition record corroborates it independently: 87% of set values on Core Interior (93% on Snowdon) appear in that element's counted reference list. By category, curtain panels, mullions and grids name their curtain wall, sketch lines their sketch, and grouped elements their model group. Other pairs are recorded, not attributed. This supports #152's ownership hypothesis at a different field from the trailing word RE-152 falsified. ElemRecord::owner_id reads the field, and elem_table::read_layout returns the detected layout. rvt-elem-table prints that layout instead of sniffing the first record for 0xFF, which misread any file whose first record names an owner. It also counts records that name an owner, and --json adds layout, records_with_owner and owner_id. Python's elem_table_records() dicts gain owner_id. tests/elem_table_corpus.rs pins the Einhoven and Core Interior counts. The support matrix gains an experimental elem-table-owner row, and the IFC export does not use the field yet.
DrunkOnJava
enabled auto-merge (squash)
September 22, 2026 20:48
Bugbot couldn't run - usage limit reachedBugbot 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_d8c198bd-249a-4cd8-8493-39823619ec25) |
This was referenced Sep 22, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Sep 22, 2026
## Summary Prepare the v0.2.0 release: the inspection-focused alpha described in `docs/release-0.2.0-plan.md`. It ships PyPI wheels, prebuilt CLI archives for 5 platforms and the multi-arch container image. **crates.io is not part of this release:** no `CARGO_REGISTRY_TOKEN` is configured, and publishing is deferred. Merging this PR is **not** the release. Nothing is published until the draft v0.2.0 GitHub Release (archives attached from a tagged-name `workflow_dispatch` run) is published, which creates the tag and runs `publish.yml`. Until then the docs on `main` say 0.2.0 is prepared and not yet published. ## Changes - Versions: `rvt` and `rvt-py` go to 0.2.0, along with the `stream_evidence` pin, both lockfiles and `.release-please-manifest.json`. - `CHANGELOG.md`: `[Unreleased]` is promoted to `[0.2.0] — 2026-09-22`, with an empty `[Unreleased]` stub. - `publish.yml`: when `CARGO_REGISTRY_TOKEN` is not configured, the crates.io job now logs a warning and exits successfully, so PyPI and the release binaries still ship. A crate the registry rejects still fails the job and blocks PyPI, which keeps the protection against publishing mismatched Rust and Python versions. - `docs/install.md`: the publication table keeps PyPI at 0.1.2 and marks the 0.2.0 archives and the container image **not yet published**. crates.io and docs.rs stay marked **not published**. - `release-binaries.yml`: a `workflow_dispatch` `tag` input names archives for a release without uploading, which is used to stage the draft. - `docs/release-0.2.0-plan.md` and the CHANGELOG heading: prepared, not yet released. ## Testing - [x] `cargo publish --dry-run -p rvt`: packages and verifies 482 files (1.7 MiB) - [x] Full local gate on the constituent PRs (#289–#297); this PR only bumps versions and changes docs and workflow configuration - [ ] CI on this PR ## Follow-up crates.io and docs.rs: add a crates.io API token as the repo secret `CARGO_REGISTRY_TOKEN`, then publish `rvt` 0.2.0 (or 0.2.1), and update `docs/install.md`. ## Breaking changes `ElemRecord` gained `owner_id` (#294); a struct literal of it now needs that field.
DrunkOnJava
added a commit
that referenced
this pull request
Sep 28, 2026
…s it (#152) (RE-31) (#499) ## Summary `Global/ElemTable`'s records start at `0x06` and each ends with its owner field. rvt-rs parses a frame starting at `0x1E`, so the owner field that opens each parsed frame belongs to the record before it. `ElemRecord::owner_id` (RE-31, #294) paired every owner with the next element. STE1200 reported this on #152 (and again in Discussion #112), together with the test that settles it: an ownership tree has no self-owned record and no cycle. ## Measured | file | old pairing: self-owned / in a cycle | new pairing | |---|---:|---:| | Core Interior | 304 / 331 | 0 / 0 | | Snowdon Towers Architectural | 1,342 / 1,356 | 0 / 0 | | RE1 Architecture | 26 / 28 | 0 / 0 | | Einhoven | 7 / 7 | 0 / 0 | RE-31's independent oracle is the element's own partition reference list naming its owner. `examples/probe_re31_owner_frame.rs` measures it: | file | old pairing | new pairing | |---|---:|---:| | Core Interior | 86.6 % | 21,072 of 21,074 | | Snowdon Towers | 92.4 % | 1,574 of 1,574 | The wall→wall, floor→floor and symbol→symbol pairs RE-31 could not explain were artefacts of the shift, and are gone. ## Change - `parse_records_from_bytes` gives each record the owner field that follows it. - The last record's owner is read from the table's tail, and kept only when it names a declared element. - The table's first record, at `0x06`, is still not parsed. Its owner (the `0x0011` `header_flag` reports on family files) is documented as such. - Updated: the corpus test pins (Einhoven 338 → 339 owners, and no record may name itself), the support matrix entry, RE-31 §6, the `rvt-elem-table` layout label and the CHANGELOG. Nothing in the IFC export uses `owner_id`. ## Checks - Local: fmt, clippy, doc, MSRV 1.85, fuzz check, integration tests, and the corpus run via `verify-real-files.sh`. ## Clean-room declaration This finding comes from public byte observations of the corpus files only. The report and the self-ownership test are from STE1200 (Discussion #112, #152), credited. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes decoded metadata for every explicit-layout ElemTable consumer (`rvt-elem-table`, Python `elem_table_records()`); behavior is better validated but is a semantic fix, not a no-op. > > **Overview** > **Fixes `ElemRecord::owner_id` (RE-31, #152):** `Global/ElemTable` records begin at `0x06` and end with an owner field, but parsing starts at `0x1E`, so the marker at each frame's start actually **closes the previous record**. Owners were previously paired with the **next** element, which produced hundreds of self-ownerships and weaker agreement with partition reference lists. > > **`parse_records_from_bytes`** now assigns each record the owner read from the **following** frame (and reads the last record's owner from the table tail, only when that id is declared). Docs, corpus tests (no self-owners; Einhoven owner count 338→339), `probe_re31_owner_frame`, RE-31 §6, support matrix, and `rvt-elem-table` layout text are updated. **IFC export still does not use `owner_id`.** > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e08a591. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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
Every
Global/ElemTablerecord carries the ElementId of the element it belongs to. It sits in the field the layout detector had treated as a0xFFmarker.ElemRecord::owner_idnow reads it, andrvt-elem-table,--jsonand Python expose it. RE-31 documents the measurement. It supports #152's ownership hypothesis at a different field from the one RE-152 falsified.Motivation
RE-30 (#290) found that this "marker" was absent on some records, and that the values in it looked like ElementIds. RE-152 had seen interior words coincide with declared ids and set that aside for lack of an independent oracle. The partition element record of the same element supplies one.
Evidence (RE-31)
Revit_IFC5_Einhoven.rvtu32at+02024_Core_Interior.rvtu64at+4By category on Core Interior, using
BuiltInCategorynames from the public API stubs:OST_CurtainWallMullions,OST_CurtainGridsWallandOST_CurtainWallPanelspoint to anOST_Wallsrecord 15,989 times.OST_SketchLinespoints to an uncategorised symbol record 2,944 times.OST_IOSModelGroupsrecord.Wall→wall (697), floor→floor (124) and symbol→symbol (128) pairs are recorded, not attributed.
Changes
src/elem_table.rs:ElemRecord::owner_id(serde default, skipped whenNone), decoded atmarker_offsetwith the marker's width.read_layout.src/bin/rvt_elem_table.rs:0xFFin record 0, which mislabelled any file whose first record names an owner.--jsonaddslayout,records_with_ownerandowner_id.elem_table_records()gainsowner_id, with the stub and test updated.tests/elem_table_corpus.rs: pins 338 / 2,614 and 22,368 / 26,425, each set value a declared ElementId.reports/element-framing/RE-31-elemtable-owner-field.md, with an update note on RE-152.elem-table-ownerrow (experimental).Testing
tools/check-local.shwith both corpora: fmt, clippy -D warnings, rustdoc -D warnings, full test suitecargo +1.85.0 check --profile ci --all-targets(MSRV)maturin develop --release, 64 passedrvt-elem-tableon Einhoven, Core Interior and Snowdon prints the layouts and owner counts aboveAudit-honesty checklist
experimental; the export does not use the field)Legal and contribution hygiene
CONTRIBUTING.md)CLEANROOM.md). Category names come from the public API enumeration.Breaking changes
ElemRecordgains a public field, so code that builds it with a struct literal must addowner_id. JSON output only adds keys.Note
Low Risk
Read-only ElemTable decoding and CLI/Python exposure; no IFC or export behavior changes. Struct-literal
ElemRecordcallers must addowner_id.Overview
Decodes and surfaces an owner ElementId on each
Global/ElemTablerecord (RE-31 / #152). The bytes the layout detector treated as an all-0xFFmarker are the field’s unset value; when set they are a declared ElementId (u32at record+0on 28-byte / 2023 layouts,u64at+4on 40-byte / 2024).ElemRecord::owner_idreads it during record parse; implicit family records always getNone.read_layoutis added and ElemTable inflate is deduplicated behind one helper.rvt-elem-tablereports the detected layout (including “owner field at +N”) instead of inferring from the first record’s0xFFpattern, prints how many records name an owner, and extends--jsonwithlayout,records_with_owner, and per-recordowner_id. Pythonelem_table_records()and stubs gain the same optional field.Corpus and unit tests pin owner counts and that every set value is a declared id; docs add RE-31, changelog, and an experimental support-matrix row. IFC export does not consume
owner_idyet.Reviewed by Cursor Bugbot for commit 6d16141. Configure here.