Skip to content

fix(reader): name every stream a resource limit stops and refuse a partial export (#1075) - #1083

Merged
DrunkOnJava merged 2 commits into
mainfrom
fix/1075-resource-limits
Oct 29, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
fix/1075-resource-limits

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

A Revit file with a stream over a resource limit no longer exports empty without a word. Every stream a limit stops is recorded on the RevitFile, listed in the export diagnostics, and rvt-ifc / rvt-gltf write no model and exit with status 3 unless --allow-partial. --large-model, --max-stream-bytes and --max-inflate-bytes raise the limits.

Motivation

#1075: two private Revit 2024 models (about 438 MB and 1.13 GB, largest partitions 402.7 MiB and 1,056.8 MiB stored) exported 0 elements and 0 storeys with exit 0. At main af50068, about 87 of the 93 inflated_partition call sites in src/ discard the error (let Ok(..) = .. else { continue }), so a partition over 256 MiB is skipped by every reader; InflatedStream::from_stored also ignored the handle's OpenLimits and capped a stream's inflated total at a literal 1 GiB, so even raised limits could truncate a read silently.

Changes

  • src/reader.rs: UnreadStream, UnreadKind, RevitFile::unread_streams(). read_stream records a stream refused for its size; inflated_partition inflates under the handle's InflateLimits and records a member over the cap or a stop at the stream's total.
  • src/compression.rs: InflatedStream::from_stored_with_limits returns an InflateShortfall; InflateLimits::max_stream_total_bytes() (max_output_bytes or 1 GiB, whichever is larger: raising the per-member cap raises the total, and OpenLimits gains no field); inflate_stream_at_with_limits, inflate_stream_auto_with_limits, inflate_at_auto_with_limits.
  • src/walker.rs: Formats/Latest and Global/Latest inflate under the handle's limits and record a limit hit.
  • src/ifc/mod.rs: record_unread_streams and UNREAD_STREAMS_REASON: a stream_not_read_resource_limit skipped item (classes maps each stream to how many limits stopped it) and a warning per stream, beginning Not read whole:.
  • src/cli.rs: open_limits, unread_stream_report, LARGE_MODEL_MAX_STREAM_BYTES (the 2 GiB file cap) and LARGE_MODEL_MAX_INFLATE_BYTES (8 GiB, or the address space on 32-bit).
  • src/bin/rvt_ifc.rs, src/bin/rvt_gltf.rs: the four flags, exit status 3, the report on stderr; rvt-ifc still writes the diagnostics sidecar when it refuses.
  • rvt-py, python/rvt/__init__.pyi: write_ifc(mode, allow_partial=False), rvt_to_ifc(path, mode, allow_partial=False) raise ValueError while a stream is unread; RevitFile.unread_streams().
  • viewer/src/main.ts: a file with a Not read whole: warning shows "Part of the file not read" instead of its element-count status.
  • Docs: docs/supported-profile.md (the "never a partial model" sentence was false), docs/user-guide.md (Large models), docs/export-diagnostics.md, docs/python.md; changelog.d/fixed/resource-limit-partial-reads.md.
  • tests/resource_limits_cli.rs (class cli).

Testing

Unit tests are banned in this repository: do not add them. Show the change working end to end on real files instead.

  • tools/check-local.sh passes: not run on the maintainer's Mac by policy; CI runs every gate (fmt checked locally with rustfmt).
  • Verified end to end on real Revit files: tests/resource_limits_cli.rs runs the built rvt-ifc and rvt-gltf on the committed tier-1 fixture with --max-stream-bytes 200 (its BasicFileInfo is 236 bytes): exit 3, no model, the sidecar names BasicFileInfo; with --allow-partial exit 0 and the model written; at default limits no item. On Core Interior (MIT, RVT_PROJECT_CORPUS_DIR, Corpus health job) with an 8 MiB stream limit and --allow-partial, the sidecar names Partitions/46 (about 17 MB stored) and fewer than 970 elements export. The reporter's files are private; the evidence they can return without sharing them is on Bug: models with a partition stream over 256 MiB open empty, with no error #1075.
  • If this touches the IFC exporter: no export changes at default limits. Measure run 40939867110 (this head against main, default models, nordic, r2025, samples): all 89 model exports byte-identical by ifc.sha256. Corpus health ran core_interior_partition_over_the_stream_limit_is_named for real (5.4 s).
  • If this is a performance change: N/A.

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/fixed/
  • If a limitation was resolved, the relevant docs are updated (docs/supported-profile.md, docs/user-guide.md)
  • If a new limitation was introduced, it is documented: the browser viewer keeps the default limits and wasm32's 4 GiB ceiling; peak memory on a 1 GiB partition is several GB and unmeasured here
  • 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
  • If this is a reverse-engineering finding: N/A

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 fixtures

Breaking changes

None to the Rust API: every item is added, and OpenLimits keeps its fields. Behaviour: rvt-ifc and rvt-gltf exit with status 3 and write no model where they used to write an incomplete one with status 0; Python's write_ifc() / rvt_to_ifc() raise ValueError there unless allow_partial=True.

Screenshots or output samples

The shape of the report (the streams listed depend on which limit stops which stream):

rvt-ifc: N stream(s) not read whole, so the export is missing what they hold:
  stream Partitions/189 (422248448 bytes stored) is larger than the stream limit of 268435456 bytes, so what it holds is missing
  Re-run with --large-model (or a larger --max-stream-bytes / --max-inflate-bytes) to read them, or --allow-partial to write the incomplete output anyway.
error: no IFC written: part of the input was not read (see above)

Related issues

Refs #1075 (stays open until the reporter confirms on their files).

…rtial export (#1075)

A partition over 256 MiB, a member that inflates past 256 MiB, or a
partition that inflates past 1 GiB was skipped by every reader: about 87
of the 93 inflated_partition call sites discard the error, so a large
client model exported 0 elements and 0 storeys with exit status 0.

- RevitFile records each such stream (unread_streams), from read_stream
  and from the multi-member inflate; the walker's Formats/Latest and
  Global/Latest inflates record theirs too.
- Partitions and the walker inflate under the file's OpenLimits instead
  of the defaults. A stream's inflated total is max_output_bytes or 1 GiB,
  whichever is larger (InflateLimits::max_stream_total_bytes), so no new
  field on OpenLimits.
- Export diagnostics gain stream_not_read_resource_limit and a warning
  per stream (record_unread_streams).
- rvt-ifc and rvt-gltf write no model and exit 3 unless --allow-partial,
  and take --max-stream-bytes, --max-inflate-bytes and --large-model.
- Python write_ifc / rvt_to_ifc raise ValueError unless allow_partial,
  and RevitFile.unread_streams() lists them; the viewer shows the file
  as not read whole.
- tests/resource_limits_cli.rs runs both CLIs on the tier-1 fixture with
  a 200-byte stream limit, and on Core Interior with an 8 MiB one when
  the project corpus is present.
@DrunkOnJava
DrunkOnJava merged commit c2bb334 into main Oct 29, 2026
29 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1075-resource-limits branch October 29, 2026 19:40
DrunkOnJava added a commit that referenced this pull request Oct 29, 2026
…aseline contradicts (#1087)

## Summary

Corrects the public claims that the 2026-10-29 full Measure baseline
(run 40927543524, main af50068, every model and scorer) and its flagged
W7 census (run 40929095759, --revit-set-placement) contradict. Docs
only.

## Motivation

A claims audit against the baseline found statements a user could act on
wrongly: an ElementId-set claim false on two CI models, 2015 rows that
ignore RE-198, stale counts, W7 quoting the unflagged census, and
local-only figures not labelled as such.

## Changes

- README.md: the 2024/2025 Elements cell and a per-model ElementId
paragraph (Core Interior 970, RE1 84/49/74, 22 R2025 models, office
12,974 exact; RE1 Plumbing +1 tank 442378, office permit +1 column
1927742, fixture 3095244 class, #792); the 2015-2018 row and the
2015-2022 bullet (RE-198); openings 138 of 138, door sizes 5 of 5 on
RE1, type objects 73 of 73 and type GlobalIds 854 of 854 (RE-167); set
placement 966 values and the 18 IFC2X3 extras; room outlines rest on
RE-101's run; local-only labels on Snowdon and the other
unredistributable models.
- docs/release-1.0-criteria.md: W2 (RE1 is a cross-release pair; 2025
same-release evidence is the R2025 models), W4 (per-model numbers), W5
(BIMcollab and the holdout pack used since; no qualifying model), W7
(flagged 12,853 vs default 13,819; held-out property census not
published; 0.11.0 milestone), W8 (#1075), W9 (stale 0.7.0), P1
(hemanth1986's report), header date.
- docs/supported-profile.md: RE1's exporter, slabs 63 of 63, openings
138 of 138, door sizes 137 of 137, room-outline provenance, the 2015
exception (lines 49-50 are left to #1083).
- docs/status.md, ROADMAP.md: the 2015 exception; 0.10.0 milestone
references move to 0.11.0.
- docs/support-matrix.json: element-records-revit-2025 and
element-records-revit-2015-2018 notes, evidence and impact; reviewed
date. Statuses unchanged.
- docs/reference-models.md: RE1 cross-release, Snowdon figures'
provenance, BIMcollab no longer held out, sample projects' export
availability.

## Testing

Unit tests are banned in this repository: do not add them.

- [x] tools/ci/api-doc-ids.py and tools/ci/re-citations.py pass locally;
docs/support-matrix.json parses; statuses unchanged so
tests/support_matrix.rs holds.
- [x] Every number cites its run: Measure 40927543524 (class_sets,
opening_boxes, door_window_sizes, type_objects, plan_profiles, psets,
qtos per model) and 40929095759 (flagged psets).

## Audit-honesty checklist

- [x] README / docs reflect the current state; nothing claimed that is
not measured.
- [x] No code change, so no changelog fragment.
- [x] No emojis, private paths or internal jargon.

## Legal and contribution hygiene

- [x] Apache-2.0; no Autodesk material.

## Breaking changes

None.

## Related issues

Refs #408, #421, #792, #874, #878, #879, #1075.
DrunkOnJava added a commit that referenced this pull request Oct 29, 2026
…1081)

## Summary

A file that kept an older release's schema is now read as that release
(#421). `schema_release` names the release the file's schema belongs to,
and `RevitFile::layout_release` gives it to the readers when it is older
than the release that saved the file. A schema that matches no measured
release still reads nothing.

## Motivation

[A field report on
#421](#421) tested 49
project files saved by Revit 2024 to 2027. 25 of them carried an older
release's element-record marker, and all 25 read as zero elements and
zero Levels:

- 17 carried the 2024 or 2025 marker;
- 8 carried `3c01ffffffff8205` or `2901ffffffff4805`.

`file_bbox_marker` refuses a schema marker that differs from the saving
release's constant, and the Level, type-record and name readers use the
saving release's constants too.

The report treated the second pair of markers as unknown, but they are
Revit 2023's and 2022's: `Outline` and `ElementParents` are `0x013c` and
`0x0582` in 2023's schema, and `0x0129` and `0x0548` in 2022's. The
files' histories start in 2014 to 2020, which fits. Those releases write
the 32-bit records that `partition_element_records_2023` reads. So
accepting their markers in `file_bbox_marker` is not enough: the whole
file has to be read as its schema's release.

## Changes

- `src/partition_element_records.rs`: `schema_release`. A 2024 to 2027
schema is matched by its `bbox_marker`; a 2015 to 2023 schema is matched
by its `schema_tags`. `None` when nothing matches.
- `src/partition_element_records_2023.rs`: `file_schema_tags`, the
`SchemaTags32` of the file's own schema.
- `src/reader.rs`: `RevitFile::layout_release` (memoised). It gives the
schema's release when that is older than `BasicFileInfo`'s version, and
the saving release otherwise.
- The readers that took `BasicFileInfo`'s version now take
`layout_release`:
- `src/partition_names.rs`, `src/partition_phases.rs`,
`src/partition_scanner.rs`, `src/partition_arc_walls.rs`,
`src/partition_design_options.rs`, `src/partition_connector_pairs.rs`;
- `src/native_document.rs`, `src/native_element_parameters.rs`,
`src/native_family_forms.rs`;
  - `compute_second_prologue_ids`;
  - the walker's partition merge;
- in `src/ifc/mod.rs`: the Level storeys, the ArcWall path, the instance
transforms and the diagnostics' scans.

Metadata, reports, the doctor, the export's "Revit N export" description
and the door GlobalId suffix (which follows the exporting Revit) keep
the saving release.
- `examples/probe_421_schema_marker.rs`: prints `schema_release` and
`layout` for each file, and `scanned` is the marker the readers now get.
- `docs/compatibility.md` (known limitations) and
`changelog.d/fixed/schema-marker-release.md`.

## Testing

Unit tests are banned in this repository: do not add them. Show the
change working end to end on real files instead.

- [x] `tools/check-local.sh` passes (fmt, clippy, rustdoc, build,
real-file / CLI / contract checks)
- `tools/check-local.sh` (required gates): "check-local: all requested
gates passed"; `cargo test --test integration` 297 passed; `cargo clippy
--all-targets --all-features -- -D warnings` clean.
- `cargo +1.87 check --profile ci --all-targets` (the MSRV job) passes.
- [x] Verified end to end on real Revit files: the command, the files
(and their licence), and the measured result against Revit's own export
are in the PR body, with the script or probe that reproduces it
- **No file here has an older release's schema.** The one local model
upgraded from 2019 and saved by 2025 carries 2025's marker, so this PR
cannot show the fix on a file of its own. The reporter offered to run a
build against their files; the counts to compare are their 0 elements
and 0 Levels per file.
- `cargo run --profile ci --example probe_421_schema_marker -- <files>`
on the local files of 2015 to 2027 (Autodesk's sample projects and
templates, the BIM4LCA models and the other files Measure reads, plus
local ones): on all 120, `schema_release` is the saving release, for
every release from 2015 to 2027. So `layout` is the saving release on
each, and nothing they read can change.
- [x] If this touches the IFC exporter: the witness verdicts replay (see
CONTRIBUTING.md) or the changed observations are refreshed in this PR
- I ran `rvt-ifc` on 132 local files of 2008 to 2027 with this branch
and with `main` at e5846fe, leaving out the timestamp lines. All 132
exports are byte-identical, including Core Interior (2024) and every
pinned sample at hand.
- [ ] If this is a performance change: reran `tools/bench.sh` and
attached the before / after
- N/A: not a performance change. `layout_release` reads the memoised
schema once per file.

## Maintainer integration (rebased on main 2026-10-29)

- Rebased onto main (after #1083); puzzbobb's commit is unchanged in
content.
- Added: the export diagnostics warn when the layout release differs
from the saving release ("Saved by Revit N but keeps Revit M's schema
..."), and `release_support` follows the release the file is read as, so
a 2025 save with a 2022 schema is reported as 2022's experimental
support, not 2025's.
- Added: `elem_table::layout`, and a warning when `Global/ElemTable`
falls back to the implicit layout. Both record readers drop records
whose ElementId is not declared there, so a file on the fallback still
reads none; the field report saw that on 5 of its 8 files with a 2022 or
2023 schema, so this PR alone likely leaves those 5 empty.
- Added: `probe_421_schema_marker` prints `elem_table` (stated count,
layout taken, and for 28 and 40 bytes the rising ids, the first drop and
whether the count fits): counts and indices only, for the reporter to
post.
- Measured on CI: Measure run 40928760469 (the original head,
samples=true, probe_421_schema_marker, base main): schema_release ==
release and layout == release on all 58 Autodesk sample projects of 2015
to 2027, with 13 distinct markers (2022 `29 01 ff ff ff ff 48 05`, 2023
`3c 01 ff ff ff ff 82 05`, which are the field report's two unknown
markers); all 58 sample exports and Core Interior byte-identical to
main. Not measured on any affected file: none is in any corpus.

## Audit-honesty checklist

- [x] README / docs reflect the current state after this PR — no claims
of features that are not actually shipped in this PR
- `docs/compatibility.md` says the change is unmeasured here, and that
the counts are the field report's.
- [x] A user-visible change has its entry as a fragment under
`changelog.d/<section>/` (see `changelog.d/README.md`), not in
`CHANGELOG.md`
- `changelog.d/fixed/schema-marker-release.md`;
`tools/release/changelog.py check` passes.
- [x] If a limitation was resolved, the "Known limitations" / "What
works today" section in the relevant docs is updated
- [x] If a new limitation was introduced, it is documented in the PR
body and in-code
- The routing is shown only on files whose schema is their own
release's. A schema of a release before 2015 matches nothing and keeps
the saving release.
- [x] Commit messages describe WHAT changed and WHY, not "fix things" or
"updates"
- [x] No emojis in code, docs, or commit messages
- [x] No private paths, personal email addresses, or internal jargon in
committed files
- [ ] If this is a reverse-engineering finding: a reproducible probe
under `examples/` and a dated addendum to
`docs/rvt-moat-break-reconnaissance.md` are included
- N/A: no new layout is measured. `probe_421_schema_marker` gains the
two fields the reporter can run.

## Legal and contribution hygiene

- [x] I agree this work is licensable under Apache-2.0 (see
`CONTRIBUTING.md`)
- [x] This PR contains no Autodesk proprietary source, decompiled
internals, or NDA'd SDK content (see `CLEANROOM.md`)
- [x] Any new test fixtures use synthetic values (`testuser`, `111111`,
`FY-20XX`, etc.) and contain no real-world PII
  - N/A: no fixtures are added.

## Breaking changes

None. `RevitFile::layout_release`, `schema_release` and
`file_schema_tags` are added; no signature changes. On a file whose
schema is its own release's, every reader gets the release it got
before.

## Screenshots or output samples

```
probe_421_schema_marker rac_basic_sample_project.rvt "Snowdon Towers Sample Architectural.rvt"
{"file":"rac_basic_sample_project.rvt","release":2022,"schema":"29 01 ff ff ff ff 48 05","constant":null,"header_tag":1340,"prologue":1340,"scanned":null,"schema_release":2022,"layout":2022}
{"file":"Snowdon Towers Sample Architectural.rvt","release":2025,"schema":"59 01 ff ff ff ff d3 05","constant":"59 01 ff ff ff ff d3 05","header_tag":1479,"prologue":1479,"scanned":"59 01 ff ff ff ff d3 05","schema_release":2025,"layout":2025}
```

A file of the kind reported would show, for example,
`"release":2026,"schema":"46 01 ff ff ff ff ab 05",…,"scanned":"46 01 ff
ff ff ff ab 05","schema_release":2024,"layout":2024`, where `main` gives
`"scanned":null`.

## Related issues

Refs #421 (item 1 and the field report on `file_bbox_marker`'s
fail-closed rule).

---------

Co-authored-by: Griffin Long <[email protected]>
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 31, 2026
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