# `jadpo replay`

Replay a request a deployment recorded.

Runs on this machine a failing request a deployment recorded and says whether it gets the same results (area 17, "Replaying a production request"): the same status, code and path. A deployment that sets JADPO_RECORD_FAILING_REQUESTS=true logs each failing request as a `request.recorded` event, its personal data as keyed hashes. The command reads that event from a file of the deployment's log, or from standard input with `-`, and runs the request as a route test it never saves: the records it read made in a throwaway database, its providers' answers given by fakes, its clock and its random bytes as recorded, and personal data given generated values. Nothing reaches production or a provider, and nothing is written in the project.

```text
jadpo replay <log>
```

## Arguments

- `log`: The file the recording was saved to, or - for standard input

## Flags

- `--request <id>`: The request to replay: any start of its id

## On every command

- `--json`: Print data for tools instead of text
- `--full`: Show everything a report shortens
- `--help`: Show every flag, with examples
- `--color <when>`: Choose when to use colour

`jadpo replay --json` writes one JSON document to standard output instead of text, with the same exit code. The document has `schemaVersion`, `command` (`"replay"`), `ok`, `data` (what the command produced, `null` when it failed) and `diagnostics` (each error with its `rule`, `reason`, `next` and `help`). A command that needs a terminal refuses `--json` and names the flags that do the same job.

## Examples

```text
# Replay the recording saved from the log
jadpo replay recording.log
# Replay one of several, piped in
pbpaste | jadpo replay - --request req_0b1e
```

## Errors

- [`cli.replay_arguments`](/docs/errors/cli.replay_arguments.md): A `jadpo replay` command is given no file of a production log, one that can't be read or holds no recording, or a request the file doesn't hold
- [`toolchain.project_not_found`](/docs/errors/toolchain.project_not_found.md): You ran a command that works on a project in a folder with no `app.jadpo`, in it or in any folder above it
- [`replay.differed`](/docs/errors/replay.differed.md): A request `jadpo replay` replayed was answered with another status or code, or took another path, than its recording kept
- [`test.database_unavailable`](/docs/errors/test.database_unavailable.md): The tests that need a database couldn't run, because PostgreSQL for the tests couldn't be started or reached
