Repository navigation
refactor: evaluator.ts を分ける(式の文字列・配列の評価) - #188
Merged
Merged
Conversation
…n their own files expressionText.ts holds what reads a formula's text without evaluating it (rendering an operand, string literals, cell references, a call's arguments); arrayEvaluation.ts the element-by-element evaluation of an expression over arrays. Code moved as it was; index.ts exports expressionText so the package's names stay the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
isamu
commented
Oct 21, 2026
| export * from "./formulaError"; | ||
| export * from "./spreadsheet-errors"; | ||
| export * from "./evaluator"; | ||
| export * from "./expressionText"; |
Member
Author
There was a problem hiding this comment.
CODEX VERDICT: CHANGES REQUESTED
- P2 public-surface compatibility: at
src/engine/index.ts:21,export * from "./expressionText"re-exports the moved helpers as intended, but it also newly exportsevaluateOverArraysfromsrc/engine/arrayEvaluation.ts:79. That is an unintentional public API addition in a refactor whose stated contract is unchanged exports. Every occurrence of this issue is the single newexport function evaluateOverArrayscombined with the singleexport * from "./expressionText"barrel at those sites. Smallest fix: removeexportfromevaluateOverArrays(or explicitly keep it out of the barrel); retain the expression-text re-export so the pre-existing names remain available. What would change my mind: confirmation thatevaluateOverArraysis deliberately part of the public API and this additive surface is documented/desired.
| Axis | Result |
|---|---|
| correctness and edge cases | none |
| security (injection / path traversal / code evaluation) | none |
| tests: does a test go red if the new behaviour breaks | none; focused engine tests passed (303/303), and the supplied differential source reaches both the evaluator path and array formulas, though its .old checkout was absent here so I did not rerun it |
| API / schema / wire / on-disk compatibility | the public API addition above; no schema, wire, or on-disk changes |
| consistency with the rest of the codebase | none |
| i18n lockstep (src/lang has 8 locales) | none; no src/lang files changed |
| TIER C (behaviour preservation: a move of code that every formula passes through; a public export surface) | public export surface finding above; formula-path behavior otherwise preserved |
| move fidelity | none; moved functions match the origin implementation apart from the allowed export changes, hoisted pieceAt, and _cell rename |
| module graph | none; the EvaluatorContext import is type-only, so no runtime cycle is introduced, and function-registry initialization order is unchanged |
| public surface: src/engine/index.ts and package entry points | src/index.ts and src/core/index.ts export lists are unchanged; src/engine/index.ts preserves the moved names but adds evaluateOverArrays |
the differential I ran (corpusdiff.mts, gendiff-cs.mts) |
none found by inspection; both import SpreadsheetEngine through src/engine/index.ts, and the generated corpus includes array expressions, so they reach the moved code |
sha read: 402b7a36abc1f147c14d313feaabf815d2b74546
FINDINGS COMPLETE: I read every hunk of the diff and this is every finding I have.
Member
Author
|
Codex round 1 triage: the one P2 (that |
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
Splits
evaluator.ts, which scoria flags asgod-file(over 500 lines). The code is moved as it was; behaviour does not change.src/engine/expressionText.ts: functions that read a formula's text without evaluating it.renderOperand: writes a value as an operand.maskStringLiteralsandisSafeConcatExpression: check a concatenation's structure.endOfStringLiteral: finds where a string literal ends.findCellRefsandsubstituteCellRefs: find and replace cell references.parseFunctionArgs: splits a call's arguments.src/engine/arrayEvaluation.ts: evaluating an expression over arrays (A1:A3*2) element by element,evaluateOverArraysand its internal pieces.evaluator.tskeeps the evaluation itself (evaluateFormulaand what it calls).dateDisplay.ts,functions/logical.tsand four tests.Items to Confirm
src/engine/index.tsnow hasexport * from "./expressionText"besideexport * from "./evaluator", so the names the package exports are unchanged. This is a re-export, kept because it is the public entry point.origin/main) and new were run side by side and compared: every formula in the tests (corpusdiff.mts) and a run over generated sheets, all identical.pieceAtcaptured nothing, so it moves to module scope; an inner_became_cell.yarn lint,yarn typecheck,yarn build,yarn test,yarn test:engine,run-all-fixtures.tsandtest:evaluatorpass. oxlint reports nothing.User Prompt
🤖 Generated with Claude Code
work in GUIChatPluginSpreadsheet