# Rehearse connected workflows

Test actual upstream outputs at each connected input boundary.

```sh
node packages/block-cli/cli.js preview my-type.json
node packages/block-cli/cli.js preview my-type.json sample-inputs.json
```

`sample-inputs.json` is keyed by Step ID, then input name:

```json
{ "first": { "text": "  My sample  " } }
```

`previewProjectType(type, options)` from `packages/block-platform/type-preview.js`
rehearses the pinned workflow without changing it. Options accept `inputs`, scoped
`context`, an abort `signal`, `onResult`, and a sandbox `run` implementation for
browser workers. The CLI uses the same isolated Node runtime as Block tests.
Unconnected inputs start with the Block's first fixture, then Step config and
custom sample values; connected values always come from actual upstream output.
Conditions use the production bypass rules. Inputs and outputs are validated at
each boundary. Offline checks share a 15-second deadline and 4 MB combined
sample budget. Interactive browser previews permit 64 MB of recorded data;
waiting for hosted consent and execution does not consume the local deadline.

The report contains a digest and per-Step results. `passed` means no executed
Step failed; **only `complete: true` means all enabled Steps completed**. Hosted
workspaces, missing context and dependent blocked Steps produce an incomplete
report. The same connected rehearsal also runs within type fixture validation and server
import admission; an executed combination that fails is rejected. Incomplete host
coverage is marked explicitly. This does not replace static admission checks,
individual fixtures, or actual host/media testing in a project. In the builder choose **Preview connected workflow**
to inspect per-Step inputs, outputs and failures.


### Interactive hosted rehearsal

In the Project Type Builder, choose **Preview connected workflow**. For included
hosted Blocks, complete or reuse each account-bound package review first. The
preview then asks for a model, payment choice, and cost confirmation for each
actual hosted invocation. A package review never substitutes its sample output
for an upstream result. Cancel at any point to stop downstream execution.

Use **Custom sample inputs** for values keyed by Step ID. Use **Sample project
context** for a JSON object containing the context fields requested by Blocks:

```json
{"metadata":{"schemaVersion":1,"hasDialogue":true}}
```

Each Block receives only its declared context inputs and permissions. Context
samples are copied; testing cannot write through to a production project.
Conditions read the resolved inputs and apply the same pass-through rules used
in production. Changing either sample clears the displayed prior result.

Before passing hosted output downstream, StillMade re-fetches the authenticated
run and checks the package, input, model selection, quote, output and media
receipts. Generated image references can feed recipe image inputs: the browser
decodes the verified media without resizing it. The recipe limit remains one
megapixel. Arbitrary URLs in sample JSON do not authorize image decoding. Local
JavaScript Blocks retain reference-based image contracts.

The browser host opts into `interactive: true`, supplies `verifyHostedResult`,
and may supply `resolveInput` for authorized media conversion. These are trusted
host callbacks, never functions supplied by imported packages. Omitting the
verifier prevents hosted execution. Keep interactive mode off in automated
admission and CLI checks; enabling it does not provide provider credentials,
payment authorization, or a server-certified workflow receipt.

A successful sample rehearsal proves that those enabled Steps ran with those
inputs. It does not prove every possible project, workspace interaction, or
conditional branch. Manual StillMade workspaces still need their working preview
or a real project. Changing accounts cancels the active hosted preview.
