Skip to content

research(saved-graphics): an InstanceInfo with no m_GRepId is the default representation, and what STE1200's Revit 2020 family still needs (#1158) (RE-342) - #1436

Merged
DrunkOnJava merged 22 commits into
mainfrom
research/1158-saved-graphics-pre2023
Nov 5, 2026
Merged

DrunkOnJava merged 22 commits into
mainfrom
research/1158-saved-graphics-pre2023

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Research. STE1200 (discussion #112) sent a patch that lets the saved-graphics reader read a Revit 2020 family whose bodies are import geometry only. This PR works out, change by change, what the patch still adds on main, measures each change on the files Measure fetches, and takes what holds.

One change holds: an InstanceInfo with no m_GRepId (Revit 2015 to 2022's schema) is read as the default representation. With Options::releases widened to NATIVE_RELEASES, native_saved_scene draws 5,459 to 5,756 of the 6,241 to 6,433 FamilyInstance and ImportInstance elements of each release's three sample projects, where main draws 68 to 70. Against the same projects' Revit 2023 downloads, 41,687 of the 45,349 elements both files draw whole have the same triangle count, world box and total surface area, among them every one of the 11,482 on the 2021 and 2022 projects; 3,662 do not (within 1 ft, not traced to a cause), which is a residual. The pairs are one reader read against itself on two separate Autodesk downloads, not a check against Revit, and no independent oracle was used (RE-342 section 7).

Three changes are not taken: deferred history episodes (0 of 92 open files, 18 held-out models and 13 families), FacetedTopology9 under normal binding 2 (0 objects in the 92 open files and 18 held-out models), and a set m_bHasScale. No file Measure fetches draws a body from a set m_bHasScale: the open files by the pairs, and the held-out models (1,592 flagged instances in 3 pre-2023 models, 283 in one later model) by run 42029562666 at e08acf30, where with the flag read the owners drawn whole and their triangles are the same as at ab9503b1 in 8 of 8 scenes (counts only). No export changes, and saved graphics stay a research reading on Revit 2015 to 2022. RE-342 has the account.

Motivation

Discussion #112: STE1200's comment of 2026-10-29 and the patch and per-instance JSON they attached on 2026-11-03 (moved to a98bd316, offered under Apache 2.0). The maintainer told them the measurement would be on Autodesk's sample projects, which CI can fetch, and that their family would not enter the repository or CI. #1158 (native readers on Revit 2015 to 2022) and #1190 (W2, W6, W7 on 2015 to 2023) are where the releases are tracked. #1144 and #156 do not apply: the first is about cone, spline and cylinder faces, the second about sketch-to-solid.

Changes

  • src/research/native_graphics_traversal.rs: default_representation, at 2 call sites (:371 and :421). An InstanceInfo whose m_GRepId is 0 (Revit 2023 to 2027) names the default representation; so does one with no m_GRepId that holds exactly m_Trf, m_symbolId and m_cda (2015 to 2022: the fields the classes of all 30 sample projects declare). Any other value is refused as before. The first version of the missing-key arm checked m_Trf and m_cda, which read_transform and the m_cda test already refuse, so the guard had moved from closed to open; the exact-fields test is closed against an object with a further stored field. It is not a test of the class schema, because the traversal holds no Registry. Nothing else in src/ changes.
  • probes/examples/probe_re342_saved_graphics_pre2023.rs: counts, for one file, what each of the patch's four changes meets (schema classes and parents, deferred episode pointers, topology classes and normal bindings with stored normals against winding normals, InstanceInfo.m_GRepId, GInstance.m_bHasScale by matrix class, a scene of the file's family instances), and for two files the same elements' meshes against each other. It prints counts only and runs on your own file.
  • tools/ci/scrub-holdout-results.sh: keeps the probe's saved graphics pre2023: count lines for a model fetched without a licence to redistribute it.
  • reports/element-framing/RE-342-saved-graphics-pre2023.md, changelog.d/research/1158-saved-graphics-pre2023.md, docs/format-reconnaissance.md, docs/contribution-map.md.

Not taken, and restoring it

The branch also carried the contributor's other changes, as their own commits, and reverts them: ca48b95a (deferred history episodes) and b486a9ba, 9d8b9dc6 (FacetedTopology0 and 9, normal binding 0 or 2) and 59ce1cb6, 6b0f6726 (FacetedTopology8) and bc9cf037, f58d4710 (m_bHasScale read with a rigid matrix only) and ab9503b1. They fail closed and move no export measured; they are out because nothing Measure fetches shows them right: the pairs table of Measure 42013687044 (all four changes) equals 42015502520's (this change alone) in its drawn-whole, equal and not-equal counts, row for row. Its stop histograms differ in 15 of the 24 pair files: in the 7 rst_basic pairs 3 owners per file move from scaled instance mode is not qualified to a GText stop, and in the 8 rac_advanced pairs one owner per file gains a GText stop and a primitive (RE-342 section 5.3).

To restore the changes, use research/1158-ste1200-all (e08acf30, all of them with the probe; the contributor has been asked to use it), pinned at refs/archive/2026-11-05/research/1158-ste1200-all. research/1158-probe-only (5a814865, main with the probe) is pinned at refs/archive/2026-11-05/research/1158-probe-only. Both branches are kept. Reverting commits of this branch does not survive the squash.

The stored normals of FacetedTopology0 under binding 2 are 4,618 facets over 0.1 degree from the winding normal, all in one Revit 2024 file (Autodesk's Snowdon Towers electrical sample), in a graph with a GImposter that the traversal skips; that is a reason to take no binding-2 normal as stored without a check.

The contributor's examples/saved_scene_dump.rs is not taken (an OBJ dump is not a measurement).

Testing

No local build. CI's fast jobs; Measure, all counts in RE-342:

  • 42015502520 (ab9503b1, 34 project files of 2015 to 2023 and 24 pairs against the 2023 download) against 42013683146 (main's readers, probe 5a814865): family-instance elements drawn whole 68 to 70 per release before, 5,459 to 5,756 after; whole in both files 45,349, same triangle count, box and area (within 0.0001) 41,687, not equal 3,662, none beyond 1 ft in its box and not traced to a cause; 0 of 11,482 on the 2021 and 2022 projects.
  • 42015507053 (ab9503b1, 59 files of 2023 to 2027): with the three 2023 samples of 42015502520 (Einhoven is in both runs), 220,660 InstanceInfo objects in 44 files, all m_GRepId 0; 92 distinct open files in all.
  • 42015511974 and 42015516241 (ab9503b1 against main at f8612274, -f nordic=true -f r2025=true -f samples=true -f scorers=none, the second with --saved-meshes): 92 of 92 IFC hashes identical in each; the flag moves 40 of the 92. Filtered runs; the unfiltered run was not made because no export moved.
  • 42015541431 (held-out census, counts only, nothing scored, ab9503b1): 18 models, 7 of Revit 2018 to 2022 without m_GRepId, 11 of 2023 to 2027 with it at 0.
  • 42013687044 (ecc302d2, all four changes) and 42013885483 (6b0f6726, both offices with FacetedTopology8 read under --saved-meshes: byte for byte main's, empty scorer diff).
  • After the guard change (c22ef90d, whose source is this PR's apart from the merge of feat(ifc): Revit 2026 and 2027 beams, stair runs, landings and sketch lines (#421) #1426, the report, the fragment and the docs): 42030623745 (the pairs, the recipe of 42015502520): all 24 pair outputs and all 34 census outputs equal 42015502520's, line for line. 42030619490 (exports against main at aae3b779, --saved-meshes, the inputs of 42015516241): 86 of 92 IFC hashes identical; the 6 that differ are the 2026 and 2027 sample projects, which feat(ifc): Revit 2026 and 2027 beams, stair runs, landings and sketch lines (#421) #1426 (in aae3b779, not yet in c22ef90d) changes. 42032443372 repeats the exports at c0636fe1, which merges aae3b779; its result is not in the PR yet.
  • 42029562666 (held-out census at e08acf30, all four changes, counts only) against 42015541431: the census lines equal in 18 of 18 models; in the 8 models with a scene the owners drawn whole and their triangles are the same (8 of 8), and the stop histogram moves in 3 (58 of 547 owners pass the scale check in one model, 57 of them decoded_saved_graphics with no primitive).

The runs at ab9503b1 measured the first version of default_representation. Run 42011570902 (the 13 families) is at the probe commit 2e7a9c8e; its census of families does not depend on the readers. The other runs dispatched on this branch at earlier heads were exploratory and are not cited.

Breaking changes

None. default_representation accepts a case main refused (an InstanceInfo with no m_GRepId that holds exactly m_Trf, m_symbolId and m_cda), which only a file of Revit 2015 to 2022 read with Options::releases widened can reach; no export does (the release gate alone keeps them out), and every file of 2023 to 2027 measured has m_GRepId 0. 271 owners of the 24 older pair files now stop at the view-component diagnostic that saved_meshes::is_partial tolerates: the exposure if the gate is lifted (RE-342 section 5.6).

Screenshots or output samples

N/A: no output changed (92 of 92 IFC hashes equal main's at ab9503b1).

Related issues

Refs #1158, Refs #1190.

Contributor declaration (CLEANROOM.md)

The changes in this PR are based on public byte observations of Autodesk's sample projects, its family corpus and the files' own Formats/Latest schemas (accepted source 1) and on STE1200's published findings and patch, offered under Apache-2.0 in discussion #112 (accepted source 3). I have not used Autodesk SDK source, ODA SDK source, leaked internal documentation, NDA material, or decompiled internal Revit implementation code beyond public symbol exports, and I have not copied or translated code from revit-ifc. The contributor's family (a manufacturer-published Revit 2020 family under BIMobject's terms) was not downloaded or read; nothing of it is committed beyond counts the contributor published in the thread.

Co-authored-by: STE1200 [email protected]

…eets on Revit 2015 to 2022 and in a family of imported geometry (#1158) (RE-342)
…s census run, whose pair run reads it (#1158) (RE-342)
…ult representation, and a set m_bHasScale on one with a rigid matrix is read (#1158) (RE-342)
…mal per facet under normal binding 2 is read (#1158) (RE-342)
…nters is read when the counted section repeats their GUIDs (#1158) (RE-342)
… its vectors can stand for; the probe meshes a family's instances like a project's (#1158)
…he class of their channel-102 record (#1158) (RE-342)
…e the 29 and 16 objects the BIM4LCA office holds outside a light source (#1158) (RE-342)
…o measure the 29 and 16 objects the BIM4LCA office holds outside a light source (#1158) (RE-342)"

This reverts commit 6b0f672.
… one normal per facet under normal binding 2 is read (#1158) (RE-342)"

This reverts commit 9d8b9dc.
…sode pointers is read when the counted section repeats their GUIDs (#1158) (RE-342)"

This reverts commit ca48b95.
…r InstanceInfo, which no file Measure fetches shows drawn (#1158) (RE-342)
…es' 2023 copies, the exports, and what the three changes left out meet (#1158)
@DrunkOnJava DrunkOnJava changed the title research(saved-graphics): Revit 2015 to 2022 saved graphics and the changes STE1200's Revit 2020 family needs (#1158) (RE-342) research(saved-graphics): an InstanceInfo with no m_GRepId is the default representation, and what STE1200's Revit 2020 family still needs (#1158) (RE-342) Nov 5, 2026
# Conflicts:
#	docs/format-reconnaissance.md
…ion only on an InstanceInfo that holds exactly the three measured fields (#1158) (RE-342)
# Conflicts:
#	docs/format-reconnaissance.md
@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 13:06
@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
…rs equal, and no held-out scene draws a body through a set m_bHasScale (#1158)
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) November 5, 2026 13:22
@DrunkOnJava
DrunkOnJava merged commit afec5e3 into main Nov 5, 2026
33 checks passed
@DrunkOnJava
DrunkOnJava deleted the research/1158-saved-graphics-pre2023 branch November 5, 2026 13:41
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
…so the walls that embed a curtain wall stop raising the export's peak (#1429) (#1441)

## Summary

The saved-graphics pass kept every owner's decoded graph until it
returned. #1401 added the 42 walls of the BIM4LCA office that embed a
curtain wall as owners, and their graphs, about 66 MiB, sat under every
later batch of door and window symbols. The pass now frees an owner's
graph with its batch, and meshes the owners that name no symbol of their
own before it reads any symbol. The elements it makes are the ones it
made; the batches of symbols are the ones they were except where an
owner names only other owners (see Changes).

## Motivation

#1429: the default export's peak memory on the BIM4LCA office rose 8%
with #1401 (917 to 993 MiB as built), time unchanged. The viewer's
wasm32 build has a 4 GiB ceiling.

The allocation, found with a peak profile on a runner (Measure
42026078557 at 999f4280 on f861227, and 42026084410 at de4bdfff on
f55a95a, the parent of #1401, office as built):

| | parent of #1401 | main | difference |
|---|---:|---:|---:|
| RSS peak of the `saved_meshes` stage (`probe_1075_memory_stages`) |
936,856 KiB | 1,014,664 KiB | +77,808 KiB (76.0 MiB) |
| RSS peak of the `export` stage | 809,028 KiB | 808,700 KiB | -328 KiB
|
| live heap after the owners are read (`probe_1075_heap_stages`, event
`saved-graphics`) | 681.3 MiB | 747.5 MiB | +66.2 MiB |
| live heap at the pass's peak (`probe_1075_heap_stages`) | 864.3 MiB |
932.2 MiB | +67.9 MiB |
| heap at the pass's peak, by dhat (`probe_1429_export_peak`, stage
`meshes`) | 191.7 MiB in 812,171 blocks | 259.6 MiB in 1,273,774 blocks
| +67.9 MiB |
| owners meshed | 538 | 580 | +42 |

At the pass's peak, dhat puts +58.6 MiB in the u64-keyed BTreeMap leaf
nodes of the decoded graphs (278,954 blocks against 181,290), +5.5 MiB
in `Cursor::field_as` and +4.2 MiB in the graph objects' vectors (595
blocks against 553: the 42 hosts), all under `extract_graphs` in
`extract_in_batches_with_control`. The mesh outputs are the same at both
refs. The growth of the live heap while meshing is the same too (+131.6
MiB against +129.9 MiB), so the peak is the same batch on a baseline 66
MiB higher. The issue's guess was half right: the cost is keeping the
graphs of all 42 hosts, drawn from their mesh (6) or not, not reading
them.

The head's whole-export dhat stage was cut at its 540 s limit on a
slower runner (inflate 812 ms against 597 ms); the stage probes and the
parent's completed export profile (859.8 MiB heap peak) carry the
pipeline-level claim.

## Changes

- `src/research/native_saved_scene.rs`,
`extract_in_batches_with_control`: the owners no other owner names are
removed from the owners' map once their batch is meshed, and dropped
with the batch's symbols on the thread that frees them; the owners that
name no symbol of their own (a wall's graph is its geometry) end a batch
of their own, so they are gone before the first symbol of their own is
read; only a batch of symbols sets the size of the next batch. The
invariant freeing rests on is now stated in the doc comment and kept in
code: a shared symbol that names an owner already freed (no owner names
it, so it was not kept) has that owner read again with the symbol, as a
shared record, which is where the mesh looks it up, as it finds it among
the owners in the one-shot read. Where it holds in the common case, the
symbol batches are the ones they were (same order, same sizes). Where an
owner names only other owners it does not: its set of symbols is empty,
so it sorts first and is meshed in the batch of owners that name no
symbol of their own, `add_references` reads the symbols of the owners it
names with it, and that batch does not size the next one, which the
first batch of symbols used to; and a batch of symbols none of which has
a record sizes the next as before (1,024 symbols). Output is unaffected
by either: sizes decide only which symbols share a batch. Among the
doors and windows alone no owner names another (`owners_naming_owners` 0
on both office files), so the first case does not occur there; whether
any file has a batch of symbols none of which has a record is not known.
- `probes/examples/probe_1429_export_peak.rs`: the dhat profile above,
with the real default pipeline (`ExportOptions::default()`, the STEP
text written to a sink) and the saved-graphics pass alone.
- `changelog.d/fixed/1429-embed-host-peak.md`.
- `.github/workflows/measure.yml`, the timing-merge step: a run whose
plan has one shard (a run with `models`, or with neither `nordic` nor
`samples`) failed with `timing shard 1 left no table`, although the
shard had timed its files. `actions/download-artifact` puts the one
artifact a pattern matches straight into `path`, with no directory of
its name, and the step looked in `shards/measure-timing-shard-1/`. With
one shard it now reads `shards/`. Measure 42033494804 and 42033498434
failed this way; the repeat with the fix is 42035065408 and 42035069785,
both with a table (one shard, Core Interior and the RE1 and Einhoven
models).

## Testing

Unit tests are banned in this repository: none added.

- [ ] `tools/check-local.sh` is not run here (no local builds); `cargo
fmt --all -- --check` passes locally and CI is the gate.
- [x] Peak resident memory, `rvt-ifc` default export, median of three,
base and head in turn on one runner, head f41eb75:
- against the parent of #1401 (f55a95a), Measure 42029771994: office as
built 916 to 914 MiB (1.00), at permit 979 to 971 MiB (0.99); time 1.02
and 1.00 (the 3-round median; runner noise is about that much); Core
Interior 323 to 323 MiB, RE1 and Einhoven 1.00;
- against `main` (aae3b77), Measure 42029769130, 68 files: office as
built 993 to 914 MiB (0.92), at permit 1,058 to 971 MiB (0.92), Snowdon
Towers architectural 1,108 to 1,062 MiB (0.96), time 0.98 to 1.02 across
the 68 files (0.99 and 1.00 on the two office files); every other file
1.00 or 0.99 but Core Interior (310 to 323 MiB, 1.04, see below), the
2026 racbasic sample (1.01) and the 2027 rmeadvanced sample (1.02).
- [x] Stage probes on the office as built, head f41eb75, Measure
42029765991: RSS peak of the `saved_meshes` stage 933,592 KiB (parent
936,856, main before this change 1,014,664); live heap at the pass's
peak 861.9 MiB (parent 864.3, main 932.2).
- [x] The batched read makes the elements the one-shot read makes
(`probe_1075_saved_batches`, Measure 42029765991): the doors and windows
(538 as built, 534 at permit) and, with their symbols as owners too (643
and 633; 538 and 534 owners named by another owner, which are kept), 0
elements different, the same progress events. The walls are not in that
probe's selections on the offices (the every-element selection is
skipped over 8,000 owners), so no symbol-free batch preceded the symbol
batches there: the new path is exercised by the run below.
- [x] Core Interior's resident peak takes one of two values on the same
code: about 310 MiB (317,228 to 321,064 KiB) or about 323 MiB (330,568
to 331,272 KiB), round to round and run to run, and `main` itself is in
both. `rvt-ifc` showed 310 MiB on `main` (aae3b77) and 323 MiB here in
Measure 42029769130; that pair was the low mode of `main` against the
high mode of this change, which is the mode `main` is usually in too.
Over 21 rounds of `main`'s code in the runs below, 16 are high and 5 are
low; this change has been high in all 12 of its rounds, as was the
parent of #1401 in its three. What decides the mode is not known. The
heap is the same either way: the stage probes on `main` and on f41eb75
(42032046664, 42032050573) give the same live heap (export peak 289.6
MiB, saved-graphics pass peak 288.8 MiB, both) and the same RSS peak of
the `saved_meshes` stage (330,608 against 330,660 KiB). The rounds, in
KiB:
- 42029769130 (aae3b77 against this code): `main` 317,228, 321,064,
317,580; this code 330,692, 330,720, 330,772;
- 42029771994 (f55a95a, the parent of #1401, against this code): the
parent 330,856, 330,900, 330,568; this code 331,040, 330,820, 330,896;
- 42033494804 (aae3b77 against itself): six rounds at 330,840 to
331,272;
- 42033498434 (4baac80 against this code): `main` 330,940, 331,152,
317,592; this code 330,788, 331,048, 331,084;
- 42035065408 (4baac80 against this code, with the timing fix below):
`main` 331,004, 330,948, 331,016; this code 331,008, 331,028, 331,100;
- 42035069785 (4baac80 against itself): 330,832, 331,020, 330,692 and
330,864, 317,564, 330,912.
- [x] The IFC does not move at 0bd31d7, Measure 42033631386 (`-f
base=4baac80c -f nordic=true -f r2025=true -f holdout=true -f
samples=true`, head 0bd31d7 against `main` at 4baac80): `ifc.sha256`
is identical on all 111 files, 0 different, none on one side only: 34
models (the reference models, the BIM4LCA office and the Revit 2025
models), 19 held-out and spent models (counts only) and 58 Autodesk
samples of Revit 2015 to 2027. The scorer diff of the run
(`compare-scorer-diff`) is one line, a file only the head side writes
(`areas_across_saves.txt`). The set did not include BIMcollab's example
or rac_advanced's IFC2X3 comparison (`bimcollab`, `racadv`), which the
recipe leaves out.
- [x] The IFC does not move at the final code, head 5808250, Measure
42037891871 (`-f base=a0639777 -f nordic=true -f r2025=true -f
holdout=true -f samples=true`, `main` at a063977 with #1439 on both
sides): `ifc.sha256` is identical on all 111 files, 0 different, none on
one side only (34 models, 19 held-out and spent models, counts only, 58
Autodesk samples). The scorer diff of the run is the one line `Only in
measure-head: areas_across_saves.txt`, as for 0bd31d7.
- [x] The batched read makes the elements the one-shot read makes at the
final code, `probe_1075_saved_batches`, Measure 42037895275 (head
5808250), 0 elements different in every selection of every model, the
same progress events:
- Core Interior (138 doors and windows): `owners_and_their_symbols` 149
owners (138 naming owners), `owners_and_every_other_symbol` 144 owners
(45 naming owners), `every_boxed_element` 970 owners, all identical;
- the office as built (538) and at permit (534):
`owners_and_their_symbols` 643 and 633 (538 and 534 naming owners),
`owners_and_every_other_symbol` 591 and 584 (272 and 250 naming owners),
identical; `every_boxed_element` skipped over 8,000 owners (12,974 and
13,020);
- RE1 Architecture: 5, 10, 8 and 85 owners, identical; RE1 Electrical,
Mechanical and Plumbing: 21 and 11 / 15 and 8 / 20 and 10 symbol
selections, 49 / 74 / 124 elements with a location, identical; their
doors-and-windows selection is empty, which the reader takes for every
record, so 10,266, 4,743 and 4,827 elements were compared, identical.
The every-element selections have the walls as owners, so a symbol-free
batch precedes the symbol batches there.
- [x] The re-read of a freed owner that a shared symbol names did not
run on any of these files, and is untested on real files. Measure
42040371054 times the same probe on a scratch branch (80d56115, since
deleted) that is this change without the re-read, on Core Interior, the
RE1 models and both office files: 0 elements different in every
selection of every model (the same counts as with it), so no symbol read
by a batch named an owner freed with an earlier batch in them, including
with every second symbol as an owner (`owners_and_every_other_symbol`,
45 owners naming owners on Core Interior, 272 and 250 on the office as
built and at permit). The re-read is the fail-closed answer to a shape
the one-shot read handles and these files do not have; it makes the
batched read equal the one-shot read where that shape occurs, and
nothing here shows it doing so.
- Merged since that run: `main` at afec5e3 (#1436: a probe, a report,
and `default_representation` in `native_graphics_traversal.rs`, which
reads an `InstanceInfo` of Revit 2015 to 2022 as the default
representation; the release gate keeps those files out of every export).
The merge, 1d7b12a, is clean and touches none of this change's files,
and the comparison above was not repeated on it.
- Not measured, stated as limits: the browser (wasm32, one thread, where
the freed owners drop inline) is inferred from the same code, not
measured: `viewer/tests/saved-meshes-measure.spec.ts` covers no model
with an embed host. Whether this change can land in Core Interior's low
resident-peak mode is untested (it has not in its 12 rounds). The 2027
`rmeadvanced` sample (559 to 568 MiB, 1.02) and the 2026 `racbasic`
sample (1.01) are in the same plus or minus 2 percent class as the mode
difference, and have no repeat.

## Audit-honesty checklist

- [x] No claim in the docs changes: no export byte is meant to move.
- [x] Changelog fragment `changelog.d/fixed/1429-embed-host-peak.md`;
its figures are the timing runs' and the unfiltered Measure's above.
- [x] No emojis, no private paths.

## Breaking changes

None.

## Related issues

Closes #1429. Its done-when is met: the allocation is found with a peak
profile on the office (above), the peak is within 1.02 of the parent of
#1401 on both office files (916 to 914 MiB as built, 979 to 971 MiB at
permit, Measure 42029771994), and the IFC is byte-identical on every
model of the unfiltered Measure (42033631386).
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
…pre-2023 route alone, narrowing what #1436 landed (#1158) (RE-342)
DrunkOnJava added a commit that referenced this pull request Nov 5, 2026
… under normal binding 2 with a winding check, and a set m_bHasScale with a rotation (#1158) (RE-342) (#1449)

## Summary

Research. #1436 took one of STE1200's four changes (an `InstanceInfo`
with no `m_GRepId`) and left out the other three, deferred history
episodes, `FacetedTopology9` under normal binding 2 and a set
`m_bHasScale`, because no file CI can fetch shows them right. STE1200
has since run the probe on their Revit 2020 family at
`research/1158-ste1200-all` and posted the counts in discussion #112:
109 deferred episode pointers and 109 episodes read; 325
`FacetedTopology9` objects under binding 2 with 47,968 facets, every
stored normal within 0.1 degree of the winding normal; `m_bHasScale`
true on 26 identity and 10 rotation instances; 36 owners drawn whole
with 48,520 triangles. All five figures agree with what they had
published. This PR restores the three, each fail closed, narrower than
their branch, and on a route that no export takes.

The evidence is that run, quoted as counts the contributor published. It
is a reported measurement on a file CI cannot fetch, and the only file
that exercises the three. The family is not downloaded, read or run here
and never enters the repository, CI or a report beyond those counts.
Nothing in CI reaches the three paths, so nothing in CI will catch a
regression in them; CI shows only that they change nothing else (below).
No export changes, and saved graphics stay a research reading on Revit
2015 to 2022.

## Motivation

Discussion #112; #1158 (native readers on Revit 2015 to 2022) and #1190
(W2, W6, W7 on 2015 to 2023). The reason #1436 gave for leaving the
three out, that no file shows them right, has changed.

## Changes

- Deferred history episodes are a research route, not a change to the
default reading. `native_index::creation_episodes` is the first step of
the native preamble that every phase, parameter and routing reader goes
through, and it is unchanged in outcome: a history with any deferred
pointer is refused (`inline history episodes require a different
contract`) and so is the file. The new reading is a separate entry
point, `creation_episodes_with_deferred`, reached only through
`Options::deferred_history_episodes` (default false, set by the
saved-graphics probe alone). The memoised preamble records how many
pointers it read, so a default call after a research one is refused, not
served the research preamble; the parameter-definition pass is keyed on
the option. On the research route: each pointer must be an `Episode`
reference with the deferred token, the bodies follow the root in list
order, the counted section must repeat their GUIDs in order, the stream
ends in four zero bytes, and a count over 1,000,000 or any mismatch
refuses the history. The default reading allocates exactly what it did.
- `native_saved_mesh`: a `GPolyMesh` on `FacetedTopology9` is read only
through `graphics_pre2023`, which `native_saved_scene` chooses when the
file's layout release is below 2023; every other entry point refuses it
as before. It is read under `m_normalsFlag` 2 only, and only where
`normals_follow_winding` holds: one stored normal per facet, each within
0.1 degree of its facet's winding normal. Collinear or repeated corners,
a corner that is not finite or out of range, a stored normal of no
length or not a number, a count that differs either way, or a mesh of no
facets refuses the whole mesh and the owner stays partial. The stored
normal is never taken unchecked and a failed mesh is not redrawn from
the winding. `FacetedTopology0` stays read under binding 0;
`FacetedTopology0`, `8` and `1` under binding 2 stay refused, which
covers the Snowdon Towers electrical sample where 4,618 of 131,028
`FacetedTopology0` facets disagree with their stored normal (one file,
in a `GImposter` graph the traversal skips).
- `native_graphics_traversal`: a set `m_bHasScale` is read only on a
`GInstance` whose `InstanceInfo` has exactly `m_Trf`, `m_symbolId` and
`m_cda` (no `m_GRepId`) and a rotation matrix: orthonormal rows and a
determinant of 1, each within 1e-9, the tolerance the partition readers
hold a rotation to. The first version read any orthonormal matrix,
mirrors included; the contributor's 36 are 26 identity and 10 rotation,
so it is narrowed to that. A mirror, a scale, and the flag on any file
of Revit 2023 to 2027 stay refused, and by code: the walk reads a set
flag only when it is asked for the graphics of a file of Revit 2015 to
2022 (`select_graphics_pre2023_at_detail`, which only `graphics_pre2023`
calls); every other `select_graphics_*` entry point refuses it before it
looks at the `InstanceInfo`, so a file of 2023 to 2027 whose decoded
`InstanceInfo` lacked `m_GRepId` would be refused as on `main`. What
guards a wrong result: the older schema only, rotations only. This
narrows what #1436 landed: an `InstanceInfo` with no `m_GRepId` was read
as the default representation on every route, by the shape of what was
decoded (exactly `m_Trf`, `m_symbolId`, `m_cda`); it is now read on the
pre-2023 route alone and refused on every other, as before #1436. The
decoder drops a field flagged transient without reading it, so a missing
key does not say the class declares none, and a default path should not
rest on that; all 62 schemas of Revit 2023 to 2027 declare the field, so
no export should move. #1436's own results (the 2015 to 2022 samples'
pairs, census and the held-out scenes) all come through
`graphics_pre2023`, because `native_saved_scene` picks the route by the
file's release, not by `Options::releases`. What does not: the flag's
meaning on the older schema is unread, and if it marks a scale the
matrix does not carry, a mesh through it is wrong and nothing in the
file says. In one held-out model 57 owners pass the scale check and end
`decoded_saved_graphics` with no primitive, with rotations only as with
every orthonormal matrix, so they are not mirrors or scales; what they
hold is unexplained, and `saved_meshes::attach` leaves an owner with no
primitive as it is.
- Pure-helper tests (the CONTRIBUTING.md exception, failure modes
first): `normals_follow_winding`, `rotation` and
`default_representation`. They prove the rules, not that a file is read
right, and not the wiring.
- `probes/examples/probe_re342_saved_graphics_pre2023.rs`: takes the
research route itself (the three `Options` set the option; the scene
picks `graphics_pre2023` by the file's release), so the contributor
needs no flag. It counts, per `FacetedTopology*` class under binding 2,
the objects the winding rule keeps and refuses (every object, whatever
its normals, with the arrays taken as the reader takes them: a malformed
row or an index that is not an unsigned 32-bit integer in range refuses
the mesh), and prints `history default reading read` or `refused`, what
every other reader answers the same history.
- `reports/element-framing/RE-342-saved-graphics-pre2023.md` (a section
9 and the header lines; no new RE number),
`changelog.d/research/1158-ste1200-readers.md`,
`docs/format-reconnaissance.md`, `docs/contribution-map.md`.

Callers checked for the claim that no export reaches the deferred
reading: `creation_episodes_with_deferred` is called by `read_preamble`
(when its argument is set) and the probe. `read_preamble` has one
caller, `RevitFile::native_preamble(deferred)`, which has two:
`routed_partitions` (current-copy routing, passes false) and
`extract_records` (passes the option). Only the probe's three `Options`
literals name the field. `creation_episodes` itself is also called by
two other probes, which keep refusing. For `FacetedTopology9`:
`graphics_pre2023` has one caller, `native_saved_scene`; the one export
that calls `native_saved_scene`
(`saved_meshes::attach_scoped_with_control`) builds the default
`Options`, whose releases are 2023 to 2027, and `extract_records`
refuses a file outside `Options::releases` before any graph is read.

## Testing

No local build. CI's fast jobs, then Measure on the files CI fetches, at
`a7ca6ee0`, the head that holds every code change (the commits after it
are text). All four runs succeeded and were read:

- **No export moved.** 42067738690, the one unfiltered run (`-f
base=3955ac90 -f nordic=true -f r2025=true -f holdout=true -f
samples=true`, no `ifc_flags`): the `ifc.sha256` of 111 of 111 models is
identical to `main`'s at `3955ac90`. They are Autodesk's sample projects
of 2015 to 2027 (58), the 24 Revit 2025 models, the four RE1 models, the
BIM4LCA office files (4), Core Interior and Einhoven, the 18 held-out
models and 1 spent held-out pair. The scorer diff holds one line, `Only
in measure-head: areas_across_saves.txt`. This is the default export;
the `--saved-meshes` variant was last run at `997d5da1` (42054606416, 92
of 92) and not repeated, and what changed since narrows what the default
routes read (an `InstanceInfo` with no `m_GRepId`), which no file of
2023 to 2027 has.
- **The same-project gates pass.** `same-project gates` on `a7ca6ee0`:
`success`, "pass: 6 samples held to their earlier saves, and the Areas
on 4 saves" (check run 127396725106). The three probe runs wrote
`neutral` "NOT MEASURED" check runs of the same name on the same commit
(they set `scorers=none` or no `samples=true`); the newest of the four
is one of those, and `arm.sh` reads every run and judges only a success
or a failure.
- **Nothing moved in the probe runs.** The pairs and their census
(42067745903, 58 files), the 2024 to 2027 census (42067752912, 59) and
the held-out census, counts only (42067762581, 18 models) are line for
line the outputs of 42054610905, 42054615619 and 42054620459 at
`997d5da1`. So the winding counts held: under binding 2 the rule keeps
182 of 185 `FacetedTopology0` objects and 336 of 336 `FacetedTopology8`
and refuses 3, all in the Snowdon Towers electrical sample, and the stop
histograms held. Against #1436's state the tables are equal and 15 of 24
pair files move in their stop histograms alone (29 owners change their
stops: 21 leave the scale-check stop, 8 gain a `GText` stop and a
partial primitive; each `rst_basic` pair loses 3 scale-check stops and
gains 3 `GText` stops, each `rac_advanced` pair keeps its scale-check
count, gains 1 `GText` stop and loses 1 owner with no primitive; none
becomes drawn whole). In 3 of the 8 held-out scenes 1, 58 and 2 owners
change their stops (57 of the 58 go from partial to
`decoded_saved_graphics` with no primitive, 182 to 239 in that model);
owners drawn whole and their triangles are equal in 8 of 8.
- **What the runs exercise.** `history deferred episode pointers` is 0
in all 111 reads (34, 59 and 18: 92 distinct open files and the 18
held-out models; and 0 of 13 families, 42011570902); no
`FacetedTopology9` object is in any; `history default reading` printed
`read` on all 111 and `refused` on none. A set `m_bHasScale` on the
older schema is in 15 open files (15 with an identity matrix, 8 with a
mirror, 8 with a uniform scale; none with a rotation that is not the
identity) and 3 held-out models, and no owner is drawn whole through it.
No export reaches any of the three changes, and STE1200's run is the
only evidence of a deferred history read, of a `FacetedTopology9` mesh
and of a body drawn through the flag.
- **What the contributor's run should read**, at this head: `history
deferred episode pointers 109 1`, `history episodes read 109 1`,
`history default reading refused inline history episodes require a
different contract 1` and `topology FacetedTopology9 normals_flag 2
objects the winding rule keeps 325`. That 325 holds only if all 325
meshes are well-formed: the count takes the arrays as the reader does,
so a malformed row, an index that is not an unsigned 32-bit integer in
range, no normals or a count that is not the facets' makes a mesh
`refuses`, where the facet counts would still read 47,968.

Beside it (42039874650 and 42039879159, at `fe6ffa76`, which printed the
binding-0 lines): 134 of the 136 `FacetedTopology0` objects under
binding 0 hold a number of stored normals that is not their facets'; the
other 2 (Core Interior) look like per-vertex normals whose count equals
the facets'. The binding-0 path is left alone: `Primitive::normals` is
read by a probe, by `transform` (which refuses a zero or non-finite
normal) and by `Serialize`; `local_mesh` and `raise_embed_host` read
vertices and triangles only.

The route gates (`self.pre2023 &&` and the `self.pre2023` arguments in
`native_graphics_traversal.rs`) are observed by nothing in CI or
Measure: a refactor that passed `true` would leave every hash and output
unchanged, because no fetched file of 2023 to 2027 has the shape they
exist for. Nothing in CI will catch a regression in the three paths, and
the family never enters the repository. A synthetic fixture for the
deferred-episode path is proposed in RE-342 section 9.4 and not built:
it needs the wire form of a deferred pointer, which only the
contributor's family shows, as decoded values. The contributor is asked
to run the probe at this PR's head and post the same lines.

## Breaking changes

None for users: the default reading, the export path and every `Options`
that does not name the new field behave as on `main`, and no export
moves. This is research API, outside the semver promise, and it changes
what it refuses: `native_saved_mesh::graphics*` and
`native_graphics_traversal::select_graphics*` (but for their `_pre2023`
entry points) refuse an `InstanceInfo` with no `m_GRepId`, which #1436
had let them read, and `Options` has a new field.
`native_graphics_traversal` accepts a set `m_bHasScale` and
`native_saved_mesh` a `FacetedTopology9` in cases `main` refused, but
only through the `_pre2023` entry points, for a file of Revit 2015 to
2022 read with `Options::releases` widened; no export does.

## Screenshots or output samples

N/A: no output changed (the export runs above).

## Related issues

Refs #1158, Refs #1190.

## Contributor declaration (CLEANROOM.md)

The changes in this PR are based on public byte observations of
Autodesk's sample projects and the files' own `Formats/Latest` schemas
(accepted source 1) and on STE1200's published findings, counts and
patch, offered under Apache-2.0 in discussion #112 (accepted source 3).
I have not used Autodesk SDK source, ODA SDK source, leaked internal
documentation, NDA material, or decompiled internal Revit implementation
code beyond public symbol exports, and I have not copied or translated
code from revit-ifc. The contributor's family (a manufacturer-published
Revit 2020 family, under its publisher's terms) was not downloaded or
read; nothing of it is committed beyond counts the contributor published
in the thread.

Co-authored-by: STE1200 <[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