Ash Weekly: Issue #15
Tidewave & Ash, better authorization errors in AshJsonApi & AshGraphql, Inertia support for Ash errors, Tidewave & Inertia get igniter installers.
Ash Weekly!
Welcome to Ash Weekly — your quick, informal digest of what’s new and notable in the world of Ash Framework. Got something cool? Drop it in the #showcase channel on Discord!
Shameless Plugs
Check out Ash Premium Support from Alembic.
Sponsor me if you like what I do.
Tidewave & Ash
Dashbit released a fancy and awesome new MCP tool called Tidewave. Its innovative mechanism of providing information to agents from your running application make it clear that having introspection tools and functions in your application are going to be a superpower. Luckily for Ash, thats kind of our whole thing! However, we want to make those tools high level and accessible, so you can drop something into your rules file telling the agent to use those for general application information. To that end, we’ve started adding high level functions to a new module called `Ash.Info`. Try telling your agent to eval these functions at the beginning of a thread to get an idea of how your application is structured. The currently available functions are:
`domains/1` lists the domains for an otp app
`domains_and_resources/1` returns a map of all domains and the resources they contain
`mermaid_overview/2` returns a mermaid chart describing the domain at a high level
Got ideas? Let us know!
In general, Ash code is very high information density, well structured, and easy to manipulate, so we believe that in a world that is increasingly agentic, we’re poised for success 😎. I’ve personally found that a decently structured rules file + Tidewave + Ash produces the best agentic Ash development experience I’ve seen to date, so give it a shot and tell us how it goes!
Better Authorization errors in AshJsonApi & AshGraphql
Generally speaking, policies on update actions are split into two concepts: the policies for reading data and the policies for updating that data. When using bulk actions, like `AshGraphql` and `AshJsonApi` do, the default behavior is to apply both sets of policies as filters. For update mutations/JSON API endpoints, however, it’s far more semantic for the *read* policies to be a filter, and the *update* policies to be an *error*. So if you can’t read the record, you get a 404, and if you can’t update it, you get a 403. A new backwards compatibility configuration has been added to each project to opt into this new nicer behavior for update & destroy actions. Keep in mind that your API consumers may have come to rely on this behavior. In the next major release, this will be made toggle-able per action and will default to the new value. Newly generated applications opt into this by default.
Inertia Support for Ash Errors
The latest version of `ash_phoenix` includes an implementation of the new `Inertia.Errors` protocol for Ash errors, changesets, queries, action inputs and forms. This allows an inertia action to be implemented quite cleanly:
Tidewave & Inertia Get Igniter Installers
We’re still working on the Inertia igniter installer, but Tidewave can now be installed with Igniter! The fact that it can be installed with igniter is .01% as cool as the fact that it exists, but its still a good sign that Igniter has a shot at becoming a ubiquitous installation and getting started tool across the Elixir ecosystem 🎉
Releases
Ash: 3.5.7-3.5.8
Add `rem/2` expression
Add `Ash.Info` for general application introspection
Skip read actions when the filter is `false`. It can’t return anything, so why bother hitting the database?
Add a value generator for `Ash.Type.Union`
Better inspect behavior, hiding empty calculations & aggregates, with new configuration in the `resource` section.
Added a new builtin `:tuple` type, which stores data as a map if used as an attribute
Support descriptions on map/keyword/struct/union fields
Accept a `context` option when calling generic actions via code interfaces, like other code interfaces do
AshGraphql: 1.7.9
Add `authorize_update_destroy_with_error?` config. See the section above for more.
Use new descriptions from map/struct/keyword/union types in generated types
AshJsonApi: 1.4.30
Add `authorize_update_destroy_with_error?` config. See the section above for more.
Use new descriptions from map/struct/keyword/union types in generated types
AshAuthentication: 4.7.6
Support installing AshAuthentication on top of existing user resources
AshPhoenix: 2.3.0
Add `Inertia.Errors` implementation, see above for more.