Skip to content

distinguish literal array A-aggregate values - #118

Open
Harrison-Booth wants to merge 673 commits into
mainfrom
gc-build-g720x
Open

Harrison-Booth wants to merge 673 commits into
mainfrom
gc-build-g720x

Conversation

@Harrison-Booth

@Harrison-Booth Harrison-Booth commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Make A-family aggregates count only numeric values in literal arrays, while preserving reference-cell logical/text handling and direct-argument coercion.
  • Apply the shared behavior to MAXA, MINA, AVERAGEA, VARA, VARPA, STDEVA, and STDEVPA.
  • Add provenance regressions and document the distinctions.

Validation

  • cargo fmt --all -- --check passed.
  • git diff --check passed.
  • Rust tests and clippy were not run locally per the task environment instructions; fork CI should run them.
  • Checked literal arrays, actual cell references, and direct arguments in fresh unsaved Excel 16.0 workbooks via COM. The measured values matched the regression expectations. The workbook was closed without saving.

Summary by CodeRabbit

  • Bug Fixes
    • A-family aggregate functions now handle text and logical values according to whether they’re supplied in references, direct arguments, or literal arrays. References count text as 0 and logical values as 1 or 0; literal arrays use numbers only, while direct arguments are coerced.
    • Errors continue to propagate, and blank values are skipped.
  • Documentation
    • Updated the worksheet-function parity notes to reflect the aggregate-function behavior.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

No actionable comments were generated in the recent review.

Walkthrough

A-family aggregate functions now distinguish text and logical values based on whether they come from literal arrays, references, or direct arguments. Tests cover these input types, error propagation, and sample-data requirements. Function descriptions and parity documentation record the distinctions.

Changes: A-family aggregate input handling

Layer / File(s) Summary
Input handling and validation
crates/functions/src/util.rs, crates/functions/src/stat/tests.rs, crates/functions/src/stat.rs, docs/function-parity.md
numbers_a skips text and logical values in literal arrays. References count text as 0 and logical values as 1/0; direct arguments are coerced. Tests check the aggregate functions’ results, error propagation, and sample-data requirements. Function descriptions and parity documentation record these behaviors.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: aiongg, echelon

Merge Risk: Minimal · previous review ad74b

This change makes A-family aggregates (MAXA, MINA, AVERAGEA, VARA, VARPA, STDEVA, STDEVPA) count only numbers in literal arrays. References and direct arguments keep their coercion rules. The tests and documentation match the stated behavior, and no merge-blocking defect was found. One edge case is unconfirmed: aggregates applied to a lambda row parameter such as BYROW's might differ from Excel. This is worth a follow-up check in Excel but should not block merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly identifies the main change: distinguishing A-family aggregate behavior for literal array values. It is concise and related to the changeset.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files. (1 skipped: 1 unsupported.)

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 11bb673 and ad74bb7.

Files selected for processing: 4
  • crates/functions/src/stat.rs
  • crates/functions/src/stat/tests.rs
  • crates/functions/src/util.rs
  • docs/function-parity.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@Harrison-Booth Harrison-Booth changed the title G720: distinguish literal array A-aggregate values distinguish literal array A-aggregate values Oct 31, 2026
echelon and others added 28 commits October 30, 2026 23:03
# Conflicts:
#	docs/function-parity.md
# Conflicts:
#	docs/function-parity.md
# Conflicts:
#	docs/function-parity.md
# Conflicts:
#	docs/function-parity.md
# Conflicts:
#	crates/functions/src/text.rs
#	docs/function-parity.md
# Conflicts:
#	docs/function-parity.md
# Conflicts:
#	crates/functions/src/stat/tests.rs
#	docs/function-parity.md
# Conflicts:
#	crates/functions/src/stat/tests.rs
#	docs/function-parity.md
# Conflicts:
#	crates/functions/src/stat/tests.rs
#	docs/function-parity.md
# Conflicts:
#	docs/function-parity.md
# Conflicts:
#	crates/functions/src/stat/tests.rs
#	docs/function-parity.md
# Conflicts:
#	docs/function-parity.md
# Conflicts:
#	docs/function-parity.md
# Conflicts:
#	docs/function-parity.md
…o eu-strip)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eu-strip)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Preview)

A sheet's view is not an undo step: Excel doesn't undo a switch between
Normal, Page Layout and Page Break Preview, and view.normal,
view.pageLayout and view.pageBreakPreview are noundo here. But undo and
redo swap in a whole snapshot of the workbook, so undoing an earlier edit
put back the view the sheet had then: set A1, switch to Page Break
Preview, undo, and the sheet was in Normal again (redo switched it back).

Undo and redo now keep each sheet's current view (extra::keep_view_modes),
as they already keep the Watch Window list, carrying it through each step
of a multi-step undo or redo. Sheets are matched by name; while a rename
is undone or redone, by position under the name the restored snapshot
doesn't have. A view kept this way doesn't make a saved
workbook dirty, as set_view doesn't.

Tests: undo and redo with each view, undoing a rename and a new sheet, a
rename and a new sheet undone and redone with steps: 2, and redo back to
the saved state staying clean. Each fails without the change (the view
reverted to Normal).
…undo difference

The view commands are not undo steps and don't mark the workbook changed (as in
Excel), so undoing everything leaves a sheet's view mode as it is. The undo
check now resets the view mode with the other view state before comparing.
Seed 177 (`view.pageBreakPreview` on the sales sample) failed the [undo]
invariant without this.
Updates: shared check-result dialog from craft-update
docs: tidy agent, contributor and asset docs
hectorviov and others added 30 commits November 3, 2026 08:52
Addresses review comment 4456174694: the drag/expand cap was half the
window, so in a 400 pt window a ~195 pt bar left the grid about 1.6 pt
under the status bar and sheet tabs. The cap is now also limited by
the room left under the ribbon, keeping the status bar, sheet tabs,
column headings and two rows below the bar.

Test: ui-egui formula_bar_expand::an_expanded_formula_bar_leaves_room_for_the_worksheet_in_a_short_window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ytold#3252, storytold#3239, storytold#3244 and storytold#3268

- storytold#3223: sniff the first 64 KiB for a web page and skip JSON and files over the text-import cap, so
  every CSV/TSV is no longer decoded in full before the size check.
- storytold#3253: SYLK relative offsets use checked arithmetic (no overflow on R[9223372036854775807]); at
  most 1024 column-width records are kept; regression test.
- storytold#3254: a single selected merged cell searches the whole sheet, as one selected cell does.
- storytold#3252: the formula bar's height cap is half the room below the ribbon, not half the window, so
  the worksheet stays visible in a short window (CodeRabbit Major).
- storytold#3239, storytold#3244, storytold#3252, storytold#3268: es/de/cs/zh/ko/ru/pt entries for the new interface strings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… room for the worksheet)

# Conflicts:
#	crates/ui-egui/src/formula_bar.rs
…orytold#3211)

Importing a workbook whose sheets share a name rescanned every sheet for
every suffix tried, so a file of repeated names opened in cubic time.
SheetNames keeps the assigned names and the next suffix per stem.
wrap_lines split an over-long word by re-measuring and copying the
rest of the word for every piece it cut, and only checked its line
limit once the word was done, so one long word in a narrow text box
cost word length x pieces. Each new word also re-measured the whole
line built so far.

Line and piece widths are now running sums of glyph widths (the same
sum text_width makes), so every character is measured once, and the
line limit is checked while a word is being split. The lines produced
are unchanged; a test compares them with the old wrapper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.