Skip to content

fix(elem-table): report each record's owner from the field that closes it (#152) (RE-31) - #499

Merged
DrunkOnJava merged 1 commit into
mainfrom
fix/elemtable-owner-frame
Sep 28, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
fix/elemtable-owner-frame

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

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.


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.

Reviewed by Cursor Bugbot for commit e08a591. Configure here.

@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) September 28, 2026 15:53
@cursor

cursor Bot commented Sep 28, 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_e24c4c5f-4a52-4903-8e79-00b283e952df)

@DrunkOnJava
DrunkOnJava merged commit 74a572b into main Sep 28, 2026
20 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/elemtable-owner-frame branch September 28, 2026 15:56
DrunkOnJava added a commit that referenced this pull request Sep 28, 2026
## Summary

Prepare v0.4.0. Merging this is not the release: the release is the
signed `v0.4.0` tag, which runs `publish.yml` (crates.io, PyPI, the
release binaries and the container image).

**Why 0.4.0.** The CHANGELOG follows semver, and before 1.0 a breaking
change bumps the minor version. Changes since 0.3.0 that consumers will
notice:
- `IfcSpace.Name` is now the room number (#503).
- Only building-story Levels become storeys (RE-118).
- System families are named in the file's saved locale (RE-123).
- `ElemRecord::owner_id` values change (#499).
- Public structs gained fields.

## Changes

- **Versions 0.3.0 → 0.4.0:** `rvt`, `rvt-py` and its pin, the
`stream_evidence` pin, both lockfiles (only the version lines change),
`.release-please-manifest.json` and `viewer/package.json`.
- **`CHANGELOG.md`:** `[Unreleased]` becomes `[0.4.0] — 2026-09-28`.
- A new **Upgrading from 0.3** section covers the room naming, storey
filtering, locale names, `owner_id`, struct fields and changed bodies
and counts.
- The 55 entries are regrouped by what they mean for a 0.3 user: Added
(Revit 2023 projects; every supported release), Changed and Fixed. They
were under two "Added" headings, with most additions under "Changed".
Entry text is unchanged.
- **Witnesses:** the IFC header carries the version (#417), so both Core
Interior `rvt-rs.json` observations are regenerated.
`witness-verdict.py` gives PASS with three replay matches for each.

## Checks

- fmt, clippy, rustdoc, MSRV 1.85, the fuzz check (locked), integration
tests, and `verify-real-files.sh --profile ci`.
- `cargo install --path . --locked`: `rvt-inspect --version` prints
0.4.0, and `rvt-info`, `rvt-inspect --json` and `rvt-ifc --diagnostics`
run on the 2024 sample family.
- `maturin build`: the 0.4.0 wheel installs in a clean venv and imports,
reporting `rvt.__version__ == "0.4.0"`.

The docs keep describing 0.3.0 as the latest release until each 0.4.0
channel has been verified from its published artifacts. That follows in
a separate PR.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Diff is version metadata, changelog curation, and witness JSON version
strings only; behavioral breaking changes ship in prior feature merges,
not in this PR.
> 
> **Overview**
> This PR **cuts the 0.4.0 release line** without changing decoder or
exporter code: it bumps **`0.3.0` → `0.4.0`** on `rvt`, `rvt-py`, the
viewer, `.release-please-manifest.json`, path/version pins in
`stream_evidence`, and the lockfiles.
> 
> **`CHANGELOG.md`** promotes the accumulated work from `[Unreleased]`
to **`[0.4.0] — 2026-09-28`**, adds an **Upgrading from 0.3** section
(room `IfcSpace.Name`, building-story storeys, locale system-family
names, `ElemRecord::owner_id`, new public struct fields, geometry/IFC
count shifts), and **reorganizes** the ~55 entries into Added / Changed
/ Fixed (Revit 2023 vs all releases) without rewriting entry text.
> 
> Both Core Interior witness **`rvt-rs.json`** observations update
**`witness_version`** to `0.4.0` so replay metadata matches the IFC
header version.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
518f90c. 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.

1 participant