Repository navigation
feat(diagnostics): count where the element records of a Revit 2008 to 2023 file stop (#1389) - #1397
Merged
Merged
Conversation
… 2023 file stop, stage by stage (#1389) The rejected-frame reasons read the 2024 layout and counted nothing on 2008 to 2023 files, so a file that exported no element showed only low_confidence_schema_scan_candidate. The marker scan and the recovery that follows now count, per partition stream and in total, the markers, those with a declared ElementId, the records, the placed instances, those with volume, the frames kept, the elements handed to the export and the elements the model holds, each step what the one before it passed on and left. They are in decoded.element_record_stages, the frames that stopped are in skipped as element_record_frame_stopped and in the log of decisions, and an export that wrote no record names the stage in stopped_at. The counts are made where the scan already decides; the IFC is unchanged. tests/element_record_stages.rs re-reads the markers on Einhoven and checks a file with no record; Measure checks the sums on each sample project with tools/re/element_stage_counts.py.
…s record, sums streams from zero, and the docs say what no_declared_id can hold (#1389)
DrunkOnJava
marked this pull request as ready for review
November 4, 2026 23:19
…th, count what is set aside, and say what a count is (#1389) The default export keeps integers only: the per-frame list is built when the log of decisions is asked for (RevitFile::record_frame_decisions), the streams are found without allocating a name, and the skipped item is counted from the integers. The elements handed to the export are written plus those set aside for one cause each (an ElementId an earlier reader already held, below the confidence floor, or by Revit class). A stream that does not inflate is counted as stream_not_read. The log keeps a share of its cap for each stage of element_record_frame_stopped. A family file and a placeholder export have no report, and rvt-ifc prints the stage on a line of its own. The stop order is documented, and the MCP count of the item says frames.
…eport, and rvt-ifc leaves a family file out by its name (#1389) The report was withheld from a file with a PartAtom stream, which the committed synthetic projects carry as a family does, so the all-zero case had no report. Only a placeholder export has none now; rvt-ifc prints no line for a .rfa or .rft input.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
For a Revit 2008 to 2023 record layout, the marker scan and the recovery after it count where element records stop: the markers found, those with a declared ElementId (52 bytes before the marker, the
ElementHeadertag 8 bytes after it), the category and box checks, the placed instances, those with volume, then what the recovery keeps, hands to the export, and what the model holds or sets aside. The counts are indecoded.element_record_stages, per partition stream and in total; the frames that stopped are also inskippedaselement_record_frame_stopped; with--export-decisionsthey are listed in the decisions log; an export that wrote no record names the stage instopped_at. Diagnostics only: the IFC is unchanged.Motivation
#1389, from hemanth1986's four files on #421 (saved by Revit 2024 to 2026, a 2022 or 2023 schema, no element exported).
RevitFile::layout_releaseroutes them correctly, but the "record rejected" counters (element_record_without_element_id,element_record_without_volume) read the 2024 layout and return nothing for 2008 to 2023, so the diagnostics showed onlylow_confidence_schema_scan_candidateand no one could say which stage lost the elements.Changes
src/research/partition_element_records_2023.rs:scan_records_countedisscan_recordswith per-stream integer counts;decode_at_markerreturns where a frame stopped (Stop) instead ofNone, with the same decisions. The default path keeps integers only: the streams are found by name without allocating one, and the per-frame list (stopped) is built only when asked for (RevitFile::record_frame_decisions, set fromExportOptions::export_decisions, which drops the memoised walk as value sources do). A stream that does not inflate is counted (stream_not_read).src/research/partition_schema_mvp/records_2023.rs,records.rs,src/walker.rs:select_newest_instance_recordsand the design option, phase, nested and category steps ofrecover_2023_recordscount at the points where they already decide;nested_component_idsis split out ofwithout_nested_components; the walk notes a record element it drops because an earlier reader held the ElementId.src/ifc/element_record_stages.rs:StageCounts,ElementRecordStages(the report),stopped_at; theskippeditem is counted from the integers, and the decisions are made only for the log.src/ifc/export_decisions.rs: forelement_record_frame_stoppedthe log keeps 1,000 entries of each of the five stages (the cap of 5,000 shared out), so the stage that sorts first, the frames with no ElementId, does not fill it.src/ifc/mod.rs:decoded.element_record_stages, for every export of a file of the layout, even with every count zero, but a placeholder export's.rvt-ifcprints a line of its own when no record was written, and none for an input named.rfaor.rft(a family reads its elements fromGlobal/Latest).rvt-mcp/src/schema.rs: the doc ofSkippedOut.countsays that forelement_record_frame_stoppedit is frames of every category, not lost elements. That changes the MCP output schema's description, so the contract (docs/mcp-tools.json) will need the watcher's sync; no tool description changed.docs/schemas/export-diagnostics.schema.json,docs/export-diagnostics.md(a section "Element record stages"),changelog.d/added/1389-element-record-stages.md.tests/element_record_stages.rs(classreal),tools/re/element_stage_counts.pyand its step inmeasure_sample.What "adds up" means here
Per stream and in total, each step is exactly the sum of what the next step took and left (
StageCounts::unbalancedand the scorer check the same five sums), and the streams' counts sum to the file's. The elements handed to the export are written plus set aside, each for one cause:handed_to_export = written_to_model + id_already_held + below_min_confidence + sum(not_written_by_class).written_to_modelis counted from the IFC model;id_already_heldfrom the walk's own dedup;below_min_confidencefrom the walk's confidence floor; the rest, by the Revit class they were handed as (elements the exporter writes nothing for, such as a Mass with no "Export to IFC As"; not attributed further here).exported.building_elementsalso holds elements other readers write (Areas, ArcWalls, stair and curtain-wall parts), so it is an upper bound forwritten_to_model, not an equality.no_declared_idcan include frames inside loaded families' own documents (RE-135);without_volumeis frames of every category. The docs say so.Review items of the second read (2026-11-04)
stream_not_read) andstopped_atcannot sayno_markersfor it.without_volumeand theskippedcount are labelled frames in the docs, the schema, the MCPSkippedOut.countdoc andExportDecision.class.rvt-ifcprints the line on its own, and none for a family file, decided by the input's name (checked on the committedtests/fixtures/families/empty.rfa). The first version of this round withheld the report from any file with aPartAtomstream, and CI showed the committed synthetic projectcorpus/tier1/structural-2023carries one as a family does (it has noProjectInformationstream either), so streams cannot tell a family from that project; the all-zero case now has its report.Testing
Nothing was built or run locally (lane rule); the results are CI's and Measure's. This round's Rust was written without a compiler: CI's first run on this head is its first check.
cargo fmt --all -- --check,tools/release/changelog.py check,tools/ci/api-doc-ids.py,tools/ci/render-mcp-tools.py --checkandpython3 -m py_compile tools/re/element_stage_counts.pywere clean locally.ifc.sha256equal to main's on all 37 exports (33 samples of 2015 to 2023, Einhoven, Core Interior, RE1 Architecture, RE1 Electrical), andelement_stage_counts.txtendingokon all 33 samples.stream_not_read), so it is run again. Wanted:ifc.sha256equal on every export,element_stage_counts.txtokon every sample, andhanded_to_export= written + set aside on each. NOT MEASURED until it finishes. The head after it (2ca24f2) differs only in when the report is withheld (a placeholder export alone), thervt-ifcstderr line, tests and docs; none of the 33 samples, nor Einhoven, has aPartAtomstream (input.has_part_atomfalse in run 41932213967's diagnostics), so the earlier gate withheld nothing from them and the run's counts stand for the new head.PartAtomgate above); the Einhoven case passed. Fixed at 2ca24f2; NOT MEASURED until CI reports on it.tests/element_record_stages.rsin Corpus health (Einhoven's markers recounted from the bytes, the sums, the default export against the logged one, the log entries re-read; the structural-2023 fixture's stage andrvt-ifcline; the family fixture's absence of both). NOT MEASURED until CI reports.Audit-honesty checklist
changelog.d/added/1389-element-record-stages.mdBreaking changes
None. A new optional field in
decodedand a newskippedreason, for projects of the 2008 to 2023 layout only; the IFC is unchanged.Related issues
Closes #1389.
Closesis justified if run 41935682998 shows the three done-when items: the sums on every public 2015 to 2023 sample with the elements handed to the export equal to written plus set aside, an all-zero export that names its stage (the tier1 test), and a byte-identical IFC.Measured on 1258ff5 (run 41935682998): the IFC byte-identical on 37 of 37 exports, and
element_stage_counts.txtendsokon all 33 samples of 2015 to 2023, with handed_to_export = written + id_already_held + below_min_confidence + not_written_by_class closing exactly. The later commits change only the family and placeholder gate, the docs and the MCP contract.