Repository navigation
fix(ifc): leave out elements that do not exist in the export phase (#328) (RE-184) - #1074
Conversation
dddc2af to
cae766c
Compare
|
Thanks for the rebase and RE-184. Review, with what I measured: What holds. The rule matches Revit's exporter for non-spatial elements: with no phase chosen it exports the document's last phase (revit-ifc What needs a change before it lands.
The branch also conflicts with main at the end of |
…in's own code (#1084) ## Summary Measure saves its shared rust cache (key `measure`, restored by every later Measure run) only when it measured main's own code: the head job when `ref` is empty, the base job when `base` is empty or `main`, the timing job when both hold. ## Motivation Measuring an outside contributor's pull request is done by dispatching Measure from main with `-f ref=refs/pull/N/head`. `save-if: github.ref == 'refs/heads/main'` was true for those runs, so on a cache miss the contributor's build scripts would have run with the ability to write a cache later main runs restore. Checked on 2026-10-29: Measure has `contents: read`, no secrets, `persist-credentials: false`; no cache was saved by the runs on #1081 and #1074, and the two existing measure caches were deleted. This closes the remaining channel. ## Changes - `.github/workflows/measure.yml`: both `Swatinem/rust-cache` steps' `save-if`. ## Testing Unit tests are banned in this repository: do not add them. - [x] The workflow parses (YAML load); CI's workflow lint runs on this PR. A Measure dispatch from main with no `ref` still restores and saves; one with `ref` set restores only. - [ ] Verified on real Revit files: N/A, CI-only. ## Audit-honesty checklist - [x] No user-visible change, so no changelog fragment. - [x] No emojis, private paths or internal jargon. ## Legal and contribution hygiene - [x] Apache-2.0; no Autodesk material. ## Breaking changes None. ## Related issues None.
cae766c to
5b447bc
Compare
5b447bc to
60be732
Compare
…runkOnJava#328) (RE-184) rvt-ifc now leaves out elements that don't exist in the export phase, as Revit's export does. A project's AllProjectPhases.m_phaseIds lists its phases in order; with no phase chosen Revit's IFC export shows the last, and an element is exported when it exists there. Squash of puzzbobb's PR DrunkOnJava#1074 (feat, test, research and docs commits) rebased onto main.
… (RE-184) Revit's exporter applies the created/demolished status rule to non-spatial elements only. A room is skipped by a different rule, IsRoomInInvalidPhase (revit-ifc ElementFilteringUtil.cs, called from Exporter.ExportSpatialElements): its ROOM_PHASE parameter, when set, must be the export phase. An area or an MEP space gets no phase check. Whether ROOM_PHASE is a room record's m_createdPhaseId is measured on no model here, so PhaseFilter::excludes now takes the record, like DesignOptions::excludes, and never excludes a room. A room created in an earlier phase than the last is still written, and the README, status page, report and changelog say so.
) (RE-184) memoised_phase_filter ended in unwrap_or_default(), so a failed read of the phases exported every element with nothing in the diagnostics. A failed read of a Revit 2023 to 2027 file now leaves the filter empty with read_error set, and the export diagnostics carry a warning that elements outside the export phase are written. A release the native record path does not read gets an empty filter and no warning, as before. The phase scan in the diagnostics now takes the layout release, like its sibling scans, instead of BasicFileInfo's.
…unkOnJava#328) (RE-184) tests/phase_filter.rs needs 01_Walls_Phases and 01_Walls_Phases_Demo with Revit's exports, which are not published or pinned, so it skips in CI and passes. Its module doc and the RE-184 report now say so, instead of leaving a green job to read as a check against a Revit export.
…ed and 23 not in Revit's export (DrunkOnJava#328) (RE-184) Snowdon Towers Architectural (2024) goes from 5,974 elements to 5,968 once the six slabs created and demolished in Legends are left out: 5,945 are in Revit's export and the other 23 are curtain panels with no resolved type. Measure run 40930512289 moved only this sample on any CI model (IfcSlab 224 to 218). The README, reference models, the W4 row of the 1.0 criteria, the roadmap, the supported profile and the contribution map no longer list the slabs or phase filtering as open, and say that rooms are not checked against the phase.
…d item (DrunkOnJava#328) (RE-184) The README's support row and the supported profile still said 29 of Snowdon Towers' elements are not in Revit's export; with the six slabs no longer written it is 23 of 5,968. The export diagnostics guide and schema now name element_record_not_in_export_phase and the warning for a failed read of the phases.
…te (DrunkOnJava#1132) DrunkOnJava#1132 moved every probe into probes/examples while this PR was open; its new probe moves there too, its run command names -p rvt-probes, and the RE-184 report and reconnaissance addendum cite the new path.
60be732 to
fef3d17
Compare
DrunkOnJava
left a comment
There was a problem hiding this comment.
Maintainer review: taking this over to land it. puzzbobb's commit stays first and keeps their authorship, so the squash credits them. The four changes from my 2026-10-29 review are on top, and the description lists them.
What I checked in the code:
PhaseFilter::excludes(record)returns false forOST_ROOMS. All four call sites (native_phases.rs,partition_element_records.rs,partition_schema_mvp.rs×2) pass the record. Rooms therefore keepmain's behaviour untilROOM_PHASEis measured against an export.- The read-error path stores
format!("{error:#}")inPhaseFilter.read_error, and the export diagnostics push one warning for it before the confidence count. Releases outside 2023 to 2027 return an empty filter with no error, so they get no spurious warning. - The rebase onto
main:lib.rstakesmain's research list plusnative_phases. The README keepsmain's rows and re-applies this PR's two edits (dropping "phase filtering (#328)" and adding the rooms row). The new probe moved toprobes/examples/with its run command. No conflict markers remain.
Verified: Measure 41025987689 (see the description). Only Snowdon architectural moves, by exactly the six Legends slabs (element_record_not_in_export_phase = 6), and everything else is byte-identical. I'll land it on CI passed for this head. Thank you, @puzzbobb: the phase-order rule and RE-184 are yours.
…elper, and one ArcWall scan per file (#1136) ## Summary The audit's helper refactor (Griffin, 2026-10-30, "One copy of each helper"): copied helpers become one shared copy each, little-endian reads go through `le_bytes` where the conversion is exactly equivalent, and the partition ArcWall scan runs once per file instead of up to four times. Nothing an export writes should change; Measure checks that. ## Changes - **`le_bytes`:** about 117 of 227 inline `from_le_bytes` reads now use `le_bytes`, which gains `i32_at` and `u16_units`. The rest are left because their failure semantics differ: `Result` errors with specific messages, `InstanceField::Bytes` fallbacks in `walker.rs`, cursor `take(n)?` reads, fixed-size arrays that cannot fail, and `src/bin`. A raw-indexed read behind an explicit bounds check becomes `?` only where that check makes the new `None` arm unreachable. Messages from `anyhow` errors are kept word for word. - **`find_subslice`:** one copy, memchr, with the empty-needle guard kept. It replaces two wrappers and one scalar loop. - **GUID:** one `guid_string`, now used by three readers. One IFC GlobalId alphabet. `derive_default_ifc_guid` calls `compress_ifc_guid`. - **`src/native_json.rs` (research):** `element_id`, `element_id_i64`, `finite_triple` and `agree`, shared by twelve `native_*` and partition modules. Variants with different semantics stay. - **`src/vector_math.rs` (private):** `sub`, `dot`, `cross`, `distance` and `polygon_area_xy`. Expressions are token-identical to the copies they replace. `from_decoded::polygon_area_sqft` keeps its public path. The three point-in-polygon copies and the signed areas differ and stay. - **Storeys:** one `elevation_storey_name`. - **ArcWall scan:** memoised on `RevitFile` per release and `WalkerLimits` (`memoised_arc_wall_scan`). The production walk, the partition assembler and both IFC-export sites share it. The public `scan_partition_arc_walls_with_limits` keeps its signature. - `changelog.d/changed/arc-wall-scan-memo.md`. No public signature changes. `fuzz/` and `rvt-probes` call public items only. ## Testing - No local build, by policy. A side agent wrote the commits, and I read every diff. - The branch's new `use crate::le_bytes;` imports made four `crate::le_bytes::` paths already on `main` redundant, which `unused_qualifications` (an error under `-D warnings`) would have rejected. They are fixed in `ac976268`. - CI is the compiler, with clippy and rustdoc under `-D warnings`, MSRV and i686. - Measure [41037020175](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41037020175), unfiltered against `main` with nordic and r2025: - The other 30 models are byte-identical on both sides: every `ifc.sha256`, every `diagnostics.json` and all scorer outputs (1,262 files on the head side). - The BIM4LCA office's host was unreachable during the base run, so the office was **NOT MEASURED** on the `main` side. - Its head-side export, diagnostics and every scorer output are instead identical to those of #1074's head (run 41025987689, commit 60be7324). Every PR merged since then (#1133, #1134, #1135, #1137) leaves the export path untouched. - `CI passed`, including clippy and rustdoc under `-D warnings`, MSRV and i686. ## Found, not changed `partition_scanner.rs:239/449` can index `buf[offset + 3]` past the end when a tag matches in a buffer's last three bytes. That is a panic on hostile input, so it will be fixed in its own PR rather than in a behaviour-preserving refactor. ## Breaking changes None. ## Related issues None.
## Summary Release metadata for v0.11.0 (RELEASE.md steps 4 to 7). Merging this is not the release: the signed `v0.11.0` tag on its squash commit is. ## Motivation `main` holds user-facing fixes that installed users do not have yet, above all #1075 (a model over the reader's limits exported empty with exit status 0; the reporter can verify only from a release) and #421 (files that kept an older schema read as zero elements). It also holds the breaking removal of unused stable API (#1128), which makes this a minor release. ## Changes - Version 0.11.0 in `Cargo.toml`, `rvt-py/Cargo.toml` (and its `=0.11.0` pin), `rvt-wasm/Cargo.toml`, `tools/stream_evidence/Cargo.toml`, `viewer/package.json`, `CITATION.cff` (dated 2026-10-30), both lockfiles' workspace entries, and the `FILE_NAME` / `IFCAPPLICATION` lines of the two synthetic IFC fixtures, which the contract checks compare byte for byte since #1133. RELEASE.md's version list now names those fixtures. - `CHANGELOG.md`: `changelog.py assemble` moved the 33 fragments into `[0.11.0] — 2026-10-30`, with an introduction, credits (puzzbobb: #1074, #1076, #1077, #1081; n3ur0m4n: #1073) and "Upgrading from 0.10" (removed API, exit status 3 for a model over the limits, saved meshes on by default, properties no longer written, `Flagged` schema fields, the probes crate). - `README.md`: "Release 0.11.0 and main", and the reconnaissance probes point at `probes/examples/` (#1132). - `rvt-py/README.md` (packed into the wheel): what `write_ifc()` does when part of a file was over the limits. ## Testing CI is the gate. After this PR's CI, both Core Interior `rvt-rs.json` witness observations and their verdicts are refreshed from its `octetproof-core-interior` artifact (only `witness_version` and the verdict hashes may differ); the PR stays unarmed until then. ## Audit-honesty checklist - [x] The changelog section and README release section state only what the entries measured - [x] No emojis, private paths or internal jargon ## Legal and contribution hygiene - [x] Apache-2.0 - [x] No Autodesk proprietary content ## Breaking changes The release carries #1128's removal of unused public API; "Upgrading from 0.10" lists what a user changes.
Summary
rvt-ifc now leaves out elements that don't exist in the export phase, as Revit's export does (#328, RE-184). A project's
AllProjectPhases.m_phaseIdslists its phases in order. With no phase chosen, Revit's IFC export shows the last one, and an element is exported when it exists there:On Snowdon Towers the order is Legends, Existing, New Construction. #328's six slabs are created and demolished in Legends, so they exist in no later phase. They are the only elements of Snowdon Architectural the rule leaves out.
Motivation
#328: Revit's export of Snowdon Towers leaves out six slabs (2287679 to 2287714) that rvt-rs writes. On 2026-10-18 you asked for this as a PR numbered RE-184 (my patch had used RE-173, which
mainnow has for column z). This is that patch rebased ontomain5a81e74 and re-measured.Changes
src/native_document.rs:Options::graph_classesdecodes graphs only for the classes named. Every other record comes back withRecord::base(native_element::decode_base), which is the cheap way to read every element's two phase ids.src/native_phases.rs(research, listed insrc/research.rs): the phase order and the ids not in the last phase. It is memoised asRevitFile::memoised_phase_filter(), with the publicRevitFile::phase_filter()behindunstable-research, asdesign_optionsis since 1.0: name the surfaces the stability commitment covers, and check each for breaking changes #873.DesignOptions::excludes:without_non_primary_options, the empty curtain panel scan and the volumeless count.src/ifc/mod.rs: a skipped itemelement_record_not_in_export_phase, counted by class.tests/phase_filter.rs, registered intests/integration/main.rsandtools/ci/test-targets.txt(real).examples/probe_re184_phase_order.rs. Report:reports/element-framing/RE-184-phase-order.md.docs/status.md, an addendum indocs/rvt-moat-break-reconnaissance.md, andchangelog.d/fixed/phase-filter.md.The commits run feat → test → research → docs.
Testing
Unit tests are banned in this repository: do not add them. Show the change working end to end on real files instead.
tools/check-local.shpasses (fmt, clippy, rustdoc, build, real-file / CLI / contract checks)cargo fmt --all -- --checkpasses.cargo clippy --workspace --all-targets --all-features -- -D warningspasses.cargo doc --no-deps --libpasses withRUSTDOCFLAGS='-D warnings', with and withoutunstable-research.cargo build --workspace --all-targets --all-featurespassescargo test --profile ci --docpasses, 28 of 28.basics_inspect,basics_elementsandbasics_export(oncorpus/tier1/architectural-2024) run cleanly;basics_exportwrites its IFC, glTF, CSV and diagnostics.cargo +1.87 check --profile ci --all-targets(the MSRV job): passes.RUSTFLAGS='-D warnings -D unnameable_types' cargo check --lib --binspasses.tools/ci/verify-real-files.sh --profile ci --no-fail-fast: passes 265 of 265. It ran withRVT_SAMPLES_DIR(phi-agd2eb1f3),RVT_PROJECT_CORPUS_DIR(magnetarfd755e1with RE1 andr2025/, with my two phase models added locally) andRVT_NORDIC_LCA_DIR(BIM4LCA), so the new test ran rather than skipped.python3 tools/release/changelog.py checkandpython3 tools/ci/re-citations.pypass.Verified end to end on real Revit files: the command, the files (and their licence), and the measured result against Revit's own export are in the PR body, with the script or probe that reproduces it
main01_Walls_Phases01_Walls_Phases_DemoWith the filter disabled the test fails:
rvt-ifc --diagnosticsonmainand on this branch:main→ branchIfcSlabchanges (224 → 218)IfcSlaband what they ownIfcWall80 → 38,IfcBuildingElementProxy307 → 271,IfcWindow66 → 46,IfcRoof6 → 0IfcWall451 → 433,IfcWindow46 → 40,IfcStairFlight19 → 17,IfcRoof,IfcSlab,IfcRailingandIfcStairone eachSnowdon 2024 is the edition Snowdon: 6 slabs in the Legends phase are not in Revit's export (phase filtering) #328 measured, fetched from Autodesk's host by its pin in
research/autodesk-sample-projects.tsv(sha25633271010…, matched), and the six slabs it lists are the ones left out. I have no Revit export of Facades or Golden Nugget, so their counts are the rule's and are not checked against Revit.Files: Snowdon Towers (Autodesk's sample projects, 2024 from the pinned Autodesk download, 2025 a local copy; not redistributed, as
tools/fetch-autodesk-samples.shsays, their own terms not checked). Golden Nugget (a local copy, not in rvt-rs's corpora; licence not checked, not redistributed).01_Walls_Phasesand01_Walls_Phases_Demo(my own, not shared). RE1, Core Interior (magnetar, MIT) and the R2025 models (mine, Apache-2.0, Sloped roofs need a Revit 2024/2025 pitched-roof oracle #356).probe_re184_phase_orderover every distinct local.rvt(135 files): the native path reads 94, and 91 list phases (Revit 2024 to 2027). Only the four files above leave anything out. That includes RE1, Core Interior and the 23 R2025 models, so the rule removes nothing their reference exports hold. Files the native path doesn't read (Revit 2019 to 2022) get an empty filter and export as before.If this touches the IFC exporter: the witness verdicts replay (see CONTRIBUTING.md) or the changed observations are refreshed in this PR
N/A: performance.
tools/bench.shwasn't run.Audit-honesty checklist
changelog.d/<section>/(seechangelog.d/README.md), not inCHANGELOG.mdchangelog.d/fixed/phase-filter.md.docs/status.md's "phase filtering (Snowdon: 6 slabs in the Legends phase are not in Revit's export (phase filtering) #328)" gaps are removed. I left the README's Revit 2024 Snowdon sentence (5,974 elements, 29 of them not in Revit's export, "6 slabs in the Legends phase") as it is: its counts are against Revit's 2024 export, which I don't have, so I can't restate them. With this PR those six slabs are no longer written.RVT_PROJECT_CORPUS_DIRor arguments. The commits are authored with GitHub's noreply address, and signed.examples/and a dated addendum todocs/rvt-moat-break-reconnaissance.mdare includedLegal and contribution hygiene
CONTRIBUTING.md)CLEANROOM.md)testuser,111111,FY-20XX, etc.) and contain no real-world PIIThe changes in this PR are based on public byte observations of the reference models and of two models I made in Revit 2025, together with Revit's own IFC exports of them (CLEANROOM.md source 1). 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.
Breaking changes
None.
RevitFile::phase_filter()andrvt::research::native_phasesare new and behindunstable-research. The export writes fewer elements only where they don't exist in the last phase, and its diagnostics name them.Screenshots or output samples
Snowdon Architectural,
rvt-ifc --diagnostics:{"reason": "element_record_not_in_export_phase", "count": 6, "classes": {"Floor": 6}, "sample_names": []}Related issues
Fixes #328. Related to #309.
Maintainer changes before landing (2026-10-30)
puzzbobb's commit is kept first, under their name. The maintainer added the four changes the 2026-10-29 review asked for:
ElementFilteringUtil.GetExportFilter). It skips a room whoseROOM_PHASEis not the export phase (IsRoomInInvalidPhase, called fromExporter.ExportSpatialElements), and checks no area or MEP space. No model here showsROOM_PHASEto be the room's created phase, soPhaseFilter::excludesnever excludes a room. The README, status and supported-profile docs, the report and the changelog state the gap.tests/phase_filter.rsand the report say plainly that CI does not run the test until the two phase models are published.Rebased onto
mainafter #1128, #1131 and #1132. The new probe now lives inprobes/examples/(#1132).Verification
Measure 41025987689, unfiltered against
mainwith nordic, r2025 and Autodesk's samples:IfcSlabgoes from 224 to 218 and Floor elements from 182 to 176, and the new skipped itemelement_record_not_in_export_phase= 6 (Floor). Those are the six Legends slabs of Snowdon: 6 slabs in the Legends phase are not in Revit's export (phase filtering) #328.