Skip to content

fix(ifc): an element's further pieces take their GlobalIds from the element's Revit GlobalId, so they hold from save to save (#1840) - #1850

Merged
DrunkOnJava merged 4 commits into
mainfrom
fix/1840-piece-global-ids
Nov 13, 2026
Merged

DrunkOnJava merged 4 commits into
mainfrom
fix/1840-piece-global-ids

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

A slab's further pieces, a layered floor's parts and a curtain wall's parts share their element's Tag, and Revit gives only the first of them a GlobalId. element_global_ids derived the GlobalIds of the rest from the document's Unique Document GUID, the Tag and the piece's place. They are now derived from the first piece's Revit GlobalId and the piece's place. Where the element has no Revit GlobalId, the document-derived one stays. Closes #1840.

Motivation

#1840, from HWT-25's report on #1829. On two saves of a Revit 2027 structural model, the Unique Document GUID differs (ff4a120b-…, 8add98bc-…). Floor 499263's 11 further pieces keep their Tag and their place, yet every GlobalId moves, while the host floor keeps Revit's own 1GIEblKKb9aOPHLDpftUL6. Tools that track elements across versions (clash status, BCF) then see every part removed and a new one added on each save.

Changes

  • src/ifc/step_writer.rs element_global_ids: the first entity carrying a Tag that has a Revit GlobalId seeds the GlobalIds of the further entities carrying that Tag. stable_guid's doc names the new seed.
  • src/ifc/mod.rs (RevitGlobalIds::document) and docs/evidence.md (the GlobalIds row) say so.
  • changelog.d/fixed/1840-piece-global-ids.md.

Testing

Unit tests are banned here. The evidence is one unfiltered Measure of this head against its merge-base with main: the samples of every year, the BIM4LCA models, the R2025 set, BIMcollab and the held-out models, with the IFC kept.

Rows, registered before the run:

  1. Only further pieces' GlobalIds move. In every export that differs, the only lines that differ are those of building elements that share their Tag with an earlier entity whose GlobalId is Revit's. Within those lines, only the GlobalId differs. Every diagnostics.json is equal.
  2. Scorers. The GlobalId and identity scorers match against Revit's export, which holds no further pieces, so their counts are unchanged. Any scorer line that moves is named here with its cause.
  3. Across saves. On the samples Measure holds as several saves of one project (rac_advanced, rac_basic and rst_basic of 2024 to 2027), the kept IFCs are compared for each Tag whose first piece has the same Revit GlobalId in two saves. On the head, the further pieces' GlobalIds are equal between the saves. On the base, they differ wherever the two saves' document GUIDs differ. If no sample has a further piece of such an element, that is stated, and this row stands on Report: Revit 2027 structural model (CHL), compared element by element with Revit's IFC4 export and run through a clash engine #1829's data alone.
  4. Gates. same-project gates pass.

What this does not cover: openings, relationships, property sets and type objects without a Revit GlobalId still take theirs from the document GUID (emit_data's gid). On HWT-25's two saves they still move, so a tool that follows openings across versions still sees them change. That is #1854.

  • rustfmt --edition 2024 --check passes. CI runs the rest of the gate.
  • Verified end to end on real Revit files: the Measure run above.
  • Exporter output changes: the GlobalIds of further pieces, rows 1 and 3.
  • N/A: no performance change.

Audit-honesty checklist

  • README / docs reflect the current state after this PR
  • A user-visible change has its entry as a fragment under changelog.d/<section>/
  • N/A: no limitation resolved or introduced
  • 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: no format finding, so no probe

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0
  • This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content
  • No new test fixtures

Breaking changes

None to the API. The GlobalId of each further piece of an element with a Revit GlobalId changes once.

…lement's Revit GlobalId, so they hold from save to save (#1840)

A slab's further pieces, a layered floor's parts and a curtain wall's parts share their element's Tag, and Revit gives only the first a GlobalId. The rest were derived from the document's Unique Document GUID, which changed between two saves of HWT-25's Revit 2027 structural model (#1829), so every part's GlobalId moved on each save while the host's held. They are now derived from the first piece's Revit GlobalId and their place among the entities sharing the Tag. Where the element has no Revit GlobalId, the document-derived one stays.
… between saves, which #1840 makes them keep (#1840)

The gate let only one GlobalId under a Tag of several products hold between
saves, because the others came from the document's GUID. With the further
pieces derived from the first piece's Revit GlobalId, every piece keeps its
own, and the gate now compares each as it compares a single product: a piece
that takes a new GlobalId, or two that swap, fails.
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Run 43322489213 (9176cfdc against 21958f8e, IFC kept), read against the rows above. Rows 1 and 4 fail as I wrote them.

  1. Fails as worded. 10 of 121 exports differ: the 2024 to 2027 rme_advanced and rme_basic samples, Snowdon Towers Architectural and the BIM4LCA concrete housing as built.
    • In each, every changed line is the same entity with only its GlobalId changed, apart from the export's timestamps (FILE_NAME, IfcOwnerHistory).
    • The changed lines are not only the pieces. Per piece, there is the IfcSlab itself, one IfcRelAssociatesMaterial, and seven IfcPropertySet with their seven IfcRelDefinesByProperties. Their GlobalIds come from emit_data's gid keyed by the piece's GlobalId, so they move with it.
    • Measured per file: 25 slabs, 400 lines on the 2024 rme and Snowdon, 300 on 2025 to 2027 rme, and 3 slabs, 48 lines on the housing.
    • On three of those files, every changed relationship relates only changed slabs, and every changed property set is defined through a changed relationship. Every changed slab shares its Tag with an earlier entity.
    • The row missed that cascade.
  2. Holds. No scorer line moves except bodies_across_saves.
  3. Holds, on other samples than I named. The pieces the gate holds across saves are on rme: 6 Tags, 31 pieces of 4 to 6 each.
    • On the head, every piece's GlobalId equals its 2024 save's.
    • Against the 2025 save (not scored), the 2026 rme_advanced outlines go from 47 equal and 6 differing to 53 equal and 0 differing.
    • On the base, only the first piece of each Tag kept its GlobalId.
  4. Fails. same-project gates fails on the rme samples of 2025 to 2027 with "6 GlobalId(s) shared ... where exactly one of each is expected". The gate encoded the old behaviour: only a Tag's first piece kept its GlobalId between saves.

Fix, 7ab9e9d1 (tools/re/bodies_across_saves.py, docs/maintaining.md). The gate compares each piece of a Tag as it compares a single product, GlobalId included. A further piece that takes a new GlobalId fails, and so do two pieces that swap. The source is unchanged, so the exports are those of 9176cfdc.

Rows for the gates run on 7ab9e9d1, registered before it runs:

  • Row 1, reworded: the changed lines differ only in their GlobalId. They are the further pieces (sharing their Tag with an earlier entity) and the material associations, property sets and property relationships of those pieces, as counted above. This stands on the run above, since the source has not changed.
  • Row 4: same-project gates pass on 7ab9e9d1, scored by the gate at 7ab9e9d1.

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 12, 2026 23:52
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Gates run 43330924424 on 7ab9e9d1, scored by the gate at 7ab9e9d1: row 4 holds.

  • same-project gates passes: 15 of 15 samples held to their earlier saves, and the Areas on 4 saves and on the 2021 save (check run on 7ab9e9d1).
  • The stricter gate tells the two behaviours apart. On the base (21958f8e) it fails all six rme saves of 2025 to 2027, each with 25 differences. Those are the 25 further pieces (31 pieces under 6 Tags) whose GlobalIds differ from the 2024 save's. On the head all six pass.
  • The exports are those of 9176cfdc: the same 9 samples differ, and all 65 diagnostics.json are equal. Row 1's counts (comment 6839226343) stand.

…BCF users, with the pieces it moves once per measured model (#1840)
DrunkOnJava added a commit that referenced this pull request Nov 13, 2026
## Summary

Release metadata for v0.20.0 (RELEASE.md, steps 4 to 7), cut from `main`
at `925c482d` and merged with `main` up to `58395b62` (#1855, #1860,
#1861, #1863, #1866, #1867 and #1868 among it):
- every version file moves to 0.20.0 (`tools/release/bump_version.py`),
and `CITATION.cff` is dated 2026-11-12;
- the fragments under `changelog.d/` are assembled into a `[0.20.0]`
section, with its introduction and "Upgrading from 0.19" (the
work-budget bullet says a stop warns and the export is still written, as
#1855 settled);
- the README's release lines name v0.20.0;
- Core Interior's two witness observations and verdicts, and the two
synthetic IFC fixtures, are taken from CI's artifacts for `e10580d0`:
only `witness_version`, the verdict hashes, the retired "Unmapped Revit
unit identifiers" warning (RE-445) and an unset transparency (#1820)
differ.

Measured and rehearsed:
- the comparison with 0.19.0 is in the section, from Measure runs
[43357862138](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43357862138)
(unfiltered, `58395b62` against `v0.19.0`'s `09b18bd3`: 49 of 146
exports move, 0 census regressions, 0 body regressions) and
[43357979238](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43357979238)
(timing: no file more than 3% slower except one that reads 0.98 in the
earlier run of the same code, no peak higher by more than 2%, the
samples of 2023 to 2027 at a median 0.76 times the peak memory). The
release adds only notes, witness files, version strings and fixtures to
`58395b62`, so a run of `main` is the run of the release; a run of this
branch would move every export through the header's version string;
- `publish.yml` rehearsal on `d9946f4b`:
[43359414819](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43359414819)
passed. Only the changelog changed since.

**Why now.** `main` holds today's crafted-file and security fixes
(#1815, #1831, #1833, #1845), and neither GlobalId move. #1850 is back
in draft until the tag, and #1854's fix is #1859. Those two ship
together in 0.21.0 (#1854 comment 6841360704).

## Testing

- `python3 tools/release/changelog.py check` passes: no fragment is
left.
- `bump_version.py` checks the version files with the preflight's own
`check_versions`.
- The PII guard runs `release_preflight.py` on this PR.
- Timing against 0.19.0 is in the section, from run 43357979238 on
`58395b62`.

## Related issues

Release 0.20.0. Milestone `0.20.0`.
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 13, 2026 05:08
DrunkOnJava added a commit that referenced this pull request Nov 13, 2026
…the branch of #1854, the three comment conflicts resolved to say both
@DrunkOnJava
DrunkOnJava merged commit b51bf33 into main Nov 13, 2026
36 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1840-piece-global-ids branch November 13, 2026 05:23
DrunkOnJava added a commit that referenced this pull request Nov 13, 2026
…ame three comment conflicts resolved to the text that says both rules
DrunkOnJava added a commit that referenced this pull request Nov 13, 2026
…their GlobalIds from the entity they belong to, so they hold from save to save (#1854) (#1859)

## Summary

Openings, property sets, quantities, material associations and the
relationships between entities now take their GlobalIds from the entity
they belong to, not from the document's `Unique Document GUID`, so they
hold from save to save. #1840 found the GUID changes on every save, and
#1854 showed it does so on every Autodesk sample. What belongs to no
entity keeps the document seed. Closes #1854.

## Motivation

`emit_data`'s `gid` closure seeded every derived GlobalId from the
document's GUID. Between two saves of one project, every opening,
property set, relationship and port took a new GlobalId while the
elements kept theirs, so a tool that follows them by GlobalId (BCF on an
opening, a property diff by set) saw every one removed and added again.

`probe_1854_project_seeds` (run 43327315618, issue comment 6839343356)
found no project-level seed that both holds across saves and differs
between projects. The first episode and ProjectInfo's Revit GlobalId are
the template's, one value on 64 of 102 models.

## Changes

- `src/ifc/step_writer.rs`, `emit_data`: 44 of the 56 `gid` sites are
now `stable_guid(<owner's written GlobalId>, <same key>)`. Each owner:

  | Derived entity | Seeded from |
  | --- | --- |
| an element's opening, its void and fill relationships, and the
opening's property and quantity sets | the host's GlobalId, then the
opening's |
| an element's property sets and material association | the element's |
  | an aggregate | its whole's |
| ports, port connections and port nesting | the element's (the document
where the element writes none) |
  | a type's property sets and its `IfcRelDefinesByType` | the type's |
| storey and building sets, containment and space aggregation | the
storey's or the building's |
  | the project, site and building aggregation | theirs |

- Left on the document seed (12 sites, and the fallback of the two port
sites):
- the project, site, building and storey where Revit gives them no
GlobalId;
  - classifications, materials and MEP systems;
  - types with no Revit GlobalId;
  - a port whose element writes no GlobalId.
- `stable_guid`'s first parameter is now `seed`, and its doc says what
may seed it.
- `RevitGlobalIds::document` (`src/ifc/mod.rs`) and `docs/evidence.md`'s
GlobalIds row say what the document seeds now.
- `changelog.d/fixed/1854-owner-seeded-global-ids.md` carries the
upgrade note for clash and BCF users: every derived GlobalId changes
once, in this release.
- `probes/examples/probe_1854_global_id_census.rs`: every GlobalId one
export writes, by class, and how many it writes twice. For a sample and
its later save, how many GlobalIds of each class both write. For a
`rac_basic` sample, how many it shares with the `rac_advanced` sample of
its year.

This ships in the same release as #1850 (issue comment 6839580056), so
each kind of entity moves once.

## Testing

Unit tests are banned here. The evidence is one unfiltered Measure of
this head against its merge-base with `main`: the samples of every year,
the BIM4LCA models, the R2025 set, `rac_advanced` and the held-out
models, with `probe_1854_global_id_census` and
`probe_pair_release=2026`.

Rows, registered before the run:
1. **Only derived GlobalIds move.** In every export that differs, every
changed line is the same entity with only its GlobalId changed, apart
from the header's timestamps. No `IfcBuildingElement` subtype, storey,
type with a Revit GlobalId, project, site or building changes. Every
`diagnostics.json` is equal.
2. **Unique.** `duplicates=0` on every model the probe reads.
3. **Across saves.** On each sample pair (2021 to 2027 against the 2026
save), every derived class that both saves write has `both` > 0.
Reported per pair, against the building elements' share held: the share
held for `IfcRelDefinesByProperties`, `IfcPropertySet`,
`IfcOpeningElement`, `IfcRelVoidsElement` and
`IfcRelAssociatesMaterial`. On the base every such GlobalId differs
between two saves by construction, since the document GUIDs differ on
all 13 saves of each project.
4. **Gates.** `same-project gates` pass.

- [x] `rustfmt --edition 2024 --check` passes. CI runs the rest.
- [x] Exporter output changes: GlobalIds only, rows 1 and 3 (read on
this PR's comment on the runs at `1abc2fa5`: only derived GlobalIds
move, and across saves they hold except for `rst_basic`'s containment
and aggregation).

## Audit-honesty checklist

- [x] Docs follow the change (`docs/evidence.md`, the
`RevitGlobalIds::document` rustdoc). The fragment states what still
moves.
- [x] Changelog fragment under `changelog.d/fixed/`.
- [x] No emojis, private paths or jargon.

## Legal and contribution hygiene

- [x] Apache-2.0. No Autodesk proprietary content. revit-ifc's
`GUIDUtil` was read for what Revit's export does, not copied (CLEANROOM
source 5).

## Breaking changes

Every derived GlobalId changes once (the upgrade note in the fragment).
No API change.
DrunkOnJava added a commit that referenced this pull request Nov 13, 2026
…does not declare are reported as what they are, not as an incomplete IFC (#1838) (#1874)

## Summary

`rvt-ifc`, the diagnostics, `rvt-inspect` and the viewer said that the
element records a file's element table does not declare use a layout
this release cannot locate, and that the IFC is incomplete. The one case
with a Revit export of the same save, a Revit 2027 structural model
reported on #1829, shows all 84 of its records were roof framing deleted
between two saves: the record chain of `Partitions/0` is the same in
both saves, the table declares 143 fewer of its records, Revit's export
of the latest save holds none of the 84, and every element it holds is
in rvt-rs's export (2,355 of 2,355 by GlobalId). A file saved in place
keeps the records of elements deleted since its last Save As, which is
what they were on that one model.

An element table read short would look the same and leave real elements
out, as it did on Autodesk's Snowdon Towers 2024 architectural sample
before RE-41, and other causes are not ruled out. So the count, the
readiness score and the skipped item stay, and each text says what was
measured on the one model (such records were elements deleted since the
file's last Save As, #1838) and that the model is likely incomplete if
nothing was deleted, not a rule (rvtDevelop's review). Wording only.

## Motivation

#1838, found by the reporter of #1829, who then compared the saves with
Revit's export of the same save.

## Changes

- `src/bin/rvt_ifc.rs`: the warning.
- `src/ifc/mod.rs`: the diagnostics' first warning, and the field's doc.
- `src/bin/rvt_inspect.rs`: the failure mode's title and summary (its
`kind`, `incomplete_model`, is unchanged), the readiness summary and the
next step.
- `viewer/src/main.ts`: the card's title and summary, and the field's
comment.
- `docs/export-diagnostics.md`, `docs/inspect.md`,
`docs/schemas/export-diagnostics.schema.json`: what the records are,
with the counts.
- `changelog.d/fixed/1838-undeclared-element-records.md`.

## Testing

- Text only: the count, the score, the item's reason and the failure
mode's `kind` are as they were, and no test or gate pins the old texts
(searched across `src`, `tests`, `viewer`, `docs`, `tools`).
- `rustfmt --edition 2024 --check`, `tools/release/changelog.py check`
and `tools/ci/api-doc-ids.py` pass locally.
- Measure, rows registered on #1838 before the run (run 43370128477,
unfiltered, against `main` at `9f43fe37`): `ifc.sha256` identical on 146
of 146, `diagnostics.json` on 121 of 121, no scorer differs beyond what
only the head writes, and `same-project gates` pass on `e90f943a`. That
head was cut before #1850 and the wording is hedged since, so `main` is
merged in and a lighter run (the samples, no base side; rows on #1838)
gives the gates verdict for the current head: the gate on `main` is now
#1850's stricter `bodies_across_saves.py`, which a head without #1850
fails.
- Not measured: no model of Measure carries the item (none of the 121
published `diagnostics.json` of the release's run holds it, and every
`unexported_element_records` is 0), so none of the new texts appears in
a measured output, and the one comparison with Revit's export is the
reporter's, as counts.

## Related issues

Closes #1838. Refs #1829.
DrunkOnJava added a commit that referenced this pull request Nov 13, 2026
## Summary

Release metadata for v0.21.0 (RELEASE.md, steps 4 to 7), cut from `main`
at `9b7dee8c` and merged with `main` up to `b76ee16e`:
- every version file moves to 0.21.0 (`tools/release/bump_version.py`),
and `CITATION.cff` is dated 2026-11-13;
- the five fragments under `changelog.d/` (#1843, #1838, #1840, #1854,
#1871) are assembled into a `[0.21.0]` section, with its introduction,
what is not measured, the comparison with 0.20.0 and "Upgrading from
0.20";
- the README's release lines name v0.21.0;
- Core Interior's two witness observations and verdicts, and the two
synthetic IFC fixtures, are taken from CI's artifacts for `10b0a299`
(run 43382001273): only `witness_version`, the verdict hashes and the
version strings of the IFC header and `IFCAPPLICATION` differ.

**Why now.** The GlobalId pair (#1850 and #1859) is in `main`: the
GlobalIds an export writes hold from one save of a project to the next,
which 0.20.0 was cut without so that they ship together. `rvt-diff
--elements` (#1843) and the `--redact` fix for Linux home folders
(#1871) are in the same release, and #1874 corrects a warning that
called deleted elements an incomplete IFC.

Measured and rehearsed:
- the comparison with 0.20.0 is in the section, from Measure runs
[43381774360](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43381774360)
(unfiltered, `main` at `9b7dee8c` against `v0.20.0`'s `9bb58fe1`: 146 of
146 exports move and `diagnostics.json` is equal on all 121 models that
publish one; the MEP samples' `bodies_across_saves` goes from FAIL to
PASS on 6 saves, and no other scorer output differs; that the exports
move only in their GlobalIds is what #1850's and #1859's own
line-by-line comparisons found, the run compares hashes) and
[43381779893](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43381779893)
(timing: 75 files at 0.94 to 1.06 times the time, median 1.00, and 0.99
to 1.01 times the peak memory). The release adds only notes, witness
files, version strings and fixtures to `9b7dee8c`, apart from the probes
and the one docs line (#1876, #1877, #1878, #1880) that landed after it
and move no export;
- `publish.yml` rehearsal on this branch:
[43383528785](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43383528785),
on `bfa6859c`; only the changelog has changed since.

## Testing

- `python3 tools/release/changelog.py check` passes: no fragment is
left.
- `bump_version.py` checks the version files with the preflight's own
`check_versions`.
- The PII guard runs `release_preflight.py` on this PR.

## Related issues

Release 0.21.0. Milestone `0.21.0`.
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.

A layered floor's parts take new GlobalIds on every save of a Revit 2027 model (#1829)

1 participant