Repository navigation
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
Conversation
… 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
marked this pull request as ready for review
November 13, 2026 11:16
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). |
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
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.
loadEventsand 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 oneJSON.stringifyof the whole list that was unbounded. The decoder's reports are already one per whole percent of a stage (forward_progressinrvt-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.?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,ensureTreeRowand the "Show more" row; the filter works overtreeFilterIndex(every element, by item) and builds the rows it lists before it hides anything;setTreeRowExpandedbuilds a group's first block on its first opening;selectTreeRowandselectStoreycallensureTreeRow;keepLastfor the load records;PHASE_OPTIONS_SHOWN;PARAMETERS_REMEMBERED_CHARACTERS_MOSTandparametersLimit. 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) andviewer/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 --noEmitoverviewer/srcwith the viewer's owntsconfig.json(noUnusedLocalsincluded): the only errors are the four that come fromviewer/pkg/rvt.jsnot being built here (a local run builds nothing).CI passedand all three browser legs green): the viewer tests are the first run of this change; measured: the threetree-rows.spec.tstests pass in leg 2/3 and the characters cache test passes in leg 1/3.tests/tree-rows.spec.tsopens 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 inparameters-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
viewer/README.md,docs/viewer-api.md)changelog.d/Legal and contribution hygiene
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.