Repository navigation
fix(elem-table): detect the 40-byte layout when a record's sentinel field is set - #290
Merged
Merged
Conversation
DrunkOnJava
enabled auto-merge (squash)
September 22, 2026 20:10
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_c30ce98d-091e-4864-a496-365fc459693d) |
DrunkOnJava
disabled auto-merge
September 22, 2026 20:12
DrunkOnJava
enabled auto-merge (squash)
September 22, 2026 20:16
…ield is set detect_layout took the record size from the spacing of the first two 0xFF sentinel runs. On Autodesk's Snowdon Towers 2024 architectural sample records 1 and 2 hold 0x10 in that field (it is an optional ElementId, -1 when unset), so the first two runs are 120 bytes apart. The flush check failed, the marker became the origin, and all 15,744 rows read ElementId 0. Element recovery joins on the declared ElementId set, so no partition element record matched and the IFC export fell back to the 64-floor cap of the plan-loop heuristic, with no ElementIds or geometry. When the measured spacing does not tile the stream flush against the declared record count, the detector now tries the known 40- and 28-byte strides that divide the spacing and do tile it. That file now declares 47,233 records (47,232 distinct ElementIds) and exports 5 walls and 1 floor with ElementIds and bodies. Core Interior, Einhoven, the Snowdon structural sample and every family file detect exactly as before. record_origin folds into flush_origin, its only remaining caller. RE-30 records what the same two Snowdon files show beyond the table: most element records of every recovered category use a second prologue whose own ElementId is not at +0x00, not the last reference slot and not at any fixed offset before the record, so recovery stays fail-closed and does not yet generalise past 2024_Core_Interior.rvt. The support matrix's user-facing line now says so. Also stops !corpus/** re-including Finder metadata.
The first RE-30 counts came from the old rvt-dump output, which lost every gzip member straddling a checksum page (10.5 MB of the architectural Partitions/68). Re-measured on the bytes RevitFile::inflated_partition returns: 7 of 2,171 architectural and 26 of 106 structural frames in the recovered categories decode. The three ruled-out ElementId locations still fail on the full bytes.
Three '||||||| <base>' diff3 markers had been committed into CHANGELOG.md: two since #221 and one from rebasing this branch. No entry was duplicated; only the marker lines are removed.
DrunkOnJava
force-pushed
the
fix/elem-table-sparse-sentinel
branch
from
September 22, 2026 20:19
5452ada to
5592716
Compare
5 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Sep 22, 2026
## Summary The required PII guard job gains a step that fails when a merge-conflict marker is committed. ## Motivation Three diff3 base markers (`||||||| <base>`) sat in CHANGELOG.md, two of them since #221. A rebase can be resolved and still leave the base marker behind, and nothing checked for it. #290 removed them; this stops them coming back. ## Changes - `.github/workflows/ci.yml`: `git grep -I -E '^(<<<<<<<|\|\|\|\|\|\|\||>>>>>>>)( |$)'` over the tree, in the existing PII guard job so it is required without a ruleset change. `=======` alone is excluded because it is also a Markdown setext underline. ## Testing - [x] The pattern matches nothing on main after #290 - [x] The same regex matches a planted `||||||| abc` line - [x] Workflow YAML parses ## Audit-honesty checklist - [x] N/A for docs: CI-only - [x] No emojis, no private paths ## Breaking changes None. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > CI-only guardrail with no runtime, auth, or data-handling impact. > > **Overview** > Adds a **required conflict-marker scan** to the existing `pii-guard` CI job so PRs fail if unambiguous merge/rebase markers are committed anywhere in the tree. > > The new step runs `git grep` for line-anchored `<<<<<<<`, `|||||||`, or `>>>>>>>` (including diff3 base markers that can linger after a “resolved” rebase). It deliberately **does not** match `=======` alone, since that string is also valid Markdown underline syntax. > > No application code changes—only `.github/workflows/ci.yml`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9d394fa. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
14 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Sep 22, 2026
…t be attributed (#293) ## Summary When most of a file's element records can't be attributed to an ElementId, the export now says so: a per-class `skipped` count, plus a warning at the top of the list that the model is incomplete. Before this, a Snowdon Towers export carrying a few percent of the building looked like any other partial export. ## Motivation RE-30 (#290) measured that on Autodesk's Snowdon Towers 2024 samples, most wall, door, window, column, floor and room records use a second prologue with no ElementId at `+0x00`. The fail-closed decode rightly skips them. Nothing in the diagnostics told a user that the IFC they downloaded holds 6 walls of a 1,200-wall building. ## Changes - `partition_element_records::count_unattributed_frames` (pure, over bytes) and `scan_unattributed_frames` (every partition, keyed by class): - One `memmem` pass over the bbox marker. It counts frames whose `+0x12` category is one of the new `RECOVERED_CATEGORIES` and whose `+0x00` is 0 or above `u32::MAX`. - Partitions are already inflated and memoised by then, so the cost is the search. Core Interior's full export takes 2.9 s. - Export diagnostics: - A `skipped` item `element_record_without_element_id` with per-class `classes`. - A warning inserted first, because the viewer's Warnings row shows only the first warning inline. - Fix: the "Suppressed N low-confidence schema scan candidates" warning read `skipped[0]`. Whenever below-confidence elements exist, that item is the below-confidence one, so the warning reported the wrong count. It now finds its own item. - `tests/project_count_fixtures.rs`: every manifest project must report no unattributed frames. - Docs: `docs/export-diagnostics.md`, the schema's `reason` description, CHANGELOG. ## Testing - [x] `tools/check-local.sh` with both corpora: fmt, clippy -D warnings, rustdoc -D warnings, full test suite (see below) - [x] Unit test: an attributed wall is not counted; an all-`FF` wall and a `0x00000006_ffffffff` door are, each under its own category; a category outside the set is not - [x] Corpus-gated `project_count_fixtures`: Core Interior, Einhoven and tier-1 report none - [x] Local-only measurement on the Snowdon samples: | file | unattributed | by class | |---|---:|---| | `2024_Core_Interior.rvt` | 0 | | | `Revit_IFC5_Einhoven.rvt` | 0 | | | Snowdon architectural | 2,043 | Wall 1,216 · Door 245 · Floor 198 · Column 180 · Window 150 · Room 54 | | Snowdon structural | 75 | Wall 50 · Floor 24 · Window 1 | `rvt-inspect` on the structural sample now opens its Warnings block with: "75 wall, door, window, column, floor or room record(s) in this file use an element-record layout whose ElementId this release cannot locate, so they are not exported and the model is incomplete (RE-30)." ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR - [x] If a limitation was resolved, the "Known limitations" / "What works today" section in the relevant docs is updated (N/A: this surfaces a limitation rather than resolving one) - [x] New limitation documented: RE-30, now visible per file in the diagnostics - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files - [x] N/A: builds on RE-30, adds no new reverse-engineering finding ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 (see `CONTRIBUTING.md`) - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content (see `CLEANROOM.md`) - [x] Test fixtures: synthetic records in the unit test; corpora are gated, not committed ## Breaking changes None. Diagnostics gain a `skipped` reason and, on affected files only, one warning. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Additive export diagnostics and documentation; decode/export selection is unchanged aside from fixing which skipped item feeds the low-confidence schema warning. > > **Overview** > **Export diagnostics now flag incomplete models when most partition element records have no attributable ElementId (RE-30).** A partition scan counts wall/door/window/column/floor/building-pad/room frames that look like element records (`BuiltInCategory` at `+0x12`, bbox marker at `+0x50`) but carry no valid id at `+0x00`, and surfaces them as a `skipped` entry with reason `element_record_without_element_id` and per-class counts. When that total is non-zero, a **model is incomplete** warning is **inserted first** in `warnings` so `rvt-inspect`, `--diagnostics`, and the viewer’s inline Warnings row show it prominently. > > The implementation adds `RECOVERED_CATEGORIES`, `count_unattributed_frames`, and `scan_unattributed_frames` in `partition_element_records`, wired from IFC export diagnostics assembly in `src/ifc/mod.rs`. > > **Bug fix:** the “Suppressed N low-confidence schema scan candidates” message no longer uses `skipped[0]`; it looks up the `low_confidence_schema_scan_candidate` item so unrelated skipped buckets (e.g. unattributed frames) do not skew the count. > > **Tests and docs:** `tests/project_count_fixtures.rs` asserts manifest corpus projects report zero unattributed frames; CHANGELOG, README, `docs/export-diagnostics.md`, and the diagnostics JSON schema document the new reason. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 78858f2. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
14 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Sep 22, 2026
… (RE-31) (#294) ## Summary Every `Global/ElemTable` record carries the ElementId of the element it belongs to. It sits in the field the layout detector had treated as a `0xFF` marker. `ElemRecord::owner_id` now reads it, and `rvt-elem-table`, `--json` and 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) | file | layout | set | declared | id density | in the element's own partition reference list | |---|---|---:|---:|---:|---:| | `Revit_IFC5_Einhoven.rvt` | 28 B, `u32` at `+0` | 338 / 2,614 | 338 | 0.301 | not measured (no 2023 element records) | | `2024_Core_Interior.rvt` | 40 B, `u64` at `+4` | 22,368 / 26,425 | 22,368 | 0.198 | 19,015 of 21,848 framed (87 %) | | Snowdon Towers architectural (local only) | 40 B | 29,177 / 47,233 | 29,131 | 0.019 | 1,527 of 1,648 (93 %) | By category on Core Interior, using `BuiltInCategory` names from the public API stubs: - `OST_CurtainWallMullions`, `OST_CurtainGridsWall` and `OST_CurtainWallPanels` point to an `OST_Walls` record 15,989 times. - `OST_SketchLines` points to an uncategorised symbol record 2,944 times. - Columns, rooms, doors, walls and panels point to an `OST_IOSModelGroups` record. 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 when `None`), decoded at `marker_offset` with the marker's width. - `read_layout`. - Three inflate copies folded into one helper. - Two unit tests: 40-byte and 28-byte owners, and no owner on the implicit family layout. - `src/bin/rvt_elem_table.rs`: - Prints the detected layout ("8-byte owner field at record +4") instead of looking for `0xFF` in record 0, which mislabelled any file whose first record names an owner. - Counts records that name an owner. - `--json` adds `layout`, `records_with_owner` and `owner_id`. - Python `elem_table_records()` gains `owner_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. - Docs: - `reports/element-framing/RE-31-elemtable-owner-field.md`, with an update note on RE-152. - The layout doc. - A support-matrix `elem-table-owner` row (`experimental`). - CHANGELOG. ## Testing - [x] `tools/check-local.sh` with both corpora: fmt, clippy -D warnings, rustdoc -D warnings, full test suite - [x] `cargo +1.85.0 check --profile ci --all-targets` (MSRV) - [x] Python: `maturin develop --release`, 64 passed - [x] `rvt-elem-table` on Einhoven, Core Interior and Snowdon prints the layouts and owner counts above ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR (support matrix `experimental`; the export does not use the field) - [x] If a limitation was resolved, the "Known limitations" / "What works today" section in the relevant docs is updated (N/A) - [x] New limitation documented: three pair kinds unattributed; no reference IFC holds curtain-wall aggregation or groups - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files - [x] Reverse-engineering finding: RE-31 with hashes, densities, the oracle and what is not claimed ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 (see `CONTRIBUTING.md`) - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content (see `CLEANROOM.md`). Category names come from the public API enumeration. - [x] Test fixtures: synthetic records; corpora gated, not committed ## Breaking changes `ElemRecord` gains a public field, so code that builds it with a struct literal must add `owner_id`. JSON output only adds keys. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Read-only ElemTable decoding and CLI/Python exposure; no IFC or export behavior changes. Struct-literal `ElemRecord` callers must add `owner_id`. > > **Overview** > **Decodes and surfaces an owner ElementId on each `Global/ElemTable` record (RE-31 / #152).** The bytes the layout detector treated as an all-`0xFF` marker are the field’s unset value; when set they are a declared ElementId (`u32` at record `+0` on 28-byte / 2023 layouts, `u64` at `+4` on 40-byte / 2024). > > `ElemRecord::owner_id` reads it during record parse; implicit family records always get `None`. **`read_layout`** is added and ElemTable inflate is deduplicated behind one helper. > > **`rvt-elem-table`** reports the detected layout (including “owner field at +N”) instead of inferring from the first record’s `0xFF` pattern, prints how many records name an owner, and extends **`--json`** with `layout`, `records_with_owner`, and per-record `owner_id`. **Python** `elem_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_id` yet.** > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 6d16141. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This was referenced Sep 22, 2026
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
Global/ElemTablelayout detection no longer mis-measures the record size when a record's sentinel field is set, which on Autodesk's Snowdon Towers 2024 architectural sample left every ElementId reading 0 and disabled element recovery for the whole file. RE-30 records what the same two Snowdon files show beyond that: element recovery does not yet generalise past the recorded edge, and the support matrix now says so.Motivation
detect_layouttook the record size from the spacing between the first two0xFFruns. On the Snowdon architectural sample, records 1 and 2 hold0x10there, so the first two runs are 120 bytes apart, not 40. The flush check failed, and all 15,744 rows parsed at 120 bytes read ElementId 0. Element records join on the declared id set, so none could match, and the IFC export fell back to 64 plan-loop floor guesses (the heuristic's cap) with no ElementId and no geometry.Changes
src/elem_table.rs: when the measured spacing does not tile the stream flush againstrecord_count, try the known 40- and 28-byte strides that divide it and do tile it.record_originfolds intoflush_origin, its only remaining caller. There is a new unit test for the sparse-sentinel shape.u64ElementId at record+4, andFF×8 is its unset value. Set values are declared ElementIds in 22,368 of 22,368 rows on Core Interior and 29,131 of 29,177 on Snowdon. This is documented in the module docs and indocs/elem-table-record-layout-2026-04-21.md.reports/element-framing/RE-30-snowdon-generalisation.md(new): on both Snowdon files most element frames in every recovered category use a second prologue whose own ElementId is not at+0x00, not in the last reference slot, and not at any fixed offset before the record. Recovery stays fail-closed.docs/support-matrix.json:element-record-instance-recoverystaysverifiedon the recorded edge. Itsuser_impactno longer reads as if any Revit 2024 project would match..gitignore:!corpus/**no longer re-includes.DS_Store.Testing
tools/check-local.shwith both corpora before the rebase: fmt, clippy -D warnings, rustdoc -D warnings, 1,337 tests passed, 0 failedcargo +1.85.0 check --profile ci --all-targets(MSRV) and the ElemTable unit tests (22) passelem_table_corpus,project_count_fixtures,samples: unchanged. Core Interior 26,425 records at stride 40, Einhoven 2,614 at 28, families unchanged.{0}rvt-ifcIfcSlabFloor-unnamed(no id, no body), 37IfcSpaceIfcWall+ 1IfcSlabwith ElementIds and bodies, 37IfcSpaceAudit-honesty checklist
Legal and contribution hygiene
CONTRIBUTING.md)CLEANROOM.md)Breaking changes
None.
Note
Medium Risk
Changes core ElemTable stride detection used for every project's declared ElementId set and element-record joins; behavior is gated by flush checks and unit tests, but wrong stride would silently break recovery on new file shapes.
Overview
Fixes
Global/ElemTablelayout detection when early records set the optional ElementId reference at+4instead of the unsetFF×8 pattern.detect_layoutno longer treats the gap between the first two0xFFruns as stride when that spacing does not tile the stream flush againstrecord_count; it falls back to known 40- and 28-byte project strides that divide the spacing and do tile.record_originis renamed toflush_originand returnsOptionso failed flush checks can trigger the fallback.On Autodesk's Snowdon Towers 2024 architectural sample this stops a 120-byte misread (15,744 rows with ElementId 0), restores 47,233 declared ids, and lets partition element records join so IFC export emits real walls and slabs instead of 64 capped plan-loop floor guesses. Other corpus files are unchanged.
Docs and honesty: CHANGELOG, elem-table layout notes (sentinel semantics), new RE-30 report (Snowdon still mostly uses an alternate record prologue without a located ElementId), and support-matrix user impact scoped to the recorded Core Interior edge.
.gitignoreexcludescorpus/**/.DS_Storere-included by!corpus/**.Reviewed by Cursor Bugbot for commit 4028efa49fb72f6da7c018cd3b79a29ee518ba3c. Configure here.