Skip to content

HF-270: Exporter honours evaluateNullToZero for bare empty cells - #1738

Open
marcin-kordas-hoc wants to merge 2 commits into
developfrom
spike/hf270-null-to-zero
Open

HF-270: Exporter honours evaluateNullToZero for bare empty cells#1738
marcin-kordas-hoc wants to merge 2 commits into
developfrom
spike/hf270-null-to-zero

Conversation

@marcin-kordas-hoc

@marcin-kordas-hoc marcin-kordas-hoc commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Fixes HF-270: the evaluateNullToZero config option is honoured by the interpreter (a formula reading an empty cell already coerces empty → 0) but was ignored by the Exporter, which always returned null for a bare empty cell read directly — so with the flag on, getSheetValues over [[null, '=A1']] gave [[null, 0]].

What changed

The Exporter's EmptyValue branch returns 0 when config.evaluateNullToZero is true, null otherwise. Default behaviour (flag off/absent) is byte-identical. ISBLANK still reports true for the bare empty cell either way. The CHANGELOG entry names the caveat: code relying on null from getCellValue to distinguish truly-empty from computed-zero under this flag should use ISBLANK instead.

Implemented independently from the task description (not taken from the fork referenced there).

Verification

Paired tests: hyperformula-tests@spike/hf270-null-to-zero (22 assertions across getCellValue / getSheetValues / ExportedCellChange / ISBLANK / default-off). tsc --noEmit clean, eslint --quiet clean.

🤖 Generated with Claude Code


Note

Medium Risk
Changes observable API output for consumers with evaluateNullToZero: true; default-off behavior is unchanged but callers relying on null for empty cells may need to adjust.

Overview
Aligns exported cell values with formula evaluation when evaluateNullToZero is enabled: bare empty cells now surface as 0 through the export layer instead of always null.

Exporter.exportValue checks config.evaluateNullToZero on EmptyValue and returns 0 or null accordingly, so getCellValue, sheet value getters, and ExportedCellChange match the interpreter’s empty→zero behavior. With the flag off, behavior is unchanged. Integrators who used null from getCellValue to distinguish empty from zero under this flag should use ISBLANK instead.

Reviewed by Cursor Bugbot for commit b1c3f34. Bugbot is set up for automated code reviews on this repo. Configure here.

With evaluateNullToZero: true the interpreter already coerced empty -> 0
inside formulas, but the Exporter returned null for a bare empty cell read
directly - getSheetValues over [[null, '=A1']] gave [[null, 0]]. The
EmptyValue branch now returns 0 when the flag is on; default behaviour is
byte-identical, ISBLANK still reports true. CHANGELOG names the caveat:
code using null to distinguish truly-empty under this flag needs ISBLANK.

Implemented by a prep-ship lane (task HF-270), loop green after 1
iteration; verified: authored specs 22/22, eslint clean, tsc clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PdHPZAjciZFWqGa19Yf7it
@qunabu

qunabu commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
hyperformula-docs b1c3f34 Commit Preview URL

Branch Preview URL
Aug 31 2026, 05:19 AM

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

Performance comparison of head (b1c3f34) vs base (114fd5d)

                                     testName |    base |    head | change
--------------------------------------------------------------------------
                                      Sheet A |  397.42 |  407.04 | +2.42%
                                      Sheet B |  132.11 |  136.03 | +2.97%
                                      Sheet T |  113.36 |  113.38 | +0.02%
                                Column ranges |   418.3 |   422.1 | +0.91%
                                Sorted lookup | 12774.3 | 12760.3 | -0.11%
Sheet A:  change value, add/remove row/column |   14.84 |   13.56 | -8.63%
 Sheet B: change value, add/remove row/column |  130.62 |  121.19 | -7.22%
                   Column ranges - add column |  134.71 |  136.89 | +1.62%
                Column ranges - without batch |  412.12 |  401.56 | -2.56%
                        Column ranges - batch |  105.38 |   99.08 | -5.98%

@marcin-kordas-hoc
marcin-kordas-hoc marked this pull request as ready for review August 18, 2026 05:48
@marcin-kordas-hoc

Copy link
Copy Markdown
Collaborator Author

Paired tests PR: handsontable/hyperformula-tests#39 — merge it BEFORE this one.

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.33%. Comparing base (114fd5d) to head (b1c3f34).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1738      +/-   ##
===========================================
+ Coverage    97.32%   97.33%   +0.01%     
===========================================
  Files          195      195              
  Lines        15739    15739              
  Branches      3390     3391       +1     
===========================================
+ Hits         15318    15320       +2     
+ Misses         421      419       -2     
Files with missing lines Coverage Δ
src/Exporter.ts 89.33% <100.00%> (+2.66%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants