From 79a1221f370fe97d275cb2c4d19e7923f501705d Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:39:24 +0000 Subject: [PATCH] Prepare native Server 3.30.0 Sets the published Compose default to 3.30.0 and adds the release notes: advertised timeout cleanup (#1201), replay_clock on query and update-validation tasks (#1338), verified history archives (#520), the retention plan and guarded apply (#522), retryable 503s for an unreachable credential store (#1342, #1346), the same-run fence index (#1340), the MariaDB catalog lookup (#1335, #1341) and release SBOMs (#1012). The schema changes on every backend (SQLite 20, PostgreSQL 21, MySQL 23, MariaDB 22) and needs the stopped-node schema-upgrade. The worker protocol stays 1.20. Co-Authored-By: Claude Opus 5.5 --- docker-compose.published.yml | 2 +- docs/releases/3.30.0.md | 305 +++++++++++++++++++++++++++++++++++ 2 files changed, 306 insertions(+), 1 deletion(-) create mode 100644 docs/releases/3.30.0.md diff --git a/docker-compose.published.yml b/docker-compose.published.yml index 9e99d441b..a8c0e283e 100644 --- a/docker-compose.published.yml +++ b/docker-compose.published.yml @@ -15,7 +15,7 @@ name: durable-workflow-server # release whose default names another image). Set DW_SERVER_IMAGE to run # any other native image, by tag or digest; pin a digest for production # change control. -x-server-image: &server-image ${DW_SERVER_IMAGE:-durableworkflow/server:3.29.0} +x-server-image: &server-image ${DW_SERVER_IMAGE:-durableworkflow/server:3.30.0} x-mysql-image: &mysql-image mysql:${MYSQL_VERSION:-8.0} x-server-database: &server-database diff --git a/docs/releases/3.30.0.md b/docs/releases/3.30.0.md new file mode 100644 index 000000000..abd3f8859 --- /dev/null +++ b/docs/releases/3.30.0.md @@ -0,0 +1,305 @@ +# Durable Workflow Server 3.30.0 (native) + +This release changes the database schema on every backend. Read +[Upgrade from 3.29.0](#upgrade-from-3290) before you replace the image. + +## Timeout cleanup is advertised + +Native has implemented deadline-triggered timeout cleanup since 3.14.0 without +advertising it. Server now advertises `timeout_cleanup: {supported: true, +version: 1}` in `/api/cluster/info` `capabilities` and in every worker +response's `server_capabilities` (#1201, #1336). + +A workflow start or `start_child_workflow` command can set +`timeout_cleanup_seconds` to reserve part of its execution or run timeout for +cleanup. The allowance is 1 to 86400 seconds. The start needs an execution or +run timeout, and each timeout it sets must be longer than the allowance. At +the work deadline, the hard deadline minus the allowance, Server records a +cooperative cancellation request whose context has `cause: "timeout"`. +Workflow code can compensate and then let the interruption escape. The run +closes timed out, and `WorkflowTimedOut` records the cleanup outcome: +`completed`, `failed`, or `expired` when cleanup outlived the hard deadline. +A terminate or hard cancel during cleanup preempts it instead: the run closes +terminated or cancelled with outcome `preempted`. +Starts without `timeout_cleanup_seconds` are unchanged. + +Admission is unchanged. Server admits an opted-in start only when a live worker +on its task queue advertises the capability. Otherwise it answers +`422 timeout_cleanup_not_supported` and writes nothing. It never falls back to +a plain hard timeout. + +Describe and run detail now report `timeout_cleanup.outcome: "running"` while +cleanup is open; it was `null` before. The bounded run observation +(`GET /api/workflows/{workflow_id}/runs/{run_id}/observation`) now returns +`timeout_cleanup` once cleanup has started, in the shape embedded Workflow +returns (#1344). + +**Timeout cleanup on mixed queues.** Server admits a start with +`timeout_cleanup_seconds` when at least one live worker on its task queue +advertises `timeout_cleanup`. It doesn't check the other workers, and any of +them can claim the cleanup turn. Server refuses the cleanup marker from a +worker that didn't advertise the capability, so an escaped interruption there +is recorded as `failed` or `expired`. But a worker without timeout-cleanup +support may never see the interruption: if its workflow code returns, the run +is recorded as cleanup `completed` although no cleanup ran. Before starting +opted-in runs on a queue, upgrade every worker on it to a supporting SDK with +cooperative cancellation enabled: PHP SDK 3.31.0 or later (3.32.0 or later for +the stricter marker rule), Rust SDK 4.25.0, Python SDK 2.24.0. + +## Replay clock on query and update-validation tasks + +Query tasks and update-validation tasks now carry the same `replay_clock` +entry instant as the run's workflow tasks +([.github #215](https://github.com/durable-workflow/.github/issues/215), +#1338). An SDK that rebuilds the workflow body to answer a query or validate an +update can then give a clock read at workflow entry the same value the +workflow task gave it. + +On these two task kinds the key is always present. It holds the +`WorkerReplayClock` object when Server can prove the run's start, and `null` +when it cannot; in that case the run's workflow tasks omit the object too. An +absent key means an older Server that never sends it. Update-validation tasks +carry it from the dedicated poll, the multiplexed workflow poll and signed task +offers. Workflow tasks are unchanged: they omit the object when the start is +not proved. + +**Replay clock at workflow entry.** `ctx.replay_now()` (Python SDK 2.24.0), +`replay_now()` (Rust SDK 4.25.0) and `replayNow()` (PHP SDK 3.32.0) return +the run's start time when they are read at workflow entry, before any durable +step, whenever the Server sends the task's `replay_clock` entry instant (Server +3.6.0 and later). Earlier SDK releases reported the clock as unavailable there. +A running workflow whose code catches that unavailable error at entry and +branches on it will take the other branch when it replays on the new SDK, +which can change its next commands. Before upgrading workers, put such code +behind workflow versioning (a version marker or a new workflow type) or let +those runs finish. Code that reads the clock only after a durable step, or +never catches the error, is unaffected. On Servers before 3.30.0, which lack +server#1338, Python and Rust queries and update validations of workflows that +read the clock at entry fail instead of answering, so upgrade the Server to +3.30.0 alongside the SDKs. Python `ctx.now()` is unchanged. + +## Verified history archives + +A history archive is a directory that holds one closed run's history export, +the exact bytes of every external payload the export references, a manifest +with each object's codec, length and SHA-256, and a receipt written only after +the whole directory was verified from disk (#520, #1334). An archive stays +readable and verifiable after retention prunes the run, after payload cleanup +reclaims its objects, and without the Server or the payload store. + +- `durable-workflow-server history-archive verify ` verifies an archive + offline. It reads no database, payload store or network, prints a JSON + report, and exits 0 only when the outcome is `verified`. Other outcomes are + `incomplete`, with coded findings, and `refused`. +- `dw workflow:history-archive` creates an archive and + `dw workflow:history-archive-check` checks one (dw 2.13.0). +- A copy uses existing routes: the history export, the runtime external + payload fetch and the external payload backup hold. It needs an admin + credential. While a copy holds the backup hold, payload reclamation and + retention prunes of runs with external payloads pause for the whole Server, + and a database backup that needs the same hold must wait. +- Open, pruned and redacted runs, histories with sequence gaps, and exports + with references the runtime transport cannot fetch are refused before + anything is copied. +- Server does not encrypt archives. Payload bytes are kept exactly as + stored, so codec-level encryption is preserved. Their storage, encryption + and lifetime are the operator's responsibility. Server cannot import or + restore an archive. +- The verifier checks every manifest identity field against the export except + `namespace`, and refuses symbolic links and, on Unix, files with more than + one hard link (#1343). Verify a plain copy, not a hard-linked snapshot. + +Server adds no route or capability for archives. See +[history archives](../history-archives.md) for the format and the copy +procedure. + +## Retention plan and guarded apply + +An admin can preview a retention change before applying it (#522, #1332, +#1350): + +- `POST /api/namespaces/{namespace}/retention-plan` takes a proposed + `retention_mode` and `retention_days` and answers + `durable-workflow.v2.retention-plan.v1`. It counts closed runs that would + become eligible for pruning, stop being eligible or stay as they are, with + example runs. It also counts archived, open and `forever`-kept runs, and + runs a prune would currently skip for an open abandoned activity, a payload + reference native cannot settle or an active backup hold. A count that + reaches its scan bound is reported as incomplete, with a lower bound. The + plan writes nothing. +- `POST /api/namespaces/{namespace}/retention-plan/apply` applies the planned + policy only if `policy_revision` and `plan_revision` still match. A proposal + that makes more closed runs eligible also needs + `"confirm_retroactive_pruning": true`. Otherwise the apply changes nothing + and answers `409 retention_policy_revision_stale`, + `409 retention_plan_revision_mismatch` or + `422 retention_pruning_confirmation_required`. An accepted apply changes + only the namespace's policy. Later retention passes prune against the cutoff + at that time, so the plan's counts are not the set that will be deleted. + +Both routes need control-plane version 2. `PUT /api/namespaces/{name}` is +unchanged and still activates a policy at once. See +[retention plan](../server-reference.md#retention-plan). + +## Retryable 503 while the database is unreachable + +During a database failover, a request authenticated with a database runtime +credential could get `500 server_error` because the credential lookup could +not reach the database (#1342). A lookup that fails with a transient storage +error now answers `503` with `reason` `backend_unavailable` (or +`backend_lock_pressure`), `retryable: true`, `retry_after_seconds: 1` and a +`Retry-After: 1` header, on both the worker and control planes. Other lookup +failures still answer `500 server_error`, and a failed lookup never falls back +to another credential. Configured tokens need no lookup. + +A MySQL or PostgreSQL protocol error raised while a new connection is set up, +as when a proxy or a starting database garbles the handshake, now counts as +transient (`backend_unavailable`) too (#1346). That also applies to worker +registration, heartbeat and deregistration and to schedule execution. Protocol +errors on an established connection are still request faults. + +## Same-run lease check uses its own index + +Since 3.29.0, every workflow task candidate checks that no other workflow task +of its run holds a live lease. That check read every task of the run. A new +index, `dw_workflow_tasks_run_fence` on `workflow_tasks (workflow_run_id, +task_type, status)`, lets it read only the run's leased workflow tasks on every +backend (#1327, #1340). The schema step below adds it. + +## MariaDB catalog checks stay in this database + +The MySQL and MariaDB checkpoint catalog check runs at bootstrap, at +verification and on every `GET /api/ready`. On MariaDB it read the trigger +catalog of every database on the server, so it could wait behind DDL in an +unrelated database. It now reads only this database's triggers, both in the +direct check (#1335) and in the stored catalog function that `schema-check` +reads with a SELECT-only account (#1339, #1341). The function change is the +MySQL and MariaDB part of the schema step below. On MySQL the check returns +the same rows as before. + +## Release SBOMs + +The native release workflow now generates an SPDX 2.3 SBOM for each platform, +`linux/amd64` and `linux/arm64`, from the image digest that passed the release +smoke test (#1012, #1328). It attests each document to the multi-arch image +index in Docker Hub and GHCR, next to the build provenance. The GitHub Release +step verifies those attestations before it creates the Release and attaches +the verified documents as `server-linux-amd64.spdx.json` and +`server-linux-arm64.spdx.json`. The Server binary is now built with +`cargo auditable`, which embeds its Rust crate list so the SBOM scan can list +the crates as well as the image's operating system packages (#1333). 3.30.0 is +the first release built this way; releases up to 3.29.0 have no SBOM. See +[native image SBOMs](../server-reference.md#native-image-sboms) to verify and +download them. + +## Other changes + +- Helm chart 5.6.0 selects Server 3.29.0 (#1330). A chart that selects 3.30.0 + is published separately. +- The activity workflow continuation v2 contract is proposed as a document. + It is not implemented or advertised (#1181, #1331). +- On MySQL and MariaDB, a connection returned to the pool skips the reset + `ROLLBACK` when the session is known to be idle outside a transaction, so a + database stall holds pool slots for one round trip less. Pending replies are + drained first, and a connection with a cancelled prepare is closed instead of + reused (#1204, #1349). +- Test and CI changes for #1204: execution tests drop their MySQL and + PostgreSQL databases (#1324), and the CI MariaDB service has 2 CPUs and + 2 GiB (#1347). +- An expected panic in the claimed-history negative control no longer prints + to test logs (#1337). +- A test inventories every writer of `workflow_history_events` and fails when + an unreviewed writer appears, a guard for the continuation v2 work (#1181, + #1351). +- The worker protocol OpenAPI and docs describe when `replay_clock` is `null`, + and a test covers it on update-validation tasks from the multiplexed workflow + poll (#1345). + +## Upgrade from 3.29.0 + +Stop all native Server nodes, including any outside this deployment that share +the database, and take a verified backup of the database and every external +payload root. Run the 3.30.0 image's `schema-upgrade` command before starting +the nodes on the new image. The step adds `dw_workflow_tasks_run_fence` on +every backend and, on MySQL and MariaDB, replaces the checkpoint catalog +function. It rewrites no rows. The index build takes longer the more +`workflow_tasks` rows the database holds. +[Stopped-node schema upgrade](../../rust/README.md#native-schema-upgrades) + +| Database | 3.29.0 schema | 3.30.0 schema | +| --- | ---: | ---: | +| SQLite | 19 | 20 | +| PostgreSQL | 20 | 21 | +| MySQL | 21 | 23 | +| MariaDB | 20 | 22 | + +The 3.29.0 schema is the schema of every release since 3.22.0, so the same +step applies from any of them. + +3.29.0 and 3.30.0 nodes cannot share a database across this step, so a rolling +upgrade is not possible. Startup never upgrades the schema: a 3.30.0 node +refuses the 3.29.0 schema with `native_schema_upgrade_required`, and a 3.29.0 +node refuses the upgraded schema with `native_schema_newer_than_binary`. On +MySQL and MariaDB, while the upgrade runs or after it is interrupted, every +node refuses with `native_schema_upgrade_incomplete`. Run `schema-upgrade` +again to resume it. + +On a binlogged MySQL or MariaDB server, creating the new catalog function can +need privileges the application account lacks. This includes the MySQL 8.0 of +the published Compose file, which has binary logging on by default. The same +applies when an administrator installed the checkpoint code from +`schema-checkpoint-ddl` and the account has no `ALTER ROUTINE` on the +function. If the upgrade reports +`native_child_checkpoint_trigger_privilege_required`, keep the nodes stopped +and run `schema-checkpoint-ddl` from the 3.30.0 image with the application +`DB_*` settings. Its output drops the old function, unless the upgrade already +dropped it, and creates the new one. Have your database administrator apply it +on the writer, then rerun `schema-upgrade` with the application credentials. +[Staged checkpoint DDL](../../rust/README.md#child-summary-checkpoints-on-mysql-and-mariadb) + +For a single-node Compose deployment, replace the published Compose file, keep +MySQL running and stop Server. Back up MySQL and the `server_storage` volume. +Then pull and upgrade, with the same environment you use for `up`: + +```bash +docker compose -f docker-compose.published.yml stop server +docker compose -f docker-compose.published.yml pull server +docker compose -f docker-compose.published.yml run --rm --no-deps server schema-upgrade +``` + +The Compose file's MySQL 8.0 has binary logging on, and the application +account cannot create the new catalog function there. So expect +`schema-upgrade` to report `native_child_checkpoint_trigger_privilege_required` +after it drops the old function. Apply the staged DDL as the MySQL root account +and rerun the upgrade. If the first `schema-upgrade` succeeded, for example +because `log_bin_trust_function_creators` is on, skip this step: + +```bash +docker compose -f docker-compose.published.yml run --rm --no-deps -T server schema-checkpoint-ddl > checkpoint.sql +docker compose -f docker-compose.published.yml exec -T mysql \ + sh -c 'MYSQL_PWD="$MYSQL_ROOT_PASSWORD" mysql --user=root --batch' < checkpoint.sql +docker compose -f docker-compose.published.yml run --rm --no-deps server schema-upgrade +``` + +Start the stack only after `schema-upgrade` succeeds: + +```bash +docker compose -f docker-compose.published.yml up -d --wait +``` + +The Compose file's `schema-plan` service runs `schema-bootstrap`, which does +not upgrade. If you start the stack before `schema-upgrade` has finished, it +fails and Server does not start. + +With Helm, scale every Server replica to zero and run the 3.30.0 image's +`schema-upgrade` through the opt-in `native.schemaUpgrade.enabled` hook or the +chart's manual Job. + +The worker protocol version stays 1.20. The worker protocol OpenAPI document +moves from revision 68 to 70: revision 69 adds +`server_capabilities.timeout_cleanup`, and revision 70 adds `replay_clock` to +query and update-validation tasks. + +To roll back after the schema upgrade, restore the pre-upgrade backup before +starting the previous image. Workflows recorded after the upgrade are not in +that backup. The published Compose file defaults to 3.30.0.