feat: clarity integration for interactive permission exploration#7
Open
barnabasJ wants to merge 1 commit intoclaude/fervent-bhabha-f3e38ffrom
Open
feat: clarity integration for interactive permission exploration#7barnabasJ wants to merge 1 commit intoclaude/fervent-bhabha-f3e38ffrom
barnabasJ wants to merge 1 commit intoclaude/fervent-bhabha-f3e38ffrom
Conversation
Optional Clarity integration that surfaces AshGrant's DSL in the Clarity LiveView dashboard: - Vertex types for scopes, grants, and field groups — rendered as first-class nodes beneath their resource/domain with tooltips, source locations, and group labels. - Introspectors that emit those vertices for every AshGrant-enabled resource and AshGrant.Domain-configured domain. - Static markdown content tabs — resource/domain permissions overview plus a detail page per new vertex type. - LiveView actor explorer on resources: enter an actor id to see every action's allow/deny status, click "explain" to render the full AshGrant.Explanation output. Maps resolver errors (:actor_loader_not_implemented, :actor_not_found) to inline banners. - Lensmaker that contributes a "Permissions" lens and enhances the built-in "Security" lens to include AshGrant vertex types. Clarity is declared optionally via the CLARITY_VERSION environment variable so our published hex dep keeps working with igniter 0.7; consumers who use both libraries activate the integration via the Code.ensure_loaded guards.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on top of #6. Adds an optional Clarity integration that surfaces AshGrant in the Clarity LiveView dashboard, so developers can navigate scopes/grants/field groups as first-class graph vertices and explore permissions interactively as a specific actor.
Scope,Grant,FieldGroup— implementClarity.Vertexplus the tooltip / graph-group / shape / source-location providers.Clarity.Vertex.Ash.ResourceandClarity.Vertex.Ash.Domain, emit the new vertices viaAshGrant.Info/AshGrant.Domain.Info.AshGrant.Introspect.actor_permissions_by_id/3to show allow/deny per action, and drills intoAshGrant.Introspect.explain_by_identifier/1for the fullAshGrant.Explanation.to_string/2output. Maps:actor_loader_not_implemented,:actor_not_found, and anonymous-resolver cases to inline banners.Every module is wrapped in
Code.ensure_loaded(Clarity)+Code.ensure_loaded(Phoenix.LiveView)guards, so AshGrant continues to compile and run unchanged when Clarity is absent. When consumers add both libraries to their app the integration activates automatically.Dependency wiring
Published Clarity 0.4 requires
igniter ~> 0.6.25, which conflicts with ash_grant's lockedigniter 0.7.9. To keep hex releases unblocked, Clarity is declared through aCLARITY_VERSIONenv-var escape hatch (same shape as the existingASH_VERSION/SPARK_VERSIONhelpers):CLARITY_VERSION=local CLARITY_LOCAL_PATH=/path/to/clarity mix test CLARITY_VERSION=0.4 mix deps.getEnd-user consumers don't touch the env var — they add
{:clarity, ...}to their own mix.exs, and the guards take care of the rest.Test plan
mix compilesucceeds with and without Clarity presentCLARITY_VERSION=local): 1153 tests, 0 failures (+27 new)