Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ash.update unloads already loaded relationships when used in other project #517

Closed
jechol opened this issue Mar 26, 2025 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@jechol
Copy link
Contributor

jechol commented Mar 26, 2025

Describe the bug
Ash.update does not unload already loaded relationships in tests within this repo (see:

test "loaded relationships remain loaded after update" do
),
but when used in another project, it does unload them unexpectedly. (See: https://github.com/jechol/ash_update_unload_check/actions/runs/14073633009/job/39412565346)

As you can see in this test file:
https://github.com/jechol/ash_update_unload_check/blob/a734f6e865e50909cb827b9d4a21815efc164e3b/test/ash_update_unload_check/content/author_test.exs#L7
the code is exactly the same as the passing test in this repo, but it fails.

To Reproduce
Clone the following repo and run mix test:
https://github.com/jechol/ash_update_unload_check

Expected behavior
The test should pass.

** Runtime

  • Elixir version: 1.18.0 (same as in ash_postgres repo)
  • Erlang version: 27.0.1
  • OS: macOS / Ubuntu (reproduced on both)
  • Ash version: main branch (4f889a2ea934abb993805059664ccf9b6e63fb10)
  • any related extension versions: N/A
@jechol jechol added bug Something isn't working needs review labels Mar 26, 2025
@zachdaniel
Copy link
Contributor

The difference in the example app was that the config: default_actions_require_atomic?: true

was set, and so it was going down the atomic update path, which had a bug and was not retaining loads. Switching the action in ash_postgres test to an atomic action highlighted the issue.

@jechol
Copy link
Contributor Author

jechol commented Mar 26, 2025

Confirmed that it's fixed on the latest main. Thanks! 🙌
(https://github.com/jechol/ash_update_unload_check/actions/runs/14074461717/job/39414822942)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants