Skip to content

fix(mcp): an element's level and the element lists are the ones the IFC export writes (#1327) - #1412

Merged
DrunkOnJava merged 14 commits into
mainfrom
fix/mcp-written-placement-1327
Nov 5, 2026
Merged

DrunkOnJava merged 14 commits into
mainfrom
fix/mcp-written-placement-1327

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Lands after the v0.15.0 release merges (the main session holds every pull request until then). #1406 and #1404 are in main; this branch has main merged in (d0836833), and its tool contract is synced from CI (d3fe753b).

Summary

The MCP server's element lists, counts and levels are the elements the IFC export writes, in the storey it puts them in. A part of a stair, a railing or a curtain wall has the level of its whole, an element in a room the level of the room, an opening the level of its host, and a further piece of an element of separate loops that the export folds into the owner's body is not a row.

Motivation

The Measure scorer of #1327 (#1404) found two disagreements that #1406 does not fix: the parts of a stair, a railing or a curtain wall have no level, or one of their own, in the answers where the IFC puts them on their whole's storey (5 Revit 2025 models, 4 held-out, and the BIM4LCA office: 599 rows of each of its files, 542 of them curtain-wall members at "Roof" where the IFC says Level_05, and 7 or 8 of 10 levels' counts), and the office lists IfcCovering rows the export does not write (158 against 111 as built, 122 against 75 at permit).

Changes

  • src/ifc/step_writer.rs: placements (the writer's decision where each building element goes: folded, a door's or window's opening, in a space, part of an aggregate, on a storey, in the building) and storey_of are public, and the writer places every element with placements. Placement::Opening is non_exhaustive.
  • The diagnostics' storey_bound_elements (src/ifc/mod.rs), the rooms schedule (room_rows in schedule_csv.rs) and every_storey_holds_an_element read placements and storey_of instead of each holding a copy of the containment rule over the element's own storey_index. Not changed: elements_csv, whose level column and rows still follow the element's own storey_index and list the folded pieces.
  • rvt-mcp: an element's level, the levels' element_count and the level filter read placements; a folded piece is neither a row nor in total or by_ifc_type, and the summary counts it by IFC entity in elements.folded_into_bodies, always present, since the diagnostics' exported counts include it. The open_model, get_summary and list_elements descriptions and the other_entities doc say the lists leave out folded pieces.
  • docs/mcp.md, changelog.d/fixed/1327-mcp-written-placement.md.

MCP contract

The summary's output schema changes (elements.folded_into_bodies, always present) and so do the descriptions of open_model, get_summary and list_elements. docs/mcp-tools.json and docs/mcp-tools.md are the contract as the server writes it, synced from CI run 41965770978. Clients: a row can be absent that was listed before (the folded pieces), and an element's level can be present where it was absent.

Testing

Unit tests are banned: none added. Proof is the scorer of #1404, run by Measure with base=none, -f scorers=mcp_answers_vs_ifc, over the office as built and at permit, the 24 Revit 2025 models and the reference models.

On the merged head d0836833 (this change merged with main 6f4bc534, which has #1406 and #1404):

  • Consistency. Run 41965720746 (base=none, -f scorers=mcp_answers_vs_ifc): 32 of 32 models pass every check: the 6 reference models, the 24 Revit 2025 models and the office as built and at permit. Before, on main's server, the office as built and at permit failed counts, element membership, element storeys and levels (47 coverings; 599 of 12,974 and of 13,020 rows, of which 542 curtain-wall members and the rest stair flights and landings; 8 and 7 of 10 levels) and so did the 5 Revit 2025 stair models (runs 41949018446 and 41949021964).
  • IFC identity. Run 41965717668 (head d083683 against main 6f4bc53, scorers=none, nordic and r2025 on): the same ifc.sha256 on 34 of 34 models: the 6 reference models, the four office files and the 24 Revit 2025 models.
  • Diagnostics. Across the 34 models of that run, one key of diagnostics.json moves: exported.storey_bound_elements, on 7 models: the office as built 12,961 to 12,971, at permit 13,008 to 13,018, the Revit 2025 stair models 13 to 15 from 24 to 27 and 16 and 17 from 24 to 25. These are the elements bound to a storey through their whole. The only use of the count besides the field is a warning that fires when it is above zero and the elevation fallback applies; no warning text moved.

The runs on the earlier review head (code 3f49fe67, merged with main da4c9141, before #1406 landed) are superseded and agree: IFC identity 41960289212 (34 of 34), scorer 41960292399 and, with #1406 merged in on a throwaway branch, 41960400798 (32 of 32). Runs against the wrong bases (41954408419, 41957584014) are superseded too.

The held-out models and Autodesk's samples were not run.

Audit-honesty checklist

  • README / docs reflect the current state after this PR: docs/mcp.md (elements and levels as the export writes them); no claim of a feature this PR does not ship.
  • The user-visible change has a fragment under changelog.d/fixed/, not in CHANGELOG.md.
  • A limitation resolved: the levels and lists disagreed with the export. Left: elements_csv's level column and folded rows; the placeholder names of non-room elements (fix(mcp): an element's name and type object are the ones the IFC export writes (#1327) #1406); a part of several wholes takes the first whole's storey, which is not measured; the held-out models and Autodesk's samples are not measured.
  • Commit messages describe what changed and why.
  • No emojis in code, docs or commit messages.
  • No private paths, personal email addresses or internal jargon in committed files.
  • N/A: not a reverse-engineering finding.

Legal and contribution hygiene

  • Licensable under Apache-2.0.
  • No Autodesk proprietary source, decompiled internals or NDA content; the change reorganises the library's own writer.
  • No new fixtures.

Breaking changes

For clients of the MCP server: elements.total, by_ifc_type and the lists leave out the folded pieces (47 rows on each office file, nowhere else measured); an element's level and the levels' element_count follow the export's containment, so a part, an element in a room and an opening have the level of its whole, room and host; elements.folded_into_bodies is new. For users of the diagnostics: exported.storey_bound_elements counts an element bound to a storey through its whole, space or host (the figures above). The rvt crate gains public items only (placements, Placement, storey_of).

Related issues

Refs #1327

…FC export writes (#1327)

The scorer of #1327 found that a part of a stair or a railing had no level in the server's rows where the IFC puts it on its whole's storey, and that the BIM4LCA office's lists held 47 IfcCovering rows the export does not write, further pieces of an element of separate loops that it folds into the owner's body. The writer's placement of each element is now a function of the library, placements, which the writer places every element with and the server reads: its level through its space, its whole or its host, and whether it is written at all. The summary counts the folded pieces by IFC entity in elements.folded_into_bodies.
…#1327)

The refactor onto step_writer::placements removed the local the opening's void and fill chain still reads; it is now whether the element's placement is an opening.
@DrunkOnJava DrunkOnJava added the ready-when-green Draft whose code is complete: marked ready for review once its fast CI passes label Nov 5, 2026
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 5, 2026 03:01
@DrunkOnJava DrunkOnJava removed the ready-when-green Draft whose code is complete: marked ready for review once its fast CI passes label Nov 5, 2026
@DrunkOnJava DrunkOnJava added ready-when-green Draft whose code is complete: marked ready for review once its fast CI passes and removed ready-when-green Draft whose code is complete: marked ready for review once its fast CI passes labels Nov 5, 2026
…ad the writer's placement; folded_into_bodies is always present (#1327)

storey_bound_elements, room_rows and every_storey_holds_an_element each held a copy of the containment rule that read the element's own storey index, so the diagnostics, the schedule and the server could disagree with the IFC on a part, an element in a room or an opening; they read step_writer::placements and storey_of. folded_into_bodies is serialised when empty, since the contract lists it as required. Placement::Opening is non_exhaustive, the descriptions of open_model, get_summary and list_elements say the lists leave out folded pieces, and the fragment states the base and the identity runs as they were.
@DrunkOnJava DrunkOnJava added the ready-when-green Draft whose code is complete: marked ready for review once its fast CI passes label Nov 5, 2026
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
…port and Revit's (#1327) (#1404)

## Summary

Measure now scores what the MCP server tells an agent about each model
it exports. A scripted client with no language model starts the built
`rvt-rs-mcp`, asks a fixed query set, and
`tools/re/mcp_answers_vs_ifc.py` checks the answers against the same
run's IFC export (any difference is a failure, `exit 1`) and against
Revit's export.

## Motivation

#1327. The server answers from the model the IFC exporter builds, so its
answers must equal the export; only the protocol was checked, on
`corpus/tier1` and Einhoven (`corpus-mcp`). This also builds the
extractor that #1334's semantic merge check reads.

## Changes

- `tools/re/mcp_client.py`: JSON-RPC over the server's stdio (stateless
2026-07-28 lifecycle, standard library only), the fixed query set, and
the deterministic semantic dump (sorted keys, floats at six decimals, no
handle, time or path). The sample is the five lowest ElementIds of each
IFC entity.
- `tools/re/mcp_answers_vs_ifc.py`: the consistency checks and the
oracle. `Report.line` takes words written with `W()` and, as values,
only integers and IFC entity names, and raises on anything else; a check
that was not measured is named in the verdict.
- `tools/ci/measure-reference-models.sh`: an `mcp` task per model (also
a model with no Revit export), never from the score cache;
`mcp-dump.json` only for Core Interior, Einhoven, RE1, the BIM4LCA
office and the Revit 2025 models.
- `.github/workflows/measure.yml`: builds `rvt-rs-mcp` only in a run
that names no scorers or names this one (binary cache key `v2`, `-mcp`
when built); a server that does not build leaves the step NOT MEASURED
with a warning and fails no other scorer, and its key is not saved
without the binary. The run summary lists each model's verdict, `no
verdict, exit N` for a crash, and fails no job; `mcp-dump.json` is out
of the diff.
- `tools/ci/scrub-holdout-results.sh`: a held-out, BIMcollab or
rac_advanced model keeps only the lines starting `mcp answers:` and its
exit status.
- `docs/maintaining.md`,
`changelog.d/added/1327-measure-mcp-answers.md`.

## What is checked, and what is not

Consistency, against the model's own export (the server's own when
`ifc_flags` is set): the protocol; the summary's counts against the
rows, the filtered totals, the IFC and the diagnostics; every element
and space by GlobalId in both directions with entity, Name, LongName,
Tag, PredefinedType and storey; the levels and the elements each holds;
the rooms' Name (the number), LongName, storey, outline source and plan
area; for the sampled elements the property and quantity sets, trust
markers, type object, translation (not rotation), host, and whether the
body is none or mapped; `get_diagnostics` against `diagnostics.json`;
the server's export against `ifc.sha256`.

It cannot catch a decode error. The server and the writer share one
`IfcModel`, so the check finds what either does to it on the way out (a
wrong projection, an element or set the writer drops or makes, a run
that does not repeat), and a value read wrongly from the file is the
same on both sides. The oracle (class sets, storeys, room areas,
property and quantity values against Revit's export, with the existing
scorers' pairing and tolerances) is what measures decode; its lines are
measurements, not failures.

## Testing

Unit tests are banned: none added. Measure, on main's server (this pull
request does not change the server):

| Run | Head | Models | Consistent |
| --- | --- | --- | --- |
| 41950741547 (the pull request's) | 9fbb594 | Core Interior, Einhoven,
RE1 (6) | 0 of 6 |
| 41949014871 | 1895e77 | the same 6 | 0 of 6 |
| 41949018446 | 1895e77 | BIM4LCA office as built, at permit | 0 of 2 |
| 41949021964 | 1895e77 | 24 Revit 2025 models | 1 of 24 (blank
project) |
| 41949025326 | 1895e77 | 18 held-out, 1 spent, BIMcollab, 6
rac_advanced (counts only) | 0 of 26 |

Equal to the export on every model: the protocol, the rooms' areas, the
sampled property and quantity sets and trust markers, the diagnostics
and the export hash. The faults found:

1. A space's `Name` was the model's `Room-<ElementId>` where the IFC has
the room number, and its `LongName` was not served (Core Interior 116 of
116 rooms, RE1 Architecture 11 of 11).
2. `element_type` lacked the `Other` and `Identity Data` sets and the
type objects made for rooms, and named a type where the writer makes
none (Einhoven's four ArcWalls).
3. Parts of a stair or railing have no level where the IFC puts them on
their whole's storey: 5 Revit 2025 models, 4 held-out, and the office,
as built 599 of 12,974 rows and 8 of 10 levels' counts, at permit 599 of
13,020 rows and 7 of 10.
4. The office lists `IfcCovering` rows the export does not write: 158
against 111 as built (47 rows), 122 against 75 at permit.

(1) and (2) are fixed in #1406: its runs 41951524664 and 41951554180
(code head 6c994f3, this branch's scorer at 9fbb594) pass 6 of 6
reference models and 19 of 24 Revit 2025 models. (3) and (4) are not
fixed. The scorer took 44 s on the office as built (13,021 rows) and 42
s at permit (13,067).

The scorer has changed twice since the runs above, on the findings of
#1406 and #1412: 3048014 reads the pieces a server folds into other
bodies (`elements.folded_into_bodies`) when it compares the summary with
the diagnostics, and 9b51c1a expects, for a space with neither a number
nor a name, the name its row gives (a family instance written as a space
keeps its `Family:Type:ElementId`) and the `<class>-<ElementId>`
placeholder only where the row has none: with the earlier rule the
office failed `rooms` on 44 of 308 spaces in each file, a scorer fault.
The pull request's own Measure run on the head 9b51c1a (merged with
main 07caf05, main's server), 41957544702, scored the 6 reference
models (it has no office or Revit 2025 models): all 6 fail, for the
faults #1406 fixes (element names and long names on Core Interior and
RE1 Architecture, type objects and their sets on all 6), with a verdict
line on every model and no crash. The fixed servers' runs with this
scorer: #1406's tip 3c9a263, run 41957587403, passes 25 of 32 models
(the 5 stair models and the office fail what #1412 fixes), and the merge
of #1406 and #1412 (`537d88ba`), run 41957685928, passes 32 of 32. The
IFC identity runs belong to those pull requests: 41954681945 (#1406, 34
of 34 identical) and 41957584014 (#1412 against its fork point, 34 of 34
identical). Not measured: Autodesk's sample projects are not asked; the
oracle's figures are in the runs' artifacts and are not summarised here.

## Related issues

Refs #1327
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
…rt writes (#1327) (#1406)

## Summary

An `IfcSpace`'s `name` in the MCP server's `list_elements` and
`get_element` is the room number the IFC writes as `Name` (its room name
is `long_name`, the `LongName`), and `element_type` is the type object
the IFC writer makes, with its sets. Both now come from the writer's own
functions.

## Motivation

The Measure scorer of #1327 (#1404) found both disagreements between the
server and the IFC export on every model it ran on: the server served
the model's `Room-<ElementId>` placeholder as a room's name, and
`element_type` was a parallel grouping in `rvt-mcp/src/views.rs` without
the `Other` and `Identity Data` sets, without the `IfcSpaceType` made
for each room, and with a type where the writer makes none (Einhoven's
four ArcWalls, type 8570).

## Changes

- `src/ifc/step_writer.rs`: `written_names` (the `Name` and `LongName`
of an element, and whether the name is the exporter's placeholder) and
`type_objects` (the type objects the writer makes: which elements each
types and the sets it holds) are public, and the writer writes with
them. The diagnostics' count of the type objects' parameter values
(`type_object_pset_values`) reads `type_objects` too, so it now skips
the pieces folded into another element's body. The move is meant to
leave the IFC text byte for byte as it was.
- `rvt-mcp`: rows and `get_element` gain `long_name`; `name` is absent
only for a room with neither a number nor a name whose name is exactly
the exporter's `<Revit class>-<ElementId>`; `element_type` gains
`ifc_type` and `name`, and is absent where the writer makes no type
object; `explain_element`'s `name` and `other_entities[].name` follow
the same rule.
- `docs/mcp.md`,
`changelog.d/fixed/1327-mcp-written-names-and-types.md`,
`changelog.d/added/1327-written-names-and-type-objects.md`.

## MCP contract

The tool output schemas change (`name` optional, `long_name`,
`element_type.ifc_type`, `element_type.name`) and the `list_elements`
and `get_element` descriptions. The contract in `docs/mcp-tools.json`
and `docs/mcp-tools.md` is committed by the contract sync from CI, not
edited here.

## Known gap

The placeholder names of elements other than rooms are still served as
`name`: a wall nothing named is `Wall-<ElementId>`. Einhoven 23 of 37
rows, RE1 Electrical 3 of 49, the BIM4LCA office as built 52 of 13,021.
Said in `docs/mcp.md` and the fragment. The path where a row has no
`name` is not measured: no row of the 32 models' dumps lacks one.

## Testing

Unit tests are banned: none added. Proof is the scorer of #1404
(`tools/re/mcp_answers_vs_ifc.py`), run by Measure with `base=none`, `-f
scorers=mcp_answers_vs_ifc`.

**Lands first**, then #1412 (which edits the same functions of
`rvt-mcp/src/views.rs` and `store.rs`) merges main.

Before: main's server with the 1895e77 scorer. After: this branch, code
head 34ace10 (merged with main 07caf05, and 3c9a263 adds the
contract) with the 3048014 scorer, run 41954686452:

| Models | Consistent before | Consistent after |
| --- | --- | --- |
| Einhoven, Core Interior, RE1 Architecture, Electrical, Mechanical,
Plumbing | 0 of 6 (run 41949014871) | 6 of 6 |
| 24 Revit 2025 models | 1 of 24 (run 41949021964) | 19 of 24 |
| BIM4LCA office as built, at permit | 0 of 2 (run 41949018446) | 0 of 2
|

Still failing, and why:

- The 5 Revit 2025 stair models (13 to 17): `element storeys` and
`levels`. The parts of a stair have a level of their own, or none, where
the IFC puts them on their whole's storey. Fixed in #1412.
- The office, as built and at permit: counts, element membership,
element storeys and levels. As built: 158 against 111 `IfcCovering`
rows, 599 of 12,974 rows, 8 of 10 levels' counts. At permit: 122 against
75, 599 of 13,020 rows, 7 of 10 levels. #1412 takes these (the 599 are
542 curtain-wall members and the rest stair parts; the coverings are the
pieces the export folds into another body).
- The office's `rooms` check also failed in run 41954686452, 44 of 308
spaces each: a scorer fault, not the server's. A family instance written
as a space has neither a room number nor a room name and keeps its
`Family:Type:ElementId` model name, which is its IFC `Name`; the scorer
expected the `<class>-<ElementId>` placeholder. Corrected in the scorer
as 9b51c1a; run 41957587403 (this branch's tip 3c9a263, that scorer)
has the same 25 of 32 models passing and no `rooms` failure.

**With #1412 merged** (throwaway merge `537d88ba` of the two heads, the
scorer at 9b51c1a), run 41957685928: **32 of 32 models pass every
check**: the 6 reference models, the 24 Revit 2025 models and the office
as built and at permit.

The office's names, long names, type objects and their sets, diagnostics
and export hash are equal.

IFC identity: run 41954681945 (`base=main` at 07caf05, head 34ace10,
`scorers=none`, nordic and r2025 on) has the same `ifc.sha256` on 34 of
34 models: the reference models, the four office files and the 24 Revit
2025 models. The held-out models and Autodesk's samples were not run.

The `parameter_value_count` that `type_object_pset_values` feeds now
skips folded pieces; no model's diagnostics were compared for it.

## Audit-honesty checklist

- [x] README / docs reflect the current state after this PR:
`docs/mcp.md` (names, `element_type`, the known gap); no claim of a
feature this PR does not ship.
- [x] The user-visible change has fragments under `changelog.d/`
(`fixed` and `added`), not in `CHANGELOG.md`.
- [x] A limitation resolved: the type objects and room names disagreed
with the export; the "Known gap" above is the one introduced or left,
and it is documented in the PR body, `docs/mcp.md` and the fragment.
- [x] Commit messages describe what changed and why.
- [x] No emojis in code, docs or commit messages.
- [x] No private paths, personal email addresses or internal jargon in
committed files.
- [ ] N/A: not a reverse-engineering finding.

## Legal and contribution hygiene

- [x] Licensable under Apache-2.0.
- [x] No Autodesk proprietary source, decompiled internals or NDA
content; the change reorganises the library's own writer.
- [x] No new fixtures.

## Breaking changes

For clients of the MCP server (the tool contract changes):

- `name` of a row, of `get_element` and of `explain_element` is now
optional: absent for a room whose name is exactly the exporter's `<Revit
class>-<ElementId>` placeholder. A client that required it must handle
the absence.
- `element_type` is absent where it used to be served: for an element
the writer makes no type object for (Einhoven's four ArcWalls), and its
`property_sets` now hold the `Other` and `Identity Data` sets.
- `element_type.element_id` is the type object's `Tag`, which for an
`IfcSpaceType` is the room's ElementId, not a type's.
- New fields: `long_name`, `element_type.ifc_type`, `element_type.name`.

The `rvt` crate gains public items only (`written_names`,
`WrittenNames`, `type_objects`, `TypeObject`, `TypeObjects`).

## Related issues

Refs #1327
@DrunkOnJava DrunkOnJava removed the ready-when-green Draft whose code is complete: marked ready for review once its fast CI passes label Nov 5, 2026
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) November 5, 2026 05:06
@DrunkOnJava
DrunkOnJava merged commit 4f8e9fc into main Nov 5, 2026
33 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/mcp-written-placement-1327 branch November 5, 2026 05:27
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
… beneath it is drawn to that wall's face (#1396) (RE-337) (#1398)

## Summary

**This ships as a labelled approximation (Griffin, 2026-11-05 at about
12:30 AM EST, answering a question asked with the question tool: ship
it, labelled).** Revit steps the end up past the wall beneath, by a join
order that is not read, and the steps above the block are not drawn. A
wall whose block stops below its top carries `BodyEndSource`
`wall_end_to_base_wall_upper_step_omitted` (2 walls on each office file,
2057668 and 2057670, run 41980282001); `wall_end_extended_to_base_wall`
is kept for a block that reaches the wall's full height, which no
measured wall does.

A wall with an edited elevation profile that is a plain rectangle along
a model axis and is drawn from its record box now has an end drawn to
the face of the perpendicular wall beneath it that holds its base, where
the record box's end (before the join trim) lies inside that wall and
the cut of the wall's base still resolves over the longer plan. The
added end is a block drawn up to the lowest of the top of the wall it
reaches, the base of any other wall the pass reads that it would lie
inside, and the wall's own top; the wall's profile openings stay where
they were. Walls 2057668 and 2057670 of the BIM4LCA office have Revit's
lowest point as built and at building permit, and no wall has more
points above Revit's top in the plan rows than on `main`. No other wall
of either office file, Core Interior, RE1 Architecture, the 24 R2025
models, the 58 Autodesk sample projects or the 25 held-out models
changes. A wall that keeps an end the rule would have drawn carries
`BodyEndRefusal`, counted in `exported.wall_end_refusals`. Report:
RE-337.

## Motivation

#1396: after RE-336 the Basement walls 2057668 and 2057670 (and 2058499
and 2058501 at permit) were 0.123 ft (0.044 ft) off Revit's lowest point
because their plans end short of Revit's at the low end of the footing.
The record's join trims the end to the face of a Level_01 wall that
overlaps the wall by 0.66 ft of 9.5, while Revit's body at the base runs
on to the face of the Basement wall beneath
(`JoinEndGStep.m_geomJoined`), which the record box's end lies inside,
and steps up the height to the faces of the walls above. Each of these
walls has an edited elevation profile, which separates them from the
other ends a join trim moves: a rule on the join alone moved 25 Autodesk
sample projects, a held-out model and one more office wall.

## Changes

- `src/ifc/export_content/wall_tops.rs`: `extend_wall_ends`,
`decide_ends`, `axis_wall`, `stepped_top_wall`, `profiled_wall`,
`join_trims`, `SteppedPlan`, `finish_wall_ends` and helpers. The pass
runs after the tops are cut and before the bases are, returns early when
no wall has a profile opening, and reads the model once. It tries the
ends of each candidate on a copy, asks RE-336's `decide_base` again for
a wall whose base join names elements (and makes the solid with the
blocks, refusing if any piece is dropped or any piece has no height
above the base), and moves nothing if the base is no longer cut. It
moves the ends, moves the wall's profile openings back by the shift of
the origin, writes `BodyEndSource`
(`wall_end_to_base_wall_upper_step_omitted` where a block stops below
the wall's top, `wall_end_extended_to_base_wall` where every block
reaches it) and `EndCoverElementId`, or one `BodyEndRefusal`
(`walls_beneath_reach_the_end_at_different_faces`,
`base_cut_lost_on_extended_plan`, `base_not_cut_over_the_extended_plan`,
`wall_beneath_not_one_rectangle`, `wall_stands_in_the_added_end`). The
base pass takes the pieces (the wall's plan and a block for each end,
each to its own top); a wall with no base cut is made by
`finish_wall_ends`, whose first item is the whole plan so the glTF keeps
its layers.
- `src/ifc/export_content.rs`: the property names and values, the order
of the passes and `finish_wall_ends`. `src/ifc/wall_cut_openings.rs`:
`BodyEndSource` counts as a stepped body, so RE-321 openings still
attach (it applies alongside #1400's rewritten `host_of`).
- `src/ifc/mod.rs`, `src/ifc/export_decisions.rs`:
`exported.wall_end_refusals` and the decision
`wall_end_extension_refused` (stage `body_left_as_box`), as for
`wall_base_refusals`; `tests/export_decisions_counts.rs` counts them
against each other and names the reason for the as-built office.
- `docs/export-diagnostics.md`,
`docs/schemas/export-diagnostics.schema.json`, `docs/mcp.md`, and the
reason lists in the descriptions of `rvt-mcp/src/schema.rs` and
`rvt-mcp/src/server.rs` (the contract is synced on the branch).
- RE-337 report, `docs/support-matrix.json`, `docs/contribution-map.md`,
`docs/format-reconnaissance.md`, the RE-336 report, and a changelog
fragment for #1396 that also corrects 0.15.0's #1384 entry (its "other 2
(4) are off" sentence); the release deleted the #1384 fragment, so this
branch deletes it too.

## Testing

No unit tests (banned). Measure at head `1b3a6bd7` against `main` at
`b36477f1` (which includes #1401, RE-340), commands in RE-337 section 4:

-
[41980282001](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41980282001):
both offices, Core Interior, RE1 Architecture, `wall_heights_vs_ifc`,
`wall_top_cover_vs_ifc`, `wall_quantities_vs_ifc`, `wall_layers_vs_ifc`,
`qtos_vs_ifc`, `unfilled_openings_vs_ifc`, `keep_ifc`.
- The rule drew the ends of 2 walls as built (2057668, 2057670) and 2 at
permit (the same two). **Both office files carry the new label on 2
walls: `wall_end_to_base_wall_upper_step_omitted` on 2057668 and
2057670, as built and at permit; `wall_end_extended_to_base_wall` on
none.** It kept the ends of 2 as built (2058499, 2058501:
`base_not_cut_over_the_extended_plan`) and 2 at permit (the same:
`wall_beneath_not_one_rectangle`). `exported.wall_end_refusals` is
`{"base_not_cut_over_the_extended_plan": 2}` as built,
`{"wall_beneath_not_one_rectangle": 2}` at permit, empty on Core
Interior and RE1 Architecture, which are byte-identical (sha256).
- The scorer's own summary against `main` with #1401: walls with base
and top Revit's 604 to 606 of 607 as built and 585 to 587 of 589 at
permit; walls with the top Revit's and the base not 2 to 0 as built and
4 to 2 at permit; misses in the same storey 3 to 1 as built and 4 to 2
at permit. 2057668 and 2057670 go from 0.1230 ft (0.0439 ft at permit)
off Revit's lowest point to Revit's; no other wall's lowest or highest
point changes. Of the scorers run, only `wall_heights_vs_ifc`,
`wall_quantities_vs_ifc` and `wall_top_cover_vs_ifc` change.
- No wall has more `taller` points than on `main` in the plan rows of
`wall_top_cover_vs_ifc`, on either file. 2057668 as built: `equal 85
taller 10 lower 0` of 95 to `equal 85 taller 10 lower 5` of 100 (the
five are where Revit goes on to 182.087 ft and the block stops at
179.2979 ft); 2057670: to `equal 90 taller 10 lower 0` of 100 (Revit's
179.2979 ft); at permit both are `equal 80 taller 10 lower 0` of 90, as
on `main`. (The block to the top of the wall beneath, `1b417c45`, made
2057670 `taller 15`: Revit's end there follows the wall in front of it
from 179.2979 ft, which is the stop now.)
- Volume: 2057668 from 1.704 ft3 under Revit's to 0.593 under, 2057670
from 1.258 under to 0.147 under; at permit both from 0.374 under to
0.088 over, where the block itself is about 0.12 ft3 under Revit's end
(it stops at 180.610 ft, the wall beneath's lowest underside, where
Revit's step is at 182.087 ft) and the rest is about 0.21 ft3 of excess
in the body elsewhere that the short end of `main` masked.
- The area where a full-height top is higher than Revit's stays at
`main`'s 0.3363 ft2 on both walls and files; that metric counts only the
faces at the wall's full height, so it says nothing of the added end,
which is below it. The far-end tab is 0.4101 ft wide, as on `main`.
- `wall_layers_vs_ifc`, `qtos_vs_ifc` and `unfilled_openings_vs_ifc`
output is identical to `main`'s on all four models. 2058499 and 2058501
as built are what `main` writes (volume, height, plan, lowest point,
base). The IFC of each office differs from `main`'s (entity numbers and
timestamp taken out) in the bodies of the two walls that take the end,
the outlines of their profile openings and the property sets of the four
walls above, and nothing else. `decoded.parameter_value_count` equals
`main`'s (54,952 as built, 55,145 at permit): the markers are in
`RvtElementRecordGeometry`, not a `Pset_` set. The scorer's fit moves
the "taller" and "lower" areas of other walls by at most 0.0578 ft2 (54
walls as built) and 0.0188 ft2 (50 at permit), with the walls themselves
unchanged.
-
[41980285452](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41980285452)
(`-f r2025=true -f samples=true -f scorers=wall_heights_vs_ifc`, my own
run at `1b3a6bd7` against `main` at `b36477f1`): it exported and hashed
88 models (the 24 R2025 models, 58 Autodesk sample projects, Einhoven,
Core Interior and the four RE1 models), and the IFC sha256 is identical
to `main` on all 88. `wall_heights_vs_ifc` was scored on the 29 that
have a Revit IFC4 export (the 24 R2025 models, Core Interior and the
four RE1 models) and its output is identical to `main`'s on all 29; the
58 sample projects and Einhoven have no export to score against, so
their hash is the whole measurement.
-
[41980288900](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41980288900):
held-out, counts only, at `1b3a6bd7`: 25 models, identical to `main` on
all.
- The same two comparisons at `b47a9a00` before #1401 was merged,
[41978482673](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41978482673)
(88 models) and
[41978485557](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41978485557)
(25 held-out), are identical too.

-
[41982867204](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41982867204):
the final, unfiltered run, on this pull request's head `96baaafe`
against `main` at `40b86b80` (`-f base=main -f nordic=true -f r2025=true
-f holdout=true`, every default scorer): 53 models, 51 byte-identical,
all 18 held-out models among them; only the two office files differ.
`wall_heights_vs_ifc` reads as above (base and top Revit's 604 to 606 of
607 as built, 585 to 587 of 589 at permit). This run also scores the
wall ends, which the runs above did not: both ends within 0.001 ft go
from 512 to 514 of 607 as built and from 435 to 437 of 589 at permit, in
`wall_bodies_vs_ifc`, `wall_ends_cv_vs_ifc` and `wall_ends_list`, each
file one `start short` and one `end short` wall to `ok` and no wall
worse. No other scorer output moves. The MCP server's answers equal the
export: 900 consistency lines, 0 differ.

Head and merges: the measured head is `1b3a6bd7`, which merges `main`
(v0.15.0, #1400, #1412, #1416, #1401). The merge of `main` after it
(#1420, the 0.15.0 post-release docs) changes documents only: it
conflicted with this branch in `docs/contribution-map.md` alone,
resolved by keeping this branch's #1384 row and main's #1335 row (which
replaces the #1237 row), and changes no figure here. An earlier merge,
`8e0aa535`, touched three workflow files and no Rust. A final unfiltered
Measure of the pushed head `96baaafe` (`-f base=main -f nordic=true -f
r2025=true -f holdout=true`) is
[41982867204](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41982867204),
registered with the watcher and not read when this was written.

Measured limits, all in RE-337 section 5:

- Revit's end steps up and follows a wall at each height by a join order
that is not read, so the added end is a bound by the geometry the pass
reads, and "no wall is drawn above Revit's at an added end" is a
measured result on the four walls, not a derived one. The steps above
the block are not drawn; 2057668 as built goes five points under
Revit's.
- Walls 2058499 and 2058501 as built keep their ends 0.31 ft short of
Revit's: no footing covers the longer plan and their base is not cut
(before and after). A footing that covers a wall's plan in part is the
follow-up.
- Walls 2058499 and 2058501 at permit are not reached: the wall beneath
them is drawn with a stepped profile, so they stay 0.0439 ft off; the
skip is counted.
- No measured wall exercises: a stepped-top wall beneath whose lowest
underside is at or below the candidate's base (its higher pieces are not
checked against the block); two candidates at one corner; a candidate
with no base join; the `BodyEndSource` arm of `is_stepped` in
`wall_cut_openings.rs`, which only `finish_wall_ends` reaches; the
refusal reasons `base_cut_lost_on_extended_plan`,
`walls_beneath_reach_the_end_at_different_faces` and
`wall_stands_in_the_added_end`; `finish_wall_ends` (a wall with no base
cut); the Level branch of the blocks; the high end of a wall; walls
along x; an end reaching the wall's full height (and so the value
`wall_end_extended_to_base_wall`); the plane-offset term of the opening
shift. Nor does a beneath wall whose top a floor cut in steps over only
part of its plan (the block stops at the lowest underside, 180.6102 ft
for 1493966, where Revit's step at permit is 182.087 ft), a beneath wall
drawn as another kind of solid is neither reached nor refused (an
uncounted skip), and a wall standing in the added end that the pass does
not read (turned off a quarter turn, or a solid of another kind) does
not stop the block.
- A wall with one end drawn and the other kept carries `BodyEndSource`
and `BodyEndRefusal` both; `JoinTrimStart` and `JoinTrimEnd` stay the
record's once `BodyEndSource` is set (documented in
`docs/export-diagnostics.md`).
- Earlier heads are not evidence for the rule: the full prism with the
slid openings (`33529d0b`), the block to the wall beneath's top
(`1b417c45`, 2057670 over-drawn), the block stopped below walls in its
way with the pass moved after the tops (`74f5ee37`, Measure 41964576550,
which lost the permit refusals of 2058499 and 2058501 because a wall
beneath with a stepped top and a profile of its own was not read; fixed
in `0f80699b`), the rule without the join-trim condition (Measure
41944433297, which moved a Snowdon Towers soffit wall to 0.1016 m longer
than Revit's export, local only) and the rule that also drew 2058499 and
2058501 as built (Measure 41947542271, their volume 4.5 to 6.9 ft3 over
Revit's).

- [ ] `tools/check-local.sh` passes: not run locally (no local builds);
CI is the gate
- [x] Verified end to end on real Revit files: the BIM4LCA office as
built and at permit (Revit 24.0.5 IFC4 exports, CC BY-SA 4.0), against
Revit's own export, with the commands and the scorers in RE-337
- [x] IFC exporter touched: Core Interior's IFC is byte-identical to
`main`, so the witness observations do not move
- [ ] Performance change: N/A

## Audit-honesty checklist

- [x] Docs reflect the current state after this PR (support matrix,
contribution map, reconnaissance addendum, diagnostics reference and
schema, RE-336 pointer)
- [x] A changelog fragment under `changelog.d/fixed/`
- [x] A new limitation is documented here, in RE-337 section 5 and in
the `extend_wall_ends` doc comment
- [x] No emojis, private paths or personal addresses in committed files
- [x] Reverse-engineering finding: report RE-337 with the bytes, what
was tried and dropped, and reproduce commands; the probe is
`probe_1067_native_dump` (its `JoinEndGStep` and `GLine` lines)

## Legal and contribution hygiene

- [x] Apache-2.0
- [x] No Autodesk proprietary source, decompiled internals or NDA
content: public byte observations and Revit's own IFC4 exports only
- [x] No new fixtures

## Breaking changes

None. Two new element-record properties on the two office walls above,
`BodyEndSource` with the new labelled value
`wall_end_to_base_wall_upper_step_omitted` (and
`wall_end_extended_to_base_wall`, which no measured wall carries) and
`EndCoverElementId`, and `BodyEndRefusal` on two more at each office
file; a new field `exported.wall_end_refusals` (default empty) and a new
decision reason `wall_end_extension_refused`; two MCP tool descriptions
list it (contract synced).

## Screenshots or output samples

RE-337 section 5.

## Related issues

Refs #1396. The done-when is met for 2057668 and 2057670 on both files
and for no other wall's length or base moving; it is not met for 2058499
and 2058501 at permit.
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
…rites it in (#1417) (#1421)

## Summary

The elements CSV (`rvt-schedule`, Python's `schedule_csv()`, the
viewer's "Download element schedule (CSV)") lists the elements the IFC
export writes, each on the storey it puts it on. A part of a stair (a
run, landing or stringer) or of a curtain wall has the storey of its
whole, an element in a room the storey of the room, an opening the
storey of its host, and a further piece of an element of separate loops
that the export folds into the owner's body is not a row. An element
with folded pieces is one row with empty width, depth and height cells,
since its body has several items and its extrusion is the first loop
alone.

## Motivation

#1412 made the writer's placement decision public
(`step_writer::placements`, `storey_of`) and moved the MCP server, the
diagnostics' `storey_bound_elements` and the rooms schedule onto it, and
left `elements_csv` on the element's own `storey_index`, listing the
folded pieces. On the BIM4LCA office the MCP server's levels disagreed
with the IFC's on 599 rows of each file (542 curtain-wall members) and
its lists held 47 `IfcCovering` rows the export does not write (#1412);
the CSV had the same two disagreements.

## Changes

- `src/ifc/schedule_csv.rs`: `elements_csv` takes each row's `level` and
`level_elevation_*` from `storey_of` over `placements(model)` and leaves
out an element whose placement is `Folded`. An element with at least one
folded piece (`model.body_pieces` for it, a piece `Placement::Folded` in
`placements`) leaves its width, depth and height cells empty: its
extrusion is the first loop, not the body the writer emits. `rooms_csv`
already read `placements`. No column changes.
- Consumers: the three callers share the one function and need no code
change: `src/bin/rvt_schedule.rs`, `rvt-py/src/lib.rs` (`schedule_csv`)
and `rvt-wasm/src/lib.rs` (`scheduleCsv`, which the viewer's "Download
element schedule (CSV)" button calls, `viewer/src/main.ts`).
`examples/basics_export.rs` is a fourth consumer, and CI runs it.
`body_pieces` is serialised with the model, so the wasm path folds what
the CLI folds.
- Docs: `docs/user-guide.md` (what the `level` column is, which rows
there are, the size cells of an element with folded pieces),
`docs/python.md`, `python/rvt/__init__.pyi`, `docs/viewer-api.md`,
`docs/evidence.md`, `docs/support-matrix.json` (csv-schedules), the
viewer's button title (`viewer/index.html`), and the doc comments of the
callers. `docs/mcp.md` and the changelog fragment of #1412
(`1327-mcp-written-placement.md`) said a railing is a part of a stair;
the wholes are stairs and curtain walls (`AGGREGATE_WHOLE_CLASSES`),
railings stay standalone. No schema in `docs/schemas` describes the CSV:
the user guide's column table is its contract, and
`tests/rvt_schedule_cli.rs` enforces its header.
- `probes/examples/probe_1417_elements_csv_levels.rs`: counts, for one
model, the rows the old rule would write against the rows written now,
the rows whose level moves (by IFC type and by why) and the rows removed
(by IFC type), the elements with folded pieces and how many stated a
size before, checks the CSV it gets (header, cells, count,
level-elevation order, every row's ElementId, IFC type and level against
the placements, and the three size cells of every element with folded
pieces being empty), and says whether the model `rvt-ifc` writes with no
switch has the same written elements and storeys as the schedule's
model.
- `changelog.d/fixed/1417-elements-csv-written-placement.md`.

## Testing

Unit tests are banned: none added. Proof is the probe and Measure, both
on code head `38ddc579`. The commit after it changes only the changelog
fragment.

**Probe**: Measure run 41983667731 (`--ref main -f ref=38ddc579`,
`base=none`, `scorers=none`, nordic and r2025 on, `-f
probe=probe_1417_elements_csv_levels -f probe_scorer=-`). All 8 models
pass the probe's six checks (header, cells, count, level-elevation
order, every row's ElementId, IFC type and level against the placements,
and the three size cells of every element with folded pieces being
empty), and on all 8 the model `rvt-ifc` writes has the same written
elements and storeys as the schedule's model (`rvt-ifc default written N
differing 0`).

| Model | Rows before | Rows after | Removed | Level moves | Elements
with folded pieces |
|---|---|---|---|---|---|
| nordic-office-as-built | 13,021 | 12,974 | 47 `IfcCovering` | 599: 542
`IfcMember`, 35 `IfcStairFlight`, 22 `IfcSlab`; 542 storey to storey, 57
none to a storey, 0 storey to none; all parts of a whole | 19, none
without an ElementId; size cells emptied on 19 |
| nordic-office-permit | 13,067 | 13,020 | 47 `IfcCovering` | 599, the
same split | 20, none without an ElementId; size cells emptied on 20 |
| core-interior | 970 | 970 | 0 | 0 (the 970 rows
`tests/rvt_schedule_cli.rs` pins hold) | 0 |
| r2025-13, -14, -15 (stairs) | 27 | 27 | 0 | 3 each, none to a storey:
2 `IfcMember`, 1 `IfcStairFlight` | 0 |
| r2025-16 (monolithic), -17 (spiral) | 25 | 25 | 0 | 1 each, none to a
storey: `IfcStairFlight` | 0 |

On the office the 47 folded pieces of each file belong to 19 ceilings as
built and 20 at permit, and the row of each of those ceilings has empty
width, depth and height. The office's 12,974 and 13,020 rows equal the
element rows the MCP server's consistency check counted on those files
in run 41977947391 (#1412). All six models of the viewer's journey test
(Einhoven, Core Interior, RE1 x4) have 0 folded pieces (the same run),
so `tests/journey.spec.ts` holds.

**The IFC does not move**: Measure run 41983679071 (`--ref main -f
ref=38ddc579`, `base=main` at `40b86b80`, `scorers=none`, nordic and
r2025 on): the same `ifc.sha256` on 34 of 34 models, none unpaired.

**What the evidence does and does not show**

- No row moved for "in a space" or "opening of its host" on the 8 models
of the probe run; those paths hold by construction, since they use the
writer's function, and they are not exercised by this measurement.
- The probe's content check derives from `placements` itself, so it
proves the plumbing. The independent evidence that the placements match
the written file is the MCP scorer's `consistency element storeys`,
which reads the written IFC: 0 differ on all 53 models in run
41977947391, plus the byte-identical IFC above.
- The held-out models and Autodesk's samples were not run.
- `rvt-ifc --saved-meshes` and `--family-extrusions`, and the viewer's
saved-mesh path, were not measured for folding.

## Audit-honesty checklist

- [x] README / docs reflect the current state after this PR:
`docs/user-guide.md` says what the level column is, which rows there are
and why an element with folded pieces has empty size cells; the support
matrix and the viewer's button title say the elements the IFC export
writes; no feature this PR does not ship.
- [x] The user-visible change has a fragment under `changelog.d/fixed/`,
not in `CHANGELOG.md`.
- [x] A limitation resolved: the CSV's level column and rows disagreed
with the IFC. Left: the viewer's Schedule panel table and its info panel
(`build_schedule` in `src/ifc/scene_graph.rs`, `element_info_panel`)
still read the element's own `storey_index` (#1422, owned by another
lane); a part of several wholes takes the first whole's storey (not
measured, #1412); the held-out models and Autodesk's samples are not
measured.
- [x] Commit messages describe what changed and why.
- [x] No emojis in code, docs or commit messages.
- [x] No private paths, personal email addresses or internal jargon in
committed files.
- [ ] N/A: not a reverse-engineering finding.

## Legal and contribution hygiene

- [x] Licensable under Apache-2.0.
- [x] No Autodesk proprietary source, decompiled internals or NDA
content; the change reads the library's own writer decision.
- [x] No new fixtures.

## Breaking changes

For users of the elements CSV (`rvt-schedule`, `schedule_csv()`, the
viewer's download): a row can be absent that was listed before (a piece
the export folds into another element's body: 47 on each office file),
an element with folded pieces has empty width, depth and height cells
where it stated its first loop's, a row's `level` and
`level_elevation_*` can differ from before (a part, an element in a room
or an opening has the storey of its whole, room or host), and rows are
still in level-elevation order, so a row whose level moves moves in the
file. The columns, their order and their names do not change. The `rvt`
crate's public API does not change.

## Related issues

Closes #1417

Follow-ups: #1422 (the viewer's Schedule panel and info panel, owned by
another lane) and #1424 (the diagnostics' count of folded pieces).
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
…orey the IFC writes it in (#1422) (#1423)

## Summary

The viewer's Schedule panel (`build_schedule`), element info panel
(`element_info_panel`) and scene tree (`build_scene_graph`) put each
element on the storey the IFC export writes it in and list only the
elements it writes, as the MCP server (#1412), the rooms schedule and
the elements CSV (#1421) do. A part of a stair (a run, landing or
stringer) or of a curtain wall is on the storey of its whole, an element
in a room on the storey of the room, an opening on the storey of its
host, and a further piece of an element of separate loops that the
export folds into the owner's body is neither a schedule row nor a tree
node. The panel of an element with folded pieces states no size, as its
CSV row has no size cells, and a click on any loop of such an element
selects the element.

## Motivation

#1412 made the writer's placement decision public
(`step_writer::placements`, `storey_of`). The viewer's three scene-graph
functions still took a level from the element's own `storey_index` and
listed the folded pieces, while the "Download element schedule (CSV)"
button in the same viewer gives the written placement (#1417, PR #1421).
Refs #1422.

## Changes

- `src/ifc/scene_graph.rs`:
- `build_schedule` skips an index whose placement is `Folded` and takes
the row's storey, and so its sort key, from
`storey_of(&placements(model), idx)`.
- `element_info_panel` takes `storey_name`, `storey_elevation_feet` and
`storey` from `storey_of`, and leaves a folded piece out of `hosted`.
For an element with folded pieces (`model.body_pieces`, a piece
`Placement::Folded`, #1421's condition) it leaves out the size rows and
the Profile row, and does not list `extents` as missing. A folded piece
is still drawn by the glTF export, so a click in the 3-D view can pick
it: its panel is the one of the element that owns it. The panel has a
new `entity_index`, additive, the index of the element it describes.
- `build_scene_graph` buckets every element by `storey_of`, not by its
own `storey_index`, and gives a folded piece no node. This is the same
defect as the panels (the tree groups elements by storey), so it is in
this PR. A door or window is nested under its host only where the host
is a written element on the same storey; otherwise it is a node of its
own storey, as is one of two elements that host each other (before, an
element whose host was not a building element was left out of the tree).
- `viewer/src/main.ts`: a click on a folded piece selects the element
that owns it (the pick maps it locally, and the panel's `entity_index`
resyncs the selection if it differs): its tree row, its GlobalId, and a
highlight and zoom over the element and all its pieces
(`IfcModel::body_pieces`). The category highlight and the storey and
category framing cover the pieces of the elements they reach. The
category list counts the elements the tree lists, so `IfcCovering` reads
as the schedule and tree do. A part of several wholes sits under the
first, as `aggregate_wholes` has it. `model.body_pieces` lists the
pieces of every owner, but the export folds a piece only where the
owner's body and the piece's are both plain (`fold_body_pieces`); a
piece with a body of its own stays an element with its own tree row. So
`writtenElementOf` and `bodyPiecesOf` take the elements the scene graph
lists as the written ones (a `Set` of its entity indices, reset where
`sceneGraph` is): a listed index is its own element and a listed piece
is not one of its owner's, with no fold rule copied into TypeScript
(6881cb5, after the measured code head a8785bb).
- Docs: `docs/viewer-api.md`, `docs/viewer-build-pipeline.md`,
`docs/user-guide.md`, `docs/status.md` and the doc of `buildSchedule` in
`rvt-wasm/src/lib.rs`: what the storey is, what the tree and the
schedule list, the panel's `entity_index` and size rows.
`changelog.d/fixed/1422-viewer-panels-written-placement.md`.
- `probes/examples/probe_1422_viewer_panel_levels.rs`: builds the model
the viewer's wasm binding builds (`ExportOptions::default()`),
reproduces main's rules inline, and counts against what the three
functions return now: the schedule rows removed, the elements whose
storey moves in the schedule, the tree and a sample of panels (all that
move up to 2000, up to 300 folded pieces, up to 300 elements with folded
pieces, an even spread of 300), by IFC type and by why; it checks the
schedule rows and the tree nodes are exactly the written elements on the
placements' storey, in level-elevation order, every sampled panel's
storey, `entity_index` and size rows, and counts the panels whose size
rows are left out. Its checks derive from `placements`, so they prove
the plumbing; the independent evidence for the decision is the MCP
scorer reading the written IFC (`consistency element storeys`, 0 differ
on 53 models, run 41977947391).
- Not touched: `src/ifc/schedule_csv.rs` (#1421); `exported.by_ifc_type`
and `building_elements` in the diagnostics still count the folded pieces
(#1424), so the Schedule panel's total can read 47 below the
diagnostics' on the office until that lands.

## Testing

Unit tests are banned: none added. Proof is the probe and Measure. The
viewer's browser tests run in CI as part of `CI passed`.

Measured at code head a8785bb (the head the runs were dispatched on).
Two commits came after it: a merge of main 182ed21, which holds #1421,
with edits to the changelog fragments only, and 6881cb5, which changes
`viewer/src/main.ts` only (below). The Rust, the IFC identity run and
the probe figures are those of a8785bb:
- Probe, Measure run 41986216576 (`base=none`, `scorers=none`,
`nordic=true`, `r2025=true`; the office as built and at permit,
Einhoven, `r2025-13*` to `r2025-17*`): all 8 models pass all 10 checks,
`panel-entity-index` and `panel-extents` included. Einhoven: 37
elements, nothing moved or removed (a null result). Office as built:
schedule 13,021 to 12,974 rows, 47 `IfcCovering` removed; 599 move (57
none to a storey, 542 storey to storey: `IfcMember` 542,
`IfcStairFlight` 35, `IfcSlab` 22, all parts of a whole); the tree and
the panels move the same 599; the tree's `Unassigned` storey goes from
60 to 3; the panels of 19 of 19 elements with folded pieces have their
size rows left out. At permit: 13,067 to 13,020, the same moves,
`Unassigned` 59 to 2, size rows left out on 20 of 20. `r2025-13` to
`r2025-15`: 3 move (none to a storey), `Unassigned` 3 to 0; `r2025-16`
and `r2025-17`: 1 moves, `Unassigned` 1 to 0. Einhoven and the Revit
2025 models have no element with folded pieces (0 of 0), so they are a
null result on the size rows. The moved counts are the same as in run
41983448919 at 32f8a3e, read from both runs' `probe.txt`.
- The IFC is unchanged: Measure run 41986242000 (head a8785bb against
main b510ff3, `base=main`, `scorers=none`): `ifc.sha256` equal on 8 of
8 models.

These figures cover the Rust side: what the three functions return and
the panel's `entity_index` and extents. The probe did not count elements
that host each other, so that path is not known to be exercised.

Not measured: the viewer's TypeScript (the click selecting the written
element and the resync to `entity_index`, the highlight and zoom over
the pieces, the category counts, the part under the first whole) in a
real browser, since no browser test exercises the fold path (Einhoven
has no folded piece); the held-out models and Autodesk's samples; 2024
Core Interior and RE1; the viewer's saved-mesh model beyond what the
probe builds. The viewer's Playwright tests (CI) cover the Einhoven wall
panel's storey jump target, the schedule's group counts adding up to its
total, the CSV header and the journey test on the reference models; this
PR's CI run is their first run on it.

#1422's done-when: both panels read `placements` and `storey_of` and
leave folded pieces out (done); `docs/viewer-api.md` says what the level
is (done); the office and Einhoven are checked, but by the probe, which
builds the viewer's model and calls the functions the wasm binding
calls, not in a browser, and the Playwright pins have not run on this
head yet. So this is `Refs`, not `Closes`.

## Audit-honesty checklist

- [x] README / docs reflect the current state after this PR:
`docs/viewer-api.md` says what the storey is, which elements the
schedule, tree and panel list, and what the panel's `entity_index` and
size rows are.
- [x] The user-visible change has a fragment under `changelog.d/fixed/`,
not in `CHANGELOG.md`.
- [x] A limitation resolved: the viewer's panels disagreed with the CSV,
the MCP server and the IFC on levels and rows. Left: a part of several
wholes takes the first whole's storey (not measured, #1412); the
diagnostics' `by_ifc_type` and `building_elements` count the folded
pieces (#1424); the held-out models and Autodesk's samples are not
measured.
- [x] Commit messages describe what changed and why.
- [x] No emojis in code, docs or commit messages.
- [x] No private paths, personal email addresses or internal jargon in
committed files.
- [ ] N/A: not a reverse-engineering finding.

## Legal and contribution hygiene

- [x] Licensable under Apache-2.0.
- [x] No Autodesk proprietary source, decompiled internals or NDA
content; the change reads the library's own writer decision.
- [x] No new fixtures.

## Breaking changes

For users of `rvt::ifc::scene_graph` and the wasm bindings
`buildSchedule`, `elementInfoPanel` and `buildSceneGraph`: a schedule
row or tree node can be absent that was listed before (a piece the
export folds into another element's body), an element's storey can
differ from before (a part, an element in a room or an opening has the
storey of its whole, room or host), a hosted element can be a node of
its own storey where it was nested under a host on another one, and
`element_info_panel(idx)` for a folded piece returns the panel of its
owner (the owner's `name`, the same ElementId) where it returned the
piece's own. The panel of an element with folded pieces has no extent
rows. `ElementInfoPanel` gains `entity_index` (additive;
`#[serde(default)]`). The public API does not change otherwise.

## Related issues

Refs #1422
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
… not when any (#1334)

The dump samples the five lowest ElementIds of each entity, so a change that
adds or removes elements of an entity moves the sample and a few property sets
are held by one dump only. Any non-zero count turned the pass of a change to the
export into NOT MEASURED (#1412: 1 of 115 in each office file). The defect it
guards against is a head that lost its details, so a model is a gap when none is
held by both while either holds any, or when more than a tenth of all of them
are held by one only (exactly a tenth is not). The check's summary says how many
are held by one dump only, gap or not.

Refs #1334
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
…how many pieces were folded (#1424) (#1425)

## Summary

`exported.building_elements`, `exported.by_ifc_type` and the other
per-element counts of the export diagnostics now count the elements the
IFC writes (what `step_writer::placements` says is written), and the new
`exported.body_pieces_folded`, by STEP entity type, counts the pieces
the writer folds into another element's body (`Placement::Folded`,
#823). The figure of `building_elements` and `by_ifc_type` from before
is the new one plus it.

## Motivation

#1424: the diagnostics counted the folded pieces as elements, which the
IFC does not write. Measure run 41977947391 (head 2fc83c4, before this
change): 158 `IFCCOVERING` on the BIM4LCA office as built (122 at
permit) in `by_ifc_type` where the IFC and Revit's export hold 111 (75),
and 13,021 (13,067) `building_elements` where the MCP server lists
12,974 (13,020). The MCP server (#1412), the elements CSV (#1421) and
the viewer's panels (#1423) already follow the writer.

## Changes

- `src/ifc/mod.rs`: `exported_model_diagnostics`, `model_decisions`,
`geometry_gap_skipped_items` and `pset_property_value_count` skip a
piece marked `Placement::Folded`; the first tallies it in the new
`ExportedModelDiagnostics::body_pieces_folded` (`#[serde(default)]`,
appended at the end).
- Which counts changed (a folded piece clones its owner's property set,
storey, location and extrusion, so it was in each of them):
- `exported`: `building_elements`, `by_ifc_type`,
`building_elements_with_geometry`, `body_sources`,
`bounding_box_bodies`, `bounding_box_spaces`, the four refusal maps,
`resolved_outline_spaces`, `approximate_outline_spaces`. On the office
as built `body_sources` summed to exactly 13,021 = `building_elements`
(run 41977947391), so leaving the pieces in either would break that
identity, and in `building_elements_with_geometry` it would break
`geometry_element_fraction`.
- The `skipped` geometry-gap items (`unsupported_geometry_*`,
`floor_boundary_annotation_only`, `opening_index_without_host_geometry`)
and the decisions made with them: a gap of an owner was counted once
more for each piece, and a piece's `Ceiling...:2` name was in
`sample_names`.
- `decoded.parameter_value_count`: it counted the `Pset_` values of the
sets `add_piece_sets` clones onto a piece, none of which `write_step`
emits. Measured in run 41989882391: 54,952 to 54,764 as built and 55,145
to 54,957 at permit (188 fewer on each file, 4 for each of the 47
pieces), equal to the `Pset_` values in the IFC file.
  - The decisions of `--export-decisions` follow the counts they total.
- Derived, so they move with `building_elements`:
`source_coverage.exported_element_fraction`,
`geometry_element_fraction`, the element terms of `confidence.score`
when `unexported_element_records` is non-zero, and the
`partial_element_geometry` test.
- Unchanged: `storey_bound_elements` (already excluded),
`building_elements_carried_by_parts`, `material_count`, `storey_count`,
`layered_element_count` (keyed by ElementId),
`wall_cut_openings_left_out`, `unit_assignment_count`, `total_entities`
(entities: the pieces stay in the model for the glTF and the viewer).
- `rvt-mcp`: the descriptions of `open_model` and `get_summary` said the
diagnostics' `exported` counts include the pieces; they now say
`exported.body_pieces_folded` holds them. `export_gltf` reports the
IFC's `building_elements` and `entity_counts` (one count path); its glb
also draws the pieces, so its `notes` say how many it draws beyond them
when there are any, and its description and the
`ExportOut.building_elements` doc say so. The tool descriptions
(`open_model`, `get_summary`, `export_gltf`) and the output-schema docs
(`ElementCounts.folded_into_bodies`, `ExportOut.building_elements`)
change, so `docs/mcp-tools.json` and `docs/mcp-tools.md` need the CI
contract sync again (not hand-edited).
- `tools/re/mcp_answers_vs_ifc.py`: `building_elements` is `total -
openings` and `by_ifc_type` the summary's, exactly;
`exported.body_pieces_folded` equals the summary's `folded_into_bodies`;
new check "parameter values": `decoded.parameter_value_count` equals the
property values in the IFC's `Pset_` sets (first time measured on every
model; `tests/parameter_diagnostics.rs` covers six);
`--require-folded-field`, which Measure passes on the head side
(`MCP_REQUIRE_FOLDED_FIELD` in `measure.yml` and
`tools/ci/measure-reference-models.sh`), makes diagnostics without the
field a difference. Without it (the base side) the old reconciliation is
used.
- Docs: `docs/export-diagnostics.md`,
`docs/schemas/export-diagnostics.schema.json` (additive), `docs/mcp.md`
(its 52 placeholder-named rows are of the office's 12,974 as built, 52
of 13,020 at permit: counted in run 41986491801's dump), a dated note in
`reports/element-framing/RE-337-wall-ends-at-the-base-wall.md` where it
quotes `parameter_value_count` (54,952 and 55,145), the fragment
`changelog.d/fixed/1424-diagnostics-count-written-elements.md` with its
Upgrading note, and the follow-up wording of the 1327, 1417 and 1422
fragments.
- Read and left unchanged: `viewer/tests/journey.spec.ts` (its
schedule-per-type and row-total comparisons hold on a model with folded
pieces now that the CSV and the counts both follow the writer), rvt-py
and rvt-wasm (no field of these is named),
`tests/fixtures/project-counts/` (Core Interior, Einhoven and RE1 have
no folded piece, none moves), `tools/ci/validate-real-ifc.py`, the
witness payload.
- The `actionlint` complaint at `measure.yml:729` (`uses:
$/.github/actions/fetch-corpus`) is on a line this PR does not touch.

## Testing

- [ ] `tools/check-local.sh`: not run (no local builds in this
checkout); CI is the gate. `cargo fmt --all -- --check`, `python3 -m
py_compile`, `shellcheck` on the driver and `python3
tools/release/changelog.py check` pass here.
- [ ] Measure run 41986491801 (`base=main`, `nordic`, `r2025`,
`holdout`; code head f7da923, before the gap-item, `Pset_`,
`export_gltf` and scorer changes), read: `ifc.sha256` equal on 53 of 53
models. Diagnostics compared on 35 models: only the two office files
moved, each by 47 in `building_elements` (13,021 to 12,974 as built;
13,067 to 13,020 at permit), `building_elements_with_geometry` (12,787
to 12,740; 12,833 to 12,786), `by_ifc_type.IFCCOVERING` (158 to 111; 122
to 75) and the sum of `body_sources` (its key
`partition_element_record_bbox`); `body_pieces_folded` is
`{"IFCCOVERING": 47}` on both and empty on the other 33.
`bounding_box_bodies` (10,723; 10,844), `storey_bound_elements`,
`parameter_value_count` (54,952; 55,145) and the `skipped` items are
unchanged there. The MCP scorer reads PASS (0 differ) on all 53 models
of the head side, with one more comparison in its counts check there
than on the base side (the old reconciliation); the diff of every scorer
output between the sides is that "compared" integer on 53 files and
nothing else.
- [x] Final run: Measure run 41989882391 (`base=main` a4044dc,
`nordic`, `r2025`, `holdout`; code head 0b1bc04, the later commits
change the contract and docs only), read:
  - `ifc.sha256` identical on all 53 models.
- Diagnostics (35 models keep them; the held-out ones keep counts only)
move on exactly the two office files. As built: `building_elements`
13,021 to 12,974, `building_elements_with_geometry` 12,787 to 12,740,
`by_ifc_type.IFCCOVERING` 158 to 111, `decoded.parameter_value_count`
54,952 to 54,764. At permit: 13,067 to 13,020, 12,833 to 12,786, 122 to
75, 55,145 to 54,957. `body_pieces_folded` is `{"IFCCOVERING": 47}` on
both and empty on the other 33. `body_sources` moves by 47 in
`partition_element_record_bbox` on both; `skipped`,
`storey_bound_elements` and `bounding_box_bodies` do not move.
- MCP scorer, head side (`--require-folded-field` set,
`MCP_REQUIRE_FOLDED_FIELD` is 1 in the job): every consistency check
reads 0 differ and PASS on all 53 models, and the new "parameter values"
check (`parameter_value_count` equals the `Pset_` values in the IFC)
passes on every model. Base side (main's build, flag unset): that check
differs on exactly the two office files, the IFC holding 54,764 and
54,957 values where main's diagnostics count 54,952 and 55,145. So that
equality had not been checked on these files before.
- Not measured: the held-out models' diagnostics (counts only),
Autodesk's samples, the `export_gltf` note on a model with folded
pieces, and the exclusion of a box-sourced folded piece (below).
- [ ] The IFC is unchanged by design (the writer is untouched); the
witness payload is Core Interior's, which has no folded piece.
- Unmeasured on every model: the exclusion of a folded piece from
`bounding_box_bodies`, the refusal maps and `body_is_record_box`. The
office's pieces carry `BodySource` `partition_element_record_bbox` with
a resolved plan profile (a sketch ceiling), so they are not box bodies
and `bounding_box_bodies` did not move; no measured model has a
box-sourced folded piece.

## Audit-honesty checklist

- [x] Docs reflect the change; no figure is cited from a run that
predates the rule it is evidence for (the before-figures cite run
41977947391, the first-round figures run 41986491801 with its head)
- [x] Fragment under `changelog.d/fixed/`
- [x] No emojis, no private paths

## Breaking changes

A reader of `exported.building_elements` or `by_ifc_type` sees fewer on
a file with folded pieces (47 fewer `IFCCOVERING` on each office file);
add `exported.body_pieces_folded` to get those two figures from before.
`body_sources`, the geometry-gap `skipped` items and
`decoded.parameter_value_count` change likewise and are not recoverable
from it. The new field is additive (`serde(default)`, absent in older
sidecars).

## Related issues

Closes #1424
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
…dumps and Jev scores the diff (#1334) (#1419)

## Summary

The advisory semantic merge check of #1334. Measure diffs the two sides'
MCP dumps for each openly licensed model, and a `workflow_run` workflow
gives the diff to Jev `jev-1.13.0` beside the pull request's own `##
Summary` and `## Testing` and asks whether the export moves in a way
they do not state specifically (Griffin, 2026-11-05: a described,
intended change passes, an unexplained move fails; the main session,
2026-11-05: a move that only a general description such as "improves how
walls are exported" covers fails too). The verdict is the check run
`semantic diff (advisory)` on the commit Measure measured: not in the
ruleset, no pull request comment, and a `fail` is a red check. Only a
Measure run of every open model with a base on main writes it, it is
written on the commit Measure measured and no other, and it cannot be a
pass unless all 34 open models are compared in full and a
same-repository pull request has that commit as its head.

## Motivation

Measure is the byte-level oracle. A pull request that moves meaning
should say so, specifically, before it is armed, not only show that
bytes moved. The agent that makes a change also writes its Summary, so a
sweeping Summary must not cover a change. Refs #1334.

## Changes

- `tools/re/semantic_diff.py`: a pure function of two dumps. Elements
added, removed and changed with the value before and after; byte offsets
inside `provenance` dropped; order ignored; values compared to the
dump's six decimals; an empty object or list the same as no field;
identical changes collapsed by the whole (path, before, after) triple.
Its `measure` mode is what the compare job runs: it fails the job on a
dump in a model that is restricted or on neither list, and records in
the manifest the open models no diff covers (`OPEN_MODEL_NAMES`, 34),
each skipped model with its own reason, the groups dropped for size, and
whether the run was asked for every open model (`--requested-all`). The
measured commit and the base are the ones the compare job passes from
the plan job's resolved refs (`--head-sha`, `--base-sha`); the
`commit.txt` of a result folder is written by a shard job that runs the
measured code and is read only when none is passed.
- `tools/re/test_semantic_diff.py` and `tools/ci/test_jev_check.py`:
failure-first tests of pure helpers, run in the PII guard job. The diff:
0.35 vs 0.3500001, a reorder with moved offsets, a bulk collapse that
hides a different value, an uncovered model. The verdict logic: a model
with no dump, a diff that failed, a dropped group, an unscored chunk or
partial coverage never reads as a pass; an answer whose probabilities do
not add up is refused; a chunk of non-ASCII text is never sent over the
16,000-character cap; a head commit that is not a 40-character SHA, a
manifest with a non-string model, HTML and invisible characters in the
pull request's text, and control characters in printed text. Each was
checked to fail under the mutation it guards against.
- `.github/workflows/measure.yml`: the compare job checks out the
script, runs `measure` when there is a base, tells it whether the run
was dispatched with no `models` filter and the office and Revit 2025
models on, and uploads `semantic-diff`. The documented command is `-f
base=main -f nordic=true -f r2025=true` with no `models` filter.
- `tools/ci/jev_check.py`: merges findings across models, chunks them
(at most 8 findings, 16,000 characters as sent), reads the
same-repository pull request whose head is the measured commit through
the API, takes its `## Summary` and `## Testing` (HTML element tags and
invisible characters removed, each cut at 2,500 characters as sent, all
of it shown in the check's summary; text in angle brackets that is not
an HTML element, such as `<set>.<property>`, stays), and asks Jev blind
(labels A and B randomised per chunk; no model name, pull request
number, title or branch in the state). Per finding Jev chooses: stated
specifically / follows from a specific change they state / covered only
by a general description / unstated / only rounding, a reordering or a
spelling; "general" plus "unstated" is the finding's score, and the
probabilities must add up to 1. A finding at 0.85 or more is a fail in a
chunk rated 1.5 or more and a warn in one rated 1.0 or more. NOT
MEASURED, never a pass, for no key, no same-repository pull request
whose head is the measured commit (a fork's included, and an empty diff
does not excuse it: the lookup is first), a check asked for on a commit
other than the measured one (both commits in the title), a base that is
missing or could not be checked, a pull request with no `## Summary`
where the diff has findings, HTTP 402, a refused key, another model's
reply, a time-out, an error (named by its type), no model compared, any
open model not compared in full, a dropped group or a missing count,
sampled property sets that one of a model's dumps alone holds too often
(none held by both while either holds any, or more than a tenth of
them), or an unscored chunk. A run whose base is not main or an ancestor
of main writes no check, and names the base. The Jev call does not
follow a redirect. An empty diff passes without a call and needs no
Summary, but only on a complete run.
- `.github/workflows/semantic-check.yml`: `workflow_run` on Measure
(environment `jev`, main only), `workflow_dispatch` with a run id, and a
keyless run on a pull request that changes the check. It scores only a
Measure run whose event is `workflow_dispatch` and whose head repository
is this repository, from `measure.yml` at that path; any other run posts
nothing, with a notice. It writes the check on the commit the artifact
names as measured, not on a pull request's live head. actionlint reports
nothing on it and zizmor 1.32.0 reports nothing on it, `measure.yml` and
`ci.yml` (the one `dangerous-triggers` finding, on `workflow_run`, is
ignored inline with its reason).
- `docs/maintaining.md` (where to find the verdict: it is on the
measured commit, not necessarily the head, which the pull request page
does not show, so look it up with `gh api
repos/<repo>/commits/<sha>/check-runs?check_name=...`; a later commit
does not clear a fail, only a new score of the same pull request does; a
filtered Measure run writes no verdict, so a pull request that changes
output needs its final unfiltered run; the Summary must state each
change specifically: which classes, which property or geometry, how many
where measured; a fail is fixed by changing the code or by stating the
change in the Summary; a warn is answered in the body; the complete
command; what a pass means: the dumps agree, not that the exports are
identical, since the dump samples five elements per entity; what is
sent, including element names and values that can hold an ElementId), a
changelog fragment.

## Testing

No local build (the lane runs no cargo); the tests above are the
pure-helper exception and run in CI's PII guard job. End to end on real
dumps:

- [x] N/A for `tools/check-local.sh`: no Rust changed.
- [x] Verified end to end on real Measure runs: see "Output samples".
The keyed path (main's `workflow_run` job with the secret) is not yet
exercised.

## Audit-honesty checklist

- The keyed path cannot run before the workflow is on main:
`environment: jev` takes only main, and a `workflow_run` workflow runs
from the default branch. After the merge: `gh workflow run
semantic-check.yml --ref main -f run_id=<a complete Measure run with a
base>`.
- The keyless path is exercised by this pull request's own run of the
workflow, and it can only say NOT MEASURED: it writes on the pull
request's head, which is never the commit Measure measured. At c36b71f
(before the delta review) it did so with the wrong reason: Measure run
41987903774 (dispatched from this branch for #1425's head c8e55f5
against main 182ed21, `-f nordic=true -f r2025=true -f
scorers=mcp_answers_vs_ifc`, no `models` filter) compared all 34 open
models (0 skipped, 0 uncovered, `requested_all` true; findings only in
the two office files, 7 each), and this workflow's run 41987854258
(attempt 2) wrote check run 127117767677 on c36b71f through
`GITHUB_TOKEN` saying only "no Jev key", a check on a commit Measure had
not measured. At b4d1932 such a check says "this check is for <the
head>, but Measure measured <the other commit>" in its title (local
scenario below; the CI proof is Measure run 41993282068 on #1425's head
722244e against main a4044dc, and this workflow's pull-request run
after it: not yet measured on this head). Measure's own pull-request run
41987854320 covered 6 of 34 models and its compare step says "the
semantic check writes no check run (this run was not asked for every
open model)", the filtered path in a real run. An earlier pass of the
keyless path (run 41966963563, attempt 2, on fd90cdc: no semantic
difference in 6 models) predates the coverage rule and the commit check.
- A pass means the dumps agree, not that the exports are identical: the
dump samples five elements per entity, and a mesh vertex or a profile
point is not in it.
- The thresholds and the wording of the per-finding question were set on
the in-sample cases below, so those cases are in-sample for them. The
held-out round is the second table. Jev's answers move by about 0.02
between two calls with the same request (#1412's own Summary passes at
0.84 and fails at 0.86 on byte-identical requests, against a gate of
0.85), so a verdict within 0.05 of the gate is not stable.
- B3 (a fork's run) and the redirect behaviour are tested by reading the
code and the unit helpers, not by a fork's run: no fork pull request was
opened.

## Breaking changes

None.

## Output samples

Everything below was scored with `tools/ci/jev_check.py` and
`tools/re/semantic_diff.py` as committed at 49d5378, and the
delta-review block below as committed at b4d1932 (which changes who may
write a check, the gaps, and the stripping of HTML and invisible
characters in the pull request's text; no prompt, threshold or
chunking), and the key from the Keychain on this Mac, from the
`semantic-diff` and `measure-*` artifacts of the Measure runs named.
Nothing was scored with a threshold or a prompt other than the committed
ones.

**Ground truth is `ifc.sha256` per model**, not a pull request's title.
Of 13 pull requests in the in-sample set (Core Interior, Einhoven, RE1
and the Revit 2025 models in every run; 34 models with the BIM4LCA
office where `nordic` was on, 30 for #1402 and #1403 and 6 for #1398),
the IFC differs on the two office files for #1388, #1400, #1401 and
#1405 and on no model measured for the other nine. The semantic diff has
findings on exactly those two models in each of those four runs, and
none on any model whose IFC is identical, except the dump-only changes
of #1373, #1379 and #1412. The documented command (no `models` filter)
is what finds them: the earlier documented command, which filtered to
Core Interior, Einhoven and RE1, reads "pass" on all four.

**In-sample: the 7 pull requests whose diff is not empty** (runs
41972569847 #1388, 41972650013 #1400, 41972664107 #1401, 41972583508
#1405, 41972597118 #1373, 41972610208 #1379, 41972636527 #1412; each 34
models). "Own" is the pull request's real Summary and Testing.
"Sweeping" is a one-line Summary that names an area and no kind of
change ("Improves how walls and floors are exported." for #1388,
"Improves how openings are written in the export." #1400, "Improves how
walls are drawn in the export." #1401, "Improves how floors and walls
are exported." #1405, "Improves how rooms, profiles and pipes are
exported." #1373, "Improves how roofs are exported." #1379, "Improves
the MCP server's answers." #1412), alone and beside the pull request's
real Testing. "Wrong" is another pull request's full body: #1329 (a
memory change that states the output does not change) and one other. The
number in parentheses is the highest probability that Jev gave a finding
as not stated specifically.

| Pull request | Findings | Own | Sweeping alone | Sweeping + its
Testing | Wrong: #1329 | Wrong: other |
| --- | --- | --- | --- | --- | --- | --- |
| #1388 | 7 | pass (0.31) | fail (0.99) | pass (0.74) | fail (0.99) |
#1412: fail (0.95) |
| #1400 | 14 | **fail (0.94)** | fail (0.99) | fail (0.98) | fail (0.98)
| #1373: fail (1.00) |
| #1401 | 12 | pass (0.63) | fail (1.00) | pass (0.77) | fail (0.96) |
#1379: fail (1.00) |
| #1405 | 2 | pass (0.51) | warn (0.99) | warn (0.90) | warn (0.96) |
#1379: **pass (0.78)** |
| #1373 | 88 | pass (0.63) | fail (1.00) | fail (0.99) | warn (0.97) |
#1400: fail (1.00) |
| #1379 | 94 | pass (0.24) | fail (0.99) | warn (0.90) | fail (0.96) |
#1401: fail (1.00) |
| #1412 | 23 | pass (0.84) | fail (1.00) | fail (0.89) | fail (0.99) |
#1388: fail (1.00) |

- **No sweeping Summary alone passes (0 of 7): 6 fail, 1 warns.** Beside
the pull request's own Testing two pass (#1388 and #1401), because their
Testing states the figures: that is the rule working, since a measured
figure in Testing counts as stated.
- **False positives: 1 of 22 expected passes, a fail.** The 22 are the 7
own Summaries, 6 jitter controls, 6 reordered controls and 3 empty-diff
pull requests on complete runs (#1329, #1377, #1382: no finding on any
model, IFC identical, each a pass without a call to Jev). #1402 and
#1403 ran without the office, so under the new rule they write no check
and are not counted. #1400 is a diff of 14 counters of the diagnostics,
and the figure its Summary and Testing leave unstated is
`parameter_value_count` +188 (office as built) and +174 (permit); its
Motivation, which Jev is not given, gives 182. #1412's own Summary sits
at the gate: the same request scored 0.84 (pass) at 4e81a95, 0.86
(fail) in one rescoring on this head's code and 0.84 (pass) in the table
above, so it is a verdict the gate cannot hold; it could as well be
counted a second false positive.
- **False negatives: 1 of 21 expected non-passes** (7 sweeping alone, 7
with #1329's body, 7 with another's): #1405's whole diff is
`total_entities` +8 on each office file, which a roofs Summary does not
state (0.78, below the gate).
- **Controls, complete** (all 34 models on both sides, one model
changed; built from the dumps of run 41972569847): six jitter controls
pass, a move of 1e-6 in every measurement of the sampled elements, the
rooms' areas and the levels' elevations in Core Interior, RE1
architecture and mechanical, Einhoven, the office as built and a Revit
2025 model, scored beside #1329's body: highest probability 0.73 to
0.79, highest chunk rating 0.6 to 0.7, below the 1.0 rating gate; 412
findings in 65 chunks on the office. Six reordered controls (every row,
set and room in another order, every byte offset shifted) are empty
diffs.
- **Coverage, on #1401's stored diff** (run 41972664107, own Summary),
changing only the manifest: complete, **pass**; one model with no dump
on the head side, **NOT MEASURED** naming it; one model whose diff
failed, **NOT MEASURED** with that reason; a dropped group, **NOT
MEASURED**; the same missing model with a run not asked for every open
model, **no check run**; a manifest with a non-string model, an error
and no check run.
- **Unchanged by the review fixes:** 34 of 35 verdicts of the in-sample
matrix are as scored at 4e81a95 (the one that moved is #1373 with
#1329's body, fail to warn; both are non-passes), and #1401 and #1405
(the two the review asked for, runs 41972664107 and 41972583508) are
unchanged in all five bodies. 18 of the 35 requests are byte-identical
to the earlier scoring; the other 17 carry a Summary or Testing that is
now cut by its length as sent (a newline or a quote in the text counts
two, so a section over the cap is cut about 20 characters earlier),
which is the review's cap fix and not a change of method.

**Delta review (b4d1932).** Run on stored complete runs, with the key
from the Keychain and real GitHub lookups, nothing posted:

- Run 41972569847 (#1388's merge commit, base 240c7d7): the pull
request is found through the API from the measured commit, the base is
on main, Jev is asked with #1388's real Summary and Testing: **pass (7
findings in 34 models)**, as before. Run 41972583508 (#1405's merge
commit): **pass (2 findings)**, as before. Run 41972664107 (#1401's head
2a35ede, which has since moved): NOT MEASURED, "no pull request of this
repository has this commit as its head", the head-moved case in a real
run; scored offline with #1401's real body the verdict is **pass**, and
all five of its bodies give the verdicts of the table above (pass, fail,
pass, fail, fail). #1388's five bodies and #1405's five are the same
verdicts as the table, except #1405 with #1329's body, warn to fail (a
non-pass either way, at a rating of 1.5).
- Run 41987903774 (PR #1425's head c8e55f5 when measured): its head has
since moved to 722244e, so the real-lookup scenario reads NOT MEASURED,
"no pull request ... has this commit as its head". Asked to write on
another commit (c36b71f), the same run reads NOT MEASURED with "this
check is for c36b71f, but Measure measured c8e55f5". An empty diff
on a merged pull request's commit (run 41980023307, #1358) is a pass;
the same empty diff with a commit no pull request has is NOT MEASURED; a
base that is the pull request's own head writes no check and names the
base.
- **Property sets held by one dump only** (`details_one_side`) are a gap
per model only when none is held by both while either holds any, or when
more than a tenth of all of them are held by one dump only (exactly a
tenth is not a gap; main session, 2026-11-05). The dump samples the five
lowest ElementIds of each entity, so a change that adds or removes
elements of an entity moves the sample and a few are held by one dump
only: that is not a defect, and the literal rule (any non-zero count)
would have turned #1412's pass into NOT MEASURED. The defect it guards
against is a head that lost its details. The check's summary says how
many are held by one dump only, gap or not. On run 41972636527 (#1412, 1
of 115 sampled elements held by one dump only in each office file, no
gap), scored offline with #1412's body three times: pass (0.84), fail
(0.85), pass (0.83), all with no gap and the same chunk (a finding at
the 0.85 gate, in a chunk rated 3.6), so its own Summary is a pass
again, at the gate, and not a stable one. No other stored complete run
has a non-zero count.

**Held-out, thresholds and wording unchanged since they were set
above.** Ten merged pull requests that were not used to set them, run
with the same 34 models (`nordic` and `r2025` on):

- #1337, #1352, #1356, #1372, #1341 and #1344 (Measure runs 41973688732,
41973701739, 41973714367, 41973727101, 41973740400, 41973754042): the
IFC is identical on all 34 models and the dumps agree, so each has an
empty diff and passes without a call to Jev, with its own Summary, a
sweeping one, #1329's or another's alike. **They test the empty-diff
path and nothing else**: none of their changes lands on an open model.
- #1350, #1358, #1364 and #1370 (provenance and diagnostics additions;
the IFC is identical on all 34 models in each, so these are dump-only
changes), Measure runs 41980008692, 41980023307, 41980037727 and
41980053223, scored with the same four bodies per pull request (own
Summary and Testing, a sweeping one-liner written before the runs
finished, that line beside the real Testing, #1329's body, and another
pull request's body). Scored first with `jev_check.py` as it was at
4e81a95 and again with the code of this head; nothing was changed after
seeing a result, and the 20 verdicts are the same in both.

| Pull request (run) | Findings | Own | Sweeping alone | Sweeping + its
Testing | Wrong: #1329 | Wrong: other |
| --- | --- | --- | --- | --- | --- | --- |
| #1350 (41980008692) | 1034 in 142 chunks | **warn** (0.86, one chunk,
rated 1.13) | fail (1.00) | fail (0.88) | fail (0.99) | #1358: **pass
(0.84)** |
| #1358 (41980023307) | 0 | pass, empty diff | pass, empty diff | pass,
empty diff | pass, empty diff | pass, empty diff |
| #1364 (41980037727) | 159 in 37 chunks | pass (0.14) | fail (1.00) |
pass (0.60) | fail (0.97) | #1370: fail (0.92) |
| #1370 (41980053223) | 98 in 16 chunks | **warn** (0.90, one chunk,
rated 1.33) | fail (1.00) | fail (0.95) | fail (0.97) | #1350: **pass
(0.21)** |

The sweeping lines were "Improves what the export records about
elements." (#1350), "Improves the diagnostics of the export." (#1358),
"Improves what the export records about bodies." (#1364) and "Improves
what the export records about profiles and stairs." (#1370).

- **The held-out result is weaker than the in-sample one.** Real
Summaries: 1 of 3 non-empty pull requests passes, 2 warn and none fail.
Sweeping alone: 0 of 3 pass (all fail). #1329's body: 0 of 3 pass.
Another pull request's body: 2 of 3 pass. With the empty diff counted,
false positives are 2 warns (no fail) of 4 expected passes, and false
negatives 2 of 9 expected non-passes.
- **Why the two warns.** #1350 added fields to the dump's `summary.file`
block (`layout_release`, `omitted_entries`, `partition_count`), which
its Summary and Testing do not name: one chunk of 0.86 at a rating of
1.13, where a warn needs 0.85 and 1.0. #1370's warn is one chunk of
`value_sources` parts of Core Interior's shading devices at 0.90, rated
1.33; a fail needs 1.5. Both are near their gates.
- **The two cross-body passes are neighbours, not strangers.** #1350
(the provenance of every decoded element), #1358 (why an element was
left out) and #1370 (value sources for profiles, stair runs and
landings) all add provenance and diagnostics, so another's Summary
covers part of the diff. They are counted as false negatives as defined.
- **Run-to-run movement.** Jev's answers move by about 0.02 between two
calls with the same request, and by more in the maximum of very many
findings: with #1358's body on #1350 (1,034 findings) the highest scored
0.83, 0.97 and 0.84 in three scorings, only the middle one on a
different grouping of the chunks (since reverted: a chunk is packed at
full context). A verdict near a gate (0.85) is not stable.
- **What it says about the thresholds.** On provenance and diagnostics
additions Jev's probabilities for a change the pull request states sit
near 0.9 where in-sample they sat at 0.2 to 0.8, so the 0.85 gate is
close to the edge for real Summaries. A recalibration follow-up is
warranted.

#1314, #1316 and #1328 cannot be calibrated: their parents predate the
server crate (71c0677), so Measure builds no `rvt-rs-mcp` there.

## Related issues

Refs #1334
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant