Skip to content

test: cover two ash_sql sort bugs - #858

Merged
zachdaniel merged 1 commit into
ash-project:mainfrom
jeroen11dijk:test-uniq-aggregate-sort-and-join-subquery-sort
Sep 19, 2026
Merged

zachdaniel merged 1 commit into
ash-project:mainfrom
jeroen11dijk:test-uniq-aggregate-sort-and-join-subquery-sort

Conversation

@jeroen11dijk

Copy link
Copy Markdown
Contributor

These tests show two sort bugs in ash_sql. The fix is in ash-project/ash_sql#263. Three of the five tests fail without the fix.

The other two tests pass with the fix and without it. This is correct. They make sure that the fix does not remove all sorts. One commit contains all the tests, because post.ex has changes for both tests.

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

Sorted uniq? aggregates: two shapes that produced
`array_agg(DISTINCT x ORDER BY y)` and failed with postgres 42P10 — an
aggregate carrying its own `sort`, and one inheriting a `sort` from the
relationship it traverses.

Join subquery sorts: `Comment.sorted_post` points at a read action that sorts,
so the join subquery built for that belongs_to carried an ORDER BY the join
immediately discards. Also asserts the read action still sorts when read
directly.

Both require the matching ash_sql fix.
@zachdaniel
zachdaniel merged commit e276391 into ash-project:main Sep 19, 2026
106 of 126 checks passed
@zachdaniel

Copy link
Copy Markdown
Contributor

🚀 Thank you for your contribution! 🚀

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.

2 participants