Repository navigation
feat(elements): an Area whose area boundary lines name each other is drawn to their joins, and a line off the axes refuses only the Areas it touches (#1261) (RE-330) - #1351
Merged
Conversation
…drawn to their joins, and a line off the axes refuses only the Areas it touches (#1261) (RE-330)
4 tasks done
It stood in this branch's first commit so that the public millimetre export could be scored; it is a fix of the shared scorers, with its own evidence, in its own pull request. tools/re/area_joins_vs_ifc.py and tools/re/space_profiles_vs_ifc.py read the public export through the fixed frame, so they need that change to be in.
…y_joined, and the evidence behind the joins is labelled (#1261) (RE-330) SpaceOutlineSource is area_boundary_joined for an Area whose outline runs along a stretch of a line carried on past its record or along a connector, and stays area_boundary for one drawn from the lines as they are. Two copies of a line that differ in their reference list make it a conflicted line, as two that differ in box do. RE-330, docs/rooms.md, the support matrix, the changelog fragment and the MCP descriptions say what the check rests on: one public IFC2X3 export by a third-party build of Revit's 2021 exporter, showing the model's 2015 to 2020 state, and the 2024 save's reader for the 2022 and 2023 saves; no Revit IFC4 export of these Areas exists.
DrunkOnJava
added a commit
that referenced
this pull request
Nov 4, 2026
…1353) ## Summary `tools/re/ifc_common.py::site_frame` moved Revit's meshes into rvt-rs's internal feet by subtracting the `IfcSite`'s origin from the IfcOpenShell world, which is in metres. It read the origin in the file's length unit and did not scale it. For a Revit export in millimetres with a placed site, Revit's side of every comparison was off by about 1000 times the site's offset. It now scales the origin by the file's unit. A file in metres, or placed at the origin, is unchanged. ## Motivation Found while scoring a public Revit 2021 export in millimetres for #1261 (RE-330). `wall_layers_vs_ifc.py` had the same defect and was fixed on its own in RE-126; this is the shared copy the other scorers use. ## Changes - `tools/re/ifc_common.py`: `site_frame` scales the site's origin by `ifcopenshell.util.unit.calculate_unit_scale`. - `docs/rooms.md`: the two rows and the sentences that quoted the corrected counts. - `reports/element-framing/RE-313-space-outlines-measured.md`, `RE-314-room-outlines-2026-2027.md`: a dated correction after the figure each quotes (their history is not rewritten). ## Testing Unit tests are banned here: none added. The evidence is a pair of filtered Measure runs that export the same rvt-rs commit (`-f ref=35a9d322`, #1351's head) and differ only in the scorers they run, `-f base=none -f nordic=true -f holdout=true -f models="nordic-office-* holdout-*" -f scorers=space_profiles_vs_ifc`: with the fixed scorers ([41833543727](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41833543727), `--ref feat/1261-area-boundaries`, where this change first stood) and with `main`'s ([41833547378](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41833547378), `--ref main`). Of the 22 models, 20 have identical space counts (the four office files, Warmond, Frigento, Vitoria, BIM Whale, `modelo_bim`, `teste_export_2025` and the 2022 to 2027 pairs). Two differ, counts only: | held-out model | in both | area within 0.1% | outline within 0.01 ft | boundary within 0.01 ft | |---|---|---|---|---| | the 2026 house, `main` → fixed | 12 → 13 | 10 → 13 | 0 → 13 | 0 → 13 | | Gdynia (2021), `main` → fixed | 18 → 18 | 18 → 18 | 0 → 16 | 0 → 18 | So rvt-rs's room outlines on those two models were right, and the scorer misplaced Revit's site. Measure takes scorers from `--ref`, so no unfiltered run is made here: the isolation pair is the evidence. Not isolated: about 20 other scorers import `site_frame` (stairs, openings, tapered walls, saved meshes, ...). Only `space_profiles_vs_ifc` was run on the two models, so their lines for these two exports, and any figure quoted from them, may move too. A grep of `docs/` and `reports/` for the house's and Gdynia's space profiles found the figures corrected here; other scorers' figures for those two models were not looked for. ## Audit-honesty checklist - [x] Docs and the two reports state the corrected counts; no emojis; no private paths - [x] Not a user-visible change: no changelog fragment - [x] Held-out data: counts only, no ids or names of rooms ## Legal and contribution hygiene - [x] Apache-2.0; no Autodesk source ## Breaking changes None. ## Every model and every scorer (added by the maintainer session) **Runs:** Measure 41836847517 (`--ref fix/scorers-site-unit`) and 41836862051 (`--ref main`). Both scored `main` at 5afb95c, the same code, on every reference model, the BIM4LCA office files, the R2025 models and the held-out models, with every scorer. **Result:** of all the scorer outputs, only the two held-out models' `counts.txt` differ, counts only. - **2026 house:** - space profiles as in the table above; - space overlaps: rooms within 0.1% of Revit's face area go from 10 to 13 of 13 (upward, downward and every face); - mesh bodies: its 2 `IfcWindow` saved meshes go from 0 to 2 of 2 within 0.01 ft, within 0.001 ft and for "ref on ours". - **Gdynia:** space profiles only, as above. **Docs:** no doc or report quotes the house's window or overlap figures. RE-126 records the same class of bug, already fixed, in `wall_layers_vs_ifc.py::site_to_internal`.
…ement, so an Area that runs past one is marked area_boundary_joined (#1261) (RE-330) The marker looked at where the middle of an edge lay against the line's stored extent, but a stored end that no other line met was not a node, so an edge from a carried-on end to the next node ran across it and read as stored. Areas 14, 17 and 20 of rac_advanced, which run 0.03 to 0.497 ft past a line's record, said area_boundary; the Python version of the rule and the outlines say they joined. RE-330 section 7 records the cf8d807 runs.
DrunkOnJava
marked this pull request as ready for review
November 4, 2026 13:40
# Conflicts: # docs/mcp-tools.md
…t, a carry and a connector are capped at 1 ft, a connector needs opposite sides, and the evidence behind the joins is labelled as measured (#1261) (RE-330) A free end was carried to the farthest mutually named perpendicular line by its fixed coordinate alone. It now stands only if that line, after its own carry, spans the place reached; a carry within 1 ft (measured 0.666) and a connector of at most 1 ft (measured 0.625) between lines that run away on opposite sides, else the end stays free. A connector is a flag, not the id u32::MAX. The export is labelled by its string (publisher not established) and the 16 of 16 as in-sample; BIM Whale's byte-identity as vacuous for the joins; the lines left out as RE-330 section 5 has them; RE-330 section 7 holds the dc56e83 runs and section 8 pins its commands.
…complexity flags (#1261)
DrunkOnJava
enabled auto-merge (squash)
November 4, 2026 14:13
4 of 9 tasks
DrunkOnJava
added a commit
that referenced
this pull request
Nov 4, 2026
… entry per element (#1326) (#1358) ## Summary Each fail-closed decision the exporter makes about an element is recorded, on request, as an entry with the ElementId, a stage, a reason code and the stream and byte offset its record was read from where known. The diagnostics' `skipped` section is now counted from the same decisions and is unchanged. `rvt-rs-mcp` gains `explain_element(model, element)`: the element's provenance, its trust markers and every decision recorded for it. ## Motivation Closes #1326 (milestone 0.15.0). `SkippedExportItem` counts what was left out by reason and class, with sample names; it cannot answer "why does this door have no opening?" or "why is this room a box?". Builds on #1325's provenance table. ## Changes - `src/ifc/export_decisions.rs` (new): `ExportDecision` (`stage`, `reason`, `element_id`, `class`, `stream`, `offset`, `detail`), `DecisionStage` and `ExportDecisionLog`, capped at 5,000 entries a reason, sorted by reason and ElementId, with `total`, `recorded` and `dropped` per reason and in all. - Each scan behind a `skipped` item now returns its elements rather than counts: `scan_unattributed_frames`, `scan_volumeless_instances`, `scan_non_primary_option_instances`, `scan_phase_excluded_instances`, `scan_empty_curtain_panels`, the Areas left unwritten and the family spaces left out for want of a body (`RevitFile` keeps them as lists), the elements below the confidence floor and the schema-scan candidates. `build_export_diagnostics_and_decisions` makes each `SkippedExportItem` from those decisions, in the order and with the classes, phases and sample names it had; the geometry gaps are made in the same pass as their decisions. `ExportResult::decisions` carries the uncapped list (not serialised). - The decisions behind `exported.bounding_box_bodies`, `bounding_box_spaces` and `area_body_refusals` are read from the final model (`body_is_record_box`, `space_outline_is_record_box`, `area_body_refused`). - **One switch or two: two.** `ExportOptions::with_export_decisions(bool)` (last field, default off; `rvt-ifc --export-decisions`, requires `--diagnostics`; Python `export_decisions=` on `export_diagnostics`, `export_diagnostics_json` and `rvt_to_ifc_diagnostics`) is separate from `with_element_provenance`. The log is bounded at 5,000 entries a reason whatever the model, where the provenance table lists every element (about 116 times the diagnostics in compact JSON on the BIM4LCA office); and it needs no table in the sidecar: where an entry's evidence is an element the walk decoded, its stream and offset come from a table built for the purpose and dropped. Someone asking why an element was left out should not pay for the table, and someone checking offsets should not get the log. The MCP server and the tests turn both on. Without either switch the diagnostics have no new key. - Stages: `element_skipped`, `body_not_drawn`, `body_left_as_box`, `opening_not_cut`, `outline_not_read`, `storey_not_bound` (the geometry gaps need the last two) and `value_left_out_exporters_disagree`. - `rvt-mcp`: the decode asks for the log; `Computed` takes it out of the diagnostics beside the provenance table. New tool `explain_element` (`model`, `element`: a Revit ElementId whether or not the export holds the element, or an exported element's GlobalId; `id` is accepted as the name `get_element` uses) returns `exported`, the provenance and trust markers where it is exported, `decisions`, and `capped_reasons`. `docs/mcp.md`, `docs/mcp-tools.json` and `docs/mcp-tools.md` follow. - `docs/export-diagnostics.md`, `docs/schemas/export-diagnostics.schema.json`, `docs/python.md`, the stub, `docs/user-guide.md` and the changelog fragment follow. - `tests/export_decisions_counts.rs` (class `real`) and `tests/json_schema_contracts.rs` (the diagnostics schema against `rvt-ifc --export-decisions` output, and no key without it); CI's Corpus health prints the first's report and uploads it as `export-decisions`. ## Testing Nothing was built or run locally (lane rule: CI and Measure are the build). Everything that needs a build is NOT MEASURED until the runs on this PR's head finish. - [ ] `tools/check-local.sh`: `cargo fmt --all -- --check`, `tools/release/changelog.py check` and `tools/ci/api-doc-ids.py` were run locally and are clean; clippy, rustdoc and the build are CI's. - [ ] Done when, on Core Interior and the office: `tests/export_decisions_counts.rs` exports each model with the log off, then on, and checks that the diagnostics are the same JSON but for the log; that for every reason of `skipped` the log's `total` is the sum of the items' counts, `recorded` plus `dropped` is `total`, and, for a reason that dropped none, the entries by class (by detail for an Area, by phase for a room) are the item's `classes`; that `body_is_record_box`, `space_outline_is_record_box` and `area_body_refused` equal `exported.bounding_box_bodies`, `bounding_box_spaces` and `area_body_refusals`; that the log has no reason in neither; that on Revit 2024 and later the bytes at a frame entry's stream and offset are the record it says (no id for a frame with none; the id, or a second-prologue frame, for an element); and that an entry the log placed from the provenance table agrees with the table. Its report (counts per reason, dropped, the log's size in JSON) is the `export-decisions` artifact. The same models also run the RE1 models and Einhoven. Core Interior has nothing left out (`skipped` empty, box bodies, box rooms and Area refusals 0 in the Measure run on this head), so its log is empty and equal to that; each other model names reasons its diagnostics count (measured), and each must have entries, so an empty log cannot pass. - [ ] `explain_element` through the MCP E2E (`rvt-mcp/tests/mcp_stdio.rs`): an exported element's answer equals `get_element`'s provenance, trust markers and file; an unknown id is a tool error; a decision the same decode records, found by running the export in the test with the log on, is in the answer; `get_diagnostics` carries neither the log nor the table; the tool list has ten tools. - [ ] Byte-identity with the log and the table off: see below. Measure: the diagnostics must be byte-identical to main's and so must the IFC. A filtered run (`-f base=main -f nordic=true -f r2025=true -f samples=true -f holdout=true -f families=true -f scorers=none`) is dispatched on the head; `diagnostics.json` of each non-held-out model is in its `measure-head` and `measure-base` artifacts, to compare with `cmp` (the compare job hashes only `ifc.sha256`; editing measure.yml would start an unfiltered Measure on this PR). A filtered timing run (switch off, head against main) is dispatched too, since every export now builds its decisions as lists where it counted: a few allocations per element left out, NOT MEASURED. Code head f5895c8, PR head ab39e6a (on top: `--anonymize` scrubs the log, the log sorts by partition number, `rvt-ifc` help text, tests, docs and the MCP contract text, and a merge of main's #1351; none of the src changes runs with the switch off, so these runs measure the PR head's switch-off path too) (the runs at 360e8e6, 41844130797 and 41844135457, stopped at a lib build error and measured nothing): byte-identity run 41846513208; timing run 41846517960 (`-f timing=true -f nordic=true -f models="core-interior nordic-office-as-built" -f scorers=none`). Results NOT MEASURED until they finish. ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR - [x] Changelog fragment `changelog.d/added/1326-export-decisions.md` - [x] Limitations documented in the PR body and in code (below) - [x] No emojis, no private paths in committed files - [ ] Reverse-engineering finding: N/A Limitations, stated: - `value_left_out_exporters_disagree` records nothing. Those values are left out by a rule for a whole class of element in the reader that would write them (the type `IsExternal`, a type's common set where two elements disagree, a property outside IFC4's sets); no step decides it per element and no aggregate counts it. The stage exists so a reader that starts counting has somewhere to put it. - `stream_not_read_resource_limit` counts streams, not elements, and has no entries. A frame with no ElementId (`element_record_without_element_id`) has an entry with its place and no ElementId, so `explain_element` cannot return it. - Beyond 5,000 entries a reason the log drops entries (counted per reason and in all); `explain_element` names those reasons in `capped_reasons`. Entries are kept by ElementId, so the highest ids go first. - An entry about an element the walk decoded takes its stream and offset from the provenance table, which is the frame the exporter selected (see #1350's limits); a frame scan's own entries carry the frame they read, and on Revit 2008 to 2023 the bytes are not re-read by the test. - `docs/mcp-tools.json` was edited by hand for the new tool and the types it adds (the server's `tools/list` is the contract and `tool_contract_is_committed` compares it byte for byte): if that test fails, the failed job uploads the server's own file as the `mcp-tools` artifact, to commit with `python3 tools/ci/render-mcp-tools.py`. - `docs/mcp.md` states no size or time for the log; the test prints them. ## Breaking changes None. New pub items are additive: `rvt::ifc::export_decisions`, `ExportOptions::with_export_decisions` (one new field on the `#[non_exhaustive]` struct, last), `ExportResult::decisions` (`#[non_exhaustive]`), `ExportDiagnostics::export_decisions` (`#[non_exhaustive]`, optional, skipped when absent), a defaulted keyword on three Python callables. The research scans named above return lists instead of counts; they are behind `unstable-research` and their one caller is the diagnostics builder. ## Screenshots or output samples N/A: the IFC and the default diagnostics are unchanged by construction; the byte-identity run is the check. ## Related issues Closes #1326
This was referenced Nov 4, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Nov 5, 2026
#1261, #1194) (#1428) ## Summary This reopens #1371 by puzzbobb on a branch of this repository, as puzzbobb agreed on that pull request ("it can be reopened on a branch here"). puzzbobb's two commits are cherry-picked in order and keep them as author (`fec15008`, `c4889e7f`, signed by the committer, as `main-protection` requires); the maintainer's five commits that followed on #1371's branch come after them, with the archived head `refs/archive/2026-11-04/pr1371-area-plan-topology` (`e5b1c8be`) as the source. Their reader is the substance: an Area that the arrangement of its lines leaves without a region takes the loop of Revit's own plan topology, checked against the area Revit saves for it, and the Areas of Revit 2025 to 2027 are read. It supersedes the wall-line rule of #1367, which was worked out from the same IFC2X3 export it is scored against; #1367 becomes research notes only once this lands (Griffin, 2026-11-04). ## The gate (Griffin, 2026-11-05, "Ship, labelled", then "Same-project gate") The Areas of Revit 2025 to 2027 and the 108 Area spaces of the recorded Autodesk 2024 Snowdon Towers samples are written by default. They are **not measured against any Revit export**; RE-333 section 9, the changelog fragments and `docs/rooms.md`, `status.md`, `evidence.md` and `supported-profile.md` say so and name the evidence: the drawn loop equals the area Revit saves in the file for it and holds the Area's point, and on 2025 to 2027 the same project's 2024 save gives the same Areas. **The marker (Griffin, 2026-11-05, "Mark 2025 to 2027 in the file").** His earlier "their own outline source value" had two readings, and the docs-only one was mine; he wants the file to show it. Areas read from Revit 2025, 2026 and 2027 now get `SpaceOutlineSource` `area_plan_topology_unchecked`, wherever the marker shows: the IFC property, `list_rooms` (`space_outline_source`), the schedule CSV's outline source column, and the MCP field's description (the watcher syncs the contract). Snowdon Towers 2024 and every other 2024 file keep `area_plan_topology`, because they share a release and a code path with the office and a release is not split; 2015 to 2023 keep it too (they are the Areas with the IFC2X3 check). It is decided by release in one place, `partition_area_records::area_release_unchecked` (`AREA_UNCHECKED_RELEASES`, 2025 to 2027), which sets a field of the decoded Area that `export_content` reads. `BodySource` and `exported.body_sources` do not split: the body is read by the same code, and the marker says how far it is checked, not how it was read. `tools/re/areas_across_saves.py` expects exactly that per release: a 2025 Area reading `area_plan_topology` and a 2024 Area reading the unchecked value are failures. Consumers checked: `export_content` (marker, `contain_in_spaces`), `schedule_csv` and `element_record_plan_profiles` (keyed on `ProfileSource`, which does not split), `element_provenance` and the COVERAGE rows (keyed on `BodySource`, unchanged), `rvt-mcp` (passes the text through; descriptions updated), `space_profiles_vs_ifc.py` (knows the value). `#1439`'s `SpaceKind` scorer has its own list of Area values, and that lane adds the new one. **The first gate tested nothing, and I recommended it.** It was "no Area written that Revit's export lacks (`only in rvt-rs` 0) on every held-out Revit 2025 to 2027 model with Areas". None of the seven held-out Revit 2025 to 2027 models writes an Area, and all seven exports are byte-identical to main's (Measure run 42003913780 on `bcb02107`), so `only in rvt-rs` 0 could not have failed. I did not count what it would count before recommending it. **The gate now (Griffin's "Same-project gate"): this lands only if rac_advanced's 25 Areas on its 2025, 2026 and 2027 saves equal its 2024 save's, Area by Area.** The fields are GlobalId, number, name, storey, outline source (the value each release gets, above), body area (1e-6 relative), top surface (the symmetric difference of the two top surfaces, 1e-6 relative), height (1e-5 ft) and lowest vertex (1e-5 ft); Griffin's list is the first six and the rest are a floor raised, so that a translation, a rotation, a shear that keeps the area, a raised base or another outline source is a difference. `tools/re/areas_across_saves.py` compares them. `tools/ci/measure-reference-models.sh` runs it on the head side of any Measure run of the samples that holds the four rac_advanced samples (whatever `sample_years` says, as long as it includes 2024 to 2027), once every export is done and before any sample's IFC is deleted; with fewer than the four it checks nothing and prints a notice. The job "The Areas agree across rac_advanced's saves" in `measure.yml` turns the run red unless the output ends `exit 0` and has the scorer's `passed` line. It fails on a missing or unreadable save, on other than 25 Areas or other than 25 Areas with a body on any save (so 26 fails the same way the workflow's grep does), on an Area with no storey, and on any difference, missing or extra Area; a pass on nothing is impossible. **Measure is not a required check, so "blocks landing" means by the landing rule: the result is read before merging.** It prints counts by field and the number of Areas compared on each save, nothing else. **What the first two passes got wrong, found by the second review.** Runs 42008539696 and 42010805118 read "storey 25 equal" on `None` equal to `None`: the first version of the scorer read the storey with `get_container`, and rvt-rs writes a space under its storey with `IfcRelAggregates`, so the storey was never compared; and it pinned 25 Areas but not 25 bodies, so all four saves losing their bodies stayed green. Both are fixed (`get_aggregate`, a missing storey, other than 25 bodies and a missing body are failures). The real storeys of the four saves are `01 - Entry Level` (9), `02 - Floor` (9) and `03 - Floor` (7) with 0 differences, so the fix cannot turn a correct head red. **The proof, run through `read_areas` on written IFC and not through `compare()` on dictionaries.** The reviewer's generator (IfcOpenShell) writes the four saves, each Area an `IfcSpace` aggregated under an `IfcBuildingStorey` with its `SpaceOutlineSource` and an extruded body, and the fixed scorer reads them as it reads an export, then the workflow's own check reads its output file. 23 cases, 0 wrong. Green: the control (25 Areas, 25 with a body, every field equal) and a height 5e-6 ft off (within the tolerance). Red: (1) no body on any save; (2) one body on every save; (3) later saves that lose their bodies; (4) one Area moved to another storey; (5) storeys renamed on a later save; (6) no storey on any save; (7) every body of a later save moved 100 ft; (8) every body turned a quarter turn; (9) one body sheared to the same area; (10) the base of every body raised 5 ft; (11) a different outline source on a later save; (11b) one 2025 Area reading `area_plan_topology`; (11c) one 2024 Area reading `area_plan_topology_unchecked`; (11d) every later Area reading `area_plan_topology`, the release rule not applied; (11e) a lines value on 2027; (12) 26 Areas on every save; (13) 24 on every save; (14) one Area missing from the last save; (15) a save missing; (16) a height 2e-4 ft off; (17) a body area 1e-4 relative off. The harness is in the lane's scratch directory (it needs IfcOpenShell to write files), not in the repository. **Tried on real data.** Run 42008535484, main's exports of the four saves (this branch's scorer and workflow, main's binaries at `ce0b2398`, no #1428): 2024 has 25 Areas, 16 with a body, and 2025, 2026 and 2027 have 0, so each later save fails and the job turned red. Run 42008539696 and run 42010805118 (the pushed head `401f5244`, finished green): 25 Areas on each of the four saves, the gate passed, and the 58 sample exports' hashes are identical to run 42003913780's (I read the second run's myself). Both ran the scorer before the fix above, so their "storey equal" counts were `None` against `None`; the final run below is the first with the fixed scorer on real files. **What it cannot catch:** an error that the 2024 read shares with the later reads (the same wrong region, number, name or height on all four saves), and an error in how the saves are exported that is the same in all of them. It compares rvt-rs with itself, on one project of 25 Areas. ## The 2021 save does not move (a measured residual) Autodesk's `rac_advanced` 2021 save keeps its 25 Areas as `area_without_proven_body` (22 `boundary_lines_not_readable`, 3 `named_lines_not_in_scheme_and_level`), as on main, although RE-333 section 4 says the topology has a region for all 25 on it. From the code: the save holds both states of the model (RE-324 section 4), so 16 area boundary lines have two disagreeing copies; `group_arrangement` returns `Group::Unreadable` for a group that holds one, and `locate` returns that before the plan topology is asked; `draw_area` refuses the 3 Areas that name such a line. That order is the refusal about safety that the review of #1371 asked for (no fallback to the topology after conflicting copies, stray heights or a design option), so it is not changed here. Measured (probe run 42008543772): the topology's 25 regions on the 2021 save equal the 2022 save's and the 2023 save's, Area by Area, in vertex count, holes, arcs and area, so its current native copy holds the later state; no Revit export of that state exists. It gets its own issue. ## Motivation #1261: BIM Whale's 2021 Areas were not written, and on Autodesk's `rac_advanced` main writes 16 of the 25 Areas (the 9 it leaves out are the ones the plan topology draws; #1367's "18 of the 25 drawn" is not on main). #1194: Areas were read on Revit 2015 to 2024 only. RE-333 has the measurements and the reasons. ## Changes - **puzzbobb's reader** (`fec15008`, `c4889e7f`): `src/research/native_area_regions.rs` (the plan topology's loops, offsets, holes and checks) and the chain-entry count that lets Revit 2025 to 2027 records be read (`partition_area_records.rs`). - **The maintainer's commits on #1371's branch, cherry-picked**: the joins cross-check and RE-333 measurements, the vertex where a third line meets, `SpaceOutlineSource` `area_plan_topology`, the warning for dropped chain records only where an Area could be lost, arcs written as arcs (an `IfcIndexedPolyCurve`), the Snowdon Towers 2025 figures removed (below), `tools/re/space_profiles_vs_ifc.py` and the MCP tool descriptions for the new value. The archive's generated contract commit (`e5b1c8be`) is not carried: `docs/mcp-tools.json` and `.md` are never hand-edited, and `rvt-mcp/src/schema.rs` and `server.rs` gain the new `space_outline_source` value, so CI's `tool_contract_is_committed` needs the watcher's contract sync before the full CI is green. - **This branch's own commit** (`94cd0fd7`), the reconciliation with what landed on main since the merge base (`fdff7018`), whose conflicts git reported in `src/reader.rs`, `src/research/partition_area_records.rs`, `docs/status.md`, `docs/export-diagnostics.md` and `docs/format-reconnaissance.md`: - **Value sources (#1368).** #1403 gave Areas `area_boundary_lines` and `area_point`, noted for the lines' frames and the partition's point. An Area drawn from the plan topology was not drawn from either, so it no longer carries them; it carries `area_plan_topology` (rule `native`, `parts`): the Area's own `RoomElem`, the `LevelRoomPlan` that holds its circuit and the `CurveElem` of each line that bounds it, each at its place in its partition (`native_area_regions.rs` `record_place`, kept only while the handle records value sources, so the flag-off path allocates nothing; `partition_area_records.rs` `note_topology_source`). `tests/value_sources_offsets.rs` has the reader in `COVERAGE`, reads each part's id at its offset, and reads the records again from their ElementIds (`check_topology_areas`): the Area's record names a circuit and a point, exactly one part is the plan whose topology holds that circuit and the Area, and the other parts are the lines of that circuit and of the circuits it encloses, all of them and no others. The office's `MIN_READERS` pin `area_plan_topology`; `area_boundary_lines` and `area_point` are no longer pinned on any model of the gate, because the office's 30 Areas all take the topology first, and the test says so beside the row. - **Export decisions (#1326).** `exported.area_body_refusals` and `model_decisions` both derive from the Area's `AreaBodyRefusal` property, so the new reasons (`area_not_in_one_plan_topology`, `area_circuit_not_found`, `area_circuit_side_not_read`, `area_circuit_area_differs`, `area_arc_not_finite`, `area_point_outside_circuit`) are counted by both and there is no list to extend. The diagnostics schema and `docs/export-diagnostics.md` list them (`area_arc_not_finite` was missing from both). - **`SpaceOutlineSource` values and descriptions** (#1351, #1405, #1412): auto-merged; `area_plan_topology` is in the MCP tool descriptions and the docs. - `src/reader.rs` keeps #1389's record stages beside the new dropped-chain-entries note. The two merges of main that #1371's branch carried are carried by this commit and by a signed merge of main. - **The same-project gate** (this round): `tools/re/areas_across_saves.py`; `tools/ci/measure-reference-models.sh` runs it between the exports and the deletion of the samples' IFCs, on the head side of a shard that holds the 2024 to 2027 saves of rac_advanced; `measure.yml` turns the job red unless `areas_across_saves.txt` ends `exit 0` and has the scorer's `passed` line, and lists its counts in the summary. `actionlint` reports nothing on the lines this adds (its only findings are the `uses: $/...` forms already in main's workflows); the workflow parses with a YAML safe loader (ruby's, no PyYAML here), and `bash -n` and `shellcheck` pass on the script. No test target is added: `tools/ci/test-targets.txt` is unchanged. - **Docs and changelog** (`6dacca98`): `docs/rooms.md`, `docs/status.md`, `docs/evidence.md`, `docs/supported-profile.md` and `docs/support-matrix.json` say Revit 2015 to 2027 and name the plan topology; the fragments `changelog.d/added/1261-area-plan-topology.md` and `1194-areas-2025-2027.md` credit puzzbobb by name. ## The review findings on #1371, in code 1. **Crafted file panics.** `partition_area_records.rs:497-498`: `buf.get(span.start..body)` and `buf.get(body + span.entries..span.end)`; a narrow record is taken whole through `buf.get(span.start..span.end)`, and a span that does not lie in the partition is skipped. No raw slice of parsed spans is left in the module. 2. **The fallback to the topology after a refusal about safety.** `locate` returns `Group::Unreadable` (a non-primary design option, stray heights, conflicting copies, a missing line) before the topology is looked at (`partition_area_records.rs:1166`, from `group_arrangement` at `:1043-1062`); the topology is asked for only where the lines are sound but not arranged (`Group::Unarranged`) or an Area's region touches a line off the axes (`group.blocks`). The refusals before it (no Levels, an unaccounted line, no lines) refuse every Area as before. 3. **Arcs as chords.** Written as arcs, `IfcIndexedPolyCurve` with three-point arcs (`src/ifc/export_content.rs`, `indexed_area_curve`); the outline is checked as written, arcs as arcs, against the circuit's saved area, and an arc that cannot be read finitely refuses the Area (`area_arc_not_finite`). 4. **Unrecorded Snowdon Towers 2025 claims.** Out of the report, the changelog and the docs (Griffin, 2026-11-04). The Snowdon Towers figures that remain are the recorded Autodesk 2024 samples in `research/autodesk-sample-projects.tsv` (sha256 `33271010...`, `6dc833f9...`), quoted as counts of what rvt-rs writes. Nothing in the tree cites the 2025 file, its Revit 2025 export or the Japanese sample except RE-333 section 7's sentence that they await a recorded source. 5. **Behind main, RE number.** Rebuilt on main at 182ed21, then a signed merge of `a4044dc8`; RE-333 is free on main and in the open pull requests. 6. **Smaller.** The `REFUSED_*` reasons reach the diagnostics (`topology.remove(&u64::from(id))` is passed whole, with no `.and_then(Result::ok)`). `!sub` replaces `-sub - 1` (`native_area_regions.rs:784`, `:836`). `docs/status.md` and `docs/support-matrix.json` say 2015 to 2027. ## The second review, in code - **Bounds against a crafted file** (`native_area_regions.rs`): a circuit is refused before its edges are built once they pass `MAX_CIRCUIT_SIDES` (10,000), or once its lines' offset parts pass `MAX_CIRCUIT_OFFSET_PARTS` (20,000); the edges are no longer cloned. - **`checked_add`** in `chain_entries`; a circuit side whose line has no `u32` ElementId refuses the Area (`add_line_ids`); `byte_range` includes the skipped entry bytes (`AreaRecord::skipped`). - **Two readers, one region.** Where Revit's plan topology and the lines' arrangement both give a region and they are not the same one (net area to 1e-6, the same corners within 1e-4 ft, no arc in the topology's), the Area has no body and says `area_regions_disagree` in `exported.area_body_refusals` (and in the decisions log). Measured at `e9124b3a`, before the check: the regions were the same on 16 of 16 and 30 of 30; with the check, not yet measured, so whether it loses an Area is what the new run says. - **`dropped` chain records** are counted by ElementId, not by record and partition, and the warning says an area boundary line among them is not among the lines an Area is checked against. The Areas of the Snowdon Towers samples are still written. - **`BodySource` and `ProfileSource`** of an Area drawn from the topology are `native_area_plan_topology`, with their own `body_readers` row and `COVERAGE` row; `schedule_csv` and the plan-profile reader accept it. This moves `exported.body_sources` (the count of `partition_area_boundary_lines` splits) and nothing else that is measured. - **Tests.** The plan records are read with `NATIVE_RELEASES`. `area_boundary_lines` and `area_point` are pinned on no gate model: the office's 30 Areas all take the topology first and no other gate model is known to draw an Area from its lines, so a regression in `note_area_sources` would pass until one does (said at `MIN_READERS`). - **Docs.** RE-333 keeps no per-Area data of the three.js export (counts only, #1377; the archived commits of #1371 carry the earlier version, which is already public, and the policy is applied from here on); six plan-topology reasons, not five; the office's vertex wording is exact (3 outlines start at another vertex and the holes of 6 come in another order as built; 2 and 6 at permit); every figure says which run measured it: the counts of what is written come from Measure run 42003913780 on `bcb02107`, the vertex-level and equality figures from the archived head `e9124b3a`. ## The third round (the second review of this PR), in code - **Hole bound** (`native_area_regions.rs`): a hole that a plan lists again is one hole (`plan()` keeps the first listing of each pair); more than `MAX_REGION_HOLES` (1,000) is `area_circuit_too_large`; one `Budget` for sides, edges and offset parts covers the outer loop and every hole of a region, so duplicates cannot each ask for a full budget. - **A topology read and failed is not replaced by the lines** (`partition_area_records.rs`, `locate`): when `area_circuit_area_differs`, `area_point_outside_circuit`, `area_arc_not_finite` or `area_circuit_too_large` is the topology's answer and the lines draw the Area, the Area has no body and says that reason, counted in `exported.area_body_refusals`. Where the saved area disagrees with the face the lines give, the rule is fail closed. Where the topology was not read (`area_not_in_one_plan_topology`, `area_circuit_not_found`, `area_circuit_side_not_read`) the lines draw as before. No public model had an Area in the first case in run 42003913780: none of its refusals is one of these but Snowdon Architectural's single `area_circuit_area_differs`, and that Area was refused, so the lines did not draw it. - **`area_regions_disagree`, helpers and tests** (`regions_agree`, `same_outline`, `near_outline`, `ring_perimeter`, `point_segment_distance`): the comparison was by corner counts, which a step jog of a few micrometres changes and a ring over 5,000 corners refused outright. It is now by distance: every vertex of each outline within 1e-4 ft of the other's edges, and the area difference within 1e-6 relative plus the band that tolerance allows along the outline. The failure-first tests (a few, next to the helpers, under the pure-helper exception) cover a region of another area, a shifted, a sheared and a curved one, a hole one reader lacks and two holes matched to one, an outline that is not finite, and then the same region called the same: a ring turned to start elsewhere, a vertex on a straight edge, a 5e-5 ft step, a ring of 6,000 vertices, and the same holes in another order. **Which branch has run on real data:** the agree branch (16 of 16 `rac_advanced` joins and 30 of 30 office Areas at `e9124b3a`, and no `area_regions_disagree` refusal on any public model in run 42003913780); the refusal branch has run on no Revit file, only in those tests. A scheme whose lines all have one offset, where the arrangement could close at other positions than the topology, is not found in any file here; if it exists the Area is refused, the fail-closed side. - **Bounds on the gate's reach and wording**: see above. `arm.sh` should read "blocks landing by the landing rule". - **Docs.** No per-Area figure of the three.js export is left in the tree (RE-333 said "three four-sided Areas of under 83 ft2" and how that export writes the curved Area; `docs/rooms.md` said "worst 2.0e-7"; now "all 25 within 1e-6 relative", counts only). `docs/rooms.md` and `docs/status.md` name `area_regions_disagree`, mark `area_plan_topology` "not measured" on Revit 2025 to 2027 and the Snowdon samples, say that it is the Areas' own outline source and not per release (a 2024 Snowdon Towers Area and an office Area take the same path), no longer say "Areas as on 2024" beside models that write none, and say that the office no longer writes `area_boundary`. Snowdon's counts say which head they are from everywhere. RE-333 section 3 reports the disagree check measured (it said "not yet measured"). ## What the evidence is, exactly - **Revit's IFC4 export has no export of these Areas.** The `rac_advanced` check is against the one public export of it, from the three.js repository: IFC2X3, by a build of Revit 2021's exporter whose string ends "IU alternativa 21.0.0.383" (publisher not established), showing the project's 2015 to 2020 state. It is counted apart, never used to remove a value or to settle a disagreement between exporters, and its Measure uploads are counts only (`racadv-*`, #1377). - **It is out of sample for this rule.** The topology's loops, and the areas Revit saves for them (`PlanCircuit m_area`) that every loop is checked against, are in the file; nothing was read off the export. That is the difference from #1367's wall-line rule, whose rule was worked out from the export it was scored on. On the 2020 save, measured on the archived head `e9124b3a`: 25 Areas written, 25 in that export, 0 extra, all within 0.1% in area and 0.01 ft in outline; main's 16 joined Areas equal their topology loops. - **Revit 2025 to 2027** are checked against the same project's 2024 save only. - Per Griffin (2026-11-04): Areas checked against a non-IFC4 or third-party export may ship labelled; the trust marker `area_plan_topology` names the rule, and RE-333, the docs and the changelog name the oracle. ## Testing Unit tests are banned in this repository: none added. The test that changes is a real-file one (`tests/value_sources_offsets.rs`). - [ ] `tools/check-local.sh` passes: not run locally (no local builds on this checkout); `cargo fmt --all -- --check` and `python3 tools/release/changelog.py check` pass here, CI's clippy, MSRV and doc jobs and the corpus tests are the gate. No let-chains; every nested tuple in a collection has a `type` alias. - [x] Verified end to end on real Revit files, **on `5008247d`, the code before the `area_plan_topology_unchecked` marker**: Measure run 42017400629 (unfiltered, base main, nordic, r2025, holdout, samples, racadv). These are the figures of record for that code; the run after the marker (below) replaces them where it differs: - 26 of 117 exports move, the same set as in run 42003913780 (below); - `rules:` findings 0 on 90 models and on 18 held-out; - held-out spaces move on one model only, from (0 in both, 0 only in rvt-rs's, 8 only in Revit's) to (6, 0, 2); - the racadv pairs 2015 to 2020: 116 in both files, 0 only in rvt-rs's, 0 only in Revit's; - MCP: 0 differ on 629 lines; - refusals: `next_storey_not_proven` 9, `area_circuit_area_differs` 1, `point_not_read` 4, and no `area_regions_disagree` and no `area_circuit_too_large`; - the gate passes on the `2024 2099` shard, 25 Areas and 25 with a body on each of the 4 saves, every field equal, and says `skipped` on the `2008 2023` shard; - the semantic merge check (#1334) reads a pass, with 5 findings for #1428. Earlier, on `bcb02107`: Measure run 42003913780 and timing run 42003917325: 25 public exports move and one held out; bodies `native_area_plan_topology` 30 on each office, 25 on each `rac_advanced` save above, 96 on Snowdon Towers Architectural and 2 on Structural; time over main's at most 1.05 (`rst_basic` 2026), peak memory at most 1.03 (`rme_advanced` 2027, 559 to 573 MiB), and the lost `samples-2008-2023` job of run 41990405944 did not recur. The vertex-level and equality figures in RE-333 section 8 are from the archived head `e9124b3a` and were not re-read. The check on the earlier pushed head `401f5244`: run 42010805118, green, with the scorer that compared the storey as `None`; its `ifc.sha256` equal to run 42003913780's on 58 of 58. **The final unfiltered run on this head `7188e2e8`: 42023345111** (`-f base=main -f nordic=true -f r2025=true -f holdout=true -f samples=true -f racadv=true`), unread when this body is written. Expected, against run 42017400629: only the exports of `rac_advanced` 2025, 2026 and 2027 move (their Areas read `area_plan_topology_unchecked`), the gate passes on the new expectation, nothing else changes. No timing run: what changed since the timing run bounds crafted input, compares two regions by distance (quadratic in one ring's vertices, tens on the files measured) and sets a marker. - [ ] If this touches the IFC exporter: the witness verdicts replay or the changed observations are refreshed. Core Interior has no Areas, so its export is expected to be unchanged; the replay is CI's. - [ ] If this is a performance change: N/A. **Final unfiltered Measure on the code of this head, run 42023345111 (7188e2e; the later commit is the MCP contract sync), read by the maintainer:** against 42017400629's head exactly 3 exports move, `rac_advanced` 2025, 2026 and 2027, by the new marker. Against main 91 of 117 are identical and 26 move, the same set as before, 1 of them held out. The same-project gate passes on the expected values: 25 Areas with 25 bodies on each of the 4 saves, every field equal, `area_plan_topology` on 2024 and `area_plan_topology_unchecked` on 2025 to 2027. `rules:` findings 0 on 90 models and 18 held-out, MCP 0 differ on 629 lines, semantic check `pass: 5 findings in 34 models`. ## Audit-honesty checklist - [x] Docs reflect the state after this PR. - [x] A user-visible change has its fragment under `changelog.d/added/`, not in `CHANGELOG.md`. - [x] Limitations: the RE-333 report's "not measured" list is kept (Revit 2026 and 2027 against a Revit export, the Snowdon Towers 2025 file, a scheme with more than one plan on a Level, an Area Revit reports as not enclosed, the straight step where two offset curves do not cross, Revit 2008 to 2014). - [x] Commit messages describe what changed and why. - [x] No emojis, no private paths in committed files. - [x] Reverse-engineering finding: `probes/examples/probe_re333_area_plan_topology.rs`, `reports/element-framing/RE-333-area-plan-topology.md` and an addendum in `docs/format-reconnaissance.md`. ## Legal and contribution hygiene The declaration is puzzbobb's on #1371, quoted here, and the maintainer's commits are Apache-2.0 as the rest of the repository: > - [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] Any new test fixtures use synthetic values (`testuser`, `111111`, `FY-20XX`, etc.) and contain no real-world PII > > The class and field names come from the schema each file embeds (`Formats/Latest`), as `rvt-schema` prints them. Autodesk's samples are fetched for the run and never stored. The office is CC BY-SA 4.0, read by byte range and never stored. (The last sentence of that declaration on #1371 about a local Revit 2025 export of Snowdon Towers is not repeated: those figures are out of this pull request.) ## Breaking changes None. `native_area_regions` is a new public module and `AreaRegion` a new public type. Areas of Revit 2025 to 2027 files are new `IfcSpace`, and an Area that main draws from its lines now says `area_plan_topology` where the topology is read. ## Output samples `SpaceOutlineSource` on `rac_advanced` (the archived head `e9124b3a`, run 41894715743): the 6 Areas main marks `area_boundary` and the 10 it marks `area_boundary_joined` say `area_plan_topology`, as do the 9 it did not write. ## Related issues Refs #1261, Refs #1194, Refs #763. Reopens #1371. Supersedes the wall-line rule of #1367. Co-authored-by: puzzbobb <[email protected]> --------- Co-authored-by: puzzbobb <[email protected]>
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
An Area of a Revit 2015 to 2024 file is now drawn from its area boundary lines joined as their records say, and a line that is not along a plan axis refuses only the Areas whose region it touches, not every Area of its scheme on its Level. Autodesk's
rac_advanced: 16 of its 25 Areas are drawn on every save but 2021's (3 before), 10 of themarea_boundary_joinedand 6area_boundary(measured on every save, run 41840118424).What the check rests on (Griffin's "ship, labelled"):
mainbecause it draws no Area body (RE-324 §7, §8), so its 0 extras are vacuous for the joins.The file's terms are not known: the repository is MIT, the file carries no licence of its own that could be found, and Autodesk's terms for the sample it exports were not checked. No workflow fetches it; it is scored by hand from a pinned URL (RE-330 §1, §8).
The 2024 save moves too. 13 of its Areas are new, numbers 9 and 11 to 22: they gain a body (3 before, 16 now; RE-317's reader drew 23, 24 and 25, still
area_boundary), and the other 9 keep their refusal. The same 13 are newIfcSpaceon the 2015 to 2020, 2022 and 2023 saves (94 to 107).SpaceOutlineSourceisarea_boundary_joinedfor 9, 12, 14, 16, 17, 18, 19, 20, 21 and 22 andarea_boundaryfor 11, 13 and 15 (the Python version of the rule; the kept IFC of run 41840118424 has the same split on each save). Their evidence: the pair probe, where the 2022 and 2023 saves equal the 2024 save, and the IFC2X3 export of the 2015 to 2020 state; nothing else.Motivation
#1261: "Areas bounded partly by walls" and "boundary lines that are not along the plan axes". RE-330 shows that the 4 Areas called bounded partly by walls are bounded by lines alone: the lines stop short of the lines they join, and the export carries them on. No wall bounds any Area drawn. Of the four lines whose box is not a line along an axis, one is a straight line off the axes (178310, Areas 7 and 8), two are axis lines whose record box is 0.497 ft wider than the line (177377 and 177363, Areas 1 to 5) and one is an arc (178788, Area 10); Area 6 has a join its records do not name. Reading Areas bounded by those is the next step, and the probe holds their stored ends.
Changes
src/research/partition_area_boundaries.rs:Arrangement::newtakes each line's named ElementIds. A free end is carried on to the farthest perpendicular line within 1 ft that names it and is named by it, only if that line, after its own carry, spans the place reached (else the end stays free); the free ends of two parallel lines within 1 ft that name each other, stop at the same place and run away on opposite sides are joined by a connector, a flag on the segment rather than the idu32::MAX.AreaFace.joined,Arrangement::reads. The stored ends of a line are nodes, so an edge lies wholly on the stored extent or wholly past it.src/research/partition_area_records.rs: a line off the axes is left out of the group's arrangement with its box (and the readable lines that name it); an Area whose region's box comes withinUNREAD_MARGIN_FEETof such a box is refusedboundary_lines_not_readable.LineRecordequality includes the reference list.m_area_body_joined.src/ifc/export_content.rs:SPACE_OUTLINE_AREA_BOUNDARY_JOINED;contain_in_spacesleaves both out of the spaces that hold furniture.rvt-mcp/src/schema.rs,server.rs,docs/mcp-tools.json,docs/mcp-tools.md(regenerated bytools/ci/render-mcp-tools.pyafter the merge with feat(ifc): the provenance of every decoded element, down to the byte (#1325) #1350),docs/mcp.md: thespace_outline_sourcedescriptions name the new value.probes/examples/probe_re330_area_line_curves.rs,tools/re/area_joins_vs_ifc.py(the same rule and caps in Python),tools/re/space_profiles_vs_ifc.py(the new value counts as an Area),reports/element-framing/RE-330-area-joins.md,docs/rooms.md,docs/status.md,docs/evidence.md,docs/supported-profile.md,docs/export-diagnostics.md,docs/support-matrix.json,changelog.d/changed/1261-area-joins.md.Testing
Unit tests are banned in this repository: none added.
tools/check-local.shpasses (CI is the build here; fmt is checked, the Rust has not been compiled locally)main'sRuns (Measure,
--ref main, filtered). At35a9d322andcf8d807d: read in RE-330 §4 and §7. Atdc56e83b(the stored ends as nodes), all green, read: everyrac_advancedsave of 2015 to 2020 and 2022 to 2024 has 10area_boundary_joinedand 6area_boundary(41840118424), the 2021 save none; office 41840110952 and BIM Whale 41840122975 byte for bytemain's; of 43 samples (41840114594) only those nine saves move; the pair probe 41840127226.At
a883a238(the carry checks its target, caps of 1 ft, connectors on opposite sides, the label, the wording of RE-330 §5), not yet read: office 41843487977; samples againstmain41843493504; all samples 2015 to 2024 with the IFC kept 41843497745; BIM Whale 41843502531. They are to show the same 16 per save (10 and 6), the office and BIM Whale unchanged, and the same nine saves moving.Audit-honesty checklist
changelog.d/changed/rac_advancedare not written (RE-330 §5); the 2021 save is still refused; the export's licence is unknown; farthest-over-nearest, the opposite-sides condition and the caps are unmeasured where they would decideLegal and contribution hygiene
revit-ifcis read for what it writes only (CLEANROOM.md source 5), not copied.Breaking changes
None.
Arrangement::newgains a parameter andAreaFacea field (research API,unstable-research).