Skip to content

Rehearsal: Calc: a formula reading its own spill area doesn't read its previous result - #32

Closed
prxnvt wants to merge 1 commit into
rehearse/sort-recalc-basefrom
rehearse/sort-recalc
Closed

prxnvt wants to merge 1 commit into
rehearse/sort-recalc-basefrom
rehearse/sort-recalc

Conversation

@prxnvt

@prxnvt prxnvt commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Rehearsal of a fix before it is proposed upstream: one commit on the current upstream main. Not for merging.

…result

A dynamic-array formula whose input overlaps the area it spills into,
such as =SORT(K16:O20) in H12 spilling over H12:L16, read its own
previous spilled values when an edit recalculated it, so it sorted its
old result into the new one. A full recalculation clears every spill
first and reads those cells as empty, so the two disagreed: after
K18=24, H12 showed 0 incrementally and 24 after a full recalculation.
The command-sequence fuzzer found it (seed 107 at 200 seeds).

While a formula is evaluated, the values its old spill left in the
store are not there for it, or for the formulas it reads: cell_value and
range_values read them as empty, as a full recalculation does.
visit_range already leaves areas with spilled values to range_values.
A new array computed in the same pass still reads as before.

Test: a SORT over its own spill area, edited four times, agrees with a
full recalculation after each edit (H12 was 0 instead of 24 before).
@prxnvt

prxnvt commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@prxnvt

prxnvt commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Closed: the same bug is already addressed by an open upstream pull request with a broader fix, which also passes this branch's regression test.

@prxnvt prxnvt closed this Oct 25, 2026
@prxnvt
prxnvt deleted the rehearse/sort-recalc branch October 25, 2026 17:48
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.

1 participant