Repository navigation
docs: ADR-004 defer desktop wrappers (M6-06 / #47) - #148
Merged
Merged
Conversation
Record the research decision to ship the browser/static viewer and defer Tauri/Electron until signing/update ownership is accepted. Mark M6-06 shipped in TODO and link the ADR from the user guide. Co-authored-by: DrunkOnJava <[email protected]>
DrunkOnJava
added a commit
that referenced
this pull request
Aug 31, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Sep 19, 2026
…names (#267) ## Summary A Revit 2024 partition element record names the `Level` that hosts the element, in the counted reference list at `+0x88`. Binding on that — accepted only when the list names exactly one recovered Level — moves storey containment on `2024_Core_Interior.rvt` from **801 to 853 of 872** emitted building elements, with **0 disagreements** against the existing elevation join across the 537 elements both answer. Separately, an element with no recovered storey is now contained in the `IfcBuilding` instead of being written into whichever storey happens to be first. ## Motivation #219 asked for a storey for 82 unbound elements: 64 plan-loop `IFCSLAB` and 18 name-only `IFCSPACE`. **Measured first, that set no longer exists.** #212 replaced the plan-loop annotations with 100 record-backed plates and #218 replaced the eleven column-derived elevations with the fifteen real Revit Levels, so the unbound set on `main` is **71**: | unbound | count | why the elevation join cannot reach it | |---|---:|---| | `IFCSLAB` | 36 | top face 0.1667 ft (2 in) below a storey — the structural-slab / architectural-topping interface | | `IFCSHADINGDEVICE` | 10 | same | | `IFCWINDOW` | 6 | record base is a sill height, 4.73 ft above its level | | `IFCWALL` | 1 | base 56.4167 ft, mid-storey | | `IFCSPACE` | 18 | recovered from a partition string; no element record at all | And all 71 were nevertheless emitted as contained in `IfcBuildingStorey` **`Basement 2`** at −40 ft, because the writer clamped a missing index with `storey_index.unwrap_or(0)` — 71 containment claims nothing had measured, indistinguishable from the 5 that belong there. ## The rule ```text level_id = the single recovered Level ElementId in the record's counted reference list at +0x88 ``` A record that names **no** Level, or **two or more**, resolves to nothing and keeps whatever the elevation join gives it. That is not a tuning threshold: a Revit column or wall carries a *base constraint* and a *top constraint* and both are in the list, so every one of the 344 `OST_Columns` records that names a Level names two, as do 432 of 638 `OST_Walls`. Nothing in the bytes says which slot is the base, so picking one would be a guess. The columns lose nothing — all 256 already bind exactly on their base elevation. The uniqueness test runs against the **broader** id set (every standalone `OST_Levels` record, not only the fifteen RE-24's name/elevation recovery validates), so a Level the full recovery would drop still makes a record ambiguous. The binding half then uses only the validated fifteen; a named Level outside them binds nothing. Measured agreement, per category (placed instances): | category | instances | no Level | exactly one | two or more | both joins answer | agree | disagree | |---|---:|---:|---:|---:|---:|---:|---:| | `OST_Floors` | 146 | 25 | 121 | 0 | 64 | 64 | **0** | | `OST_BuildingPad` | 2 | 1 | 1 | 0 | 0 | — | — | | `OST_Columns` | 463 | 119 | 0 | 344 | 0 | — | — | | `OST_Walls` | 1487 | 849 | 206 | 432 | 206 | 206 | **0** | | `OST_Doors` | 320 | 53 | 267 | 0 | 267 | 267 | **0** | | `OST_Windows` | 7 | 1 | 6 | 0 | 0 | — | — | | **total** | | | | | **537** | **537** | **0** | 537 of 537 agree, which is why the stated join runs first and the inferred one fills in behind it. ## Changes - `src/element_record_level_refs.rs` (new) — `unique_level_reference`, the `m_levelId` field and `LevelElementId` property names, and five unit tests covering both fail-closed edges. - `src/partition_level_records.rs` — `scan_partition_level_ids`: the broad Level id set in one sweep, no name/elevation blocks. - `src/partition_schema_mvp.rs` — `element_record_decoded` attaches `m_levelId` and flips `m_level_bound`; the level-id set is recovered **once** in `recover_partition_schema_mvp` and threaded to every category rather than re-scanned per category. - `src/ifc/export_content.rs` — `LevelBindResolved` is now `true` when a Level was named, with `LevelElementId` and `LevelBindSource` beside it. - `src/ifc/mod.rs` — `apply_record_level_reference_storeys`, running before the #213 elevation join, which now leaves an already-bound element alone; `apply_partition_level_storeys` records the Level id → storey index map into a `LevelStoreyBind`; the stale "ElementId↔Level binding is still pending" warning now reports the real count. - `src/ifc/step_writer.rs` — storey-less elements are contained in the `IfcBuilding`, not in `storey[0]`. - `tests/iter_elements_typed.rs` — new corpus gate `core_interior_2024_storey_containment_is_evidence_backed` (skips when the sample is absent). - `tests/ifc_synthetic_project.rs` + `tests/fixtures/synthetic-project.ifc` — the storey-less element now gets its own containment relation on the building; see "IFC output" below. - `reports/element-framing/RE-27-level-reference-storey-bind.md` + `examples/probe_re27_level_reference.rs` — the finding and its reproducible probe. - `docs/status.md`, `docs/user-guide.md`, `docs/export-diagnostics.md`, `docs/support-matrix.json`, `CHANGELOG.md`, both project-count manifests, both `rvt-rs` witness observations. ## IFC output `target/ci/rvt-ifc _project_corpus/Revit/2024_Core_Interior.rvt --mode geometry`: | type | level reference | base elevation | top elevation | unbound | |---|---:|---:|---:|---:| | `IFCCOLUMN` | 0 | 256 | 0 | 0 | | `IFCDOOR` | 132 | 0 | 0 | 0 | | `IFCSHADINGDEVICE` | 20 | 0 | 0 | 0 | | `IFCSLAB` | 80 | 0 | 0 | 0 | | `IFCSPACE` | 0 | 0 | 0 | 18 | | `IFCWALL` | 134 | 225 | 0 | 1 | | `IFCWINDOW` | 6 | 0 | 0 | 0 | | **total** | **372** | **481** | **0** | **19** | Before: 0 / 747 / 54 / **71**. | | before | after | |---|---:|---:| | elements in a specific `IfcBuildingStorey` | 801 | **853** | | elements on a storey nothing measured | **71** | **0** | | `IFCRELCONTAINEDINSPATIALSTRUCTURE` | 13 | 14 | | `IFCPROPERTYSINGLEVALUE` | 8435 | 9231 | | `IFCPROPERTYSET` / `IFCBUILDINGSTOREY` / `IFCRELFILLSELEMENT` / `IFCMATERIAL` / every `by_ifc_type` | — | unchanged | | `Basement 2` contained elements | 76 | 6 | Every element bound in both exports keeps the same storey: 801 of 801, 0 moved, 0 lost. `tests/fixtures/synthetic-project.ifc` is **not** byte-identical, and the diff is the intended behaviour change: the one element with `storey_index: None` moves out of `#146` (Ground Floor) into its own `#148=IFCRELCONTAINEDINSPATIALSTRUCTURE(...,(#130),#20)` on the `IfcBuilding`, and its `IfcLocalPlacement` parent moves from the Ground Floor placement to the building placement (both are at the origin, so no coordinate changes). The header timestamp moved because the fixture was regenerated. ## What is NOT claimed - **Reference side NOT MEASURED.** The paired Revit IFC exports (`IFC Exports/2024_Core_Interior_slim.ifc`, `Revit/2024_Core_Interior.ifc`) are not in this checkout, so none of the 853 is scored against Revit's own `IfcRelContainedInSpatialStructure`. Every number above is measured on the `.rvt` and on rvt-rs's own emitted STEP. No `expected_*` value in either manifest was touched. - **The 18 `IFCSPACE` rows stay unbound** and are not placed by proximity — they come from partition strings, carry no element record, and have no elevation evidence of any kind. So does `Wall 55840`, whose record names no single Level. #219 is therefore `Refs`, not `Closes`. - **This is not the #86 / RE-20 typed level bind.** `level_bind.rs` binds a typed `Floor` / `Room` through an `m_level_id` schema field; that field is still unrecovered and `level-elementid-storey-bind` stays `unsupported` in the support matrix. A new, narrower `record-level-reference-storey-bind` row carries this claim with its scope stated. - **Scope is Revit 2024 partition element records.** Where `partition_element_records` or `partition_level_records` decline, the level-id set is empty, the join resolves nothing, and every element keeps the elevation join it had. Verified unchanged on the 2023 Einhoven sample. ## Testing - [x] `cargo test --all` passes locally — `tools/check-local.sh` green (fmt, clippy `-D warnings`, rustdoc `-D warnings`, `cargo test --workspace --all-targets --all-features`) - [x] `cargo clippy --all-targets --all-features -- -D warnings` passes - [x] `cargo fmt --check` passes - [x] New / changed code has unit tests — 5 in `element_record_level_refs`, 3 in `ifc::tests` (`a_named_level_reference_binds_an_element_no_elevation_join_reaches`, `an_unknown_level_reference_stays_unbound`, `the_elevation_join_leaves_a_level_reference_bind_alone`), all written failing first - [x] IFC exporter: `tests/fixtures/synthetic-project.ifc` diff documented above with rationale - [x] Corpus run with `RVT_PROJECT_CORPUS_DIR` set (both magnetar `.rvt` samples): 54 suites green, including `iter_elements_typed` (11), `witness_verdict` (2), `ifc_roundtrip`, `ifc_export_modes`, `arc_wall_corpus`, `support_matrix`, `json_schema_contracts`, `witness_registry` - [ ] **NOT MEASURED:** `project_count_fixtures::project_count_manifests_match_available_corpus` cannot complete locally — it panics at manifest resolution on `reference IFC missing at .../IFC Exports/2024_Core_Interior_slim.ifc`, which is absent from this corpus checkout, before any decoder work runs. It fails identically on `main` here. The schema half (`project_count_manifests_are_complete_and_explicit`) passes, and no `decoder_*` value in either manifest moved. - [ ] N/A: not a performance change (`tools/bench.sh` not rerun; export wall time on the 33.7 MB sample went 25.2 s → 27.2 s for the one added partition sweep) - N/A: no new element decoder ## Audit-honesty checklist - [x] README / docs reflect the current state — `docs/status.md`, `docs/user-guide.md`, `docs/export-diagnostics.md` and `docs/support-matrix.json` all updated, including correcting the #218 row's now-stale "46 plates remain unbound" sentence - [x] Limitation resolved → documented: the 46 plates / 6 windows are named in `status.md`, the RE-27 report and the manifest notes - [x] New limitations documented in the PR body and in-code — the 19 that stay unbound, the NOT MEASURED reference side, and the 2024-only scope - [x] Commit message describes what changed and why - [x] No emojis - [x] No private paths, personal emails, or internal jargon in committed files - [x] RE finding: reproducible probe at `examples/probe_re27_level_reference.rs` and a dated report at `reports/element-framing/RE-27-level-reference-storey-bind.md`, matching where RE-21…RE-26 live. `docs/rvt-moat-break-reconnaissance.md` carries no RE-2x addenda and was not touched. ## Legal and contribution hygiene - [x] Licensable under Apache-2.0 - [x] No Autodesk proprietary source, decompiled internals, or NDA'd SDK content — the finding is byte-level observation of a file plus Autodesk's published `BuiltInCategory` constants - [x] No new fixtures with real-world PII ## Breaking changes Rust API only, within the pre-1.0 crate: `partition_schema_mvp::{columns,walls,slabs,openings,instances}_from_partition_category_records` and `{column,wall,opening}_instances_from_records` / `instances_from_records` / `columns_from_records` take a `&BTreeSet<u32>` of Level ElementIds (obtain it with the new `partition_schema_mvp::level_element_ids`, or pass an empty set to keep the old behaviour). IFC output changes as described above. ## Related issues Refs #219. Refs #86 / RE-20 (still unsupported for the typed `m_level_id` join). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes IFC spatial containment semantics and export ordering (record Level bind before elevation); scope is Revit 2024 partition records with fail-closed rules, but downstream viewers comparing containment will see different grouping for previously mis-placed elements. > > **Overview** > **Revit 2024 IFC export now binds building elements to storeys using the host Level ElementId named in each partition element record** (#219, RE-27), when the record’s `+0x88` reference list names exactly one recovered Level. That join runs before the existing elevation match, leaves already-bound elements alone, and surfaces `LevelBindResolved`, `LevelElementId`, `LevelBindSource`, and `StoreyBindSource = record_level_reference` on emitted elements. Columns and walls that name two Levels (base/top constraints) are declined and keep the elevation join. > > **Elements with no recovered storey are no longer written into the first storey.** The STEP writer used to use `storey_index.unwrap_or(0)`; they are now related to **`IfcBuilding`** via a separate `IfcRelContainedInSpatialStructure`, so “storey unknown” is explicit instead of falsely placing items (e.g. 71 elements into `Basement 2` on Core Interior). > > On `2024_Core_Interior.rvt`, measured containment rises **801 → 853 of 872** building elements in a named storey (plates below level, windows at sill height, etc.), with **19** still unbound (18 name-only spaces, one wall). Docs, support matrix, corpus gates, RE-27 report, and witness observation hashes reflect the new properties and relation count. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0ba6217. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> BREAKING CHANGE: the five `partition_schema_mvp` entry points now take the recovered `Level` ElementId set (`&BTreeSet<u32>`, see `level_element_ids`) so the record reference list can be tested for a unique Level; callers that used the previous two-argument forms must pass it.
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
Closes #47 (M6-06 desktop distribution investigation).
docs/decisions/ADR-004-desktop-distribution.md: compare browser vs Tauri vs Electron; defer native wrappers until signing/update ownership is accepted and decode confidence is past scaffold-only demos.TODO.md; link ADR fromdocs/user-guide.md.Test plan
docs/decisions/Note
Low Risk
Documentation and decision-record only; no runtime, viewer, or packaging code changes.
Overview
Closes the M6-06 desktop distribution research (#47) by recording an accepted decision instead of starting wrapper code.
ADR-004 compares browser vs Tauri vs Electron on install, footprint, privacy, updates, and signing, and defers native wrappers until decode confidence, hosted viewer UX, and a named maintainer for signing/releases are in place. If revisited later, Tauri is preferred over Electron, still using the same WASM worker and no-network import rules.
TODO.mdmarks M6-06 shipped with a link to the ADR.docs/user-guide.mdstates there is no Tauri/Electron app and points users to the hosted or self-hosted static viewer path.Reviewed by Cursor Bugbot for commit 78d32cb. Configure here.