Skip to content

fix(statistical): MAXA/MINA ignore a Zoned value that MAX/MIN treat as an error #781

Description

@hhimanshu

What

MAX/MIN consult stat_helpers::zoned_extreme before their argument loop. MAXA/MINA never have. So the same arguments produce an error from one pair and a confident answer from the other:

=MAX (TZDATETIME(2026,1,1,0,0,0,"UTC"), DATE(2020,1,1))   #VALUE!
=MAXA(TZDATETIME(2026,1,1,0,0,0,"UTC"), DATE(2020,1,1))   43831   ← the zoned value silently dropped

Value-changing variants too:

=MAXA(43831, DATE(2021,1,1), <zoned>)   43831 → 44197
=MINA(5, <zoned>, DATE(2021,1,1))       5 → 5, now date-typed

86 rows in a reviewer's differential.

Why now

Before dates were folded into the A-variants, both pairs answered an error for a zoned/date mix. Now one errors and the other answers a date with no indication the zone-aware value was dropped.

That is the recurring failure mode in this area: a visible error becoming a plausible-looking value. It has already happened twice here — a #REF! becoming a believable 0 via a catch-all, and a #REF! becoming 0 for a date column.

Status: unprobed. Do not fix from reasoning.

No captured row covers a Zoned beside a Date, in either direction. Two defensible answers exist — make the A-variants error like their siblings, or make all four handle the mix — and picking without evidence is what this issue exists to prevent.

Zoned is a truecalc extension with no Sheets equivalent, so the oracle may not be able to answer directly. If it cannot, the decision has to be made explicitly and documented as a truecalc-only rule rather than inferred.

Scope

  • Decide whether Zoned beside a Date is an error or a comparison, and apply it to all four functions.
  • If the oracle cannot settle it, record it as a deliberate truecalc-only decision with its reasoning — not as though it were observed.
  • Prove nothing else moved with a differential against main, reporting the case count.
  • Check any other reducer consulting zoned_extreme for the same asymmetry, and probe rather than assume they behave alike — MIN and MAX looked like they should already agree here and did not.

Acceptance criteria

  • All four functions agree on a Zoned beside a Date
  • The chosen behaviour is either captured or explicitly recorded as a truecalc-only decision
  • No sibling reducer left with the same asymmetry
  • Differential against main with the case count reported
  • CI green

Related

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions