Skip to content

fix(viewer): the page bounds what a large or crafted file can make it hold: the tree builds its rows in blocks, and the phase list, the load reports and the saved-parameter answers have limits (#1887) - #1904

Merged
DrunkOnJava merged 2 commits into
mainfrom
fix/1887-viewer-caps
Nov 13, 2026

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

The four findings of #1887, batch 5's audit of the viewer: no injection and no network path for file data was found, and what was found is memory or DOM growth a large or crafted file controls. Each is bounded; the viewer only. No export moves.

  1. The element tree builds its rows in blocks. A group (a storey's categories, a category's elements, an element's parts) builds 500 rows at a time. The groups of a model of up to 150,000 rows are all built when it opens, as they always were (the largest model Measure holds, the BIM4LCA office, exports 91,723 entities); past that a group builds its first block when it is opened, and a "Show more" row at its end builds the next. The filter looks at every element and lists the first 2,000 matches, building their rows, and says "N elements match; the first 2,000 are listed" when there are more. A click on an element in the 3-D view, a jump from the element panel and the storey jump build the row they need first.
  2. The phase field lists at most 200 phases: the first 199 and the last, which is the default; the hint says how many the file names.
  3. loadEvents and the loading card's announcements keep their last 2,000, and the attribute the tests read says how many were dropped (data-load-progress-dropped). The issue says the list is serialised into a DOM attribute on every push; the code writes it three times, at the end of an open (loaded, failed, out of memory), so it is one JSON.stringify of the whole list that was unbounded. The decoder's reports are already one per whole percent of a stage (forward_progress in rvt-wasm/src/lib.rs), a few hundred in an open, so a real file does not reach 2,000: this bounds what a decoder that reports more often would make the page hold.
  4. The saved-parameter answers are bounded in characters as well as in elements (8 Mi characters of JSON, 64 elements), the answer just read always staying; and the address could set the element limit with no upper bound (?parametersRemembered=), so it can now only lower it. An answer measured on the office is about 2,300 characters, so the budget is fifty times what 64 of them come to.

Motivation

#1887. Rows: none to register (no export moves).

Changes

  • viewer/src/main.ts: TreeGroup, buildTreeBlock, fillTreeGroup, updateTreeMore, ensureTreeRow and the "Show more" row; the filter works over treeFilterIndex (every element, by item) and builds the rows it lists before it hides anything; setTreeRowExpanded builds a group's first block on its first opening; selectTreeRow and selectStorey call ensureTreeRow; keepLast for the load records; PHASE_OPTIONS_SHOWN; PARAMETERS_REMEMBERED_CHARACTERS_MOST and parametersLimit. The arrow-key movement is one function, moveTreeFocus, used by every row and by the "Show more" row.
  • viewer/src/styles.css: the "Show more" row.
  • viewer/tests/tree-rows.spec.ts (new) and viewer/tests/parameters-row.spec.ts (one test), viewer/README.md ("Limits on what a file can make the page hold"), docs/viewer-api.md, changelog.d/fixed/1887-viewer-caps.md.

Testing

Unit tests are banned in this repository apart from pure helpers; these are end-to-end tests on a real model.

  • tsc --noEmit over viewer/src with the viewer's own tsconfig.json (noUnusedLocals included): the only errors are the four that come from viewer/pkg/rvt.js not being built here (a local run builds nothing).
  • This PR's CI (head c3af4d9, run 43416451870, CI passed and all three browser legs green): the viewer tests are the first run of this change; measured: the three tree-rows.spec.ts tests pass in leg 2/3 and the characters cache test passes in leg 1/3. tests/tree-rows.spec.ts opens Einhoven twice: whole (the oracle: the tree as it was built before the blocks) and with a block of 3 rows and nothing built up front (?treeRowsShown=3&treeRowsEager=0), opens every group and every "Show more" row, and expects the same elements in the same order; a second test uses Enter on the row and expects the next block and the focus where it was; a third finds an element past the first block with the filter, expects "1 element matches" with only that row visible, and "ifc" to list the first 12 and say so. The cache test in parameters-row.spec.ts (?parametersRememberedCharacters=1) expects only the answer just read to be kept and the older one to be read again. Every existing tree test runs on models built whole, so their rows are where they were.

Not measured: the phase cap (no model has 200 phases) and the load-record cap (2,000 reports) are not reached by any file here, and are not tested; the tree at its real limits (500 and 150,000) is covered only through the address options, which lower them.

Audit-honesty checklist

  • README / docs reflect the current state after this PR (viewer/README.md, docs/viewer-api.md)
  • A user-visible change has its entry as a fragment under changelog.d/
  • 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

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 test fixtures

Breaking changes

A model of more than 150,000 tree rows shows its later groups only when they are opened, and a group of more than 500 children shows 500 and a "Show more" row where it showed all; the filter lists at most 2,000 matches. The address options ?parametersRemembered= can no longer raise the limit above 64.

Related issues

Closes #1887.

… hold: the scene tree builds its rows in blocks, the phase list, the load reports and the saved-parameter answers have limits (#1887)

The scene tree builds each group's rows 500 at a time; models of up to 150,000 rows
are built whole as before, and past that a group builds its first block when opened
and a Show more row builds the next. The filter looks at every element and lists the
first 2,000 matches; a click on an element builds the row it needs. The phase field
lists at most 200 phases, the page keeps at most 2,000 load reports and
announcements, and the saved-parameter answers are bounded to 8 Mi characters of JSON
as well as 64 elements, the answer just read staying. The address can only lower the
cache's limits. No export moves.
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 13, 2026 11:16
#1887)

The first step of a leg fails on a spec file no leg lists; the full CI of #1904 failed on it.
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Approved at c3af4d9 by the review bot as a self-approval, under Griffin's answer of 2026-11-12 ("You are allowed to self-approve"): rvtDevelop's session has not read the head sent to it at about 11:40 UTC. I re-read the whole diff (keepLast and the dropped counters, the phase list, the tree built in blocks with ensureTreeRow, the filter over the whole tree, the saved-parameter cache bounded in characters, the new spec and the leg that runs it) as if another session had written it. The viewer tests of this head passed, the three tree-rows tests in leg 2/3 and the characters cache test in leg 1/3 among them (run 43416451870).

@DrunkOnJava
DrunkOnJava merged commit 78b0f3a into main Nov 13, 2026
39 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1887-viewer-caps branch November 13, 2026 13:08
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.

viewer: phase list, load events, element tree and the parameter cache grow with the file uncapped

1 participant