Repository navigation
fix: an Analysis ToolPak function given a logical answers #VALUE! - #682
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Arguments are read in order up to the first error or refused logical; ACCRINT's calc_method and the .INTL weekend still take a logical. Part of #681. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tead of evaluating it again Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t read leaves the logical check undecided Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
Local Codex review ledger (
|
| round | head | result |
|---|---|---|
| R1 | 3-commit head | R1.1: SPARKLINE read ahead draws twice. Rejected. sparklineCells.ts keeps the last chart per cell, so drawing twice sets the same chart again. A chart is shown only where the cell answers "", which a ToolPak function never does. |
| R2 | same | R2.1: arguments read ahead are evaluated twice. Accepted in 772ad2c: values read ahead are kept for the call and the handler's evaluateFormula answers from them. |
| R3 | 772ad2c | LGTM |
| R4 | 772ad2c | R4.1: array expressions in array places are computed ahead (=XNPV(0.1,A:A+0,B:B)). Accepted in 96e94ea: an array place is read only when it is one cell or a written logical, and an argument that is not read leaves the check undecided. |
| R5 | a3e78d0 | LGTM |
| R6 | a3e78d0 | R6.1: a logical computed in an array place is missed. Rejected as a documented limitation (Items to Confirm). Telling one value from an array means evaluating the expression, which R4.1 asked to avoid. The recorded cases put a logical there only as a cell or written. |
| — | 6d0c3bc | merged origin/main (evaluator.ts overlap), so the count restarted. The census rerun against the new main gave the same result. |
| R7 | 6d0c3bc | LGTM |
| R8 | 6d0c3bc | LGTM |
This was referenced Dec 6, 2026
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.
Summary
Part of #681 and #680 (its row 3). An Analysis ToolPak function (
TOOLPAK_FUNCTIONS) now answers#VALUE!when an argument evaluates to a logical: written (=EDATE(45000,TRUE)), from a cell, or computed (=QUOTIENT(5,1=1)). Arguments are read in order, so an error before the logical is answered instead (=EDATE(1/0,TRUE)stays#DIV/0!;=EDATE(TRUE,1/0)is#VALUE!). ACCRINT'scalc_methodand the.INTLweekend still take a logical.src/engine/toolpakLogicalRefusal.ts: the rule as a pure function. It is given a reader per place and stops at the first error or refused logical, so later arguments are never read.src/engine/evaluator.ts: before a ToolPak handler runs, its arguments are read ahead through that reader. Ranges of cells are skipped, and so are arguments that may answer differently when evaluated again (theevaluatesAliketest that range arguments already use).src/engine/emptyArgumentRefusal.ts: exportsisToolPakFunction, so the list stays in one place.tests/engine/test_toolpakLogicalArgument.tsandtests/engine/fixtures/toolpak-logical-argument-excel.json: tests of the rule in both directions, plus every recorded case this change fixes.Items to Confirm / Review
evaluateFormulaanswers from that store, so an argument is not evaluated twice. That is safe because only arguments that evaluate alike are read. Reading stops at the first error. Before that rule, a generated=AMORDEGRC(#VALUE!,…,19:8)written in row 8 read its own cell through implicit intersection and answered#REF!.TRUE/FALSE. Anything else there could be a whole array computed for nothing, such as=XNPV(0.1,A:A+0,B:B). Ranges and draws are not read either. An argument that is not read ends the check undecided, because it might hold an error that comes first:=GCD(NA()+1,FALSE)stays#N/A. As a result, a logical after such an argument is not refused, for example=GCD(A1:A3,TRUE). The same goes for a logical computed in an array place:=WORKDAY(1,5,IF(TRUE,TRUE,FALSE))still answers 6, while a cell or a writtenTRUEthere answers#VALUE!..INTLweekend (index 2) take a logical. The recordedWORKDAY.INTL(…,TRUE)andNETWORKDAYS.INTL(…,TRUE)answers still match.Verification
drive.pyovercensus.mts.tests/engine/formulaGenerator.ts, seeds 11, 22 and 33, 1000 formulas each, on the same 8×8 grid of numbers, logicals, text and errors on three sheets):expression()formulas: none changed out of 3000. The generator calls no ToolPak function.#VALUE!, and each has a logical argument with no error before it. 529 were confirmed automatically. The remaining one,=CONVERT(B2,"#N/A"&2,LET(x,TRUE,x))(old#N/A), has the text"#N/A2"as its second argument, which is not an error, so the logical in the third argument decides.yarn format && yarn lint && yarn build && yarn typecheck && yarn test && yarn test:engine && yarn test:fixtures && yarn qualityall pass.User Prompt
work in GUIChatPluginSpreadsheet
🤖 Generated with Claude Code