fix: bound ParserWithCaching cache growth (HF-105) - #1760
Conversation
|
@Tobiadefami thanks for the pull request. No CLA step needed here — our records show you signed the Contributor License Agreement on 2026-07-31. That signature came from our previous signing form and has been carried over, so there is nothing for you to re-sign. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 28cf3ce. Configure here.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
hyperformula-docs | 5aaeae0 | Commit Preview URL Branch Preview URL |
Sep 10 2026, 09:40 AM |
Performance comparison of head (5aaeae0) vs base (c920375) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1760 +/- ##
===========================================
+ Coverage 97.32% 97.33% +0.01%
===========================================
Files 195 195
Lines 15739 15762 +23
Branches 3390 3471 +81
===========================================
+ Hits 15318 15342 +24
+ Misses 421 412 -9
- Partials 0 8 +8
🚀 New features to boost your workflow:
|

Context
Addresses HF-105: unbounded growth of the
ParserWithCachingcache.Repeatedly replacing a cell with distinct formulas retained every parsed formula for the lifetime of the engine, even with undo disabled. This change bounds the parser cache with least-recently-used eviction and adds
maxParserCacheSize(default 10,000;0disables caching).Undo and clipboard snapshots now retain parsed formula (AST) references directly. Restoration rebuilds parsing metadata when an entry has been evicted, preserving undo/redo, paste, and structural operations. A Map plus a doubly linked list keeps promotion and eviction efficient. The limit controls cache entries, not formulas still needed by the workbook, undo history, or clipboard.
Updates include API documentation, the performance guide, developer notes on formula ownership, and changelog entries linked to this PR.
How did you test your changes?
Validation on Node 22:
npm run test:jest -- --maxWorkers=2: 505 suites and 6,267 tests passed; 3 existing skips.npm run test:browser: Chrome and Firefox each passed 6,267 tests, with 3 existing skips.npm run compile,npm run verify:typings, andnpm run lintpassed; lint reported warnings but no errors.npm run test:performancepassed all five build and five CRUD benchmarks.After removing the redundant existing-entry branch in
Cache.set(), all 36 tests in four focused cache suites passed, along with production type checking, lint forCache.ts, andgit diff --check. The focused coverage run covered every executable line in theCacheclass.Types of changes
Related issues:
Fixes #1635.
Checklist:
Note
Medium Risk
Touches parser caching, undo/redo snapshots, and clipboard restore;
ClipboardCellFormulanow exposesastinstead ofhash, which may affect TypeScript integrators.Overview
Adds
maxParserCacheSize(default 10,000,0disables caching) so the parser AST cache is LRU-bounded instead of growing without limit in long-running workloads.Because cache entries can be evicted, undo snapshots, clipboard formula cells, and formula restore paths now retain
Astreferences (not parser hashes). Restoration goes throughfetchCachedResultForAst/setFormulaToCellFromAst, which rebuild parsing metadata when the cache no longer has the entry. Docs and changelog describe the new option and parser-cache ownership.Reviewed by Cursor Bugbot for commit 2ad5b30. Bugbot is set up for automated code reviews on this repo. Configure here.