# Run report

> This document describes the JSON run report emitted by floe run and the status/exit code rules.

Source: https://openlakeforge.dev/floe/reference/report/

This document describes the JSON run report emitted by `floe run`
and the status/exit code rules.

## Goals

- Provide a deterministic, machine-readable summary of each run.
- Avoid logging raw row values (PII risk).
- Support multiple input files and entities under the same run.

Reports only include aggregate counts and row indices for examples; raw row
values are excluded.

## Report directory layout

Reports are written under the configured report directory:

```
<report.path>/run_<run_id>/run.summary.json
<report.path>/run_<run_id>/<entity.name>/run.json
```

(`<entity.name>` is `<domain>/<name>` for an entity with a qualified id, see [config](https://openlakeforge.dev/floe/reference/config/#entity-identity).)

When every entity of the run belongs to one domain (D37, 0.8), the run directory sits
under that domain (`<report.path>/<domain>/run_<run_id>/`), so a domain's runs are listed together, and `run.summary.json`
carries `run.domain`. A run spanning several domains, entities without a domain, or a
pre-0.3 domain holding `.`, `/` or `\` (not a safe directory name) keeps `<report.path>/run_<run_id>/` and has no `run.domain`. `run_finished`'s
`summary_uri` and `entity_report_uris` point at the actual location; `report_base`
stays `<report.path>`. Floe 0.7 always wrote `<report.path>/run_<run_id>/`.

`run_id` is a filename-safe ISO-like string: `YYYY-MM-DDTHH-MM-SSZ`
(colons replaced by dashes). The report JSON must include the full
`report_file` path.

Each entity produces its own `run.json`. The run summary aggregates all entities.

Golden example files live under `example/report/run_2026-01-19T10-23-45Z/`.

## Top-level sections

### Run summary (`run.summary.json`)

- `spec_version`: Config version string.
- `tool`: Tool name/version and optional git info.
- `run`: Run ID, `domain` (only when the run has a single domain, D37), timestamps, duration, status, and exit code.
- `config`: Config path, version, and metadata (free-form).
- `report`: Report base path and the full summary report file path.
- `results`: Totals for files, rows, accepted/rejected rows, warnings, errors.
- `entities`: Per-entity totals + entity report file paths.

### Entity report (`<entity>/run.json`)

- `spec_version`: Config version string.
- `entity`: Entity name and metadata (free-form).
- `source`: Input format, path, options, cast mode, read plan, and resolved inputs.
- `sink`: Accepted/rejected/archive paths and formats.
- `policy`: Severity.
- `accepted_output`: Entity-level accepted output summary (path, row counts, write metadata, and file metrics).
- `schema_evolution`: Entity-level schema-evolution summary for the accepted write path.
- `results`: Totals for files, rows, accepted/rejected rows, warnings, errors.
- `files`: Per-file outcomes and validation summary.
  - `input_size` (integer or `null`) and `input_mtime` (string or `null`): the size in bytes and modification time listed for `input_file`, the values that feed the incremental state and `input_hash`. `null` when the storage does not report them. Use them to check that the file behind `input_file` is still the one that was validated.
- `timings_ms`: Where the entity spent wall-clock time (see below).

### `timings_ms` (entity report)

Cumulative wall-clock milliseconds (integers, measured with a monotonic clock) per call site, summed over all files of the entity:

| Key | Boundary |
|---|---|
| `list_ms` | Listing the entity's source inputs (done for every entity before the first one starts). |
| `download_wait_ms` | Time blocked waiting for the next input file to be downloaded. Downloads run ahead of the read, so this is waiting only, not download time. Local sources do not wait. |
| `read_validate_ms` | Reading, casting and checking each file, without its rejected writes. |
| `rejected_write_ms` | Writing rejected rows, copying rejected raw files and writing reject error reports. |
| `accepted_write_ms` | Time in the accepted sink between pulls of the next chunk, including the Iceberg commit after the last chunk. There is no separate commit time. |
| `archive_ms` | Moving the source files to the archive after the sink committed. |

- Reading, validating and the accepted write interleave chunk by chunk, and downloads overlap them, so the phases overlap with the prefetch and their sum is not the entity's elapsed time. Replaying a file's spilled chunks to the sink is in no phase.
- A phase that did not run is `null`, never `0`: no rejected rows, no archive, no files to read. `0` means the phase ran in under a millisecond.
- Writing this report is not measured. The run-level write of `run.summary.json` is reported as `report_write_ms` on the `run_finished` event.
- A failed entity writes no report, so its timings are not available.

### `accepted_output` (entity report)

`accepted_output` is the main place to inspect write-time sink metadata after a run.

Common fields:
- `path`: accepted sink target URI/path used for the run
- `table_root_uri`: table/dataset root URI (defaults to `path` when not format-specific)
- `write_mode`: resolved write mode (`overwrite` or `append`)
  - possible values: `overwrite`, `append`, `merge_scd1`, `merge_scd2`
- `accepted_rows`: total accepted rows written for the entity
- `files_written`: number of accepted data files written (format-specific semantics; `null` when unknown)
- `parts_written`: writer part count (may differ from `files_written`, especially for table formats)
- `part_files`: capped list of output data-file basenames (when collected)

Format-specific metadata:
- `table_version`: version identifier when the sink exposes one
  - Iceberg: metadata version (parsed from metadata filename)
  - Delta: the table version after the run's commit
- `snapshot_id`: Iceberg snapshot id (when a snapshot exists)
- `iceberg_catalog_name`, `iceberg_namespace`, `iceberg_table`: present for Iceberg runs
- `delta_catalog_name`, `delta_schema`, `delta_table`: present for Delta runs with a `sink.accepted.delta` Unity block

Write-time file sizing metrics (optional):
- `total_bytes_written`
- `avg_file_size_mb`
- `small_files_count`

Accepted-output metrics contract:

| Report value | Meaning |
| --- | --- |
| `null` | Unknown or not computable |
| `0` | Computed exactly and the exact value is zero |
| `> 0` | Computed exactly and the exact value is non-zero |

This applies to `files_written`, `total_bytes_written`, `avg_file_size_mb`, and
`small_files_count`. Floe does not use sentinel values such as `-1`.

Merge-specific metrics (Iceberg `merge_scd1`):
- `merge_key`: merge key columns (`schema.primary_key`)
- `inserted_count`
- `updated_count`
- `merge_elapsed_ms`

### `schema_evolution` (entity report)

- `enabled`: `true` when `mode` is `add_columns`
- `mode`: resolved config mode (`strict` or `add_columns`)
- `applied`: `true` when Floe added columns to the Iceberg table during the write (D13)
- `added_columns`: ordered list of the columns added in that write; present only when `applied` is `true`
- `incompatible_changes_detected`: always `false` in 0.8 (a non-additive change fails the entity before the report)

Floe also emits a `schema_evolution_applied` event when it adds columns (see [Logging](https://openlakeforge.dev/floe/reference/logging/)).

Notes:
- Metrics are populated when the writer can collect them cheaply and reliably.
- Iceberg file sizing metrics count Iceberg data files only (not metadata/manifests).


## Status and exit code rules

Per-file status:
- `success`: No errors for the file.
- `rejected`: Rows were rejected and written to the rejected output.
- `aborted`: The file triggered abort behavior.
- `failed`: Technical error (I/O, parsing, unexpected failure).
- `skipped`: The file was not read. `skip_reason` says why:
  - `already_ingested`: `incremental_mode: file` state already holds the file.
  - `already_ingested_changed`: the same, but its size or mtime changed (with a warning).
  - `active_claim`: another live run has claimed the file.
  - `already_committed` (0.8): an `append` to Iceberg retried a batch whose rows a dead run
    already committed (the snapshot's `floe.input_hash` matches), so the file is marked done
    without being read or written again. See [Incremental](https://openlakeforge.dev/floe/concepts/incremental/#retries-of-an-append).

Run status:
- `success`: All files succeeded.
- `success_with_warnings`: No rejected/aborted/failed files, but warnings were emitted.
- `rejected`: At least one file was rejected and none failed/aborted.
- `aborted`: At least one file aborted and none failed.
- `failed`: Any file failed.

Exit codes:
- `0`: success, success_with_warnings, or rejected.
- `2`: aborted (policy).
- `1`: failed (technical error).

An entity aborted by `policy.severity: abort` fails only that entity (D36, 0.8): its `run.json`
is written with status `aborted`, and the run continues with the next entity. The run summary
lists every entity, and the run status and exit code stay `aborted` / `2`. A technical error
(storage, catalog, credentials, memory) still stops the run at that entity, with no summary
(see `run.failure.json` below). Floe 0.7 stopped the run at the first aborted entity.

An entity whose rejection rate exceeds `policy.max_rejection_rate` ends `aborted` the same way, after its accepted rows are committed. When the threshold is set, the `policy` block of its `run.json` also carries `max_rejection_rate`, `rejection_rate` (`rejected_total / rows_total`, `0.0` with no rows) and `max_rejection_rate_exceeded`; without a threshold these keys are absent.

`policy.min_rows` is checked the same way, after the commit, against `results.rows_total`. When it is set the `policy` block carries `min_rows` and `min_rows_violated`: `true` below the threshold, `false` at or above it, `null` when every file of the run is `skipped` (nothing to check). A violation at `abort` ends the entity `aborted` (exit `2`); at `warn` it ends `success_with_warnings`, and so does the run, while `results.warnings_total` is unchanged. Without `min_rows` these keys are absent.

### Run failure (`run.failure.json`)

When listing the inputs, an entity or the final summary write raises (a bad credential, a missing bucket), the run stops and Floe writes `<run_dir>/run.failure.json` next to where the summary would
be, then re-raises the original error. It is additive: a successful run never writes it.

- `spec_version`, `tool`: as in the run summary.
- `run`: `run_id`, `domain` (when the run has one), `started_at`, `failed_at`, `duration_ms`, `status: "failed"`; inside a Dagster run also `dagster_run_id` and `dagster_job_name` (from `DAGSTER_RUN_ID` and `DAGSTER_JOB_NAME`, absent when unset).
- `error`: `type` (exception class name), `code` (the typed error code, `null` when the error has none) and `message`, the same
  text the terminal shows. No row values.
- `entities`: every selected entity in config order, with `name` (its qualified id, `<domain>.<entity>` when it has a domain, as in events) and `state`: `completed` (its `run.json` is
  written; `report_file` points to it), `failed`, `not_started`, or `unknown` (it started, but its outcome is not
  proven, for example a bug or an interrupt).
  A `failed` or `unknown` entity also has `sinks`: `{"rejected": ..., "accepted": ...}`, each `not_started` (no write began), `committed` (every write that began returned) or
  `unknown` (a write began and did not confirm, so it may or may not have landed). `committed` is never claimed without the sink returning. An Iceberg quarantine commit is `rejected`; an accepted
  `committed` means the rows are in the sink even though the entity's `run.json` was not written.
  Once the entity has claimed inputs it also has `input_hash`, the fingerprint of the claimed input set (their URIs, sizes and mtimes): the same value as the Iceberg snapshot's `floe.input_hash`, so you can match the failure to the snapshot. It is absent when the entity failed before claiming any input.

The run also emits a `log` event with `code: "run_failure_report"` whose message carries the file's URI, plus `error_code` when the error has a typed `code`.

The file is best-effort: if it cannot be written, the original error is still raised. When the report storage itself cannot be resolved (a bad `report.storage`), there is nowhere to write it: no file is written and only the terminal event carries the error. The file holds paths and URIs (references to the report, never copies of rows) but no row values and no credentials. Read it with plain `json`: it needs no Iceberg or Polars import. Treat the absence of both
`run.summary.json` and `run.failure.json` as unknown, never as success.

## Validation payloads

Validation summaries report aggregated counts only (no row-level examples).

Aggregations:
- `validation.errors`/`warnings` are totals for the file.
- `validation.rules[]` aggregates violations by rule and column. A rule appears once per resolved severity, so
  it repeats only when its columns have different `rule_severity` levels. The `policy` block adds `rule_severity`
  when the entity sets it.
- `min_rows_per_file` is a file-level rule: its entry has `"violations": 1` and an empty `columns` list.

Example rule summary:

```json
{
  "rule": "not_null",
  "severity": "reject",
  "violations": 12,
  "columns": [
    {"column": "customer_id", "violations": 12, "source": "CUSTOMER-ID"}
  ]
}
```

Row-level error details are written to the rejected error report JSON
(`*_reject_errors.json`) when available; reports do not include examples.
When a column has an explicit `source`, row error logs include a `source`
field (JSON) or an extra column/annotation (CSV/text) alongside `column`.

With `sink.rejected.format: parquet` the rejected rows carry raw source values plus `__floe_row_index`, `__floe_errors`,
`__floe_run_id` and `__floe_source_uri` (see [Rejected row envelope](https://openlakeforge.dev/floe/reference/rejected/) for the columns of each format); `output.rejected_path` is then the `<sink.rejected.path>/rows` directory, not one
part. To replay byte-for-byte use the archived source file
(`output.archived_path`). For an entity with `pii`, the rejected rows hold masked values only and cannot be
replayed: the replay input is the original file, `output.archived_path` when set, otherwise `input_file`, read with
the same `source.options` and selected by `__floe_row_index`
([decision](https://github.com/OpenLakeForge/floe/blob/main/context/decisions/pii-rejected-replay.md)).

---

<small>Synced from floe @ `v1.1.0` (`313b534`), [docs/reference/report.md](https://github.com/OpenLakeForge/floe/blob/313b53441b3b088290403ed1adb2f3894833b6c5/docs/reference/report.md).</small>
