---
title: "explain"
description: "Show which grants decide an action for each fixture subject, with the deny that won and the grants passed over."
source: "https://permdock.com/docs/cli/explain"
---

# explain

Source: https://permdock.com/docs/cli/explain

Show which grants decide an action for each fixture subject, with the deny that won and the grants passed over.

`permdock explain <action>` decides every fixture for one permission key with `explain: true` and prints the trace: the grant that granted or asked for approval, the denial reasons, every deny that matched and each grant passed over with the reason. It reads the same fixtures as [`rls verify`](/docs/cli/rls) and [`diff --impact`](/docs/cli/diff), and changes nothing.

## Usage [#usage]

```bash
permdock explain post.update
permdock explain invoice.send --fixtures ./fixtures.ts --json
```

| Flag | Meaning |
| --- | --- |
| `--policy <module>` | Module exporting the policy; default `policy` in the config |
| `--fixtures <file>` | Fixtures file; default `rls.fixtures` in the config, else `rls.fixtures.json` |
| `--json` | Print `{ action, rows: [{ subject, tenant, outcome, matched, denials, evaluated, allows, denies, skipped }] }` |

```text
post.read: 1 fixture(s)
u1: granted by member; 3 grant(s) evaluated
  passed over: admin allow (role)
```

A row adds `expected` when the fixture's `expected` differs from the outcome. A fixture for another action is not shown; an action no fixture checks prints `explain: no fixture checks <action>`. An action the policy does not declare exits 2 with `config_invalid`.

## Why [#why]

`can()` answers yes or no, and a denial names a reason but not the grant that lost. The trace from `permdock.explain()` names them, and running it over the fixtures answers "why can't this user do this" without a debugger or a database. The trace never reaches a `DecisionSink` ([decisions](/docs/concepts/decisions)).

## Side effects [#side-effects]

| Command | Effects |
| --- | --- |
| `permdock explain` | None |
