Skip to content

research(saved-graphics): deferred history episodes, FacetedTopology9 under normal binding 2 with a winding check, and a set m_bHasScale with a rotation (#1158) (RE-342) - #1449

Merged
DrunkOnJava merged 20 commits into
mainfrom
research/1158-ste1200-readers
Nov 5, 2026
Merged

DrunkOnJava merged 20 commits into
mainfrom
research/1158-ste1200-readers

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

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 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 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 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. 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. 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'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 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'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]

…nters is read when the counted section repeats their GUIDs (#1158) (RE-342)

(cherry picked from commit ca48b95)
…he stored normals follow the winding, and a set m_bHasScale on an older InstanceInfo with a rotation (#1158) (RE-342)
…r's run, what they guard and what nothing in CI will catch (#1158)
… hashes equal, the pairs equal, the winding rule keeps 182 of 185 FacetedTopology0 and 336 of 336 FacetedTopology8 (#1158)
@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 15:10
@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
…o export reaches, FacetedTopology9 is read in the graphics of 2015 to 2022 only, and a rotation holds 1e-9 (#1158) (RE-342)
…ecked, the binding-0 normals and the runs at the gated head (#1158)
…2 of 92 exports identical, nothing moved, no file exercises the deferred or FacetedTopology9 reading (#1158)
@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
# Conflicts:
#	docs/format-reconnaissance.md
…alk, the history reading allocates as before, and the probe's winding count takes the arrays as the reader does (#1158) (RE-342)
… the owners whose stops move, and the runs at the final head (#1158)
…pre-2023 route alone, narrowing what #1436 landed (#1158) (RE-342)
…, states the route gates unobserved, and says what the research API now refuses (#1158)
…ports identical, the gates pass, the probe outputs unchanged (#1158)
@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 19:08
@DrunkOnJava
DrunkOnJava merged commit 44c055d into main Nov 5, 2026
33 checks passed
@DrunkOnJava
DrunkOnJava deleted the research/1158-ste1200-readers branch November 5, 2026 19:25
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