fabro/docs/public
Scott Werner 287afd7928
Hooks: typed end-to-end interpolation, narrow header tokens, fail-closed resolution (#528)
## What

Makes hook interpolation typed end-to-end and fail-closed, and removes
the bespoke template engine on HTTP-hook headers.

- **Typed end-to-end.** Hook `command`, `url`, header values, `prompt`,
and `model` are now carried as a typed `InterpString` from the config
resolve layer all the way to the executor. The executor resolves each
segment at hook fire time from the typed value instead of collapsing it
to a `String` and re-parsing it. This mirrors the MCP transport env
resolution boundary (`resolve_transport_env` / `runtime_mcp_server`).
- **Narrow header tokens.** HTTP-hook headers previously ran through
MiniJinja with an env allowlist
(`TemplateContext::with_env_lookup_allowed`). They now resolve through
the same narrow `{{ ns.NAME }}` token resolver as every other hook field
— no template engine, no allowlist.
- **Fail-closed everywhere.** A missing or out-of-scope `{{ env.* }}` /
`{{ secrets.* }}` token in a command, URL, header, prompt, or model is
now a hard error that blocks the hook rather than firing it with a
half-resolved or empty value. Previously command hooks failed closed but
http/prompt/agent hooks failed open (warned and proceeded), which could
dispatch an HTTP request with an empty credential header or run an LLM
call against a half-rendered prompt. Transport-level outcomes (non-2xx
responses, connection errors, unparseable bodies) stay fail-open.

A follow-up cleanup commit removes the template engine's `env` namespace
(`with_env_lookup` / `with_env_lookup_allowed` / the `EnvLookup`
object), which the header path was the last consumer of.

## How

- `fabro-types` and `fabro-hooks` `HookType` / `HookDefinition` now type
the interpolatable fields as `InterpString`. `InterpString` serializes
as its raw source, so persisted run specs and checkpoints round-trip
unchanged.
- The `fabro-config` resolve layer clones the typed `InterpString`
through instead of calling `as_source()`, so the fields no longer leak
unresolved template text — the old "source preservation" `#[expect]`
annotations on the hook resolvers are gone.
- The executor's single `resolve_interp` helper resolves a typed
`InterpString` and is shared by the command, http, prompt, and agent
paths; resolution failure maps to `HookDecision::Block`, which the
runner already reports loudly (error for blocking hooks, warn for
non-blocking).

## Testing

- New unit tests: fire-time resolution from the typed value (no
re-parse), narrow-token header resolution, and fail-closed behavior for
HTTP url, HTTP header, and prompt hooks on a missing variable (the hook
does not fire and the resolution error surfaces).
- Existing hook tests updated and kept green.
- Gates: `cargo build --workspace`, `cargo +nightly-2026-04-14 fmt
--check --all`, `cargo +nightly-2026-04-14 clippy --workspace
--all-targets -- -D warnings`, and `cargo nextest run` for the touched
crates (`fabro-hooks`, `fabro-types`, `fabro-config`, `fabro-template`,
`fabro-workflow`, `fabro-server`, and the `fabro-cli` hook/config
tests), all green.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 17:07:11 -04:00
..
administration feat(web): add server-managed Environments CRUD settings UI (#462) 2026-06-13 08:44:38 -04:00
agents Hooks: typed end-to-end interpolation, narrow header tokens, fail-closed resolution (#528) 2026-06-30 17:07:11 -04:00
api-reference Hooks: typed end-to-end interpolation, narrow header tokens, fail-closed resolution (#528) 2026-06-30 17:07:11 -04:00
changelog feat(web): add server-managed Environments CRUD settings UI (#462) 2026-06-13 08:44:38 -04:00
core-concepts fix(cli): use server catalog for provider login (#529) 2026-06-26 08:46:38 -04:00
examples feat(sandbox): secure daytona snapshot names (#429) 2026-05-27 11:52:35 -04:00
execution feat(workflow): support overriding cwd for local sandbox provider (#467) 2026-06-14 12:32:32 -04:00
getting-started refactor: rationalize server secret scopes (vault-only for optional int… (#401) 2026-05-25 17:26:01 -04:00
human-tools fix(config): disable Slack unless configured 2026-06-02 18:41:36 -04:00
images Add system resources settings page (#328) 2026-05-20 17:22:53 -04:00
integrations fix(cli): use server catalog for provider login (#529) 2026-06-26 08:46:38 -04:00
languages refactor(docs): split docs/ into public/ and internal/ 2026-04-27 07:21:13 -07:00
logo refactor(docs): split docs/ into public/ and internal/ 2026-04-27 07:21:13 -07:00
reference feat(llm): Amazon Bedrock provider — Converse codec, SigV4 + API-key auth (#459) 2026-06-16 11:46:49 -04:00
tutorials docs: sync product docs with runtime changes 2026-05-26 21:55:17 -04:00
workflows docs: refresh changelog and sync product docs 2026-06-11 11:04:31 -04:00
.mintignore refactor(docs): move .mintignore into docs/public and update skill paths 2026-04-27 07:29:59 -07:00
docs.json feat(llm): Amazon Bedrock provider — Converse codec, SigV4 + API-key auth (#459) 2026-06-16 11:46:49 -04:00
dot-highlight.js refactor(docs): split docs/ into public/ and internal/ 2026-04-27 07:21:13 -07:00
favicon.svg refactor(docs): split docs/ into public/ and internal/ 2026-04-27 07:21:13 -07:00