# Bring an application to Synapse · v1

Start in the repository of the application you want to model. Choose a user control or API trigger, the responsible handler, an expected outcome and a value worth checking. Give actions and steps stable IDs. Labels can change independently. A handler is a team-supplied symbol; Synapse does not infer application logic from its source code.

## Find the right public interface

Start with `synapse capabilities` and `synapse schema`. The service advertises the guide, starter files and OpenAPI reference. `synapse --help` lists the installed CLI syntax. A scoped assistant needs the Synapse origin and project ID. Use a saved connection in the signed Mac pilot or a scoped integration credential. Keep credential values outside source control, URLs and handoffs.

| Developer’s question | Public entry point | Evidence to keep |
| --- | --- | --- |
| Which action did the user trigger? | [Search and simulate](#find-behavior-and-run-it) using `search` at the project revision. Page with the same selector. Use `map` and `callers` to inspect related flows. | Project, revision, selected stable ID, source pointer and any remaining pages. |
| Which parts of the app are modeled, and which ran? | [Inventory a consuming revision](#inventory-a-consuming-revision) using the source router, project map, call sites and a pinned run. | Source trigger, model entry or missing mapping, run coverage, subscriber evidence and a scoped workbench link. |
| Can I document this before implementing a handler? | [Author and publish](#author-validate-and-publish) with Git or `publish`. Use local `flow validate` and `flow simulate` or submit a pinned remote run. Check the expected branch tip on writes. | Authored model revision, request ID, case file, run and attempt. Record independent application evidence when available. |
| Where did this particular value come from? | [Trace a writer](#trace-an-observed-value-back-to-its-writer) with `events`, `event` and `upstream`. Use [downstream](#find-what-else-a-field-affects) for a field version or declared reader. Use the returned viewer link and continuation. | Original writer event, observed consumers, possible readers and gaps in the retained trace. |
| Did a timeout, retry or delayed subscriber change the answer? | [Inspect a subscriber](#inspect-a-join-and-its-subscribers) or [request a verified replay](#recover-missing-simulation-evidence) when the original omitted the detail. | Original run/attempt, message or invocation, replay ID and evidence origin. |
| What changed on the branch? | Use [history](#find-the-change-that-introduced-a-rule), [compare](#compare-two-branches-by-stable-identity) and [candidate comparison](#compare-the-behavioral-impact-of-a-branch). Inspect both case outcomes and all required pages. | Source and receiving tips, candidate commit/tree, case-level runs, affected outputs and uncovered paths. |
| Who may merge this change? | An assistant can prepare a comparison. A reader can review it. A maintainer uses the [tested merge review](#confirm-a-tested-model-change) when the configured provider qualifies. | Comparison ID, public review URL and the installed commit on a completed receipt. Mixed branches follow the repository review route. |

For individual calls, roles, identifiers and paging limits, use the [public operation inventory](#public-operation-inventory).

## Connect a project

### Connect to a hosted workspace

Build with `cargo build --locked --workspace` in the Synapse checkout and put the resulting binaries on your PATH. Sign in with your passkey, open the project, and choose **My assistant access**. Select **View** to inspect flows and evidence, or **Modify** to let Codex publish and simulate within your current permissions. The default lifetime is 24 hours, with one-hour and seven-day choices. Save the one-time secret in the consuming client's secret store and inject it as `SYNAPSE_TOKEN`. Give Codex the HTTPS service origin and project ID. A maintainer issues a separate CI credential from **Project access** for independent observations.

```sh
export SYNAPSE_URL=https://synapse.arkline.ph
synapse capabilities
synapse projects
synapse head "$project"
```

Use the hostname published by your operator. Both clients verify the certificate chain and hostname using their normal certificate stores. They accept a root origin with an optional port and refuse all HTTP redirects. HTTP is available on numeric loopback addresses for development. A certificate failure or redirect means you should verify the configured origin and trust store with the operator before retrying.

#### Use a saved connection in the signed Mac pilot

This path applies to an opt-in workspace with the signed Mac CLI and its user-session helper installed. In the Workbench, open the project and choose **My assistant access**. Under **Connect a Mac**, copy the setup command. It searches `~/.synapse/bin` and your usual command directories for that invocation. Run it once in Terminal on the Mac that Codex uses, review the project and its requested access, and approve with your passkey. The CLI reports the connection after it reads Project Head. View is the default. Pass `modify` after the project ID for branch publication and simulation when your membership permits it.

Use the same project ID and HTTPS origin in Codex tasks with the configured helper socket. The saved connection supports `head`, `search`, `history`, `status`, `events`, `event`, `invocation`, `upstream`, and `downstream`. Modify also allows `publish`, `run`, and `replay`. Use `replay-status` to read a verified reconstruction. Normal commands renew access through the helper. An explicit integration credential takes precedence when supplied. CI uses its own evidence credential.

If a first approval is cancelled or expires, `project_not_connected` means you can run the same copied setup command and scope again. Repeat the same command if the approval reply is interrupted. After disconnect or 30 days of inactivity, copy the reconnect command from **My assistant access** and approve it on the same origin. To request Modify, insert `modify` before `--reconnect`. During an outage, repeat the command when the service returns. If you lose the Mac's protected state, sign in to the Workbench and disconnect its old entry before setting up the replacement. To increase the scope of a live saved connection, disconnect it in the Workbench and approve the new scope.

#### Use the Rust CLI under a Codex network policy

Allow the Synapse hostname in the local Codex network policy. In that Codex session, with `SYNAPSE_URL` set to your HTTPS Synapse origin, run:

```sh
SYNAPSE_TRANSPORT=codex-proxy synapse capabilities
```

Use the same setting for ordinary `synapse` commands in that environment. This mode uses the loopback HTTP proxy Codex supplies through `HTTPS_PROXY`. The CLI verifies the Synapse certificate and hostname through the tunnel and refuses redirects. If `codex_proxy_unavailable` appears, check that the session is running with its managed proxy. If `service_unavailable` appears, check that the policy allows the configured Synapse hostname and that the server is reachable. Leaving `SYNAPSE_TRANSPORT` unset or setting it to `direct` uses the direct Rust CLI connection. The Python reference client uses a direct connection. [Codex network controls](https://learn.chatgpt.com/docs/agent-approvals-security#network-isolation)

From a consuming checkout, the [standard-library Python reference client](http_client.py) uses the same service origin and explicit token settings. To exercise authoring and simulation in an empty test project, run `python3 http_client.py --project "$project"`. It writes a review branch, submits a scenario, and reopens paged events. Use the [authoring flow](#author-validate-and-publish) with your own model for a working project.

#### Keep a backup sign-in method

In the Workbench, open **Account security** and select **Add backup passkey**. Verify with an existing passkey, then register the backup on a separate device or security key. Confirm that the backup signs in independently. You can rename or remove a passkey and sign out another session from the same page.

#### Replace an expired or revoked credential

An expired or revoked credential returns HTTP 401 with `unauthenticated`. The Rust CLI exits 4. In the hosted Workbench, open **My assistant access** and rotate the credential, or issue a new one if the previous credential was revoked. Rotation revokes the old key and assigns a new ID. Put the replacement in the client's secret store and verify it on a known project or run. If an issuance reply was lost, check the ledger before retrying and rotate or revoke the key whose secret you did not receive. For a local workspace, have the maintainer issue the replacement and revoke the previous key. Keep the saved project, revision, run and cursor when reopening evidence. If a write might already have completed, reopen its branch or receipt before deciding whether to submit again. Keep bearer values out of repository files, shell history, and logs.

### Connect to a local workspace

The operator starts the local service and worker against the same database, binds the HTTP service to loopback and configures its local bare Git provider. The application repository needs an initial commit. Its model directory may be absent. A maintainer receives a human credential and an exact repository/directory grant from the operator. See [project access](../../../docs/architecture/project-access.md), [Git provider setup](../../../docs/architecture/model-publishing.md) and [worker setup](../../../docs/architecture/run-service.md).

Build the three executables with `cargo build --locked --workspace` in the Synapse checkout. Place its build directory on your PATH before changing to the consuming repository. The local `flow` CLI compiles and simulates files. The `synapse` CLI calls the same project service as a REST integration. Set `SYNAPSE_URL` to the numeric loopback origin and supply `SYNAPSE_TOKEN` privately through the environment.

```sh
export SYNAPSE_URL=http://127.0.0.1:7490
synapse capabilities
synapse schema
project=$(synapse register <<'JSON' | jq -er .id
{"name":"My application","binding":{"repository":"team/application","model_path":"behavior"}}
JSON
)
synapse head "$project"
```

Use the actual operator-granted binding in the registration JSON. To connect Codex, a maintainer sends `POST /v1/projects/{project}/credentials` with `{"role":"assistant"}` and passes the returned credential privately to the assistant. The assistant sets its own `SYNAPSE_TOKEN`. To grant a human reviewer access, the maintainer sends `PUT /v1/projects/{project}/members/{human}` with `{"role":"reader"}`. The browser uses the reviewer’s credential. Direct Git pushes use the consuming repository’s ordinary Git identity.

### Set up the same project in the workbench

These steps use an operator-managed local workspace.

1. Open `/workbench` with your human credential. In **Projects**, choose **New project**, enter a name and select the repository and model directory granted by the operator. **Create project** opens the new workspace. If the confirmation is interrupted, retry with the same name and binding to reopen that project. If no binding is listed, ask the operator to grant the repository and directory you need.
2. Open **Project access**. Add the provisioned human reviewer as a reader. Choose **Assistant** under **Integration role** and issue its credential. Save the one-time value in the integration's secret store and close the dialog. Use a separate CI credential for application-test observations. If the issuance reply is lost, refresh the list, revoke the row marked **reply lost**, then issue a replacement. The public request ID identifies that exact row even if another maintainer issued the same role.
3. Choose **Back to project**. The first-flow screen identifies the model directory and suggests a review branch. From the application checkout, follow the authoring instructions below, correct any validation errors, and publish through Git or the scoped CLI. Enter the actual branch in **Published branch** and choose **Open published branch**.
4. Select the action and the completed run. A human reader can open that same revision and run link using their own credential. To remove access, revoke the integration credential or remove the human member from **Project access**. Each subsequent request uses the current grant.

## Author, validate and publish

Start a topic branch at the project’s current head. Name it `review/{project-uuid}/{topic}`. In the model directory, create the three files illustrated by the [neutral starter](starter/project.json), [flow](starter/flows/intake.json) and [case](starter/runs/smoke.json). The running service also serves their exact text in the `files` map at `/v1/starter`. Use your own trigger, handler, participants, typed fields and assertions.

```sh
git switch -c "review/$project/first-flow"
flow validate behavior
flow simulate behavior runs/smoke.json
git add behavior
git commit -m 'Model the first application action'
git push origin HEAD
revision=$(git rev-parse HEAD)
synapse head "$project" "review/$project/first-flow"
```

For example, changing a write expression from `input.item` to an undeclared field makes validation exit 2. Read `diagnostic.source.file` and `pointer`, correct the field and validate again. Run case files listed in `project.json`’s optional `runFiles` are validated with the model. Existing code-authored cases under `runs/` can still be submitted directly. For REST-managed cases, include the relative JSON path in `runFiles` and submit its contents in the batch.

An HTTP client can publish the entire model without a developer clone. Read `GET /v1/projects/{project}/head` for the initial commit. Submit `POST .../changes` with `branch`, `expectedHead`, a unique `requestId`, `create:true` and `documents:[{"path":"…","content":"…"}]`. Send the actual JSON text of each file as its content. A rejected batch returns a diagnostic before the branch moves. Repeating the same accepted request is safe. For subsequent changes use the current branch head and omit `create`. The response supplies the commit and an `inspect` path for the browser.

If publication returns HTTP 409 with `stale_head`, another author may have advanced the branch. Read `GET /v1/projects/{project}/head?branch=BRANCH` with the branch name URL-encoded. Open the returned revision using `GET .../model?revision=COMMIT`. In your checkout, fetch the branch and verify the fetched commit matches that revision. Rebase your intended edit onto it and inspect the resulting diff, especially when both authors changed the same document. Resolve any overlapping edits before continuing. Run `flow validate MODEL_DIR` and `flow simulate MODEL_DIR RUN_FILE`. Publish the combined document with the reopened revision as `expectedHead` and a new `requestId`. If the head moves again, repeat recovery. After an ambiguous network result, resend the identical accepted request using the same credential and request ID to retrieve its original revision. A `request_id_conflict` means the ID was already used for different content.

The [complete Python REST client](http_client.py) uses standard HTTP and JSON. It registers a new operator-granted project, obtains a scoped assistant credential, authors its own three flows, corrects an invalid field, publishes, searches, runs and follows both kinds of message. With a **new** empty binding, execute `python3 http_client.py team/archive design`. It prints model files, calls and cursors. Its enrollment step uses the maintainer token from the environment.

## Find behavior and run it

```sh
synapse search "$project" "$revision" 'Submit item'
synapse search "$project" "$revision" 'items.submit'
synapse search "$project" "$revision" 'field:intake.selected' --exact
run=$(synapse run "$project" "$revision" runs/smoke.json first-smoke | jq -er .runId)
synapse status "$project" "$run"
synapse events "$project" "$run" 1 0 10
synapse event "$project" "$run" 1 1
```

Poll status while the worker is queued or running. A completed run includes its simulation result in `summary.status`. A failed assertion includes the observed and expected values. Read the event selected by `firstDivergentWriterOrdinal` when present. To reopen a retained event through REST, use `GET /v1/projects/{project}/runs/{run}/events/{ordinal}?attempt={attempt}`. Use the run, attempt and event from the saved link. When the link includes a replay ID, open `GET /v1/projects/{project}/runs/{run}/replays/{replay}?event={ordinal}` for that reconstruction. Each individual event returns a browser `viewer` path. Resolve it against `SYNAPSE_URL`. An external assistant can hand that link to a reviewer without sharing its credential.

### Retry a single simulation submission

Send `POST /v1/projects/{project}/runs` with the pinned revision, case file, and a request ID chosen before the first attempt. For example, the stocktake fixture uses this body (replace `{commit}` with the full Git commit).

```json
{"revision":"{commit}","runFile":"runs/stocktake.json","requestId":"stocktake-review"}
```

HTTP 202 returns a `runId`. Save it with the project and revision and poll the original run. If a response is lost, repeat the same body using the same project and principal. A repeat of an accepted submission returns the original run. Changing the case or revision under an accepted request ID returns HTTP 409.

| HTTP 429 body | What the client knows |
| --- | --- |
| `{"error":"project_admission_busy"}` | The service could not acquire this project's admission lock in time. |
| `{"error":"project_queue_full","limit":4}` | All four places for queued, running or canceling work in this project are occupied. |

For either refusal, read the `Retry-After` response header in seconds and wait at least that long before resending the same request. Give the client a bounded retry budget. If every attempt returns 429, record the project, revision, request ID, last refusal, and number of attempts as **retry budget exhausted**. An explicit 429 supplies no run ID. If an earlier response was lost, its outcome is still unknown. If the caller later resumes, reuse its saved request ID. Keep a refused submission distinct from a simulation that ran and failed an assertion.

For a reader handoff, retrieve the original event by run, attempt, and ordinal. Its `workbench` path opens that selection in the web workbench when present. The reviewer signs in with their own project credential.

For REST discovery, start with a term from the user's description. For example, the following request searches action labels and other action metadata on one pinned revision.

```http
GET /v1/projects/{project}/context?revision={commit}&q=confirm&kind=action&limit=2
```

Omit `kind` to search across symbol types. Read the stable IDs in `items`. If `page.nextOffset` has a value, pass it as `offset` with the same project, revision and filters. To reopen one exact result, set `q` to its URL-encoded ID, add `exact=true` and follow its `viewer` path. A term with zero matches can still describe a real user symptom. Try an action verb or field name and verify the writer against a run.

Search matches stable IDs, qualified fields/flows and action labels, handlers, triggers and actors case-insensitively. Use `--exact` with a returned stable ID to resolve similar names case-sensitively. Each result supplies the model-relative file, JSON Pointer and pinned browser link. Actions expose declared outcomes and any authored opaque boundary. Flow, step and field matches expose their owning flow's possible exits. An outbound request identifies its fixture boundary. The browser displays message identity, virtual time, parent ordinal and source for a selected event. Follow a cause, open the step or use browser Back. The link pins the revision, run, attempt and ordinal. Each tab holds its reader credential in memory until lock or reload.

### Compare a prediction with a later application test

1. Commit the feature brief in the consuming repository. Record its full Git commit as the first application revision. On a separate model branch, publish the scenario, its input, expected response and expected delayed effects. Declare an `observation` contract in the run file with the CI test name and each observed assertion’s phase, unit and time window. The reserved assertion `$root` represents the user-visible response.
2. Simulate the pinned model commit and save the run ID and attempt. As a reader, request `GET /v1/projects/{project}/comparisons/{run}?attempt={attempt}&appRevision={briefCommit}`. Open the returned `viewer` in the workbench. The model’s expected and simulated values are visible. With no report selected, the app column reads **unobserved**. Keep this link as the original prediction.
3. At a later app commit, have CI run the actual handler and its downstream consumer with the same input and delivery schedule. Use a project CI credential to `PUT /v1/projects/{project}/observation-artifacts/{reportId}`. The report identifies the original run, attempt, model commit, case digest and the app commit CI tested. Supply the measured fields, units, elapsed times and observation window. Use the served OpenAPI reference for the request schema. A shorter window or omitted field can leave a result unobserved.
4. Save the receipt’s `comparison` and `viewer` paths. For a fix confined to the app, keep the original model and run, execute the app test at the new app commit and submit under a new report ID. A fresh reader can open both saved comparisons with their own credential. Compare `revision`, `runId`, `attempt`, `appRevision` and the observed samples to attribute the change. The original link continues to select the original evidence.

### Discover compatible run files

Use `GET /v1/projects/{project}/scenarios?revision={commit}&entry={trigger}` or select the entry flow with `flow={flow-id}`. Use a URL-encoded query and supply exactly one selector. The service checks case files from the model directory's `runs/` tree, including older Git-authored projects. Each choice carries its exact `runFile`, resolved scenario label, trigger, flow, and a preview of its input fields and fixture steps. Two files for one scenario can describe different schedules.

In the web workbench, open an action and choose **Simulate scenario**, or open a flow definition and choose **Simulate this flow**. Select a checked-in case file and run it. If the reply is lost, sign in again with the same identity and choose **Resume submission**. A reader can open the saved URL and select the same Debug event. The single-event CLI and REST result includes a `workbench` URL pinned to the event, alongside the `viewer` URL for the inspector. Open it under the service origin with ordinary project access. A historical record without a recoverable entry has a null workbench URL. The event panel gives the corresponding CLI command. For an action-linked run, **View application evidence** opens its independent app reports. For an event beyond the saved trace, follow the historical link to request or inspect a verified replay.

Open the `workbench` URL from `synapse event` and choose **Sequence**. The canvas shows up to nine saved events around the selection, with a separate lane for each observed invocation. A dashed return points back to the requesting invocation. On a late reply, click the selected arrow or follow **Cause** to its original dispatch and use browser Back to return. A withheld delivery stays at the channel. Expand **Events in this window** for keyboard navigation or use the diagram's pan, zoom and fit controls. Sharing the current URL preserves the run attempt, event and view. Events outside the retained prefix use the historical inspector.

Choose **Process** at the same event to open the pinned flow and the particular invocation that ran it. Inputs show the values received by that invocation. A return becomes visible when the cursor reaches its recorded return event. Use **Caller** to reopen the originating event. At a call, inspect the named port types, mappings and actual arguments, then use **Enter invocation** to open its first recorded event. **Show process source** opens the selected step beside the diagram. Switching back to Sequence preserves the run, attempt and event.

When canceling from a saved run link, use `POST /v1/projects/{project}/runs/{run}/cancel?attempt={attempt}`. If another contributor has already retried, the service returns 409 and preserves the newer attempt. Omitting the optional attempt requests cancellation of the current attempt.

Follow `nextOffset` at the same project, commit and selector until it is null. The limit counts files examined, so a page can be empty before the search is complete. An unavailable case carries its source diagnostic and cannot establish a match. Submit the selected file with the same revision through the normal run endpoint.

## Limits and outcomes

| Result | How to recognize it |
| --- | --- |
| Successful response | Remote CLI exit 0. A queued run has been accepted. Read status for the terminal result. |
| Merge handoff | `synapse merge-status` exits 0 for `ready` or `integrated`. Read `state` to distinguish a handoff to a maintainer from a completed merge with a receipt. A blocked or unavailable merge decision returned with HTTP 200 exits 3. |
| Failed assertion | Remote status exits 1 for `summary.status=failed_assertion`. Local `flow simulate` also exits 1. Other simulation outcomes remain visible in the native result. |
| Invalid input | Remote CLI exits 2 for bad arguments, malformed input or rejected model. REST distinguishes 400, 409 and 422. Model diagnostics carry a file and pointer. |
| Partial context | Remote CLI exits 3 when search returns a partial view or the run reports additional or omitted events. Search exposes offset, limit, returned count, total matches and next offset. The result-item payload budget is 128 KiB and pages contain at most 64 items. Outcomes include a total and an omission flag after 16 entries. |
| Missing access or resource | Remote CLI exits 4 for 401, 403 or 404. An excluded project returns the same 404 as an unknown one. |
| Service or transport failure | Remote CLI exits 5. JSON output identifies the failure. |

Continue search with the **same project, revision, query and options** and `--offset <nextOffset>`. `page.complete` describes whether this response contains all matches to that query. A last page can still be a partial view. Event pages use `nextAfter` and the selected attempt. If `truncated` is true, the worker retained a prefix of the semantic trace. See the [run service](../../architecture/run-service.md) for lifecycle, retention and cancellation.

Discover the checked-in [OpenAPI reference](../../../access/run-api.json) at `GET /openapi.json`, the versioned guide at `GET /v1/guide`, and the project, flow and case schemas at `GET /v1/schema`. `GET /v1/capabilities` advertises feature support, model step types and limits. A model runs synthetic inputs locally and can represent external behavior with declared boundaries and fixtures. Use the [application observation API](../../architecture/application-observations.md) to compare independently measured fields from an app test with this run.

### Recover a consuming client

Save the project ID, immutable revision, operation, request ID or cursor, and the JSON response before retrying. Keep credentials in the caller’s secret store.

| What the client received | What to do next | What to verify |
| --- | --- | --- |
| Search exits 3 and returns a page | Resume with `synapse search "$project" "$revision" "$query" --limit "$limit" --offset "$nextOffset"`. Keep the search options and revision from the first page, even if the branch advances. Stop when `nextOffset` is null. | A last page can still exit 3. Count distinct result IDs against the reported total and retain any omissions declared by the operation. |
| Local validation exits 2 or publication returns 422 with `invalid_model` | Open `diagnostic.source.file` at the JSON pointer, correct the field and run `flow validate` and `flow simulate` in the consuming checkout. Read the current branch tip before submitting the corrected change. | Check that the refused edit left the old tip intact, or that the requested new branch is still absent. Check the accepted revision and case outcome after correction. |
| A conditional publish returns 409 with `stale_head` | Fetch the winning revision, inspect the competing edit, reapply yours, validate and simulate. Publish with that revision as `expectedHead` and a new request ID. | Reopen the accepted revision and verify both authors’ changes. If the accepted reply was lost, resubmit its identical request with the same ID to recover its revision. |
| Merge status is `stale` with `source-moved` or `target-moved` | Read both heads and the old comparison. For remaining changes, prepare a new candidate and rerun the affected scenarios. A maintainer reviews the new commit and tree. | A stale confirmation returns 409. If another review already installed the intended commit, verify the receiving tip and its completed receipt and finish there. |
| An access request exits 4 | Read the HTTP status and JSON error. An excluded caller can receive 404 for a known project or run. Stop and ask the project maintainer to confirm the intended project or grant. For a 403 on confirmation, hand the comparison ID to the authorized maintainer. | The receiver uses their own credential to reopen the same comparison and review it. Share only identifiers the receiver is authorized to see. |

The [courier recovery transcript](../../testing/consuming-client-recovery.json) records the actual responses, branch revisions, affected runs and pinned event links for these cases.

## Reproduce the two onboarding journeys

With PostgreSQL binaries, Chrome and Python with Playwright installed, run `PG_BIN="$(pg_config --bindir)" tools/test_access.sh --onboarding` from the Synapse repository. Set `PYTHON` to the test interpreter and optionally `CHROME_BIN` to a Chrome executable. To retain transcripts, authored files, pinned cursors and rendered screenshots, set `SYNAPSE_ONBOARDING_EVIDENCE` to a new output directory. Timing starts at client registration with the service and worker ready. The harness creates a private database, fresh repositories and scoped identities, then removes them. The independent participant pilot is tracked separately.

Run `tools/test_access.sh --https-clients` with PostgreSQL, Python, and OpenSSL to verify both client entry points against an isolated TLS endpoint. It exercises certificate and hostname rejection, blocked redirects, loopback compatibility, scoped publication, paged evidence, and credential rotation.

## Review an action in the browser

From the Synapse checkout, install the Rust target with `rustup target add wasm32-unknown-unknown` and the matching JavaScript binding generator with `cargo install wasm-bindgen-cli --locked --version 0.2.130`. Run `tools/build_workbench.sh` before starting the local access service. The script puts the two generated assets in `workbench-assets/` beside the debug server. Set `WASM_BINDGEN` to use an existing matching executable.

Open `/workbench` on that service, unlock with your reader credential, then select a project. Choose Main or a saved run's model revision. Search by action label, actor, handler or trigger. The Process panel shows the modeled flow and its outgoing calls and publications. Open a boundary or a writer to inspect the other flow. “Steps and connections” provides the same targets with keyboard controls. Show source displays the selected step's compiled definition and original file location.

Select a run to see its simulation result. Select a test report to compare against that report's app commit, or change the target app commit to check for stale evidence. A writer button opens the exact simulation event. Copy its CLI command or copy a field ID into `synapse search`. Share the workbench URL to preserve the project, revision, action, run, attempt and selected evidence. Each reader supplies their own credential.

Operators can repeat the disposable project and browser walkthrough with `SYNAPSE_CHECK_WORKBENCH=1 tools/test_access.sh --observations` after building the viewer. The observation harness needs the PostgreSQL binaries and Python Playwright with desktop Chrome.

## Inventory a consuming revision

1. Pin the app checkout and the model revision. Read the app’s actual entry registrations, including any routing or trigger translation. Compare each resulting trigger with the model manifest’s `entries`. For an exact lookup send `GET /v1/projects/{project}/context?revision={commit}&q=entry%3A{trigger}&exact=true&limit=1` with the trigger URL-encoded. A source trigger absent from the manifest and exact lookup is a missing model entry at that revision. Record the source location and the app commit.
2. Page through the project map, then open each returned domain or group. Use the [caller lookup](#find-every-caller-of-a-subprocess) for shared flows. Record each call site, target, state store key, read and write step, and each publication’s declared subscribers. Use the pinned model source for declarations the map summarizes. Keep the page limit, offsets and any unexamined groups in the handoff.
3. Run a checked-in case or open a saved run by ID. To find prior runs for a trigger, use `GET /v1/projects/{project}/review-runs?revision={commit}&entry={trigger}` and continue with its `after` cursor. This operation supplies its own page size. Compare declarations with the selected attempt. To check a subscriber, follow the publication’s message ID and inspect its delivery outcome. An `undelivered` record naming the subscriber supports a missed delivery for that publication. Check `total`, `retained` and `truncated` before drawing conclusions about the whole run. If `summaryOmitted.unvisitedSteps` is positive, page the events for the exact step or message to establish coverage. Save the returned event `workbench` path with the project, revision, run, attempt and ordinal so a reader can reopen the finding.

## Find every caller of a subprocess

Start with **Project map** in the project's action catalog, or use **Project** on a saved Debug event. Open a domain to see its flows, immediate callers and message subscribers. Select a flow to inspect its named inputs, returns and calling steps. On a saved run, pick a caller and occurrence to see the recorded inputs, child invocation and return. Open the return in Process and use browser Back to recover the selected caller and field.

An assistant can run `synapse map PROJECT REVISION` and reuse a returned group ID with `--group 'domain:Sorting'`. The equivalent REST route is `GET /v1/projects/{project}/project-map?revision=COMMIT`. Both interfaces accept `limit` (1–64) and `offset`. Use the same pinned revision and the returned `nextOffset` on the next page. A domain link counts declarations. An expanded link includes its source and target steps. To find saved executions, request `GET /v1/projects/{project}/runs/{run}/events?attempt=1&step=sorter.forward`. Continue with `nextAfter` and check `truncated` for missing historical coverage. For a queued handoff, expand the publishing or subscribing domain, choose **Trace**, and select the publication. Match the handler or withheld result with `synapse events PROJECT RUN ATTEMPT --message ORDINAL`. A declaration alone supplies no observed handler result. External boundaries show the project's declaration and source. Selecting **Show source** fetches only the chosen flow definition. The server currently scans the compiled snapshot to project the map. Large-project timing belongs to the performance qualification.

Use `synapse callers PROJECT REVISION FLOW --limit 24` when you know the child flow and need its callers. The equivalent reader-scoped operation is `GET /v1/projects/{project}/call-sites?revision=COMMIT&callee=FLOW&limit=24`. Each item identifies the exact calling step, target entry step, domain, input bindings, named result, return routes and model source. The response includes the child’s input and alternative return ports. Two calls from one flow have separate identities.

Continue with the same revision and callee and pass `--after` the returned `nextAfter`. Exit code 3 means another page is available. An existing flow with no callers returns an empty list. These declarations describe possible calls. Open the pinned run and invocation to inspect which caller executed and which value it received.

## Inspect one subprocess invocation

Choose **Project flows** to browse the selected revision by flow or domain. A flow may declare a `domain` string. Open a call in Process and expand **Subprocess contract** to see its typed arguments, caller bindings, outcome-specific return ports and next steps. A reply can return any declared local field, including a value the child computed.

From a saved workbench event select **Inspect this invocation**. The URL pins the project, revision, run, attempt and invocation. The caller link opens the exact invocation that made the call or published the message. Child and event links preserve those pins. For fields written several times, use the invocation and writer ordinal within that run attempt to identify a particular value.

```sh
synapse invocation "$project" "$run" 1 2
```

The same record is available from `GET /v1/projects/{project}/runs/{run}/invocations/{id}?attempt=1`. A null outcome means the saved events contain no explicit return. Check `retained`, `total` and `truncated` before interpreting a missing invocation. The scoped API returns HTTP 410 and the CLI exits 3 when the retained prefix cannot establish whether the requested invocation existed.

The [two-call fixture](../../../fixtures/subprocesses/project.json) passes revisions 3 and 4 through the same child and returns its computed field to each caller. An optional run-file `limits.maxCallDepth` counts the synchronous root as one. Starting an asynchronous consumer begins a new synchronous call stack. An attempted call beyond the limit ends the simulation with `limit_exhausted` and a diagnostic at the caller's target mapping.

## Recover missing simulation evidence

Start with the original run and attempt. When the workbench shows a partial trace, open **Inspect historical evidence**. A pinned event or invocation beyond the original range also opens the coverage view. Contributors, maintainers and project assistants can select **Replay missing details**. Readers can open a prepared replay or a shared inspector link with their own credential.

The CLI uses the same project-scoped REST operations. These examples use the long two-call fixture. Supply the project UUID, source run UUID and original attempt from the run record.

```sh
synapse replay "$project" "$run" 1 historical-second
synapse replay-status "$project" "$run" "$replay" --caller review.second --occurrence 1
synapse replay-status "$project" "$run" "$replay" --event 142
synapse replay-status "$project" "$run" "$replay" --field approval.checked --after 0 --limit 20
```

Use the returned `replayId` for the status command. The `viewer` link carries the exact selection. A request ID is scoped to a principal and project. Retry the same submission safely. Use a fresh request ID to reconstruct expired details. The API also accepts an optional selector on submission. Read the receipt and results using `GET` on its `href`, with one of the documented selectors. An active job can be canceled with `synapse replay-cancel PROJECT RUN REPLAY`.

**How an assistant should interpret a record.** Check `origin`, `state` and `verification` first. A matched replay reproduced the complete semantic report. `invocationOrigin` identifies the caller or publisher. Reconstructed variables have their own origin and coverage. Follow `nextAfter` with the same selector for additional records. CLI exit 3 indicates partial pages or an unavailable, divergent, canceled, interrupted or expired replay. On an expired receipt, a previous successful verification can remain visible. Detailed values are available only in the matched state. An application result requires independent application-test evidence.

The [inspector screenshot](../../testing/historical-replay.png) and [matching CLI and REST response](../../testing/historical-replay.json) show the reconstructed return and its field writer. The [run service](../../architecture/run-service.md#verified-historical-replay) describes compatibility and retention.

### Hand off an expired field link

A reader can reopen the saved field page with the values from its URL. Keep the project, revision, run, attempt, old replay ID, decoded field name, `after` and `limit`. If the original link omitted a paging flag, omit it when reopening the page. The commands below use a link that includes both flags.

```sh
synapse replay-status "$project" "$run" "$old_replay" --field "$field" --after "$after" --limit "$limit"
```

An expired receipt returns exit 3. Its previous digest match remains visible, but its field rows have expired. A reader who requests a replay receives `forbidden` (exit 4). Share the saved link with a contributor. Each person uses their own credential.

```sh
synapse replay "$project" "$run" "$attempt" "$fresh_request_id"
# Use the replayId from this response. Repeat the status read while queued or running.
synapse replay-status "$project" "$run" "$new_replay" --field "$field" --after "$after" --limit "$limit"
```

Use a new request ID for the replacement. Check that the receipt names the saved revision, run and attempt, reports `matched` and `semantic_report_matched`, and has equal original and result digests. A matched page can also return exit 3 when it contains rows and `nextAfter` points to another page. Read the JSON state and the selected row before deciding whether recovery succeeded. The contributor can now share the returned `viewer` for that field page. The reader can follow **Open original coverage** to see which events were saved in the original attempt.

To trace that version, take the ordinal from the selected row’s `event.ordinal` and keep the replacement replay ID:

```sh
synapse upstream "$project" "$run" "$attempt" --event "$ordinal" --replay "$new_replay" --limit 64
```

Read `firstEvidencedMismatch` and its source pointer. To check the original boundary, open the same ordinal with `synapse event "$project" "$run" "$attempt" "$ordinal"`. For an event outside the retained prefix, the original endpoint returns HTTP 410 and the CLI reports `event_not_retained` (exit 2).

## Trace a late provider reply

Run either controlled model from the Synapse repository.

```sh
cargo run --locked --bin flow -- simulate fixtures/correlation/parcels runs/interleaved.json
cargo run --locked --bin flow -- simulate fixtures/correlation/festival runs/interleaved.json
```

The parcel model sends two jobs from depot `north` through the same carrier subprocess. Parcel 101 weighs 7 and parcel 102 weighs 11. At 5 ms both requests time out. Both retries start at 6 ms. At 8 ms the original replies arrive while the retries are pending. At 9 ms each retry completes and its own invocation records the correct weight. The festival model uses season and venue and handles the provider request in the receiving flow.

After publishing one of these model directories to your project, submit `runs/interleaved.json` at the selected revision. Open its late reply in the inspector or retrieve it from the CLI.

```sh
synapse events "$project" "$run" 1 0 64
synapse event "$project" "$run" 1 "$ordinal"
```

Read the ordered entity key, logical request, provider attempt and immediate parent. Open the parent event to inspect the original dispatch. The record’s `viewer` link gives a project reader the same selection. The [browser capture](../../testing/request-correlation.png) and [recorded two-project results](../../testing/request-correlation.json) show the selected events and both fixture revisions.

## Inspect a join and its subscribers

The [dispatch desk](../../../fixtures/deliveries/project.json) publishes A to an audit log and a deduplicating ledger, then joins A and B for one ticket. Run `flow simulate fixtures/deliveries runs/late.json` in the Synapse checkout, or author the same subscription and delivery plan in your own project. A normal client can discover the available policies via `synapse capabilities`.

On a registered project, submit the scenario, then page `synapse events PROJECT RUN 1 AFTER LIMIT`. Open a selected record with `synapse event PROJECT RUN 1 ORDINAL` or its returned browser link. For a join, inspect `event.data.deliveries` and `outstanding`. For a downstream write, follow `deliveryAttemptId`, `messageId`, `subscriber` and `cause`. Those ordinals belong to this run and simulation attempt. The consumer invocation links back to its publishing step. The browser exposes the same links under **Received input**, **Publication** and **Parent event**, using the actual project’s event names.

In the late fixture the caller times out at 12 ms with B missing. B arrives for the same ticket at 16 ms and its consumer still runs. Three deliveries of A produce one ledger write and three audit writes. A lost acknowledgment, an unacknowledged attempt during processing and a committed duplicate have separate trace records. If the run stops early, follow `summary.pendingWaits[].ordinal` to the pinned interruption event. Check `summaryOmitted` for omitted rows. [Model and schedule reference](../../architecture/behavior-model.md#subscriber-delivery-and-correlated-joins)

[Seven controlled run records](../../testing/subscriber-deliveries.json) · [Captured deadline inspector](../../testing/subscriber-deadline.png)

## Find the write that supplied a state read

The [parcel allocation fixture](../../../fixtures/state/parcels/project.json) uses a store keyed by depot and parcel. Run `flow simulate fixtures/state/parcels runs/timeout.json` or publish the model to an authorized project and submit the same scenario. Two entities share the same depot. The initial quantity for parcel 101 is 7. A second flow revises it to 9. Parcel 102 retains 11.

Use `synapse search PROJECT REV state:allocation.weight --exact` to find the definition. Open the post-timeout `state_read` in the run’s event page. Inspect `data.key`, `version`, `value` and `writerOrdinal`. Open that ordinal with `synapse event PROJECT RUN 1 ORDINAL` or **Open state writer** in the pinned inspector. From the write, **Open previous writer** follows the same field and entity to version 1. The read’s parent link identifies the timeout that resumed the caller. A historical replay can be paged with `synapse replay-status PROJECT RUN REPLAY --field state:allocation.weight`. A missing key records the authored fallback and supplies no writer.

The [festival fixture](../../../fixtures/state/festival/project.json) repeats the check for a season and venue with an independently supplied capacity. Store data belongs to the simulation, including when two runs or projects use identical key values.

[Six controlled read/write records](../../testing/state-reads.json) · [Captured state inspector](../../testing/state-read.png)

## Model a data transformation or a business approval

The same project format supports calculations without messages and processes that wait for a decision. Start locally from the Synapse checkout with either controlled example, or copy the model into a registered app repository and submit its run file with the normal CLI or REST interface.

```sh
flow simulate fixtures/measurement runs/uncalibrated.json
flow simulate fixtures/measurement runs/calibrated.json
flow simulate fixtures/permit runs/approve.json
flow simulate fixtures/permit runs/at-deadline.json
```

In the [measurement flow](../../../fixtures/measurement/flows/reading.json), 12 pulses at 5 micrometres per pulse produce 60 micrometres. A boolean guard controls whether the calculation includes the calibration factor of 3. The enabled case returns 180. To reproduce the defect, change the false edge of `reading.include` on a model branch from `keep` to `calibrate` and rerun `uncalibrated.json`. The assertion still expects 60 and records 180.

Open the selected write with `synapse event PROJECT RUN 1 ORDINAL`, its REST event URL, or the returned browser link. For a write, `valueInputs` lists the field names the pinned expression read. The written field’s type or unit is in `valueType`. For operand values at that instant, use `invocationState.bindings`. The event records the written field, result and expression source. A branch event names the guard and its observed boolean value. In the inspector, open the preceding branch to see why that expression executed. Earlier stored records can lack the input list. A verified replay can reconstruct it when the original model and run inputs remain available.

In the [permit process](../../../fixtures/permit/flows/permit.json), the applicant supplies only a case ID. A separate [fixture harness](../../../fixtures/permit/flows/fixture.json) schedules a synthetic reviewer ballot. The [ballot handler](../../../fixtures/permit/flows/ballot.json) stores the reviewer and decision, then publishes a notification for that case. The permit waits up to 10 ms for the recorded decision. The run file specifies the ballot and delivery time. A real person's deliberation is outside the simulation.

| Run file | What the applicant sees | Evidence to follow |
| --- | --- | --- |
| `approve.json` / `reject.json` | Approved or rejected at 9 ms | Wait release → notification delivery → publication. From the state read, open the vote writer and its preceding signature. |
| `withheld.json` | Expired at 10 ms | The deadline lists the missing notification. The trace contains an undelivered ballot and no signature. |
| `at-deadline.json` | Expired at 10 ms | Delivery reaches the ballot inbox at 10 ms. The queued permit deadline executes before the handler records and announces its decision. |
| `late.json` | Expired at 10 ms | The ballot arrives at 11 ms. The subsequent write and notification remain visible in the run. |

Inspect `interactionMode` and the event kind to distinguish a local value/guard, an asynchronous message, and the synchronous caller waiting for the permit. The [reference run records](../../testing/model-kinds.json) preserve both project revisions and the selected event identities. The [measurement project](../../../fixtures/measurement/project.json) declares the unmodeled warehouse boundary. An unsupported operation submitted for publication returns a diagnostic with its model-relative source location.

[Measurement expression and operands](../../testing/measurement-writer.png) · [Missing decision at the permit deadline](../../testing/permit-deadline.png)

## Open the same field investigation in the workbench

Open the `workbench` link returned by `synapse event PROJECT RUN ATTEMPT ORDINAL` with a reader credential and select **Data Lineage**. At a failed write, the selected record shows the assertion's expected and observed values. **Open first wrong writer** jumps to the earliest evidenced mismatch on this lineage. **Show lineage source** opens the pinned expression beside the diagram. **Copy source reference** copies the source object as JSON. **Copy field record** copies the selected record from the scoped API response.

Choose **Consumers** to follow the selected version. For a publication, select the message or a payload port. An observed consumer opens its event. Selecting a declared or skipped consumer keeps its source and evidence on the current page with the last recorded event as context. Use **Next lineage page** for more results. The canvas draws connections whose endpoints appear on that page. **Focus** centers the selected record and **Fit** shows the page. The list below the diagram supports the same selection with a keyboard.

Switch to **Process**, **Sequence** or **Debug** at the recorded event. Browser Back restores the investigation. If the original run retained only a prefix, open historical evidence to prepare a replay with an authorized contributor. **Open verified replay in Data Lineage** uses the verified reconstruction for that attempt. **Return to original trace** reopens the original evidence. Share the workbench URL with another authorized reader or retain the project, revision, run, attempt, replay and field identifiers for CLI queries.

## Trace an observed value back to its writer

A project reader or assistant can start from an assertion ID in the run summary or from a pinned write, state write or state read event. The query stays within one project, revision, run and attempt. A verified replay can supply events omitted from the original.

```sh
synapse upstream "$PROJECT" "$RUN" 1 --assertion selected-output --limit 4
synapse upstream "$PROJECT" "$RUN" 1 --assertion selected-output --limit 4 --cursor "$CURSOR"
synapse upstream "$PROJECT" "$RUN" 1 --event 204 --replay "$REPLAY"
```

The equivalent request is `GET /v1/projects/{p}/runs/{r}/lineage/upstream?attempt=1&assertion=selected-output&limit=4`. Pass exactly one of `assertion` and `event`. For repeated assertions, use the returned event ordinals or qualify the assertion with `invocation`. Keep every selector and limit when using `page.nextCursor`. A changed selection returns HTTP 400. CLI exit 3 means there is another page or the query reached a coverage boundary. Check both `page.complete` and `coverage.complete`.

Each node identifies a value by event ordinal and field. Its parents identify expression inputs, returned ports, transport or the exact stored version. Guards, store keys and join deliveries explain execution context. A preceding guard or join identifies an earlier decision on the recorded causal path. Its presence by itself cannot establish how an alternative branch would behave. The scenario-input row at ordinal zero opens the supplied fixture and describes its external boundary. Each observed source pointer addresses the captured JSON at the response's model revision. The `viewer` links reopen the selected event or the reported mismatch.

In the [two-shipment fixture](../../../fixtures/lineage/README.md), output 76 is 42 instead of 14. The returned port at 69 reads state version 2 at 63. That read identifies write 44, which used the incorrect conversion at 42. The earlier conversion expected 7 and wrote 21. Output 77 belongs to another invocation and is 22 as expected. `firstEvidencedMismatch` is the earliest failed expectation reached through value inputs. It is null when the traversed value path has no such expectation. A failed guard can still appear among the control edges.

The default traversal depth and fan-out are 16, each configurable up to 32. Pages default to 32 nodes and allow up to 64. Traversal stops at 512 nodes or 2 MiB of encoded nodes. Each page holds up to 96 KiB of encoded nodes. Large individual values are marked omitted. An omitted event, incomplete assertion index, ambiguous occurrence, traversal limit or expired replay returns a coverage reason. A matched replay retains the original event count and identifies the reconstruction separately. [Recorded CLI and REST results](../../testing/upstream-lineage.json)

## Find what else a field affects

Before editing a rule, select its stable field at the project commit. The result lists declared readers and their source expressions, even when the project has never been simulated. Use depth 1 to inspect immediate uses. A deeper query follows returned ports, state reads, guards and published fields. Shared subprocess definitions can lead to several possible callers. An executed run identifies the actual caller and invocation.

```sh
synapse downstream "$PROJECT" "$REV" field:reading.base --depth 1
synapse downstream "$PROJECT" "$REV" input:reading.useCalibration
```

To investigate a failure, save the upstream response for the selected assertion. The CLI prints JSON even when it exits 3 for a partial result or a page with a continuation. Inspect `coverage` and `page` before using the result. In the parcel example, `firstEvidencedMismatch` identifies a flow-field write. Use its field and event directly in the next request.

```sh
synapse upstream "$PROJECT" "$RUN" 1 --assertion selected-output --limit 64 > upstream.json
jq -e '.firstEvidencedMismatch != null' upstream.json
synapse downstream "$(jq -r .project upstream.json)" "$(jq -r .revision upstream.json)" \
  "field:$(jq -r .firstEvidencedMismatch.field upstream.json)" \
  --run "$(jq -r .runId upstream.json)" --attempt "$(jq -r .attempt upstream.json)" \
  --event "$(jq -r .firstEvidencedMismatch.ordinal upstream.json)" --limit 16
```

For a historical reconstruction, pass the same `--replay` ID to both commands. The REST equivalent is `GET /v1/projects/{project}/lineage/downstream` with query parameters `revision`, `field`, and the same optional flags. The scoped credential goes in the authorization header. A model query omits run, attempt and event. To inspect execution, supply all three. Event 0 selects a scenario input. Other selectors include `state:store.field`, `message:event` for an envelope, and `channel:event/port` at a publish event for one payload field.

| Evidence in a result | How to use it |
| --- | --- |
| `declared`, `possible` | The model contains a reference. Its location and relationship explain why it could matter. |
| `observed` | The selected version reached this event. Inspect `causes` for the binding and value or execution influence. A delivery records transport. A data read or write has its own event. |
| `processed`, `suppressed`, `failed_delivery`, `undelivered` | Inspect the subscriber, message and delivery attempt when one occurred. A terminal transport record alone supplies no handler write or inferred output. |
| `skipped`, `unknown` | A finished run can establish an unvisited step or the opposite branch. An external boundary identifies the last supported source. A partial or suspended run can leave declared uses possible. |

A reader can open an observed row's `viewer` link at its project, revision, run, attempt and event. Each response has a `coverage` object. Read every page with the original selector, limits and `page.nextCursor`. A final page can still be incomplete. Defaults are 16 hops, 32 outgoing relationships and 32 rows per page. The maximums are 32 hops, 64 outgoing relationships and 64 rows per page. The traversal bounds the graph at 512 nodes or rows and 2 MiB, the scan at 65,536 event fields, and a page at 96 KiB of encoded rows. Revisited definitions count once in the model traversal. Run evidence keeps distinct field versions and invocations. On replay expiry the response reports the boundary and how to request a replacement. Start a fresh query with the replacement replay ID.

In the controlled parcel run the bad conversion at 42 reached state write 44, read 63, return 69 and the original failed output 76. Parcel 102 used a different conversion and caller. The published weight for parcel 101 had a processed subscriber, a suppressed duplicate and a withheld subscriber. [Paired consumer results](../../testing/downstream-consumers.json)

## Find the change that introduced a rule

In the Workbench, select a saved event in **Debug** and expand **Rule history**. The list uses that run’s revision and the event’s authored step. Each change shows the recorded Git author, rationale when available, and links to the available definitions before and after it. Use **Earlier changes** to continue through history pages.

From the consuming application repository, use the stable symbol returned by search and the commit on the run you are investigating. For example, a contributor can look up a checkout price calculation with these commands.

```sh
synapse search "$project" "$revision" checkout.price --exact
synapse history "$project" "$revision" checkout.price --limit 4
```

The equivalent reader-scoped operation is `GET /v1/projects/{project}/history?revision=COMMIT&symbol=checkout.price&limit=4`. Flow and field IDs use their search forms, such as `flow:checkout` and `field:checkout.amount`. Use the returned `nextOffset` with the same revision and symbol until it is null. Each page examines up to eight commits, so an empty page can still have a continuation. Branch movement leaves a pinned investigation at its original revision.

Read `before` and `after` for the authored value, file and JSON pointer. A declaration can move without changing its meaning. A display-label edit keeps an action’s ID. Replacing an ID produces a removal under the old ID and an addition under the new one. A merge lists its parents and compares against its first parent. Continue paging to locate an original edit on the merged branch. Git supplies the recorded author, time and subject. To record an explicit rationale in a project commit, add a blank line after the subject and a `Synapse-Reason: …` trailer. Without that trailer `rationale` is null. An API-generated commit may identify the service as its Git author.

Open a present definition's `viewer` with a project reader credential. The `runs` field lists up to eight available runs at that revision. Open a run and request its events filtered by the step to confirm whether the selected rule executed. An unsupported model produces `unknown` with a compiler diagnostic. An absent definition is labeled `absent`. A Git commit object larger than 128 KiB returns `COMMIT_METADATA_LIMIT` for that revision. Continue paging to examine earlier commits. Definitions over 8 KiB return their digest, byte count and source location. Read the exact model file at the named commit for the full value. The history describes authored changes. The separate lineage queries show which consumers actually used an output. [Controlled history walkthrough](../../testing/symbol-history.json)

### Hand the earlier writer to a reader

1. On the history row for the rule change, use the earlier definition’s revision. Look for a saved run on that revision. If you need to discover runs for the triggering action, query `GET /v1/projects/{project}/review-runs?revision={earlierCommit}&entry={trigger}`. Use the full revision and the selected attempt throughout the investigation.
2. Run `synapse events "$project" "$run" "$attempt" 0 16 --step "$step"` and choose the writer for the relevant field and invocation. Run `synapse event "$project" "$run" "$attempt" "$ordinal"`. Resolve the returned `workbench` path against the service origin and share that URL. The reader signs in with their own access. At the top of **Debug**, **First** gives the modeled reply or event-handler outcome. **Afterward** shows the selected event if it followed that outcome. On initial entry it shows the first later field write on the loaded pages, otherwise the last later event loaded. The event numbers establish order even when timestamps match. For the exact field, value and source, expand **Machine record** and inspect `event.data`.
3. To identify the application revision that was actually tested, request `GET /v1/projects/{project}/review-reports?run={runId}&attempt={attempt}`. Each item gives the report `id`, test name, and `appRevision`. If `nextAfter` is present, pass it as `after` with the same run and attempt. Open `GET /v1/projects/{project}/comparisons/{runId}?attempt={attempt}&appRevision={appRevision}&observation={id}` and inspect the assertion’s simulated value, sample, and comparison state. If there is no report, you can still hand off the simulated writer. Leave the application outcome unconfirmed.

## Compare two branches by stable identity

Resolve the two commit IDs in the consuming repository. On the Synapse CLI, pass the proposed source commit first and the receiving target commit second. Both commits must be visible to the project reader.

```sh
source_commit=$(git rev-parse feature/carton-conversion)
target_commit=$(git rev-parse main)
synapse compare "$PROJECT" "$source_commit" "$target_commit" --limit 16
```

An API-only assistant can resolve each tip with `synapse head PROJECT BRANCH` or `GET /v1/projects/{project}/head?branch=BRANCH`. Use the returned revisions throughout the review.

The REST operation is `GET /v1/projects/{project}/compare?source=SOURCE&target=TARGET&limit=16`. Synapse returns both tips and their best common ancestors. With one base, it compares each authored declaration against that base. An empty model directory at a pinned revision has zero declarations, so a team can review its first model or a model removal. With unrelated histories or multiple best bases, it returns `unrelated` or `ambiguous-base`. An unavailable or incompatible model returns revision-linked diagnostics. The CLI prints the record and exits 3 when the comparison has no unique base or the model is unavailable. Compare accepts the current `schemaVersion: 1` format.

Rows identify source-only, target-only and identical two-sided changes. An `overlap` identifies two different edits to the same declaration. Use the three projected values, source locations and browser links to investigate. A container owns its declaration order. Its children own their individual expressions and types. Moving a file and reordering steps can therefore appear together on one flow row. Changing a waiting request to a publication changes the step even when the mapped fields stay identical.

Continue with `--offset` set to `nextOffset` and the original commits until the service returns null. Each call examines up to 256 ordered symbol IDs and returns up to 32 changed rows. An empty page can have more results. A projected value or order larger than 8 KiB includes its byte count, digest and source pointer. Full source is available at the named Git commit.

To see what a user would experience, run the same case at each revision and follow an executed writer with `synapse downstream`. In the controlled checkout, one Inventory expression changed. The two runs show Payments and Fulfillment each receiving 24 units before the fix and 12 after it. The checkout amount was 3,897 in both runs. The comparison covers authored model declarations. External run-file contents, simulated output differences and candidate eligibility have separate evidence. [Controlled comparison and run traces](../../testing/three-way-comparison.json)

## Prepare and inspect a combined candidate

For branch comparison, use the published `schemaVersion: 1` model format. If an older fixture simulates but its review returns `UNSUPPORTED_COMPARISON_FORMAT`, convert both branches from a common versioned baseline, validate both models and replay the existing cases before comparing again. The [document-publishing walkthrough](../../testing/publishing-walkthrough/README.md) shows this conversion and a repair that still has a failing downstream case.

From your app repository, resolve the two commit IDs. Pass the proposed branch first and the receiving branch second. A contributor, maintainer or project assistant can prepare the review. A reader can reopen it in a fresh session.

```sh
source_commit=$(git rev-parse feature/carton-conversion)
target_commit=$(git rev-parse main)
synapse candidate "$project" "$source_commit" "$target_commit" > candidate.json
review_id=$(jq -r .reviewId candidate.json)
synapse candidate-status "$project" "$review_id"
```

The REST equivalents are `POST /v1/projects/{project}/candidates` with `source` and `target` and `GET /v1/projects/{project}/candidates/{reviewId}`. Repeating the same ordered pair reopens the same receipt. The branch comparison also exposes its URL under `candidateReview`. Save the receipt together with the scenario and run identities when reviewing a change.

| Receipt state | What a developer or assistant can do |
| --- | --- |
| `compiled` | Inspect the combined model at `candidate.commit` and run an authored scenario there. The tree covers the entire repository. Candidate parents are target then source. Identical tips reuse the original commit. |
| `conflicted` | Open the indicated files and pointers at the named base, source and target. Resolve competing choices on a branch and submit the new tips. The receipt identifies the review even when a candidate tree cannot be assembled. |
| `invalid-candidate` | Inspect the compiler diagnostic at the combined commit. Where identifiable, `relatedSymbols` gives original definitions, file locations, absent declarations and viewer links on all three revisions. Fix the declaration or its consumer and prepare again. |
| `unrelated`, `ambiguous-base`, `unavailable-model` | Inspect `bestBases` and revision diagnostics. Choose revisions with a shared, supported model history. |

The CLI returns exit status 3 with the JSON receipt for every noncompiled state. Structural diagnostics report the first conflict per affected model document, up to 32. Compilation reports its first error. Unmodeled repository files retain their bytes and modes when the choice is unambiguous. If both branches change the same such file differently, reconcile it in the consuming repository. Preparation writes service-owned Git objects and a receipt. Project branch tips move only through a separate integration operation.

For a compiled receipt, use your case path and a new request ID. In the controlled checkout this ran the Inventory correction together with the receiving branch’s file move. Payments and Fulfillment each observed 12 units and checkout still charged 3,897. Compiling a candidate establishes that its declarations and declared case files validate. Review its simulation evidence before making a behavior decision. [Recorded candidate, compiler diagnostics and run](../../testing/merge-candidate.json)

```sh
candidate_commit=$(jq -er 'select(.state == "compiled") | .candidate.commit' candidate.json)
synapse run "$project" "$candidate_commit" runs/recovery.json review-carton-1
```

## Submit a set of simulation cases

From the consuming app, put the commit and ordered case paths in a JSON request. Use a request key unique to the submitting identity. Every selected case is required for the batch verdict.

```sh
revision=$(git rev-parse HEAD)
jq -n --arg revision "$revision" '{revision:$revision,requestId:"checkout-review-1",
  runFiles:["runs/checkout.json","runs/payment-retry.json","runs/fulfillment.json"]}' |
  synapse batch "$project" > receipt.json
batch=$(jq -r .batchId receipt.json)
synapse batch-status "$project" "$batch" --limit 32
```

Poll until `counts.pending` reaches zero. For another page, pass the returned `nextAfter` with `--after`. Each page includes counts for the whole batch. The CLI prints JSON and exits 3 for a failed or incomplete terminal verdict. A pending receipt has `eligibleAsEvidence: false`. Repeating the original request with the same scope and contents reopens it. A changed path, order or revision with the same key returns HTTP 409.

A valid case has a run ID and attempt. Open its ordinary run, assertion, event, lineage and replay endpoints. A failed business assertion keeps its observed value, expected value and trace. An invalid definition has a diagnostic and source location. A missing file has a null case digest. One invalid case lets other valid cases run. Only a batch whose selected cases all passed can provide passing evidence. The reviewer still needs to check the selected coverage and Git tips.

To resume after the submitting client exits, keep `receipt.json`. A reader with their own credential can list the cases from that receipt. Start at zero, then repeat the page request with each returned `nextAfter` until it is null. A terminal failed batch returns CLI exit 3 even on a page containing a passing case. Preserve the JSON and inspect the rows.

```sh
project=$(jq -er .project receipt.json)
batch=$(jq -er .batchId receipt.json)
after=0
rc=0
synapse batch-status "$project" "$batch" --after "$after" --limit 1 > page.json || rc=$?
case "$rc" in 0|3) ;; *) exit "$rc" ;; esac
jq '{nextAfter, cases: [.cases[] | {caseId, runFile, state, simulationStatus, diagnostic}]}' page.json
```

Match the authored `runFile` and save its `caseId` together with the project, revision, and batch ID. The cursor is a page position. The case ID identifies the row across reads of this batch. On the page containing the selected case, set `case_id` to that saved ID and `assertion_id` to the authored assertion. For a failed assertion with a retained writer, open the event as follows.

```sh
jq -e --arg id "$case_id" '.cases[] | select(.caseId == $id)' page.json > case.json
run=$(jq -er .runId case.json)
attempt=$(jq -er .attempt case.json)
writer=$(jq -er --arg id "$assertion_id" '.assertions[] | select(.id == $id and .status == "failed") | .writerOrdinal | numbers' case.json)
synapse event "$project" "$run" "$attempt" "$writer" > writer.json
jq -er .workbench writer.json
```

When an assertion repeats, select the intended invocation before opening its writer. If there is no writer ordinal, inspect the assertion and available trace. For REST, follow the case row’s `run` path and compare the batch’s `simulationStatus` with the original run’s `summary.status`. A business failure has batch case `state: failed` and simulation status `failed_assertion`. An invalid case has a stable case ID, a diagnostic code and source location, and no run ID. Share the returned workbench path against the service origin. It pins the selected project, revision, run, attempt, and event.

Use `synapse batch-cancel "$project" "$batch"` to cancel outstanding work. Completed cases keep their evidence. For an interrupted case, use the ordinary run retry endpoint with its last attempt. Query the same batch again to see the new attempt. REST clients can discover these operations through `GET /v1/capabilities` and the [OpenAPI reference](../../../access/run-api.json).

Submission accepts up to 1,000 distinct `runs/*.json` paths, a 1 MiB request envelope, 1 MiB per case and 16 MiB of case contents in total. Each project admits one outstanding batch. HTTP 429 includes a retry interval. A reader can inspect results and a project contributor, assistant or maintainer can submit or cancel.

## Compare the behavioral impact of a branch

Start with the compiled review ID returned by `synapse candidate`. Inspecting the plan is optional. A contributor or scoped assistant can submit the two branch names and a request ID directly. A reader can inspect a plan or reopen a comparison.

```sh
synapse candidate-impact "$project" "$review" --offset 0 --limit 16
jq -n --arg source "$source_branch" --arg target "$target_branch" \
  '{sourceBranch:$source,targetBranch:$target,requestId:"review-001"}' |
  synapse compare-candidate "$project" "$review"
synapse comparison-status "$project" "$comparison" --limit 16
synapse comparison-status "$project" "$comparison" --run-file runs/recovery.json
```

Use the returned `comparisonId` for later reads. Repeat the same submission after a lost reply. Reusing the request ID with different parameters returns HTTP 409. The service resolves the branch names inside the selected project and checks that both tips match the prepared review. Worker execution continues after the caller disconnects. The ordinary project batch limit applies throughout both runs. A busy project returns HTTP 429 with its retry delay.

The selector examines the receiving revision and the combined candidate independently. Each case includes its selection reason, input-file digests and a path to a changed definition where one is known. A path can include a synchronous call, a published event, a subscriber, a correlated wait or a stored field. An opaque port, an unresolved case, changed project declarations or a traversal limit can expand the comparison to the full suite. A plan covering 60 selected cases estimates 120 executions. If the inventory exceeds the batch limits, the receipt explains the boundary and schedules zero jobs. Inspect `nextOffset` for additional cases and `changedSymbolsTruncated` for display limits.

Both sides expose the original run and attempt. A single-case read adds retained field writes and writer-event links. Inspect the per-assertion expected and observed values and the unvisited steps before treating a potential reader as an observed consumer. `totalEvents`, `retainedEvents` and `summaryOmitted` describe the available detail. Read `blockers` across the entire required set, including cases outside the displayed page. A fresh read checks the runner build and both branch tips. Merge integration must recheck those identities when it writes the target ref.

For a bug fix, the baseline can finish with an observed assertion failure. If both sides use the same fixture and assertion definitions, every required candidate case passes, and the other comparison checks pass, the review reports `mergeReady: true`. The baseline run and batch retain their failed verdicts. Open the case’s `assertionDeltas` to see the expected value, both observed values, and each original writer. Repeated evaluations include a one-based occurrence within the same assertion and step. A baseline assertion that never reached its writer yields `baseline-assertion-evidence-incomplete`. A failing candidate yields `candidate-assertion-failed`.

Discover the three routes through `candidateComparison` in `/v1/capabilities`. The request and result schemas are published at `/openapi.json`. The CLI emits the JSON body even when it exits with 3 for an incomplete page, a withheld plan or an ineligible comparison.

If the comparison reports `incompatible-runner` or `engine-changed`, retain its ID and original attempts. Ask the operator to verify the API and worker build identities. After both are pinned to the same build, request a new comparison with a new `requestId` for the same source and receiving branch tips, then inspect both new attempts. Reopening the old comparison preserves its original evidence.

## Confirm a tested model change

Open `mergeOperation.viewer` from a comparison, or use `synapse merge-status PROJECT COMPARISON`. A reader can inspect the branch names, candidate commit, comparison blockers and original runs. A maintainer on a qualified controlled repository can select **Review merge**, inspect the receiving branch and tested commit, then **Confirm merge**. Cancel returns to review. After confirmation the same link opens the durable receipt. A stale review requires fresh tips, a new candidate, and affected reruns.

A passing simulation applies to the modeled behavior. Synapse compares the target and candidate trees after accounting for each revision’s manifest, declared flows and recognized scenario files. When the candidate also changes application files, the screen identifies the source, receiving branch and repository for an ordinary pull request. Keep the whole branch together and attach the comparison to that review. The Synapse operation returns `review-only` and preserves both branch tips. This applies to undeclared application files inside the registered directory as well as files outside it. Hosted GitHub bindings already use repository review.

For a coding assistant, read the project-scoped operation at `GET /v1/projects/{p}/candidate-comparisons/{id}/merge`. The comparison ID is also the operation ID. A maintainer can submit the pair inspected in the review:

```sh
synapse merge-status "$project" "$comparison" > merge-review.json
jq -e 'select(.state == "ready") | {candidateCommit: .candidate.commit, candidateTree: .candidate.tree}' merge-review.json > confirmation.json
synapse confirm-merge "$project" "$comparison" < confirmation.json
```

The REST equivalent is a POST to the same resource with that JSON body. HTTP 409 returns a stale or ineligible decision, an unavailable writer, or a mismatch with the submitted pair. HTTP 403 identifies an insufficient project role. An inaccessible project or comparison returns 404. After a timeout, reopen the operation. A completed receipt records the approving principal, approval time, original branch tips, commit, tree, engine build and both batch IDs. Both batch IDs retain the originally compared attempts. A later change to either branch leaves this receipt and its evidence available.

**Provision a controlled writer.** Use a dedicated local bare repository as the authoritative remote for a controlled project. Only trusted operators and the Synapse service may have filesystem-level write access. Direct Git clients use receive-pack. The operator verifies the actual writers and protects the existing default receiving branch from ordinary pushes. A local mirror of a hosted repository cannot qualify that hosted repository. Using the previously configured bare repository and registered project UUID:

```sh
target_ref=$(git -C "$bare" symbolic-ref HEAD)
git -C "$bare" config --add receive.hideRefs "$target_ref"
git -C "$bare" config --local --add synapse.controlledWriter "$project $target_ref"
```

Keep `transfer.hideRefs refs/synapse/` on the repository. Run `synapse-access init` during the service upgrade to install the integration audit index. Test a denied direct push and read back the capability on the controlled fixture. Each enabled project has its own local authorization entry. Removing its exact entry with `git config --local --fixed-value --unset-all synapse.controlledWriter "$project $target_ref"` in the bare repository withdraws that grant while preserving existing receipts. The supported strategy installs the tested two-parent merge commit with the receiving parent first. Equal tips need no write. Changes to both refs and the receipt use one Git reference transaction. A client recovering from an interruption can reconstruct the database audit record by reopening the Git receipt. [Controlled browser, race and recovery checks](../../testing/controlled-merge.json)

### Review the source change and downstream values

After preparing a candidate, open its `viewer` to inspect a conflict and its source locations. After the comparison runs, open `mergeOperation.viewer`. Choose an affected scenario, then filter by module, flow or field. **Source changes** shows the exact expression or guard, including links to the common base, proposed and receiving definitions. **Observed writes** includes downstream modules whose source stayed the same. Open either value to inspect its original event, writer and revision. **Rule history** and **Flow history** show authors, dates, recorded rationale and earlier evidence.

For the same evidence in an assistant session, use the project credential and the scenario file from the review.

```sh
synapse comparison-status "$PROJECT" "$COMPARISON" --case-index true --limit 64
synapse comparison-status "$PROJECT" "$COMPARISON" --run-file "$SCENARIO"
```

The REST equivalents are `GET /v1/projects/{project}/candidate-comparisons/{comparison}?caseIndex=true` and the same path with `?runFile={scenario}`. Follow `nextOffset` for more case names. Each selected case includes `writeComparisons` with the original events on both sides. A single write to the same field by the same step with compatible types and complete comparable traces can establish a changed value. Repeated writes without a verified pairing retain both event lists with status `uncertain`. One-sided observations and unvisited steps have separate labels. The comparison records the original decision even after a branch moves. Prepare and run a fresh comparison for the new tips before merging.

## Reopen after scheduled maintenance

Use your saved project, revision, run and comparison links. An interrupted attempt remains available to inspect. A contributor can request a retry with current project access. If your credential is rejected, contact the project maintainer for verification and reissue. [Operator recovery and evidence](../../architecture/pilot-recovery.md)

## Public operation inventory

Start with the developer question above, then use this index to choose a command, credential and evidence handle. `P` means `/v1/projects/{p}`, where `p` is the project UUID. CLI names refer to `synapse`. A dash in the command column means use REST. The service publishes exact JSON bodies, parameter types and per-operation status codes at `GET /openapi.json`. [Checked-in OpenAPI reference](../../../access/run-api.json)

**Access.** Read = project reader, contributor, assistant or maintainer. Write = contributor, assistant or maintainer. CI = a project-scoped observation credential. Binding = a human with an operator-granted repository and model directory. Access checks use the caller’s credential and project on every request. Save IDs, revision and selectors with results. Keep tokens private.

**Errors and coverage.** Inspect the response body as well as HTTP status. A 200 can describe an invalid model, incomplete evidence or a blocked merge. A 202 acknowledges queued work. Common failures include malformed input (400), invalid credentials (401), insufficient role (403), missing or inaccessible project/resource (404), conflicting state or reused request ID (409), unavailable retained detail (410), size or model validation errors (413/422), capacity limits (429) and service unavailability (503). Follow the continuation returned by the operation with the same revision, attempt and filters. An empty filtered page can still have a continuation. Record reported omissions even after reaching the last page.

### Discover a project and establish access

| Method and path | CLI command | Access | Inputs, evidence and limits |
| --- | --- | --- | --- |
| `GET /v1/capabilities` | `capabilities` | Public | Discover API/model versions, supported simulation steps, feature paths and advertised bounds. |
| `GET /v1/schema` | `schema` | Public | Fetch the project, flow and run schemas. Use the schema version when authoring. |
| `GET /v1/guide` | — | Public | Read this versioned Markdown guide. |
| `GET /v1/starter` | — | Public | Fetch the starter documents. Preserve their relative paths when creating a model. |
| `GET /v1/projects` | `projects` | Signed in | List projects visible to this identity. The CLI accepts an optional query. REST clients can also use `setup=true` to inspect registration bindings. |
| `POST /v1/projects` | `register` | Binding | Submit name and exact repository/model-path binding. Keep the project UUID for subsequent calls. |
| `POST /v1/projects/starter` | — | Hosted session | Retry the caller's reserved starter if managed storage was unavailable. Keep the returned project UUID for authoring. |
| `POST /v1/projects/managed` | — | Hosted session | Create a private project by name. Reuse the same request UUID and name on retry. |
| `GET P` | — | Read | Resolve the project UUID to its registered repository and model directory. |
| `POST P/permissions/{op}` | — | By operation | Check the named operation with the acting credential. For merge, also inspect provider capability and the comparison decision. |
| `GET P/resources/{kind}/{id}` | — | Read | Resolve a saved model, run, trace or evidence reference in its original project. Use its kind and local ID together. |
| `GET P/members` | — | Maintainer | Read human identities and their project roles. |
| `PUT P/members/{human}` | — | Maintainer | Grant or change a human’s role. Preserve at least one project maintainer. |
| `DELETE P/members/{human}` | — | Maintainer | Remove the named member. The last-maintainer guard also applies here. |
| `GET P/credentials` | — | Maintainer | Inspect integration credential metadata. Use a saved issuance request ID to identify a grant after a lost response. |
| `POST P/credentials` | — | Maintainer | Supply assistant or CI role and optionally a request ID. Save the credential ID for revocation. The secret is returned at issuance. |
| `DELETE P/credentials/{id}` | — | Maintainer | Revoke the integration credential by its public ID. Further access with its token returns 401. |

### Author, validate and find behavior

For a local checkout, `flow schema` prints the same three schemas. `flow validate MODEL` checks the authored documents and declared run files. `flow compile MODEL` also returns the compiled representation. `flow check MODEL` evaluates the declared static checks and exits 3 when there are none. `flow simulate MODEL RUN_FILE` executes a selected case and returns its result and evidence. These commands use local file access. Add `--at REF` to the four model commands to read committed input. Use a pinned commit when handing evidence to another developer.

| Method and path | CLI command | Access | Inputs, evidence and limits |
| --- | --- | --- | --- |
| `GET P/head` | `head` | Read | Read the current commit for the optional branch. Keep it as the expected tip of a conditional change. |
| `GET P/model` | — | Read | Inspect index state at a revision or branch. Check the state and diagnostics in the reply. |
| `POST P/changes` | `publish` | Write | Submit branch, expectedHead, requestId and documents together. Use create for a new review/{project UUID}/… branch. A stale expected tip rejects the write. |
| `GET P/context` | `search` | Read | Search a revision by stable ID, label, handler or field. Inspect source pointers, page.nextOffset, omissions and coverage. Up to 64 results per page. |
| `GET P/project-map` | `map` | Read | Start at a revision, expand a group, and page with offset/limit. Keep stable domain and flow IDs for drill-down. |
| `GET P/call-sites` | `callers` | Read | Locate callers of a callee flow at a revision. Continue from the returned call-site cursor with after. |
| `GET P/flow-overview` | — | Read | Browse a revision by domain. Continue with nextAfter to see more flows. |
| `GET P/process` | — | Read | Open a flow by revision and stable flow ID. Inspect its source file, field types and declared destinations. |
| `GET P/scenarios` | — | Read | Supply revision and exactly one entry or flow. Continue by offset even when a page has no matches. The limit counts case files examined. |

### Simulate, debug and replay

| Method and path | CLI command | Access | Inputs, evidence and limits |
| --- | --- | --- | --- |
| `POST P/runs` | `run` | Write | Submit revision, runFile and requestId. Keep the run UUID and attempt. Reuse the request ID only for the same submission. |
| `GET P/runs/{r}` | `status` | Read | Read run state and summary. REST can select an attempt. The CLI reads the current attempt. |
| `GET P/runs/{r}/updates` | — | Read | Poll with afterVersion and waitMs (up to 1,000 ms). Compare the returned version before polling again. |
| `GET P/runs/{r}/manifest` | — | Read | Select the attempt to recover its pinned inputs, build and digests for reproduction. |
| `GET P/runs/{r}/events` | `events` | Read | Page an attempt by ordinal with after/limit and optional step/message filters. Pages hold up to 64 events within the retained prefix of 128. |
| `GET P/runs/{r}/events/{ordinal}` | `event` | Read | Open one event in the selected attempt. Keep its ordinal and viewer link. Omitted detail can return 410. |
| `GET P/runs/{r}/invocations/{id}` | `invocation` | Read | Drill into one call in an attempt using its invocation ID. Inspect its inputs, outputs and causal links within retained evidence. |
| `POST P/runs/{r}/cancel` | — | Write | Cancel queued or executing work. Pin the attempt to avoid acting on a different retry. |
| `POST P/runs/{r}/retry` | — | Write | Supply expectedAttempt for an interrupted run. Preserve the original run ID and record the new attempt. |
| `POST P/runs/{r}/replays` | `replay` | Write | Submit original attempt and requestId. Keep the replay ID, selector and verification state separately from the original evidence. |
| `GET P/runs/{r}/replays/{id}` | `replay-status` | Read | Select an event, invocation, caller occurrence or field. Page with after/limit and inspect replay coverage and availability. |
| `POST P/runs/{r}/replays/{id}/cancel` | `replay-cancel` | Write | Cancel the identified replay in its original run. Refer to its receipt for the resulting state. |
| `POST P/batches` | `batch` | Write | Submit revision, ordered runFiles and requestId. Up to 1,000 cases, 1 MiB per case and request envelope, 16 MiB of case inputs in total. |
| `GET P/batches/{b}` | `batch-status` | Read | Page by after/limit (up to 64). Inspect each case ID, run or definition diagnostic. Valid cases can run alongside a rejected case. |
| `POST P/batches/{b}/cancel` | `batch-cancel` | Write | Cancel outstanding work by batch UUID. Completed evidence remains available to review. |

### Trace values and compare application observations

| Method and path | CLI command | Access | Inputs, evidence and limits |
| --- | --- | --- | --- |
| `GET P/runs/{r}/lineage/upstream` | `upstream` | Read | Pin attempt and select an assertion or event. Follow the writer by event/invocation, optionally in a verified replay. Return nextCursor with the same selectors. |
| `GET P/lineage/downstream` | `downstream` | Read | Start from revision and qualified field. Add run/attempt/event to follow that field version. Distinguish observed from possible readers. Follow nextCursor and inspect omissions. |
| `POST P/observations` | — | CI | Save a project-scoped evidence reference with id, revision and artifact_id. Use the artifact route below to upload a full application report. |
| `PUT P/observation-artifacts/{id}` | — | CI | Upload the independently measured report with app and model revisions, run/attempt, fixture digest, correlation and measured fields. Retain its observation ID. |
| `GET P/observation-artifacts/{id}` | — | Read | Retrieve the stored report by observation ID for the project. |
| `GET P/comparisons/{run}` | — | Read | Supply attempt and appRevision and optionally select an observation. Inspect each assertion’s classification, including stale, incomparable or unobserved. |
| `GET P/review-revisions` | — | Read | Discover revisions with saved runs. Pass nextAfter as after for the next page. |
| `GET P/review-runs` | — | Read | Select revision and entry to find reviewable runs, optionally a specific run. Continue with nextAfter. |
| `GET P/review-reports` | — | Read | Select run and attempt to discover report IDs, application revisions and tests. Continue with nextAfter. |

Lineage traversals cap depth at 32, total nodes at 512 and page size at 64. Upstream fanout is capped at 32 and downstream at 64. The three review catalogs return up to 24 items per page. Use the selected run and attempt when opening the workbench’s Debug and Sequence views.

### Inspect history, compare branches and review a merge

| Method and path | CLI command | Access | Inputs, evidence and limits |
| --- | --- | --- | --- |
| `GET P/history` | `history` | Read | Pin revision and stable symbol. Read recorded changes and rationale. Pages examine up to eight commits. Follow nextOffset through empty pages. |
| `GET P/compare` | `compare` | Read | Pin source and target commits visible to the project. Review stable-symbol changes against their unique base. Page with offset/limit (up to 32) and inspect the 256-symbol examination bound. |
| `POST P/candidates` | `candidate` | Write | Prepare the exact combined model from source and target commits. Keep reviewId, commit and tree or the conflict/validation evidence. |
| `GET P/candidates/{id}` | `candidate-status` | Read | Retrieve the preparation result by review ID and inspect its state and viewer link. |
| `GET P/candidates/{id}/impact` | `candidate-impact` | Read | Inspect selected, possibly affected and uncovered cases. Page by offset/limit, up to 64. maxVisits bounds traversal at 2,048. |
| `POST P/candidates/{id}/comparisons` | `compare-candidate` | Write | Supply sourceBranch, targetBranch and requestId. Keep comparisonId for the two pinned revisions. Uncertain impact selects the full comparison within project limits. |
| `GET P/candidate-comparisons/{id}` | `comparison-status` | Read | Use caseIndex=true to page scenario paths and selection, or runFile to inspect one case’s retained writers. Follow nextOffset. The full result includes run evidence and readiness blockers. |
| `GET P/candidate-comparisons/{id}/merge` | `merge-status` | Read | Inspect the current merge decision, reviewed candidate and viewer URL by comparison ID. Recheck after either branch moves. |
| `POST P/candidate-comparisons/{id}/merge` | `confirm-merge` | Maintainer | Confirm the reviewed candidateCommit and candidateTree on a qualified provider. Keep the installed commit from the receipt. Route mixed model/application branches through repository PR review. |
