ash-project / ash-project/ash

Possible bug in `Ash.Actions.Update.Bulk.do_run/3`

Open
#1,811 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Elixir
Stars
2.5k
Forks
426
Avg merge
23h 26m
Merged PRs (30d)
46

Description

**Describe the bug**

When using `ash_archival`, `Ash.Actions.Update.Bulk.do_run/8` calls `Ash.Actions.Read.Stream.stream_strategy/3`. If the strategy returned is `:keyset`, `do_atomic_batches/6` is executed, which only applies the `:atomic` strategy. However, the action does not support `:atomic`, causing a failure.

https://github.com/ash-project/ash/blob/c675101316222205b3e3f2a16602763d89ec48e1/lib/ash/actions/update/bulk.ex#L1087

It seems that when `Ash.Actions.Read.Stream.stream_strategy/3` returns `:keyset`, the `:stream` strategy should be applied instead.

**To Reproduce**

I failed to reproduce it in my playground project.

**Expected behavior**

When `Ash.Actions.Read.Stream.stream_strategy/3` returns `:keyset`, the `:stream` strategy should be applied instead of enforcing `:atomic`, ensuring that the requested operation does not fail.

**Runtime**
- Elixir version: 1.18.1
- Erlang version: 27
- OS: mac
- Ash version: 3.4.60
- any related extension versions
- ash_archival: 1.1.1

**Additional context**

Contributor guide

Open the contributing guide

Research direction

Start in lib/ash/actions/update/bulk.ex around the linked call near line 1087. Trace Ash.Actions.Update.Bulk.do_run, Ash.Actions.Read.Stream.stream_strategy/3, and do_atomic_batches/6, then inspect how the :keyset result is handled when ash_archival is involved. Done means the keyset path no longer fails by enforcing an unsupported :atomic strategy and the requested bulk operation completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.