feat(html): report the sheet a view cut, and budget its cells - #757
Merged
Conversation
andiwand
force-pushed
the
feat/spreadsheet-cut-reporting
branch
2 times, most recently
from
August 29, 2026 08:21
4a6ed36 to
a9e5ca9
Compare
andiwand
force-pushed
the
feat/spreadsheet-cut-reporting
branch
3 times, most recently
from
August 29, 2026 08:41
8424d2d to
183ab1f
Compare
`spreadsheet_limit` dropped every cell past it and wrote nothing in its place: the `<table>` simply ended, and nothing came back to say so. A reader saw a document that looked complete and was not, and an embedder could only find out by opening the document a second time to measure it. `HtmlView::sheet_cut` answers with the extent the sheet's cells span against the extent the markup carries, or nothing where the view writes every cell. It is measured without rendering and cached, so the host can decide before it renders; a view writing several sheets into one file answers for the first it cut. `spreadsheet_cell_limit` is the second half. As a rectangle alone the limit punished a tall-narrow sheet - 5 columns by 100000 rows is half a million cells and an ordinary export - to guard against a wide one, where 10000x500 is five million and no webview survives it. Budgeting cells and deriving the rows from the width the sheet turns out to have is the same protection with the row cap raised tenfold. Bound in python, jni, wasm and apple; wasm reaches `spreadsheetLimit` for the first time, without which a host there cannot act on the report. Fixes #740 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Re7MMYiM7fL58uELzKGy77
andiwand
force-pushed
the
feat/spreadsheet-cut-reporting
branch
from
August 29, 2026 08:49
183ab1f to
f552d1e
Compare
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.
🤖 Generated with Claude Code
Fixes #740.
spreadsheet_limitdropped every cell past it and wrote nothing in its place: the<table>simply ended, and nothing came back to say so. A reader saw a document that looked complete and was not, and an embedder could only find out by opening the document a second time to measure it — a second parse, for a read-only format, to re-derive what translation had just computed and thrown away.The view property
Nothing where the view writes every cell, and for a view that renders no sheet. Measured without rendering, and cached — so a host can decide before it renders, which is the point. A view writing several sheets into one file (
document.htmlfor a workbook) answers for the first it cut; the remedy — re-render with the limits dropped — is global anyway.No sheet name in the struct: a sheet view's
name()already is one.The cell budget
HtmlConfig::spreadsheet_cell_limit, 500000 cells for one sheet, bounding the rows by how wide the sheet turns out to be:As a rectangle alone the limit punished a tall-narrow sheet — 5 columns by 100000 rows is half a million cells and an ordinary export — to guard against a wide one, where 10000×500 is five million and no WebView survives it. With the budget doing the protecting,
spreadsheet_limitrises from 10000 to 100000 rows. The trade is the other way at the wide end: a sheet 500 columns across keeps 1000 rows where it kept 10000 — which is the protection the rectangle was buying badly, and it is no longer silent.Both halves need the same measurement, so they share one.
What is not changed
The renderer still measures its content extent within the window (
Sheet::content(spreadsheet_limit)). Passingnulloptthere instead looks like a simplification and is not: for a.odswhose cells stop at row 3 but which carries one cell far down, it turned a 3-row render into thousands of empty ones. The cut is measured separately, against the whole sheet — which is exactly what makes it able to say "you are seeing 3 rows of 65364".Bindings
python, jni, wasm and apple. wasm gains
spreadsheetLimittoo — it was never exposed there, and without it a host cannot act on the report.Test