# Move permission outcome construction out of the UI layer \(\#52050\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f8b74acc0fdff0cbfb233f24088592db1cefba1f)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f8b74acc0fdff0cbfb233f24088592db1cefba1f

Requested commit: f8b74acc0fdff0cbfb233f24088592db1cefba1f

Commit: f8b74acc0fdff0cbfb233f24088592db1cefba1f

Tree: 4c8b5b1b530493a0f0578dd928fb0eab89e05924

Author: Eric Holk

Committer: GitHub

## Message

````
Move permission outcome construction out of the UI layer (#52050)

Follow-up to the terminal permission params refactor, addressing
@benbrandt's [review
feedback](https://github.com/zed-industries/zed/pull/51782#pullrequestreview-2926899804)
about string formatting leaking into the UI layer.

## Changes

### Outcome construction moved to acp_thread

- Added `PermissionOptionChoice::build_outcome(is_allow)` — builds a
`SelectedPermissionOutcome` from a choice, attaching
`SelectedPermissionParams::Terminal` when the choice carries
`sub_patterns`.
- Added
`PermissionOptions::build_outcome_for_checked_patterns(checked_indices,
is_allow)` — handles the `DropdownWithPatterns` per-command checklist
flow, returning `None` when zero patterns are checked (degrading to
once).

The UI's `authorize_with_granularity` no longer does any
`format!("always_allow:{}",...)` string formatting or
`SelectedPermissionParams` construction.

### `option_kind` folded into `SelectedPermissionOutcome`

`SelectedPermissionOutcome` now carries `option_kind:
acp::PermissionOptionKind`, eliminating the separate parameter that was
threaded through the entire `authorize_tool_call` chain:

```
ThreadView::authorize_tool_call
  → Conversation::authorize_tool_call
    → AcpThread::authorize_tool_call
```

Every signature in this chain dropped one parameter.

### `SelectedPermissionParams` removed from UI imports

The type is now only referenced by `acp_thread` (construction) and
`agent` (consumption). The UI passes `SelectedPermissionOutcome`
opaquely.

Release Notes:

- N/A
````

## Parents

- [bcd29c87e9b8cc208132b54a93d1e333dfa138f1](https://git.cafe/gitcafe/zed/commit/bcd29c87e9b8cc208132b54a93d1e333dfa138f1?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f8b74acc0fdff0cbfb233f24088592db1cefba1f?format=markdown)
