Skip to content

test: unsorted list aggregates exclude nils - #6

Draft
wtsnz wants to merge 1 commit into
mainfrom
fix/unsorted-list-nil
Draft

wtsnz wants to merge 1 commit into
mainfrom
fix/unsorted-list-nil

Conversation

@wtsnz

@wtsnz wtsnz commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Regression test for list aggregates without a sort including nil values. The fix is in AshSQL: wtsnz/ash_sql#11.

What it checks

A post has comments titled "bbb", nil, "aaa" and "aaa", one of them with no likes. An unsorted query-level list aggregate of their titles must return:

  • ["aaa", "aaa", "bbb"] by default;
  • ["aaa", "bbb"] with uniq?: true;
  • ["aaa", "bbb"] with its own filter (likes > 0);
  • all four titles, nil included, with include_nil?: true.

The list has no sort, so the test compares each result sorted.

Results

  • With the published AshSQL 0.7.6: it fails, returning [nil, "aaa", "aaa", "bbb"] by default.
  • With the AshSQL fix (ASH_SQL_VERSION=local): it passes. The full suite has the same 39 failures as main in the local test database, and nothing new.

This PR depends on that AshSQL fix being released.

Found by

The data-layer conformance suite (wtsnz/ash#7), gap unsorted-list-nil.

A list aggregate leaves out nil values unless include_nil? is true, with
or without a sort. The unsorted case currently keeps them, in AshSQL's
lateral strategy; these tests pass with that fix (ASH_SQL_VERSION=local).
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