Skip to content

feat(viewer): retry a model the reader's limits stopped, with the large-model limits (#1075) - #1135

Merged
DrunkOnJava merged 2 commits into
mainfrom
feat/viewer-large-model-retry
Oct 30, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
feat/viewer-large-model-retry

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

When the viewer reports that a resource limit kept part of a file from being read ("Part of the file not read", #1075), it now offers Retry with large-model limits. The retry reopens the file with the limits rvt-ifc --large-model uses and states the 4 GiB memory a browser tab can use. One new wasm binding carries the limits.

Motivation

Griffin's decision of 2026-10-30 ("Add a large-model retry"). Since #1075 the viewer said what it could not read, but only the CLI could raise the limits.

Changes

  • rvt-wasm: openRvtBytesWithDiagnosticsModeAndOpenLimits(bytes, mode, limits). limits is { largeModel?, maxStreamBytes?, maxInflateBytes? } or null, resolved by rvt::cli::open_limits exactly as the CLI flags are. Unknown fields and fractional, negative or non-finite byte limits throw.
    • On wasm32, largeModel reads streams up to 2 GiB and inflates up to 4 GiB, against the CLI's 8 GiB on a 64-bit host.
    • openRvtBytesWithDiagnosticsMode shares the helper and behaves as before.
    • This is the 12th binding, and additive (wasm-api.py compat passes).
    • serde returns to rvt-wasm's dependencies, and cargo metadata --locked --offline resolves.
  • Viewer:
    • The retry row sits under the status panel's Mode row. It is offered only when the file was opened without large-model limits.
    • The row's note cites rvt-ifc --large-model and the 4 GiB ceiling.
    • A large-model open that still leaves streams unread points to the CLI on a desktop.
    • For tests only, ?maxStreamBytes= and ?maxInflateBytes= apply to the first open.
  • Test: viewer/tests/large-model-retry.spec.ts opens the committed tier-1 fixture at ?maxStreamBytes=200. Its 236-byte BasicFileInfo is over that, as in tests/resource_limits_cli.rs. The test sees the not-read status, the diagnostics entries and the retry, clicks it, and sees the full model load with the warnings gone. Three more tests check that the limits apply to the first open only, that a default open offers no retry, and that a non-integer parameter is ignored.
  • Docs: docs/viewer-api.md (12 bindings), README.md, docs/user-guide.md, docs/supported-profile.md and viewer/README.md, plus changelog.d/added/viewer-large-model-retry.md.

Testing

Deploy viewer builds the wasm and runs Playwright, and is the end-to-end check here; CI compiles and lints rvt-wasm. Both results will be read before merge (Deploy viewer is outside CI passed).

Breaking changes

None (an added binding).

Related issues

Refs #1075.

…ge-model limits (#1075)

When a stream is over the reader's resource limits the File status panel
already said "Part of the file not read", but the browser could only point at
rvt-ifc --large-model. It now offers "Retry with large-model limits", which
reads the same file again with the stream and inflate limits that flag uses
and says a browser tab can use at most 4 GiB of memory.

One new wasm binding, openRvtBytesWithDiagnosticsModeAndOpenLimits(bytes,
mode, limits), takes { largeModel?, maxStreamBytes?, maxInflateBytes? } or
null and resolves them with rvt::cli::open_limits, as rvt-ifc does; the old
openRvtBytesWithDiagnosticsMode is unchanged. The viewer reads ?maxStreamBytes=
and ?maxInflateBytes= for its first open, so a browser test reaches the path
on the 20 KiB tier-1 fixture with ?maxStreamBytes=200.

@DrunkOnJava DrunkOnJava left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer self-review. GitHub does not let a PR's author approve it, so this review stands in for an approval. A side agent wrote the commit, and I reviewed it as a reviewer would.

  • Binding: openRvtBytesWithDiagnosticsModeAndOpenLimits resolves limits with rvt::cli::open_limits(Option<u64>, Option<usize>, bool), the same function rvt-ifc uses, and opens with RevitFile::open_bytes_with_limits (src/reader.rs:371). Byte limits must be finite whole numbers that are not negative. An inflate limit past 32-bit usize saturates, and unknown fields throw (deny_unknown_fields). openRvtBytesWithDiagnosticsMode shares the helper with the default limits, so the viewer's normal open is unchanged.
  • Lockfile: serde returns to rvt-wasm, and Cargo.lock adds it to rvt-wasm's list only; cargo metadata --locked --offline resolves.
  • UI: the retry is offered only when Not read whole: warnings exist and the file was not opened with large-model limits. It reopens the same File with { largeModel: true }. The ?maxStreamBytes and ?maxInflateBytes parameters apply to the first open only and accept whole numbers only.
  • Verified:
    • CI passed, which lints rvt-wasm with -D warnings.
    • Deploy viewer's build ran Playwright in Chromium, 31 passed, including the four new tests: the not-read path and the retry on the tier-1 fixture at ?maxStreamBytes=200, limits applied to the first open only, no retry at the defaults, and non-integer parameters ignored.
    • wasm-api.py compat passes, since the binding is additive.

Ready to land.

@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 30, 2026 09:14
@DrunkOnJava
DrunkOnJava merged commit cbb59bc into main Oct 30, 2026
28 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/viewer-large-model-retry branch October 30, 2026 09:38
DrunkOnJava added a commit that referenced this pull request Oct 30, 2026
…elper, and one ArcWall scan per file (#1136)

## Summary

The audit's helper refactor (Griffin, 2026-10-30, "One copy of each
helper"): copied helpers become one shared copy each, little-endian
reads go through `le_bytes` where the conversion is exactly equivalent,
and the partition ArcWall scan runs once per file instead of up to four
times. Nothing an export writes should change; Measure checks that.

## Changes

- **`le_bytes`:** about 117 of 227 inline `from_le_bytes` reads now use
`le_bytes`, which gains `i32_at` and `u16_units`. The rest are left
because their failure semantics differ: `Result` errors with specific
messages, `InstanceField::Bytes` fallbacks in `walker.rs`, cursor
`take(n)?` reads, fixed-size arrays that cannot fail, and `src/bin`. A
raw-indexed read behind an explicit bounds check becomes `?` only where
that check makes the new `None` arm unreachable. Messages from `anyhow`
errors are kept word for word.
- **`find_subslice`:** one copy, memchr, with the empty-needle guard
kept. It replaces two wrappers and one scalar loop.
- **GUID:** one `guid_string`, now used by three readers. One IFC
GlobalId alphabet. `derive_default_ifc_guid` calls `compress_ifc_guid`.
- **`src/native_json.rs` (research):** `element_id`, `element_id_i64`,
`finite_triple` and `agree`, shared by twelve `native_*` and partition
modules. Variants with different semantics stay.
- **`src/vector_math.rs` (private):** `sub`, `dot`, `cross`, `distance`
and `polygon_area_xy`. Expressions are token-identical to the copies
they replace. `from_decoded::polygon_area_sqft` keeps its public path.
The three point-in-polygon copies and the signed areas differ and stay.
- **Storeys:** one `elevation_storey_name`.
- **ArcWall scan:** memoised on `RevitFile` per release and
`WalkerLimits` (`memoised_arc_wall_scan`). The production walk, the
partition assembler and both IFC-export sites share it. The public
`scan_partition_arc_walls_with_limits` keeps its signature.
- `changelog.d/changed/arc-wall-scan-memo.md`.

No public signature changes. `fuzz/` and `rvt-probes` call public items
only.

## Testing

- No local build, by policy. A side agent wrote the commits, and I read
every diff.
- The branch's new `use crate::le_bytes;` imports made four
`crate::le_bytes::` paths already on `main` redundant, which
`unused_qualifications` (an error under `-D warnings`) would have
rejected. They are fixed in `ac976268`.
- CI is the compiler, with clippy and rustdoc under `-D warnings`, MSRV
and i686.
- Measure
[41037020175](https://github.com/DrunkOnJava/rvt-rs/actions/runs/41037020175),
unfiltered against `main` with nordic and r2025:
- The other 30 models are byte-identical on both sides: every
`ifc.sha256`, every `diagnostics.json` and all scorer outputs (1,262
files on the head side).
- The BIM4LCA office's host was unreachable during the base run, so the
office was **NOT MEASURED** on the `main` side.
- Its head-side export, diagnostics and every scorer output are instead
identical to those of #1074's head (run 41025987689, commit 60be7324).
Every PR merged since then (#1133, #1134, #1135, #1137) leaves the
export path untouched.
- `CI passed`, including clippy and rustdoc under `-D warnings`, MSRV
and i686.

## Found, not changed

`partition_scanner.rs:239/449` can index `buf[offset + 3]` past the end
when a tag matches in a buffer's last three bytes. That is a panic on
hostile input, so it will be fixed in its own PR rather than in a
behaviour-preserving refactor.

## Breaking changes

None.

## Related issues

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