Repository navigation
CLI: check subcommand - cached-value calc oracle and XLSX round-trip fidelity on any corpus - #416
Merged
Conversation
…fidelity on any corpus Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 11, 2026
Member
|
Merged — thank you for the contribution! If you haven't already, please join our Discord: https://discord.gg/artcraft |
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.
What changed
New
gridcraft-cli check <file-or-dir>... [--json] [--tolerance 1e-9] [--max-report 20](apps/gridcraft-cli/src/check.rs). It measures calculation correctness and file fidelity on any set of.xlsx/.xlsmfiles and writes nothing next to them.checkreads each file and keeps those cached values, recalculates every formula with GridCraft, and compares the two. Numbers must agree within a relative tolerance (absolute when the magnitude is below 1). Errors must be the same kind. Text and logicals must match exactly.fullCalcOnLoadfiles from libraries that don't calculate, such as xlsxwriter) are counted as no oracle. Volatile formulas, and everything downstream of them in the dependency graph, are counted as volatile. Neither is compared.number → #SPILL!), which tends to group one root cause.--jsongives a machine-readable report for CI or scripts. Usage is documented indocs/cli.md.Why
The parity docs count which functions exist, not whether they return what Excel returns. This gives a repeatable number from real Excel-saved files without needing Excel installed. It's clean-room: it only uses values Excel already wrote into the files.
Current
main(ce0483f) on 40 Excel-saved files (20 calculation-heavy Apache POI test workbooks plus 20 assorted POI/Microsoft sample files):Top primary culprits:
TEXT226 (number-format rendering), formulas with no function call 70,CONCATENATE22, then a long tail. Most come from a few root causes, the biggest being legacy formulas opened without Excel's implicit@. The follow-up PRs listed below each fix part of this. On a local branch with all of them merged (on a slightly oldermain), the same run gave 3 mismatches, all VBA user-defined functions, and 0 round-trip differences.Follow-up PRs, each independent of this one (they don't need the subcommand to build), with the mismatches they remove where measurable:
cm) open with Excel's implicit@and calculate like Excel #417: legacy formulas get Excel's implicit@(645 → 255).?pads thousands separator, TEXT booleans through text section #418:TEXT()/ number-format fractions,?padding, booleans (226TEXTcells → 0)._xlpm.LET/LAMBDA parameters, table names and columns (round trip).cargo xtask cion PRs) and Engine: command-sequence fuzz harness (undo/redo, XLSX round-trip, full-recalc invariants) and the bugs it found #425 (command-sequence fuzzer).Tests
apps/gridcraft-cli/tests/cli.rs::check_exit_codes_and_json: a GridCraft-written workbook matches itself and round-trips (exit 0), the--jsonschema and totals, an unopenable file is reported and fails the run (exit 1), and usage errors exit 2.Commands run:
Docs
docs/cli.md: newchecksection.Not done
cargo xtask ci. It could become a step that fails when the mismatch count goes up.