mix ash_grant.verify (AshGrant v0.18.0)

Copy Markdown View Source

Runs policy configuration tests.

Usage

# Run all policy tests in default location
mix ash_grant.verify

# Run tests from specific directory
mix ash_grant.verify test/policy_tests/

# Run tests from a YAML file
mix ash_grant.verify priv/policy_tests/document.yaml

# Run with verbose output
mix ash_grant.verify --verbose

Options

  • --verbose - Show detailed output for each test
  • --format - Output format: text (default), json

Permission syntax warnings

After running the tests, this task resolves each policy test actor's permissions and reports deprecated or dead grant syntax — see AshGrant.Permission.diagnostics/1 for the full list of codes.

This only sees grants held by the actors your policy tests declare, so a clean run is not proof that your permission store is clean. Permission strings live in your own database or seeds, which AshGrant cannot reach; to audit all of them, run AshGrant.Permission.diagnostics/1 over your own data:

MyApp.Role
|> MyApp.Repo.all()
|> Enum.flat_map(& &1.permissions)
|> Enum.flat_map(&AshGrant.Permission.diagnostics/1)

YAML tests carry their permissions inline rather than through policy test modules and are not scanned. Warnings never affect the exit code.

Exit Codes

  • 0 - All tests passed
  • 1 - One or more tests failed