Ash.update! with :load does not seem to respect manual relationships

Hi. I have implemented a manual relationship used in has_one relationship on my Resource. It fetches the most recent commit from a git repository modeled by the Resource Commit.

My relationship looks something like this:

# Repo.ex
has_one :most_recent_commit, Commit do
    manual Relationships.MostRecentCommit
end

# Commit.ex
action :read do
   primary? true
   argument :ref, :string, allow_nil?: false
   argument :repo_path, :string, allow_nil?: false
   get?: true
end

When using:

Repo.update(repo, %{title: "Foo"}, actor: ..., load: [:most_recent_commit])

I get the following error:

      %KeyError{key: :ref, term: %{}, message: nil}
       (myapp 0.1.0) lib/myapp/commit/actions/read.ex:12: MyApp.Commit.Actions.Read.read/4
       (ash 3.4.8) lib/ash/actions/read/read.ex:2584: Ash.Actions.Read.run_query/4
       (ash 3.4.8) lib/ash/actions/read/read.ex:1032: Ash.Actions.Read.reselect_and_load/6
       (ash 3.4.8) lib/ash/actions/read/read.ex:255: Ash.Actions.Read.do_run/3
       (ash 3.4.8) lib/ash/actions/read/read.ex:81: anonymous fn/3 in Ash.Actions.Read.run/3
       (ash 3.4.8) lib/ash.ex:1841: Ash.load/3
       (ash 3.4.8) lib/ash/actions/read/relationships.ex:369: anonymous fn/5 in Ash.Actions.Read.Relationships.do_fetch_related_records/4
       (ash 3.4.8) lib/ash/actions/read/relationships.ex:65: Ash.Actions.Read.Relationships.fetch_related_records/3
       (ash 3.4.8) lib/ash/actions/read/relationships.ex:24: Ash.Actions.Read.Relationships.load/3
       (ash 3.4.8) lib/ash/actions/read/read.ex:293: Ash.Actions.Read.do_run/3
       (ash 3.4.8) lib/ash/actions/read/read.ex:81: anonymous fn/3 in Ash.Actions.Read.run/3
       (ash 3.4.8) lib/ash.ex:1841: Ash.load/3
       (ash 3.4.8) lib/ash/actions/update/bulk.ex:2434: Ash.Actions.Update.Bulk.load_data/5
       (ash 3.4.8) lib/ash/actions/update/bulk.ex:587: Ash.Actions.Update.Bulk.do_atomic_update/5
       (ash 3.4.8) lib/ash/actions/update/bulk.ex:260: Ash.Actions.Update.Bulk.run/6
       (ash 3.4.8) lib/ash/actions/update/update.ex:157: Ash.Actions.Update.run/4
       (ash 3.4.8) lib/ash.ex:2643: Ash.update/3

If I instead of using :load do a repo |> Ash.load!([:most_recent_commit]) after the call to update - everything works fine.

This happens when trying to access arguments in the query of the ManualReadAction.
It normally these arguments would be provided by the manual relationship implementation, but it seems like the manual relationship module is skipped completely and the has_one relationship :most_recent_commit uses the primary read action directly on the destination resource.

Hey! Could you please put together a reproduction? Either as a git repo I can clone or as a test in ash or ash_postgres?

You can quickly create a new project to test with igniter:

mix archive.install hex igniter_new
mix igniter.new reproduction --install ash,ash_postgres

Will do when I get a moment. Thanks for the reply.