Skip to content

Product Commands

A product spec is one TOML file at products/<name>.toml. It declares WHAT a data product must be: its grain, columns, checks, freshness, and classifications. The spec adds no new runtime machinery. Every field lowers onto something the engine already enforces — a contract, declarative tests, sidecar metadata, or the policy posture. A field that cannot lower is refused at parse time, never shimmed. Two fields are also read from the spec itself by rocky run. The delivery deadline (below) lowers to nothing. The volume range (below) lowers to a test and is also checked after each production build. The source volume ranges (below) lower to nothing and are checked when a production run starts.

The verbs on this page are the deterministic half of spec fulfillment. They parse, verify, lower, and approve. The agent loop that drafts SQL is rocky fulfill, and it is gated by the same policy plane as every other agent action.

products/<name>.toml ──verify──▶ posture + tags + collisions
│
├──approve──▶ immutable snapshot + approval record (one transaction)
│
└──compile──▶ Phase A: models/<model>.contract.toml
Phase B: metadata merged into models/<model>.toml
(staged writes; the manifest rename commits)

A product can say when its output must arrive. Add two optional keys to [product]:

[product]
name = "revenue_daily"
intent = "Daily gross revenue per client in EUR"
deliver_by = "0 6 * * *" # a 5-field cron expression; each occurrence is a deadline
timezone = "Europe/Lisbon" # IANA name; defaults to UTC

The parser checks deliver_by with the scheduler’s own cron parser (deliver-by-unparseable). It refuses an unknown timezone (timezone-unknown) and a timezone without deliver_by (timezone-without-deliver-by).

Each production rocky run that builds the product’s output model records the deadline that build served. A build covers the first deadline at or after it finished. If an earlier deadline was still open when it finished, the build serves that one instead, and it is late. A late build also covers every deadline that passed before it finished, so it reports one lateness, not one per missed deadline. A previous build with no recorded deadline is no baseline, so the first build after a spec gains deliver_by is judged like a first delivery. Lateness is wall-clock time from the deadline to the moment the model finished. Shadow and branch runs record no deadline. rocky run reads products/ under the directory of the rocky.toml it runs.

The scheduler status (GET /api/v1/schedule) derives a latest_start from each deadline for every scheduled pipeline that feeds it. It warns when a cron starts too late. See the scheduler status.

A product can say how many rows one load of its output should hold. Add an optional table to [product.output]:

[product.output.volume]
min_rows = 1_000 # optional, inclusive
max_rows = 5_000_000 # optional, inclusive; at least one bound is required
severity = "warning" # "warning" (the default) or "error"

What rocky run counts depends on the output model’s strategy. The JSON output names it in basis:

Strategy basis What is counted
full_refresh total_rows The table’s rows after the build.
incremental rows_added The rows this run appended: the count the adapter reported for the INSERT, else the table’s COUNT(*) after the write minus before.
merge, or incremental with a unique_key rows_touched The rows this run’s MERGE inserted or updated, as the warehouse reports them. A matched row counts even when its values did not change. Only a run that sent exactly one statement has a count.
time_interval partition_rows The rows in one partition this run wrote, counted with that partition’s own time window. Each partition is judged on its own.

A run that created the table (a first run) or rebuilt it (rocky run --full-refresh) counts every row in it, on any basis.

DuckDB, PostgreSQL, SQL Server and Spark report a MERGE count. Databricks, Snowflake, BigQuery, Trino and Redshift do not, so there a merge output is not_evaluated, with the reason in reason, and rocky product verify refuses it at error severity (volume-merge-count-unavailable). For rows_added, Rocky checks the INSERT’s reported count against the table’s growth. If they differ, or the table shrank, the check is not_evaluated: something else wrote to the table. The check assumes the run is the table’s only writer.

A view, an ephemeral model, a materialized view and a dynamic table store no rows Rocky writes. A delete_insert, snapshot or content-addressed load has no one count. These strategies are refused (volume-strategy-unsupported).

The parser refuses a block with no bound (volume-missing-bound; min_rows = 0 alone counts as a bound), min_rows above max_rows (volume-min-above-max), a severity other than warning or error (volume-severity-unknown), an unknown key (unknown-key), and a negative or non-integer bound (invalid-value). The spec does not name the model’s strategy, so rocky product verify checks it.

On a full-refresh output, the range also lowers to one row_count_range test in the model sidecar, with the same bounds and severity. It replaces any row_count_range test the worker wrote over the whole table, so rocky test --declarative and rocky run judge the same range. On any other output the range writes no test, because a row_count_range test counts the whole table and the range is about one load. Only rocky run judges it, and a worker’s own row_count_range stays.

After each successful production build of the output model, rocky run counts the rows once, on the same warehouse connection:

build ok ──▶ count ────▶ in range ────────────▶ in_range
│ ├─▶ out of range, warning ─▶ a `volume_warnings` line; delivery as usual
│ └─▶ out of range, error ───▶ the model is marked failed
└─ count failed, not reported,
or cancelled ────────────────────▶ not_evaluated (never a failure;
a `volume_warnings` line says why)

At error severity the table is already written and Rocky cannot undo it. The model is marked failed after the fact, downstream models are withheld, the run status is partial_failure, and the build gets no due_at. A time-interval output is judged one partition at a time: a partition that breaches at error fails the model and is marked failed in the run record, the others stay successes, and no partition gets a due_at. Partitions written before another partition failed to run are judged too.

An error breach also:

  1. Opens a breach marker for the model (a time-interval marker lists the breached partitions).
  2. Fails every later run that builds the model while the marker is open, even when that load is in range. Downstream stays withheld, and the load still writes its rows. The error says when the breach opened, which partitions are still breached, and how to clear it.
  3. Clears when a rebuild is judged in range, or when you run rocky product clear-breach.
error breach ──────────────────────▶ marker opened, model fails
marker open, in-range append ──────▶ rows written, model still fails
marker open, rebuild in range ─────▶ marker deleted, model passes

What counts as a rebuild:

  • Full-refresh, incremental, merge: a build that created or replaced the whole table (a first run, rocky run --full-refresh, or a drift rebuild), judged on the whole table. A rebuild still out of range keeps the marker.
  • Time interval: a rewrite of the breached partition, judged in range (rocky run --missing, --partition <key> or --from/--to). A breached partition is recorded failed in the partition state, so --missing plans it again. The marker is deleted when its last partition is clear. A default run (latest) of another partition does not clear it.

The marker lives in the replicated state table product_volume_breaches (state schema 36). Rocky writes it to the local state file right after the model’s check, so a later crash does not lose it locally. If the state store cannot record a new breach, the model fails. If it cannot delete a marker, Rocky warns, the marker stays and the model stays failed.

With a remote state backend:

  • A run that opens, widens, narrows or clears a marker must upload its state, whatever on_upload_failure says. If the upload fails, the run fails with refusing to exit 0. A run that stops on an error after the change still uploads, best effort. An interrupted run that opened a marker exits non-zero, not 130, when that upload fails. A run that changes no marker keeps the configured on_upload_failure.
  • When the state download fails, an ungoverned run continues on its local file and skips its upload. If it opens a marker, it fails and says the marker was not replicated: rerun once the backend is reachable. A governed run (rocky apply) with a [policy] block refuses instead.
  • A run cannot see a marker another machine opened, so every output whose product declares an error range is held, as if a marker covered the whole output. A downstream model run alone is withheld. A build of the output passes only if it rebuilt the whole table in range. An in-range incremental, merge or time_interval load stays held. The same holds when the local store was recreated for a newer schema (on_schema_mismatch = "recreate"). A warning range is never held.
  • Without conditional writes (concurrency_control = "off", or Valkey), a concurrent run’s upload can overwrite an uploaded marker. Use concurrency_control = "cas" where runs overlap.
  • rocky product clear-breach uploads with a conditional write on S3, GCS and the tiered backend, so a run that started before the clear cannot put the marker back. Valkey, and concurrency_control = "off", have none: clear a breach while no run is in flight. clear-breach warns about this.

A marker is enforced only while the product still declares a range for that output model. If the range is removed or the model renamed, the marker holds nothing but rocky product status still lists it: delete it with clear-breach. A whole-output marker stays when the model becomes time_interval. A severity lowered to warning keeps an open marker until a rebuild or clear-breach. A warning breach, or a count that was not evaluated, opens no marker, but an open marker still holds the model when a later run is not_evaluated. A shadow, branch or backfill run (rocky apply of a backfill plan) neither reads, writes, judges, clears nor enforces markers. A run that does not build a held output model, such as rocky run --model <downstream>, withholds every model downstream of it. A cancel after the write does not skip the count.

Terminal window
rocky product clear-breach <name> --model <model>

Deletes the open volume breach of the product’s output model, without a rebuild. Use it when you have judged the breached rows acceptable. With a remote state backend it downloads the state first, deletes the marker, and uploads the change before it reports. If the download fails it refuses and changes nothing, because the next download would restore the marker. With no marker open it changes nothing and exits 0. --output json returns product, model, was_open and the cleared marker.

An output whose strategy is refused is not_evaluated with volume-strategy-unsupported in its reason. Every not_evaluated check adds a volume_warnings line with its reason, at either severity, and never fails the run.

The result is the volume object on the model’s entry in materializations: product, model, basis, row_count, min_rows, max_rows, severity, verdict (in_range, below_min, above_max, not_evaluated) and reason. A time-interval output carries one on each partition the run wrote. The run records each check in its history with its basis, and rocky product status reports the newest build’s check. When the model’s [target] table differs from the model name, the history entry is named by the table, so rocky history --model takes the table name.

A product can say how many rows a source table should hold before the run builds the output. Add one [[product.source.volume]] table per source table to [product.source]:

[product.source]
tables = ["raw.sales.orders", "raw.sales.customers"]
[[product.source.volume]]
table = "raw.sales.orders" # one of source.tables
min_rows = 1_000 # optional, inclusive
max_rows = 50_000_000 # optional, inclusive; at least one bound is required
severity = "warning" # "warning" (the default) or "error"

The count is the source table’s total rows when the run starts, before the run writes anything. It is not the number of rows the build reads.

The parser uses the same codes as the output range, with the path product.source.volume[i]: volume-missing-bound, volume-min-above-max, volume-severity-unknown, unknown-key and invalid-value. It also refuses a table that source.tables does not list (volume-source-unknown), a second range on one table (volume-source-duplicate), and a table part that is not a plain SQL identifier of letters, digits and _ (source-table-invalid). A source table with no range is not checked. Any output strategy can carry source ranges.

A production rocky run counts the sources once, at run start, before the model phase writes anything and before the skip gate runs:

run start ──▶ for each range whose product output is in the selection:
SELECT COUNT(*) FROM <table> (one per distinct table)
├─▶ in range ─────────────────────▶ in_range (recorded)
├─▶ out of range or count failed:
│ warning ──▶ a `volume_warnings` line; the output builds
│ error ────▶ the output model is refused, not built
└─▶ run cancelled before the count ──▶ not_evaluated, nothing refused
  • A table that two ranges name is counted once. Rocky counts tables one after another, on the run’s warehouse connection.
  • On a view, an external table or a federated table, the count scans the whole table. A cancelled run stops waiting for a count that has started. On most warehouses the query stops too; on DuckDB it runs to completion in the background.
  • A production run refuses its model phase when any spec in products/ cannot be read, parsed or validated, or when products/ cannot be listed ([product-spec-unloadable], naming the file and rocky product verify <name>). A shadow or branch run checks no range, so it only warns. Keep drafts outside products/, and run rocky product verify in CI.
  • Shadow, branch and backfill runs count nothing. A replication pipeline that also builds models copies its tables first, so the count sees the copied rows.

At error severity, an out-of-range count refuses the output model, and so does a count Rocky could not take (a missing table, a refused name, a query error, an unreadable result). The output table keeps its rows. The model records one failed execution, with the count’s time as its duration. The on_model_error hook fires. on_before_model_run and on_after_model_run do not. Downstream models are withheld, the run status is partial_failure, and the model gets no due_at. Only the output model is protected: the upstream models in the chain still build.

The result is source_volumes on the run output: one row per range, with product, model (the output model), table, row_count, min_rows, max_rows, severity, verdict (in_range, below_min, above_max, not_evaluated) and reason. The run records the same rows in its history. A row stays even when the skip gate later skips the output model. An output refused at error is never skipped as unchanged: the refusal always reaches it, and the run fails.


Check that a product may be fulfilled, without writing anything.

Terminal window
rocky product verify revenue_daily

Four checks run in order, fail-closed:

  1. Trust posture. rocky.toml must carry the frozen propose_only posture: a [policy] block with default_agent_effect = "require_review", an agent propose rule that resolves allow and is scoped to exactly this product’s output model (no any, no glob, no extra predicates, no autonomy budget), and agent apply resolving require_review or deny. A policy that merely happens to resolve safely is rejected — authority that reaches past the product is global agent authority. The verdicts come from the engine’s own policy evaluator, run against the attributes the lowering is about to create (the post-image), so the gate cannot be evaded by the change under review.
  2. Classification tags. Every tag in output.classifications must resolve to a [mask] strategy, a [mask.<env>] override, or [classifications].allow_unmasked. This is an error here; plain rocky compile only warns (W004). Resolution only: whether masking is applied is warehouse-dependent.
  3. Identity collisions. The product name must not be claimed by another spec file, and the output model must not be claimed by another product.
  4. Volume strategy. When the spec declares [product.output.volume] and the model exists (models/<model>.sql or models/<model>.rocky, plus models/<model>.toml), the model must be a full_refresh, incremental, merge or time_interval model (volume-strategy-unsupported). The strategy is read the way the compiler reads it, including _defaults.toml. Before the model is drafted, verify cannot judge the strategy, so this check passes; the Phase-B compile runs it again. If a model with another strategy still reaches rocky run, the run does not count it: the verdict is not_evaluated with reason volume-strategy-unsupported, never a failure.
  5. Volume on a merge. A merge output, or an incremental one with a unique_key, is counted from the rows its MERGE reports. When the range has severity = "error" and the model’s adapter is Databricks, Snowflake, BigQuery, Trino or Redshift, verify refuses it (volume-merge-count-unavailable): those adapters report no MERGE count, so every run would be not_evaluated and the guarantee would never fire. Use severity = "warning", another strategy, or another adapter. The adapter is the model’s own adapter when it sets one. Otherwise it is the target adapter of the transformation pipeline whose models glob matches the model file, or of all transformation pipelines when they share one. When verify cannot tell which adapter the model runs on, it passes and adds a WARNING [volume-merge-count-unknown-adapter] to its reason instead of guessing.

Exit codes: 0 pass · 1 needs input (a paste-ready [policy] block is printed) · 2 fail.

ProductVerifyOutput: status (pass | needs_input | fail), reason, paste_block, and the resolved propose_effect / apply_effect.


Verify, then lower the spec. Refuses unless verify passes.

Terminal window
rocky product compile revenue_daily

Lowering runs in two phases because the drafting tool rewrites the model sidecar wholesale — metadata lowered before drafting would be destroyed:

  • Phase A (before drafting) renders models/<model>.contract.toml — the spec-owned contract the draft must compile against.
  • Phase B (after the drafted sidecar exists) merges the spec-owned metadata into models/<model>.toml: sources, the product tag, classifications, freshness, and the generated tests (grain uniqueness, not_null per non-nullable column, one expression test per check, one row_count_range for a declared volume on a full-refresh output). The worker’s name, intent, and appended tests survive, except a worker row_count_range with no filter when the spec’s volume lowers to a test. A filtered worker range survives. Phase B reads the output model’s strategy to decide; when the spec declares a volume and the model does not load, it refuses (volume-strategy-unresolved). The generated range carries generated_by = "product.output.volume", so removing the volume block removes that range on the next lowering; rocky test ignores the key.

The command picks the phase itself: Phase A on a fresh product, Phase B once models/<model>.toml exists. Re-running is safe — the merge is idempotent.

Every generation commits through staged, journaled writes in the same directory. The lowering manifest is renamed last, as the commit marker. The next run recovers from the journal, which it treats as untrusted: forged, traversing, symlinked or foreign entries are refused before anything changes.

Recovery reads the marker first:

Marker Recovery
Unreadable (a permission fault, a swapped link) Changes nothing and fails with commit-io, because a rollback could restore backups over a commit that succeeded.
Committed Deletes each .ff-staged and .ff-prev sibling and keeps the new files, without inspecting them.
Not committed Restores the previous generation.

A restore refuses, and keeps the journal, in two cases. A .ff-prev backup the journal does not record fails with commit-unexpected-backup, naming the file to inspect. A new file that recovery cannot read is left alone, with commit-io.

A restore reads every recorded backup first, writes the bytes to a new synced file and renames that over the final. It never renames the backup itself. On Unix a backup that is a symlink or has a second hard link is refused with commit-io, and nothing is restored. A crash during a restore leaves the backup and journal, so the next run repeats it.

On Unix, product compile also refuses to write into a directory that is itself a symlink (such as models -> models_real), even when the link points inside the project. It fails with commit-io (“taking directory custody for the commit failed”). Replace the link with the real directory.

If an approval exists, compile re-verifies the snapshot’s bytes against the approval digest before doing anything. A mismatch is tamper, and nothing proceeds.

ProductCompileOutput: the committed phase, each artifact with its sha256, the manifest_path, and the approval echo (spec_matches_approval is false when the working spec has moved past the approved revision — not an error; the loop treats it as supersession).


Record a human’s approval of the current spec revision.

Terminal window
rocky product approve revenue_daily
rocky product approve revenue_daily --expect-digest sha256:<hex>

With --expect-digest, the command approves the working spec only if its digest is exactly the one given (as rocky product status prints it). A different digest refuses with approval-digest-mismatch before the store is opened, and nothing is written. Use it to approve exactly the spec you read. Without the flag, the spec on disk when the command runs is approved. The browser UI always passes it.

Approval is one authority transition, in a fixed order:

  1. The approved bytes are written to .rocky/fulfillment/<name>/approved-<digest-hex>.toml — immutable and digest-addressed. A digest-named file is never overwritten, so no reader can ever observe new-digest-old-bytes.
  2. One state-store transaction records the approval, moves the product’s fulfillment state to spec_approved, and appends the journal row. All or nothing.

A crash between step 1 and step 2 leaves only an orphan snapshot file — harmless; the next approve completes over it. Approving the already-approved digest is a no-op. When two people race, the second approve loses its compare-and-swap cleanly and prints the winning digest.

The approver identity is the same best-effort git identity the review marker records. It is an attribution, not an authentication.

The command reads the channel from ROCKY_SESSION_SOURCE, as rocky review --approve does. In a terminal, approver is the bare email. In a job that rocky serve started (the browser UI, or POST /api/v1/jobs/product_approve), ROCKY_SESSION_SOURCE=http_api is set and approver is <email> (http_api). That job refuses with approver_identity_unresolved, and writes nothing, when the git identity cannot be read or is literally unknown. The label names the channel, not the person.

ProductApproveOutput: spec_digest, approver, approved_at, snapshot_path, previous_state, and already_approved.


Read-only report. Writes nothing, recovers nothing.

Terminal window
rocky product status revenue_daily

Reports: the spec’s identity (or its parse error), the committed lowering phase, byte-verification of every committed artifact against the manifest, whether a crashed commit’s journal is pending (the next compile resolves it), the approval record with snapshot integrity, whether the working spec still matches the approved revision, and the persisted fulfillment state with its journal row count.

When the spec declares deliver_by, status also reports delivery:

Field Meaning
on_time, late_by_seconds Whether the latest production delivery met the deadline it served, and by how much it missed. null until a run records a deadline.
last_due_at, last_delivered_at That deadline, and when the output model finished.
next_due_at The deadline the next delivery must meet. A time in the past means it is already late.
at_risk true when the p90 duration is longer than the time left before next_due_at. null when the estimate is unknown.
estimate state (known or unknown), n, window (20), p50_ms, p90_ms, growth.

The estimate times each of the last 20 successful production deliveries from run start to the output model’s finish. With fewer than 5, it is unknown and gives no verdict. From 10 runs on, when the newest 5 all ran slower than the p90 of the older ones, growth is true and p90_ms is the slowest of those 5.

When the spec declares [product.output.volume], status also reports volume:

Field Meaning
min_rows, max_rows, severity The declared range and severity.
run_id, counted_at The newest production run that built the output, whatever its status, and when it finished. An older run’s count never stands in for a newer build that took none.
row_count, basis That build’s count and what it counted (total_rows, rows_added, rows_touched, partition_rows). Absent when the build took no count. A build that wrote several partitions shows the partition that decides the verdict: the first one out of range, otherwise the newest.
verdict That build’s count judged against the range the spec declares now: in_range, below_min, above_max. It is not_evaluated when the build took no count, or counted on a basis the output model no longer has.
reason Why the verdict is not_evaluated.

Status also lists open_volume_breaches, one row for each breach still open for the product (empty and omitted when there is none): product, model, opened_at, run_id, partitions (empty means the whole output), rows, min_rows, max_rows and reason. The text view prints each as OPEN VOLUME BREACH with the command that clears it. Status reads the local state file and does not download remote state. With a remote state backend it warns that the list may lag another machine until the next run downloads the state.

When the spec declares [[product.source.volume]], status also reports source_volumes, one row per declared range:

Field Meaning
table, min_rows, max_rows, severity The declared source table, range and severity.
row_count, counted_at, run_id The count from the newest production run that counted this product’s sources, and when that run started. Absent when that run took no count of this table.
verdict That count judged against the range the spec declares now, or not_evaluated when there is no count.

When the product has a [product_budget.NAME] and its spec parses, status also reports cost_month: the product’s cost and budget for the current month, in the project’s [schedule].timezone.

Field Meaning
month, timezone, as_of, history_complete The month reported, its time zone, when it was computed, and whether run history covers it.
cost The product’s row from rocky cost --month <month> --by product: built, kept, charged, money, budget and breach_events.

When the month cannot be computed, cost_month is absent and cost_month_error says why. rocky product status and GET /api/v1/products/<name> report cost_month; rocky product list does not.

ProductStatusOutput — every field above, machine-readable.


Read-only. One row per product the project knows, sorted by name.

Terminal window
rocky product list
rocky product list --output json

A product is listed when either is true: products/<name>.toml exists, or the state store holds a fulfillment or approval record under that name. So a product whose spec file was deleted still appears, with spec_present = false and the loader’s reason in spec_error. A project with no products/ directory and no records lists nothing and exits 0.

Each row is a projection of rocky product status <name>: spec identity or its error, the committed lowering phase, the count of artifact byte-verification problems, whether a staging journal is pending, the approval record, whether the working spec matches the approved revision, the fulfillment state, and the journal row count. The two commands are built by the same code, so a row can never disagree with the status it summarises.

The same payload is served over HTTP by rocky serve at GET /api/v1/products, and one product’s status at GET /api/v1/products/{name}. The server and the CLI both read products/ under the directory of the rocky.toml they use. With the default --config rocky.toml, that is the working directory. The server reads the state store named by --state-path, or the default under its own models directory, namespaced when --state-namespace or the config’s [state] namespacing resolves one, the same derivation every command makes. So a server started with the namespace the CLI uses answers from the store the CLI wrote. Both reads open the store read-only: a store at the current schema version is never written, an older one is migrated forward as every read command does, and a store written by a newer engine is refused.

ProductListOutput — products (one ProductListEntry each) and count.


Read-only. A product’s fulfillment journal: every persisted transition, in append order.

Terminal window
rocky product journal revenue_daily
rocky product journal revenue_daily --output json

Each row is the loop’s own record of one transition: its sequence number, when it happened, what happened in plain words (spec approved, …), the state before and after, and the spec digest, plan id and idempotency key involved when the event concerns one. The rows are read through the same store function the fulfillment loop reads through, so what the command shows is what the loop sees. rocky product status reports only the count of these rows.

A product is known by the same rule status and list use: products/<name>.toml exists, or the state store holds a fulfillment or approval record under the name. A known product with no rows prints an empty journal and exits 0. A product the project does not know exits 1, because an empty journal for a typo would read as “nothing happened”.

The same payload is served over HTTP by rocky serve at GET /api/v1/products/{name}/journal. An unknown name answers 404 product_not_found.

ProductJournalOutput — product, product_id, rows (one ProductJournalEntry each) and count.


rocky validate checks products/ offline with its own code band:

Code Severity Meaning
V050 ok Every spec in products/ parsed.
V051 error A spec fails the strict parser; the message carries the parser’s stable reject code.
V052 error A spec’s product.name disagrees with its file name.
V053 error Two specs claim the same output model.