Skip to content

demonstrate bug with nested calculations that reference the actor via…#716

Merged
zachdaniel merged 1 commit intoash-project:mainfrom
jsw800:demonstrate-bug-with-context-actor-nested-calculations
Mar 17, 2026
Merged

demonstrate bug with nested calculations that reference the actor via…#716
zachdaniel merged 1 commit intoash-project:mainfrom
jsw800:demonstrate-bug-with-context-actor-nested-calculations

Conversation

@jsw800
Copy link
Copy Markdown
Contributor

@jsw800 jsw800 commented Mar 17, 2026

… context

I've on occasion used the actor in the context arg on a calculation. This can be useful to use instead of ^actor(...) templates in some scenarios for a few reasons, but those reasons aside, it's something that definitely feels like should be supported as things are currently written.

I've run into this issue though, where if a calculation references another calculation, when expression/2 is called on the calculation module, the actor passed to the calculation module is nil, even when an actor is passed to the query that loaded the calculation. It seems like wherever the "inner" calculation's expression callback is called, the framework is not managing to pass the actor through to it, so things don't function as expected. I've tried to figure out where this is, and I do not know if it is in ash core or ash_postgres.

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

@zachdaniel zachdaniel merged commit 72dc741 into ash-project:main Mar 17, 2026
64 of 67 checks passed
@jsw800 jsw800 deleted the demonstrate-bug-with-context-actor-nested-calculations branch March 18, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants