Skip to content

fix(ifc): openings, property sets, quantities and relationships take their GlobalIds from the entity they belong to, so they hold from save to save (#1854) - #1859

Merged
DrunkOnJava merged 9 commits into
mainfrom
fix/1854-owner-seeded-gids
Nov 13, 2026
Merged

DrunkOnJava merged 9 commits into
mainfrom
fix/1854-owner-seeded-gids

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

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.
  • rustfmt --edition 2024 --check passes. CI runs the rest.
  • 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

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

Legal and contribution hygiene

  • 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.

…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.
…BCF users, with the pieces it moves once per measured model (#1840)
…their GlobalIds from the entity they belong to, not the document's GUID, so they hold from save to save (#1854)

The STEP writer seeded every GlobalId it derives from the document's
Unique Document GUID, which changes on every save of every Autodesk sample
measured (probe_1854_project_seeds, run 43327315618). No project-level
identity could replace it: the first episode and ProjectInfo's GlobalId are
the template's, one value on 64 of 102 models. Each derived GlobalId is now
seeded from its owner's written GlobalId, with the same key; only what
belongs to no entity keeps the document seed. probe_1854_global_id_census
counts, per class, the GlobalIds two saves share.
…tribute is a GlobalId, so a property's 22-character name is no longer a duplicate (#1854)
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

The four rows, read. Rows 1, 2 and 4 hold. Row 3 holds except for two classes of rst_basic, whose owners have no Revit GlobalId.

The code under test is 192371d4. The three commits after it change a probe and the held-out scrubber, never the export (1abc2fa5 is the head).

The first full run's probe counted the wrong thing: duplicates= was 1,500 to 22,161 on every model because it read any entity whose first value is a 22-character string, and a property's name is one (rvtDevelop found the same in #1850's kept IFCs). Now it skips the classes that open with a name (6e677bda), and the scrub keeps its counts (1abc2fa5).

1. Only derived GlobalIds move: holds, on the 73 exports whose IFC was kept.

  • Runs 43352463723 (Core Interior, a BIM4LCA housing file, the samples of 2021 to 2024 and Snowdon Towers' five: 22 models) and 43353761562 (the BIM4LCA models, puzzbobb's 24 Revit 2025 models and the samples of 2025 to 2027: 51), each against 925c482d, every line of each pair read in order.
  • Of 9,508,714 lines, 2,515,226 differ, each the same entity with the same class and the same attributes but its GlobalId. The one other line per file is the IfcOwnerHistory's creation time.
  • The classes that move: IfcDistributionPort, IfcElementQuantity, IfcOpeningElement, IfcPropertySet, IfcRelAggregates, IfcRelAssociatesMaterial, IfcRelConnectsPorts, IfcRelContainedInSpatialStructure, IfcRelDefinesByProperties, IfcRelDefinesByType, IfcRelFillsElement, IfcRelNests and IfcRelVoidsElement. No building element, type, storey, project, site or building moves, in any of the 73.
  • 43348032462, all 126 exports against its merge-base: diagnostics.json is equal on 102 of 102, and the scorer diff holds only what the head alone writes. The 18 held-out files and the 2015 to 2020 samples are checked by hash and diagnostics only, since their IFCs are not kept here.

2. Unique: holds. 43353251287 (scrubber of 1abc2fa5): duplicates=0 on all 102 models the probe reads, 3,749,224 GlobalIds, held-out files included (counts only). The 30 pair runs below also say 0 on each side. rac_basic and rac_advanced of one year share 9 GlobalIds, the template's: 2 storeys, 2 property sets, 1 aggregation, 2 containments and 2 defines-by-properties.

3. Across saves: holds, with the two exceptions named. 43353791041, 25 pairs (each sample of 2021 to 2027 against the same project saved by Revit 2026), both / the save's own count:

  • Building elements held: 100% on 16 pairs, 467 of 470 on rac_basic 2024, 2025 and 2027, and 6,718 of 7,463 and 6,763 of 7,502 on rme_advanced and rme_basic (90%).
  • The derived classes follow the elements. Openings, voids, fills, ports and nests are held in full on every pair but two: rac_basic of 2024 (29 of 33 openings and voids) and rme_basic of 2023 (2,469 of 2,948 port connections). For example rac_advanced 2024: 108 of 108 openings, 107 of 107 fills, 30 of 30 ports. Quantity sets are held in full on 23 of 25 pairs (5,510 of 5,510 on rac_advanced 2024), the exceptions being rme_basic 2023 (3,958 of 3,964) and rac_basic 2024 (311 of 315).
  • Property sets and their defines-by-properties: 24,128 of 24,129 on rac_advanced 2025 and 2027, and 2,354 of 2,357 on rst_basic. On the saves of 2021 to 2024 they are about two thirds (22,683 of 33,769 on rac_advanced 2021), the rest being GlobalIds only one of the two saves writes. Material associations 88% on rac_advanced 2021 (204 of 231). Not asserted either way, as registered.
  • The exceptions. IfcRelContainedInSpatialStructure is both=0 on 6 rst_basic pairs (2021 to 2025 and 2027) and IfcRelAggregates on 3 (2021 to 2023). On rst_basic the building, the site, the project and every storey have no Revit GlobalId and sit on the document seed (both=0 for each of them), and these relationships are seeded from them. That is the case the Changes section leaves on the seed, so those GlobalIds still change on every save. Every other derived class with a count has both > 0.

4. Gates: hold. same-project gates pass on 1abc2fa5: 15 samples held to their earlier saves, and the Areas on 4 saves and on the 2021 save.

What it means for the release note: a tool following derived GlobalIds across saves now finds them for every element whose own GlobalId holds, with rst_basic's containment and aggregation the measured exception.

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

Copy link
Copy Markdown
Owner Author

The head (03092d87) now holds #1850's branch (a072764f: main at 9f43fe37, the v0.20.0 release, and #1840), merged in so that the two GlobalId changes are built and tested together. Until #1850 lands, this PR's diff against main shows both.

The merge had three conflicts, all comments: stable_guid's doc, the doc of RevitGlobalIds::document, and the GlobalIds row of docs/evidence.md. Each now says both rules (a piece takes its element's Revit GlobalId, #1840; any other entity takes the GlobalId of the entity it belongs to, #1854). No code needed resolving: element_global_ids and the seeding sites merged apart.

The rows above were read at 1abc2fa5 and stand for this PR's own code. The final unfiltered Measure runs on the head after #1850 has landed and main is merged here, when the diff is this PR's alone; its gates verdict is what lets this land. The exporter-output box in the checklist is ticked: rows 1 and 3 are read above, with rst_basic's containment and aggregation the measured exception.

…ame three comment conflicts resolved to the text that says both rules
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Rows for the final runs at 112bfd15, registered before they run. #1850 has landed (main is b51bf334) and is merged here, so the layered floors' pieces already take their GlobalIds from their element in the base, and the diff against it is this PR's alone: the six files above, of which the code is the same as at 1abc2fa5 and the rest comments. The runs repeat the five that read the rows above, each against b51bf334:

  1. Only derived GlobalIds move (the two runs that keep the IFCs, over the same 73 models): every differing line is the same entity with the same class and attributes but its GlobalId, plus the owner history's creation time; the classes that move are the thirteen listed above, and no building element, type, storey, project, site or building moves.
  2. Unique (the census run): duplicates=0 on all 102 models the probe reads.
  3. Across saves (the 25 pairs to 2026): no class holds fewer on any pair than the table above gives, and each rme_* pair's building elements held rise by the layered floor's pieces that 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 now holds (25 per pair in the element diff of feat(cli): rvt-diff --elements compares two saves of a model element by element, keyed by the GlobalId the IFC export writes (#1843) #1852). rst_basic's containment and aggregation stay the named exception.
  4. Gates (the run of all exports): same-project gates pass on 112bfd15, and diagnostics.json is equal on all 102 models whose results are published.

A row that does not hold stops the PR until its cause is read.

@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 13, 2026 05:27
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

The four rows at 112bfd15, read: all hold. main is b51bf334, which holds #1850, so the diff is this PR's alone (its six files).

1. Only derived GlobalIds move: holds, on the 73 exports whose IFC was kept. Runs 43372147482 (22 models) and 43372152200 (51 models: the BIM4LCA models, puzzbobb's 24 Revit 2025 models and the samples of 2025 to 2027), each against b51bf334, every line of each pair read in order. Of 9,527,306 lines, 2,515,136 differ, each the same entity with the same class and the same attributes but its GlobalId; the one other line per file is the IfcOwnerHistory's creation time, and no file differs in length. The classes that move are the thirteen listed above, and no building element, type, storey, project, site or building moves, in any of the 73.

2. Unique: holds. 43372165635: duplicates=0 on all 102 models the probe reads, 3,748,996 GlobalIds, held-out files included (counts only).

3. Across saves: holds, and shows what #1850 adds. 43372170303, the 25 pairs (each sample of 2021 to 2027 against the same project saved by Revit 2026): no class holds fewer on any pair than in the table above. On each rme_advanced and rme_basic pair of 2024, 2025 and 2027 the building elements held rise by the layered floors' 25 further pieces, from 6,718 to 6,743 of 7,463 and from 6,763 to 6,788 of 7,502, with the property sets and their defines-by-properties up by 125 and the material associations by 25 on each. rst_basic's IfcRelContainedInSpatialStructure and IfcRelAggregates stay the named exception (both=0: the file's building, site and project have no Revit GlobalId); #1868 left each of those saves one containment and two or four aggregations where they had three to six.

4. Gates: hold. 43372136035, all 126 exports against b51bf334: same-project gates pass on 112bfd15, diagnostics.json is equal on 102 of 102, and no scorer differs beyond what only the head writes. The 126 ifc.sha256 all differ, as the GlobalIds do.

@DrunkOnJava
DrunkOnJava merged commit 7e7b69b into main Nov 13, 2026
98 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1854-owner-seeded-gids branch November 13, 2026 06:19
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

1 participant