Closed pshoukry closed 3 weeks ago
Hey @pshoukry thanks for the report, would it be possible to provide a reproduction for this issue? Either in tests or in a reproduction project? It can be difficult to reproduce the exact scenario often, and I'm quite short on time these days.
@zachdaniel working on that and maybe a fix if I can figure it out :)
@zachdaniel the issue mainly happens on context Multi-tenancy. so if you create for example a post with comments on tenant foo
If you have aggregate count :comments_count, [:post, :comments]
and you try to Ash.load(:comments_count, tenant: "foo")
It will sporadically select the count of comments from bar. I am using Dynamic repos with tracer to connect to multiple DBs
I am trying to figure out if this can be reproduced in ash it self or ash_postgreql. but this is the better definition I have for the problem after going through the code a bit.
I am working on a fix but sorry was a bit busy wrapping something.
This is better movied to ash_postgres
Describe the bug count :add_somthign, [:parent, :child, child2] doesn't pass the tenant properly if it was passed ot Ash.load
or any other aggregate
IT drops the tenant on the nested resources.
To Reproduce Ash.load!(:add_somthing, tenant: tenant)
Expected behavior Should run with the poper tenant
Runtime
Additional context Add any other context about the problem here.