I have 2 resources: X.Core.Project (api: X.Core) and X.Core.Call (api: X.Core)
Project has_many :calls
Project has a count :count_calls, :calls
Project has a calculation calculate :why_you_no_work, :boolean, expr(count_calls == 0)
X.Core has
authorization do
authorize :by_default
require_actor? true
end
this works:
Ash.get!(X.Core.Project, "some-id", actor: actor) |> Ash.load!([:count_calls], actor: actor)
and this fails:
Ash.get!(X.Core.Project, "some-id", actor: actor) |> Ash.load!([:count_calls, :why_you_no_work], actor: actor)
with the following stacktrace:
** (Ash.Error.Forbidden) Forbidden
* The api X.Core requires that an actor is provided at all times and none was provided.
(elixir 1.16.2) lib/process.ex:860: Process.info/2
(ash 2.21.12) lib/ash/error/exception.ex:59: Ash.Error.Forbidden.ApiRequiresActor.exception/1
(ash 2.21.12) lib/ash/actions/helpers.ex:167: Ash.Actions.Helpers.add_actor/3
(ash 2.21.12) lib/ash/actions/helpers.ex:110: Ash.Actions.Helpers.set_opts/3
(ash 2.21.12) lib/ash/actions/helpers.ex:101: Ash.Actions.Helpers.add_process_context/3
(ash 2.21.12) lib/ash/query/query.ex:462: Ash.Query.for_read/4
(ash 2.21.12) lib/ash/filter/filter.ex:3550: Ash.Filter.do_hydrate_refs/2
(ash 2.21.12) lib/ash/filter/filter.ex:3715: anonymous fn/3 in Ash.Filter.do_hydrate_refs/2
(elixir 1.16.2) lib/enum.ex:4839: Enumerable.List.reduce/3
(elixir 1.16.2) lib/enum.ex:2582: Enum.reduce_while/3
(ash 2.21.12) lib/ash/filter/filter.ex:3714: Ash.Filter.do_hydrate_refs/2
(ash 2.21.12) lib/ash/filter/filter.ex:3223: Ash.Filter.resolve_call/2
(ash 2.21.12) lib/ash/resource/calculation/expression.ex:107: Ash.Resource.Calculation.Expression.select/3
(ash 2.21.12) lib/ash/query/query.ex:1331: Ash.Query.select_and_load_calc/3
(ash 2.21.12) lib/ash/query/query.ex:1285: Ash.Query.load_resource_calculation/4
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.21.12) lib/ash/api/api.ex:2480: Ash.Api.load/4
(ash 2.21.12) lib/ash/api/api.ex:2460: Ash.Api.load/4
(ash 2.21.12) lib/ash/api/api.ex:2429: Ash.Api.load!/4
(elixir 1.16.2) elixir.erl:405: :elixir.eval_external_handler/3
(ash 2.21.12) lib/ash/actions/helpers.ex:167: Ash.Actions.Helpers.add_actor/3
(ash 2.21.12) lib/ash/actions/helpers.ex:110: Ash.Actions.Helpers.set_opts/3
(ash 2.21.12) lib/ash/actions/helpers.ex:101: Ash.Actions.Helpers.add_process_context/3
(ash 2.21.12) lib/ash/query/query.ex:462: Ash.Query.for_read/4
(ash 2.21.12) lib/ash/filter/filter.ex:3550: Ash.Filter.do_hydrate_refs/2
(ash 2.21.12) lib/ash/filter/filter.ex:3715: anonymous fn/3 in Ash.Filter.do_hydrate_refs/2
(elixir 1.16.2) lib/enum.ex:4839: Enumerable.List.reduce/3
(elixir 1.16.2) lib/enum.ex:2582: Enum.reduce_while/3
(ash 2.21.12) lib/ash/filter/filter.ex:3714: Ash.Filter.do_hydrate_refs/2
(ash 2.21.12) lib/ash/filter/filter.ex:3223: Ash.Filter.resolve_call/2
(ash 2.21.12) lib/ash/resource/calculation/expression.ex:107: Ash.Resource.Calculation.Expression.select/3
(ash 2.21.12) lib/ash/query/query.ex:1331: Ash.Query.select_and_load_calc/3
(ash 2.21.12) lib/ash/query/query.ex:1285: Ash.Query.load_resource_calculation/4
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.21.12) lib/ash/api/api.ex:2480: Ash.Api.load/4
(ash 2.21.12) lib/ash/api/api.ex:2460: Ash.Api.load/4
(ash 2.21.12) lib/ash/api/api.ex:2429: Ash.Api.load!/4
iex:12: (file)
is this a bug or am I missing something?