fabro/lib
Scott Werner a483402092
Interpolate run variables ({{ vars.* }}) in node prompts and goals (#524)
## What

Threads the run's variable store through the workflow transform pipeline
so
node `prompt`s and the graph `goal` can interpolate `{{ vars.* }}`.

Until now `{{ vars.* }}` only resolved in settings-level fields (e.g.
`run.goal`) via the server-side `substitute_variables` pass. Node
prompts are
DOT graph attributes that pass never touched, so `{{ vars.* }}` in a
prompt
rendered as undefined. This closes that gap.

Builds on the earlier template-context slice (adds `vars` to
`TemplateContext`); this PR wires it end to end.

## How

- `TransformOptions` carries a `vars` map, threaded into the import,
  file-inlining, and template transforms — and propagated into imported
subgraphs, so imported prompts interpolate vars too. Every prompt/goal
render
  context gains the variable map.
- The create API accepts `vars` (`CreateRunInput` →
`preprocess_and_validate` →
  `TransformOptions`).
- The server snapshots its `VariableStore` at run creation
  (`VariableStore::value_map()`) and passes it in — the same store the
  settings-goal substitution already reads.

## Scope decisions

- Goal `@file` contents interpolate vars too; **import paths stay
inputs-only**
(structural file resolution, conceptually outside the prompt/goal
scope).
- Offline / CLI / `fabro validate` render with an empty var map, so
`{{ vars.* }}` is undefined there: a warning at validate, a hard error
at
  run-create — identical to how `inputs` behaves offline.

## Testing

- Transform-level: node-prompt and goal interpolation; unknown-var
warning.
- Create-pipeline: vars resolve; an unknown var warns at validate and
promotes
  to a hard error at run-create.
- End-to-end server test: `POST /variables` + `POST /runs`, asserting
the
  rendered prompt in the persisted `run.created` event.

Verified: `cargo +nightly fmt --check`, nightly `clippy -D warnings`
(including
the `test-support`-gated server integration binary), the tests above,
and a
full-workspace `cargo check`.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 16:18:09 -04:00
..
crates Interpolate run variables ({{ vars.* }}) in node prompts and goals (#524) 2026-06-24 16:18:09 -04:00
packages/fabro-api-client feat(workflow): support overriding cwd for local sandbox provider (#467) 2026-06-14 12:32:32 -04:00