Repository navigation
fix(ifc): a project whose last phase holds no room writes the rooms of the latest phase that holds any (#1359) (RE-326) - #1435
Merged
Conversation
…f the latest phase that holds any (#1359) (RE-326) RE-326 left out every room whose own phase is not the project's last. Autodesk's rac_basic_sample_project has its 14 rooms in Working Drawings and none in its last phase, Learning Content, so 0.14.0 wrote none and an importer's room count went from 14 to 0. Where no phase is named and the last phase holds no room, the rooms are judged against the latest phase that holds any (Griffin, 2026-11-05): rooms all in one phase cannot overlap, and the only Revit export of this model holds them. Every other element still follows the last phase, a phase named (rvt-ifc --phase, Python phase=, the MCP phase argument), the last included, is exact, and a project with a room in its last phase is unchanged. The diagnostics name the phase and count its rooms (room_phase_fallback), rvt-ifc and rvt-schedule print a line, the Python bindings raise a RuntimeWarning, and RevitFile::room_phase_fallback gives the phase. It is a choice, not a measurement of Revit's default.
…ot yet measured on this head (#1359)
…1 exports, run 42011174043 (#1359) (RE-326)
DrunkOnJava
marked this pull request as ready for review
November 5, 2026 10:58
… the diagnostics and the notes read one answer (#1359) (RE-326) The fallback took every RoomElem record with a set phase for a room. With 14 placed rooms in one phase and one unplaced record in a later one it chose the later phase, left the 14 out and printed nothing; an unplaced record in the last phase stopped the fallback on a project that has placed rooms only before it. Both "the last phase holds a room" and "the latest phase that holds any" now count placed rooms, by the test scan_phase_excluded_instances counts the left-out rooms by (a placed instance of the rooms category, not in a non-primary design option), on Revit 2016 to 2023 and on the releases supported from 2024. The scan runs only when some RoomElem record names a phase before the last, and where placement cannot be told there is no fallback. The placed rooms in the fallback phase are counted in the filter, so RevitFile::room_phase_fallback, the diagnostics' room_phase_fallback and the note agree, and a failed scan_phase_excluded_instances no longer hides the field. Also: rvt-gltf and rvt-sheet say so; --anonymize replaces the phase in the note on stderr; PhaseFilter::differs_in_effect_from is the walk-drop predicate, with failure-first tests of the filter's state logic and of a project whose phase order is not ascending by ElementId; a Python test on Autodesk's rac_basic_sample_project runs in the wheel job; the MCP phase description, the anonymize and run_export docs and the diagnostics doc say what is known.
4 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
…no IFC for the gates, and the docs say a gate's run has no flags (#1435)
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
… 42035308270 (#1359) (RE-326)
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
) ## Summary The two same-project gates in Measure (`bodies_across_saves`, `areas_across_saves`) now skip a run dispatched with `ifc_flags`, and say so in a notice and the run summary, instead of turning it red. Their claim is about the default export. ## Motivation Measure run 42035311977 (`-f ifc_flags="--phase 961604" -f samples=true`, #1435's named-phase check) failed in `Same-project gates`: `areas across saves: FAILED: 2024: the IFC is missing`, on all four saves. That phase belongs to `rac_basic`, so `rac_advanced` refuses it and writes no IFC. A false red is a CI defect, and any run naming a phase or another flag hits it. ## Changes - `tools/ci/measure-reference-models.sh`: with a flag in `RVT_IFC_FLAGS` (a whitespace-only value is no flag, since `export_ifc` passes it unquoted and `rvt-ifc` gets none), `areas_across_saves` writes `skipped:` and `bodies_across_saves` writes `SKIPPED` for each candidate, naming the flags. The check scripts already print those as notices, and neither counts as a pass. A flagged run keeps no IFC for the gates, and a retained IFC is still deleted afterwards. - `docs/maintaining.md`, `measure.yml`'s comment and the two check scripts' headers: a run with `ifc_flags` checks neither gate, so the run a gate judges has no `ifc_flags`. ## Testing Unit tests are banned: none added. `bash -n` and `shellcheck -S warning` pass. Ran `tools/ci/check-areas-across-saves.sh` and `tools/ci/check-bodies-across-saves.sh` on fake results holding the new lines: both exit 0 with a notice for each file, and neither prints a pass. The real path is the next Measure with `ifc_flags`; #1435's named-phase runs are the case. Not measured: a real run on this head. A default run is unaffected: `RVT_IFC_FLAGS` is empty or only spaces there. Tested the guard on an empty value, one space, three spaces and `--phase 1`. ## Audit-honesty checklist - [x] No capability claim changes, and no export changes. - [x] No changelog fragment: a change to Measure only. - [x] No emojis, private paths or personal addresses in committed files. ## Legal and contribution hygiene - [x] Apache-2.0. No Autodesk proprietary source, decompiled internals or NDA content. ## Breaking changes None. ## Related issues Refs #1435.
DrunkOnJava
enabled auto-merge (squash)
November 5, 2026 14:08
11 tasks done
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
…p from the native record (#1357) (RE-343) (#1438) ## Summary #1357 asks for a door's or window's hand flip and facing flip, or how to derive them. They are two booleans of the instance's native `FamilyInstance` record, `m_flippedX` and `m_flippedY`. The decoded Door and Window records now carry them as `m_hand_flipped` and `m_facing_flipped`, and the typed Door view's `flip_hand` and `flip_facing` read them. No door or window is stored as a reflection, so the transform (and `m_opening_facing`, its Y axis) holds neither flip as such; `reports/element-framing/RE-343-door-window-flips.md` gives both answers with counts. ## Motivation #1357. The reporter's two questions, answered in the report from Measure runs 42014420180, 42015182768, 42021277032, 42021280392, 42021284465, and 42024103319, 42024107131, 42024111444 (the last three at `e2f8accc`), and 42037268099 and 42037272808 (at `18954f33`) and Snowdon Towers scored locally: - A mirrored transform: none is stored. The first orthonormal block has determinant 1 on 1,439 doors and windows scored against Revit's export, and the native `InstanceInfo.m_Trf.m_3x3` on all 1,219 of the open models'; and on 1,820 of the 2024 to 2027 samples. - `m_opening_facing` turns with `m_flippedX` only. For a door or window set in a plain wall rvt-rs binds, Revit's own placement is the stored axes reversed where the two booleans differ, so the direction it faces (the placement's +Y) is `m_opening_facing` reversed there: exact on 653 doors and 626 windows (0 wrong), and on 41 doors and 105 windows of held-out models. The two office files are one building and R2025 models 12 to 17 one layout six times: counted once, 456 doors and 346 windows. The case where the booleans differ (287 doors, 286 windows; 186 and 146 counted once) is measured on three 2024 buildings, one 2025 door, one 2026 house and no 2027 element. The 160 doors rvt-rs binds to no plain wall follow the rule on 111 and not on 49 (exact inversions, uniform by `IfcDoorType`, which fits revit-ifc's `StyleTransform`: report sections 1 and 3, not shown); nothing is claimed for them. - The fields are carried, equal to the booleans, by 1,820 of the 1,820 doors and windows of the 2024 to 2027 samples and by none of 2015 to 2023, whose doors and windows are not decoded as Door and Window records. ## Changes - `src/research/native_symbol_cuts.rs`, `partition_schema_mvp/openings.rs`, `fields.rs`, `../partition_schema_mvp.rs`: `OPENING_FLIP_FIELDS`. On 2024 and 2025 the flips are read in the pass `instance_cuts_and_symbols` already makes over the doors' and windows' records (`attach_cut_loop_sizes` passes it every door and window, those that are an opening alone too; the symbols it sizes are still those of the doors with a body): no pass is added. `InstanceCuts` is now a struct. On 2026 and 2027, and on no other release, `attach_opening_flips` makes one pass of its own (`graph_classes` limited to `FamilyInstance`). Both take the element's one current record (`native_document` allows one per channel and id). - `src/elements/openings.rs`: the typed `Door` view matched `fliphand` and `flipfacing`, names no record carries; it now matches the new fields, and its module doc no longer promises a hinge side. - `probes/examples/probe_re343_door_flips.rs`, `tools/re/door_flips_vs_ifc.py`: the probe and scorer; `tools/ci/scrub-holdout-results.sh` keeps the scorer's count lines for held-out models, a `field ... values` line only with values true, false, null or under 100. - `reports/element-framing/RE-343-door-window-flips.md`, a `docs/format-reconnaissance.md` addendum, `docs/status.md`, `docs/support-matrix.json` and `changelog.d/added/1357-door-window-flips.md`. - Revit's IFC as rvt-rs writes it is not changed (nothing reads the fields). What rvt-rs writes for a door's local axes is not measured here; a follow-up issue measures and decides it. ## Testing No unit tests (banned). End to end on real files: - [x] Measure runs of the probe and scorer on the open reference models, the office, the R2025 models, the 58 Autodesk samples and the 18 held-out models (runs above); Snowdon Towers (local only) scored on a Mac, counts only. - [x] At `e2f8accc`: the unfiltered Measure against `main` (run 42024095189): `ifc.sha256` equal on all 111 models; the timing run (42024099050), 64 files: no peak memory moves by more than 1 MiB, export time within 1.2% of `main` on the files of 2023 to 2025 and within 1.6% on those of 2026 and 2027, against 7% either way on the 33 files of 2015 to 2023 that the change does not touch. - [x] At the head `18954f33` (the second review's changes): G 42037262675, a filtered byte-identity run (the two office files and the 58 samples) against `main` at `a0639777`: `ifc.sha256` equal on all 60 models, no semantic finding. D'' 42037268099 and F'' 42037272808, the probe on the open models and the samples: the fields and the typed Door view equal to the booleans on 132 of 132 doors of Core Interior, 5 of 5 of RE1 Architecture, 268 of 268 of the office (as built, and at permit), 1 of 1 of R2025 model 12, and 1,588 of 1,588 doors of the 2024 to 2027 samples; none of the 1,540 doors of 2015 to 2023. - [x] Merged with `main` at `dd3dc116` (signed; the last merge brought #1435 and #1446, which this change does not touch). The measured code differs from what the run at `e2f8accc` measured (the second review's edits and everything `main` gained), so the unfiltered run was repeated on the merged head `80a9d72c`, with `main` at `afec5e37` as its base: run 42040585454 (`-f base=main -f nordic=true -f r2025=true -f holdout=true -f samples=true`), read. All 15 jobs that ran succeeded (the three timing jobs are skipped by design). `ifc.sha256` is the same on head and base on all 111 models (the 58 samples among them), the semantic diff has no finding on its 111 folders, and the scorer diff's one line is `Only in measure-head: areas_across_saves.txt`, the Areas gate's own output. `Same-project gates` passed (bodies 6 of 6 samples; the 25 Areas of `rac_advanced` equal on its four saves) but test beams, stairs, sketch outlines and Areas, not doors or windows: the evidence for this change is the byte identity. The run predates #1448, so the PR's gates verdict is by override citing it. Since that run `main` has moved to `dd3dc116`; this change's own `src/` files are unchanged (`git diff 18954f3 HEAD` over the five). ## Audit-honesty checklist - [x] Every figure names its run and head in the report; what is not yet measured on this head is labelled. - [x] A user-visible change has its fragment under `changelog.d/added/`; `docs/status.md` and `docs/support-matrix.json` say what `decoded_elements()` now shows. - [x] No emojis, private paths, personal email addresses or internal jargon in committed files; held-out data is not in them. - [x] Reverse-engineering finding: the probe is included, with a dated addendum to `docs/format-reconnaissance.md`. ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 - [x] The changes in this PR are based on public byte observations of the redistributable reference models and Autodesk's public sample projects, the buildingSMART IFC specification, and Autodesk's open-source exporter `revit-ifc` (CLEANROOM.md source 5), read for what Revit's export writes (`DoorWindowInfo`, `FamilyInstanceExporter`, `PlacementSetter`); `ExporterIFCUtils.GetTransformForDoorOrWindow` is cited by its public name only. It cites no source outside CLEANROOM.md's five: the assignment of `m_flippedX` to the hand and `m_flippedY` to the facing rests on revit-ifc's `DoorWindowInfo` (source 5), with the API names as exported symbols (source 2), and on the measurements. I have not used Autodesk SDK source, ODA SDK source, leaked internal documentation, NDA material, or decompiled internal Revit implementation code beyond public symbol exports, and I have not copied or translated code from revit-ifc. - [x] No test fixtures ## Breaking changes None. Two fields are added to decoded Door and Window records, and the typed Door view's two fields stop being null. ## Related issues Refs #1357
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
Where no phase is named and a project's last phase holds no room, the export writes the rooms of the latest phase that holds any. Only placed rooms count, both for "the last phase holds a room" and for "the latest phase that holds any". Every other element still follows the last phase, a phase named (
rvt-ifc --phase, Pythonphase=, the MCPphase), the last included, is exact, and a project with a placed room in its last phase is unchanged.Motivation
#1359: an outside importer reports Autodesk's
rac_basic_sample_projectgoing from 14 rooms (decoded_elements(),IfcSpace) in 0.13.0 to 0 in 0.14.0. The cause is the room-phase rule of RE-326 (#1328): all 14 rooms are in Working Drawings, the second of three phases, and the last, Learning Content, holds none. Measure run 41985023986 (refb510ff3c): the 2016 to 2027 saves holdIFCSPACE0 androom_not_in_export_phase14, all in Working Drawings; the 2015 save holds 14 and counts none (both phase rules start at Revit 2016, #1332).This is a choice by Griffin (2026-11-05, "Fall back to rooms' phase"), not a measurement of Revit's default: rooms all in one phase cannot overlap, and the only Revit export of this model holds the 14. No Revit export made at the last phase of such a project exists.
Changes
src/research/native_phases.rs:PhaseFilter::room_fallbackandroom_fallback_rooms, found from the placed rooms only (placed_room_ids,is_placed, the testscan_phase_excluded_instancescounts the left-out rooms by; the scan runs only when aRoomElemrecord names a phase before the last, and where placement cannot be told there is no fallback),export_named(named versus defaulted),room_fallback_in_effect,room_export_phase,with_default_export_phase,differs_in_effect_from(the walk-drop predicate);room_outside_export_phasejudges rooms againstroom_export_phase. Elements still useexcluded, which the fallback does not touch.src/reader.rs:RevitFile::room_phase_fallback;set_export_phaseandclear_export_phasedrop the memoised walk bydiffers_in_effect_from(naming the last after a fell-back default, and back).src/ifc/mod.rs,src/ifc/export_pipeline.rs:ExportDiagnostics::room_phase_fallback(RoomPhaseFallback { phase, rooms }, from the same filter as the handle's answer, absent when not applicable, replaced under--anonymize),ExportNote::RoomPhaseFallback(appended last) withanonymized().src/bin/rvt_ifc.rs(help; the note, with the phase replaced under--anonymize),rvt_gltf.rs(the note),rvt_schedule.rsandrvt_sheet.rs(a line each).rvt-py/src/lib.rs,python/rvt/__init__.pyi: aRuntimeWarningfrom every export call and fromschedule_csv,decoded_elementsandelement_counts.tests/python/test_room_phase_fallback.pyand a step of the wheel job that fetches the 2018 save (pinned by sha256).viewer/src/main.ts,viewer/index.html: the last phase's label and hint say so; the downloaded diagnostics redact the phase.rvt-mcp/src/args.rs: thephasedescription says that naming the last phase differs from leaving it out (the contract files follow from the watcher).docs/schemas/export-diagnostics.schema.json,docs/export-diagnostics.md,docs/rooms.md,docs/evidence.md,docs/python.md,docs/user-guide.md,docs/status.md,docs/supported-profile.md,docs/mcp.md,docs/viewer-api.md,docs/format-reconnaissance.md,README.md,reports/element-framing/RE-326-room-phases.md(new section 9),changelog.d/changed/1359-room-phase-fallback.md.Testing
Unit tests are banned in this repository; the only ones are failure-first tests of pure helpers with no I/O, the exception the operator policy allows:
room_fallback_phase(no phases, no room, a room in the last phase, a phase not in the project, rooms in two earlier phases, one phase, an order that is not ascending by ElementId) andPhaseFilter's state (the default, a phase named, the last named, going back,differs_in_effect_from). Nothing was built or run locally;cargo fmt --all -- --checkandtools/release/changelog.py checkpass.tools/check-local.shpasses: not run locally; CI runs it (the fast jobs passed atb0abb7b6).ea0c74499bdc4346435cf89c8fd95856371127cb(this PR's code merged withmainata0639777,SpaceKindincluded; what follows is documentation). The commands and the reading are in RE-326 section 9.4.-f base=main -f nordic=true -f r2025=true -f holdout=true -f samples=true): 111 exports compared; 12 moved, the 2016 to 2027 saves ofrac_basic_sample_project, each now 14IfcSpace(0 before) ofSpaceKindroom14 (space_kinds_vs_ifc: area 0, mep_space 0, family_instance 0, no SpaceKind 0), noroom_not_in_export_phase(14 in Working Drawings before),room_phase_fallback{Working Drawings, 14}, 464 entities (450 before) and thervt-ifclog line; the other 99 are byte for byte as before byifc.sha256, the 2015 save and 18 held-out exports among them (counts only, none moved). The scorer diff names only those 12 models; IfcOpenShell's WHERE rules read findings 0 on all 13 saves; nospace_kinds_vs_ifc.txtof the head side reports a space without a kind; the semantic check of the MCP dumps of 34 models reports 0 changes.--phase 961604, 2018 to 2027): 14room_not_in_export_phase, 0IfcSpace, no fallback field,ifc.sha256equal tomain's default on 10 of 10 saves. ItsSame-project gatesjob failed and its exports did not: the phase id exists only inrac_basic, sorac_advancedwrites no IFC under the flag and the Areas gate saw nothing, a false red that fix(ci): the same-project gates skip a run with ifc_flags (#1435) #1446 fixes.--phase 86961): 14IfcSpaceof kindroom, andifc.sha256equal to this PR's default on 10 of 10 saves.ifc.sha256) against the public Revit 2018 export of RE-326 section 5, fetched again and its sha256 checked (1114ce91…): rvt-rs 14IfcSpace, Revit 17, in both 14, only rvt-rs 0, only Revit 3 (the MEP Spaces), as section 6 found for--phase 86961. Counted with a regular expression over theIFCSPACEGlobalIds because IfcOpenShell was not installed where it ran; the scratch copy was deleted and the export is not committed.mcp answersfor rac_basic (the MCP scorer and dump run only on models with a Revit export); Revit's default at the last phase of such a project (no export exists); the Python warnings, which havetests/python/test_room_phase_fallback.pyin the wheel job of the full CI and have not run on this head (the draft ran the fast jobs); the viewer's label, which has no browser test.rac_basic_sample_projectsaves, which are in no witness set).Audit-honesty checklist
changelog.d/changed/rac_basic_sample_projectare replacedLimitations introduced:
rvt-ifc --phase, Python and the MCP server can.rvt-elements,rvt-infoand the other CLIs that read the walk write the fallback rooms and print nothing about it.Legal and contribution hygiene
Breaking changes
None to the API: the
ExportNotevariant is appended to a#[non_exhaustive]enum,ExportDiagnosticsis#[non_exhaustive]and the field is skipped when absent. A caller that matched on the 0.14.0 result forrac_basic_sample_project(0 rooms by default) now gets 14, which is the point;phase="Learning Content"(or the last phase's ElementId) keeps the 0.14.0 result.Screenshots or output samples
The log line
rvt-ifcprints on each of the 12 saves, from run 42035308270:rvt-ifc: the project's last phase holds no room, so the 14 room(s) of "Working Drawings", the latest phase that holds any, are written; every other element is of the last phase. Naming the export phase (rvt-ifc --phase, Python's phase=, the MCP phase argument) is exact: naming the last writes no roomRelated issues
Refs #1359 (the issue also holds a report on doors and windows, which this does not address).