Skip to content

2.13.0

Latest

Choose a tag to compare

@github-actions github-actions released this 26 Nov 11:05
· 5 commits to main since this release
Immutable release. Only release title and notes can be modified.
f5655f2

Durable Workflow CLI 2.13.0

Verified history archives

workflow:history-export keeps each external payload as a reference, so its
bundle still depends on the source database and payload store. Two new
commands write and check a self-contained archive of one closed run instead
(cli#175, cli#176, durable-workflow/server#520):

# Copy a closed run and every external payload it references
dw workflow:history-archive order-123 01HXYZ ./archives/order-123
dw workflow:history-archive order-123 01HXYZ ./archives/order-123 --hold-ttl=1800 --json

# Check an archive from its files alone: no Server, database or payload store
dw workflow:history-archive-check ./archives/order-123
dw workflow:history-archive-check ./archives/order-123 --json

An archive holds history-export.json (the export's exact bytes),
objects/<reference id> (the exact bytes of every external payload the export
references), manifest.json (each object's codec, length and SHA-256) and
receipt.json. It stays readable after retention prunes the run and after the
Server or its payload store is gone. The format is v1 of the Server's
history archive guide
(durable-workflow/server#1334, #1343), and dw verifies the Server's own v1
conformance archive.

Copy under the backup hold

workflow:history-archive copies the run under the Server's external payload
backup hold, so no payload is reclaimed while it is copied:

  1. It acquires the hold with a new owner, recorded in the directory first.
  2. It reads the export and fetches each referenced object once, checking its
    length and SHA-256 before the file is renamed into place.
  3. It writes the manifest and verifies the whole directory cold, from disk.
  4. It confirms that the same hold is still held, and only then writes
    receipt.json, bound to the manifest digest the verification read.

The hold is renewed once a third of --hold-ttl has passed (900 seconds by
default, 60 to 3600) and again before verification. It is released on every
path, including errors, Ctrl-C (exit 130) and, on Unix, SIGTERM (exit 143). No
receipt is ever written after a signal.

Outcome Exit Meaning
verified 0 The archive verified and the receipt is written.
incomplete 1 An object could not be copied, the hold was lost or refused a renewal, or verification failed. No receipt is written.
refused 2 Nothing was copied: the run is open, pruned or redacted, its history has gaps, or it references a payload the runtime transport cannot fetch. A directory this run created is removed.

Connection, authentication and Server errors keep their usual exit codes. A
backup or archive that already holds the hold is the Server's HTTP 409
(exit 2); retry later. An acquire the Server refuses, such as 403 for a
non-admin token (exit 4), took nothing, and dw records nothing. A Server
without the backup hold route fails with exit 1. An invalid --hold-ttl is a
usage error (exit 1).

--json returns one dw.history-archive.result.v1 document with
outcome, directory, namespace, workflow_id, run_id, objects,
object_bytes, copied, resumed, failures and hold (owner,
acquired_at, released). Depending on the outcome it also carries
blockers, hold_lost, verification (the full verification report) and
receipt (its path).

Resume and refusals

Run the same command into the same directory to resume an unfinished archive
of the same run. Objects already present with the right length and digest are
kept; corrupt objects, leftover partial downloads and objects the export no
longer references are replaced or removed. A crashed copy's hold is released
by the next run, or expires after its TTL. If a release cannot be sent, dw
says so and keeps the owner recorded for the next run. The progress record
names the Server and namespace, and an owner still to be released is only
released at the same ones.

dw writes only into a new or empty directory, or into an unfinished archive of
the same run. It refuses a completed archive, another run's archive, any other
directory, a linked objects/ directory, and a directory another dw is
writing. Each object must arrive within half the hold lease (at least 30
seconds); for larger objects, raise --hold-ttl.

Check an archive

workflow:history-archive-check reads every file back and reports verified
(exit 0), incomplete (exit 1) with a coded finding for each failed check,
such as object_missing, object_digest_mismatch or receipt_missing, or
refused (exit 2) for a directory it cannot read as a v1 archive. --json
returns the durable-workflow.history-archive.verification.v1 report:
outcome, findings, identity, manifest_sha256, object counts and bytes,
and directory.

An archive covers the selected run only and is not a database backup. It is
written unencrypted, with owner-only files on Unix, and its lifetime is yours
to manage. The digests detect damage, not deliberate tampering.

Server requirements

workflow:history-archive needs an admin token, because the backup hold is an
admin route, and a native Server that serves:

  • GET /api/workflows/{workflow_id}/runs/{run_id}/history/export;
  • GET /api/external-payloads/v1/{reference_id};
  • GET /api/system/external-payload-backup-hold and its acquire, renew
    and release routes.

Native Server 3.0.3 and later serve all of them; the tests run against native
Server 3.12.0, the one dw server:start-dev embeds. Native Server 3.30.0 adds
history-archive verify, the Server's own verifier for the same format; dw
does not need it. workflow:history-archive-check needs no Server.

See Verified history archives
in the CLI reference for the full behaviour.

Unchanged

  • No existing command, option, exit code or JSON shape changed.
  • dw server:start-dev still embeds native Server 3.12.0, and its data
    directory is unchanged.
  • The CLI still uses the published Rust SDK 4.18.0. Building from source needs
    Rust 1.99. Cargo.lock is unchanged apart from the version.
  • The only CI-only change since 2.12.0 is a parity-check fix:
    rust/parity/parity.py no longer treats a version after a constraint
    operator (such as the Server's SDK range >=2.13.0,<3.0.0) as the CLI's own.