Skip to content

test: cover the sort on a from_many? relationship reached through an aggregate - #873

Merged
zachdaniel merged 1 commit into
ash-project:mainfrom
sephianl:test-from-many-aggregate-sort
Sep 28, 2026
Merged

zachdaniel merged 1 commit into
ash-project:mainfrom
sephianl:test-from-many-aggregate-sort

Conversation

@DGollings

@DGollings DGollings commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Apologies for the quick AI PR, but confirmed against my own code plus had it TDDd.
Should solve a simple ordering bug in ash_sql

Description

Regression coverage for ash-project/ash_sql#266, which fixes a from_many? relationship losing its sort when reached through an aggregate. The test belongs here because it needs a SQL data layer.

combination_test.exs already has a test named for this behaviour, but it creates a single comment — every ordering agrees, so the sort is never exercised. These create two, and add a two-hop aggregate to Author so the from_many? hop is not first in the path, which is the case the fix addresses.

Against ash_sql main the two-hop test fails with the aggregate returning "oldest"; with #266 all three pass. The other two pass either way and are here to close the single-row gap, not as regression coverage.

Contributor checklist

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests

…aggregate

The existing coverage in `combination_test.exs` creates a single comment, so
every ordering of the relationship agrees and the sort goes untested. These
use two comments, and add a two-hop aggregate so the `from_many?` hop is not
the first in the path.

Requires ash-project/ash_sql#266.
@zachdaniel
zachdaniel merged commit 63cf7ca into ash-project:main Sep 28, 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