Repository navigation
fix(engine): keep rule formulas aligned with structural edits - #1656
harrisonoconnorhover wants to merge 2 commits into
Conversation
FredApps
left a comment
There was a problem hiding this comment.
ReviewerA — source-read COMMENT (not an approval)
I read the head of the diff: rule formulas stay aligned with structural edits. The data validation helper is_literal_list decides whether a list source is a typed list (A1,A2 can look like references but is literal choices) or a formula: a source that starts with a quote is literal, and one without ! is literal unless it parses as a reference or a name. Deciding by parsing is better than looking at the text, but a literal list with one item that happens to be a valid name ("Total") is read as a name, which is Excel's behaviour too (a single word in the list box is taken as a name if one exists). Row and column inserts and deletes must adjust the references in rule formulas and leave literal lists alone; a test with insertion above a rule and a literal list is the proof. I have not run it, and no exact-head CI result exists for this head. Nothing was run.
I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.
Status: waiting_author.
Fixes #1009.
Inserting or deleting rows, columns or cells moved conditional-format and data-validation ranges without updating their formulas. A rule on
C4:C5reading$A4moved toC5:C6but still read$A4, silently changing highlighting and allowed input.Structural edits now adjust conditional-format expressions, comparison bounds and formula-valued color-scale/data-bar/icon thresholds, plus both validation formulas. References from other sheets also follow the edit. When deletion removes a rule's first application cell or area, per-cell-relative formulas are first rebased to the first surviving old cell. Literal validation lists keep their existing interpretation, including choices that look like cell references.
Tests use synthetic workbooks and check formula text, computed highlighting, bar and icon results, accepted/rejected input, undo/redo and XLSX save/reopen. The original contribution established that five regressions failed on unchanged main with stale coordinates before the fix. Additional coverage checks deleted anchors and all threshold fields. No Excel-based parity measurement is claimed.
Validation on macOS arm64 with Rust 1.99.1:
cargo run --locked --offline -p xtask -- cipassed all eight gates: formatting, strict workspace/all-target Clippy, workspace tests, assets, layers, WASM, parity and keytips.28f166d47a2aca36c7f8a55832930e22c15d4856is published unchanged as head02c9f95c662ec2ad7472f8070547a220f4ece13e; the isolated checkout was verified clean at that commit.dv.f2.as_deref().map(fix_rule), fixing the Rust 1.99.1 strict-Clippy failure from the original hosted run. No lint suppression or dependency change was added.The earlier Rust 1.95.0 local run stopped at the unchanged
clippy::collapsible_matchincrates/xlsx/src/xls/mod.rs:273on basef1894c6. That historical toolchain result is separate from the passing full Rust 1.99.1 run above. Windows and Linux runtime behavior was not tested locally.