Skip to content

test(aggregates): cover an overflow below the range and the words sqlite sends - #1019

Merged
abnegate merged 1 commit into
mainfrom
test-overflow-edges
Oct 15, 2026
Merged

abnegate merged 1 commit into
mainfrom
test-overflow-edges

Conversation

@abnegate

@abnegate abnegate commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #1018, tests only.

#1018 held sum() and aggregate() to refuse a double that overflows to INF. These tests also hold them to the cases it left unexercised:

  • Overflow below the range. Two -1e308 rows overflow to -INF. sum() and aggregate([sum]) / aggregate([avg]) refuse it with Exception\Limit:
    • tests/unit/SumOverflowTest.php::testANegativeSumThatOverflowsIsRefused covers SQLite in both fetch modes and Memory.
    • tests/unit/AggregateOverflowTest.php::testAnAggregateThatOverflowsBelowTheRangeIsRefused covers SQLite in both fetch modes, for sum, avg and an unaliased sum.
    • tests/e2e/Adapter/Scopes/DocumentTests.php::testNegativeSumOverflowIsRefused covers every adapter, unfiltered, bounded and filtered. The rows are in their own collection so the unfiltered fast path does not depend on row order.
    • tests/e2e/Adapter/Scopes/AggregationTests.php::testFloatAggregateOverflowIsRefused adds a sunk series for sum and avg.
  • The words SQLite sends. tests/unit/Adapter/SumResultTest.php holds sumOf() to read INF, -INF and Inf as the infinities, NAN as NaN, and any other word as 0.

Against the source before #1018, every new unit case fails. Counting #1018's own cases, the three files fail 6, 9 and 13 cases. All of them pass at main. Pint and PHPStan are clean on the changed files.

🤖 Generated with Claude Code

…ite sends

A sum of two -1e308 rows overflows to -INF the same way two 1e308 rows
overflow to INF, so sum() and aggregate() are now held to refuse it on
SQLite in both fetch modes, Memory and, through the adapter E2E, every
engine. The negative rows sit in their own collection so the unfiltered
fast path stays order-independent.

sumOf() is also held to read INF, -INF, Inf and NAN as the doubles they
name and any other word as 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: utopia-php/database/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 276c7ee4-da84-46c5-ba49-4c5609881746
📥 Commits

Reviewing files that changed from the base of the PR and between 107dbf5 and 1005247.

📒 Files selected for processing: 5
  • tests/e2e/Adapter/Scopes/AggregationTests.php
  • tests/e2e/Adapter/Scopes/DocumentTests.php
  • tests/unit/Adapter/SumResultTest.php
  • tests/unit/AggregateOverflowTest.php
  • tests/unit/SumOverflowTest.php
  • 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

Comment @coderabbitai help to get the list of available commands.

@abnegate
abnegate merged commit 6ca4574 into main Oct 15, 2026
44 of 45 checks passed
@abnegate
abnegate deleted the test-overflow-edges branch October 15, 2026 10:58
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.

1 participant