ash-project / ash-project/ash

Policies should have an `applicable_action_types` callback

Open
#2,406 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Elixir
Stars
2.5k
Forks
422
Avg merge
23h 26m
Merged PRs (30d)
46

Description

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

### AI Policy

- [x] I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.

### Is your feature request related to a problem? Please describe.

A lot of policies don't make sense to run on create actions, because they test against the original record. eg. `relates_to_actor_via`. At the moment this will either raise a runtime error, or silently fail.

### Describe the solution you'd like

If each built-in policy could define which action types it worked on, we could emit a compile-time warning if people write policies that don't make a lot of sense or will never pass on a create action.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

No files or tests are named in the issue. Start by locating the built-in policy definitions and the code that validates policies or emits compile-time warnings; determine how action types are represented. Done means built-in policies can declare applicable action types and policies that do not make sense for create actions produce an appropriate compile-time warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.