Repository navigation
fix(HF-135): enforce array dimensions and spill boundaries #1774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,6 +63,7 @@ export class DependencyGraph { | |
| public readonly lazilyTransformingAstService: LazilyTransformingAstService, | ||
| public readonly functionRegistry: FunctionRegistry, | ||
| public readonly namedExpressions: NamedExpressions, | ||
| private readonly config: Config, | ||
| ) { | ||
| this.graph = new Graph<Vertex>(this.dependencyQueryVertices) | ||
| this.sheetReferenceRegistrar = new SheetReferenceRegistrar(sheetMapping, addressMapping) | ||
|
|
@@ -82,7 +83,8 @@ export class DependencyGraph { | |
| stats, | ||
| lazilyTransformingAstService, | ||
| functionRegistry, | ||
| namedExpressions | ||
| namedExpressions, | ||
| config | ||
| ) | ||
| } | ||
|
|
||
|
|
@@ -468,7 +470,7 @@ export class DependencyGraph { | |
|
|
||
| public isThereSpaceForArray(arrayVertex: ArrayFormulaVertex): boolean { | ||
| const range = arrayVertex.getRangeOrUndef() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a blocker, but worth a follow-up ticket before this ships. Once Example: with The mechanism is pre-existing: a value-blocked array on develop does not re-spill when the blocker is cleared either. But before this change the only way into that state was a collision with a value; now any array near the bottom or right edge gets there. The paired tests only cover recovery by re-entering the formula,
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed as #1785, and the Arrays guide links to it in One correction to the scope: the tests#57 undo and dependency-change tests check that the error stays when the array still doesn't fit. Recovery is only covered via editing the formula and |
||
| if (range === undefined) { | ||
| if (range === undefined || range.exceedsSheetSizeLimits(this.config.maxColumns, this.config.maxRows)) { | ||
| return false | ||
| } | ||
| for (const address of range.addresses(this)) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEV_DOCS.mdasks that deviations from Excel be recorded indocs/guide/list-of-differences.md, and this paragraph introduces one. Measured in Excel Online: only rows are capped for in-memory arrays (=SUM(VSTACK(SEQUENCE(1048576),SEQUENCE(1)))→#NUM!); columns are not (=SUM(HSTACK(SEQUENCE(1,16384),SEQUENCE(1,1)))→ 134225921, and an over-wide array only fails when it spills, with#SPILL!). HyperFormula caps both dimensions and returns#VALUE!. Capping both is a reasonable safety choice. Could you add a row for it? For example: array dimensions vs.maxRows/maxColumns— HyperFormula:#VALUE!for either dimension, including intermediates; Excel:#NUM!for rows only.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an "Array size limits" row to
list-of-differences.mdine450ecb20, using your example:=SUM(VSTACK(SEQUENCE(1048576), SEQUENCE(1)))#VALUE!#NUM!549756338177The Excel column says rows are capped for in-memory arrays but columns aren't, so an over-wide array fails only when it spills, with
#SPILL!. I checked Google Sheets directly: it caps neither dimension (=SUM(HSTACK(SEQUENCE(1,18278),SEQUENCE(1,1)))→167051782, and even a 20-million-cell=SUM(SEQUENCE(20000000))computes).