Problem
A few hot paths and explicitly-documented invariants lack tests. Each is small but high-value because regressions would be silent.
Gaps
-
clipboard::adjust_formula clamp behaviour (crates/cell-sheet-tui/src/clipboard.rs:43–47) — negative row_delta / col_delta that would push refs below row/col 0 are clamped via .max(0), but this is untested. Off-by-one here silently mis-paste formulas.
-
.cell round-trip with absolute refs — crates/cell-sheet-core/tests/integration.rs covers basic formula round-trip but not =$A$1+$B$1-style absolute references.
-
:w! overwriting a .cell formula sheet with CSV — AGENTS.md calls this out as an invariant ("CSV export flattens formulas; the :w! force-save flow is what allows CSV to overwrite a formula sheet"). No test covers the path.
-
fn_min/fn_max empty-input semantics — both return 0.0 on empty input (intentional, but undocumented by tests). A future maintainer might "fix" it to be consistent with fn_average (which returns #DIV/0!).
Proposed fix
One PR adding ~6 small tests:
adjust_formula_row_clamps_to_zero and adjust_formula_col_clamps_to_zero in clipboard.rs.
cell_format_preserves_formula_with_absolute_refs in tests/integration.rs.
- TUI integration test for
:w! CSV overwrite of a formula .cell (or document why this lives only in headless tests).
min_empty_returns_zero and count_skips_text_and_empty in functions.rs.
Priority
MEDIUM — pure test additions, no risk, locks in current behaviour.
Problem
A few hot paths and explicitly-documented invariants lack tests. Each is small but high-value because regressions would be silent.
Gaps
clipboard::adjust_formulaclamp behaviour (crates/cell-sheet-tui/src/clipboard.rs:43–47) — negativerow_delta/col_deltathat would push refs below row/col 0 are clamped via.max(0), but this is untested. Off-by-one here silently mis-paste formulas..cellround-trip with absolute refs —crates/cell-sheet-core/tests/integration.rscovers basic formula round-trip but not=$A$1+$B$1-style absolute references.:w!overwriting a.cellformula sheet with CSV — AGENTS.md calls this out as an invariant ("CSV export flattens formulas; the:w!force-save flow is what allows CSV to overwrite a formula sheet"). No test covers the path.fn_min/fn_maxempty-input semantics — both return0.0on empty input (intentional, but undocumented by tests). A future maintainer might "fix" it to be consistent withfn_average(which returns#DIV/0!).Proposed fix
One PR adding ~6 small tests:
adjust_formula_row_clamps_to_zeroandadjust_formula_col_clamps_to_zeroinclipboard.rs.cell_format_preserves_formula_with_absolute_refsintests/integration.rs.:w!CSV overwrite of a formula.cell(or document why this lives only in headless tests).min_empty_returns_zeroandcount_skips_text_and_emptyinfunctions.rs.Priority
MEDIUM — pure test additions, no risk, locks in current behaviour.