Skip to content

Add task-queue:retirement and task-queue:retire (server#519) - #172

Merged
rmcdaniel merged 1 commit into
mainfrom
general/cli-retirement-commands
Nov 25, 2026
Merged

rmcdaniel merged 1 commit into
mainfrom
general/cli-retirement-commands

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Part of durable-workflow/server#519. Native Server 3.14.0 and later serve a read-only retirement inventory and a guarded retire action for worker builds and task queues. These commands expose both in the shipped Rust dw.

Commands

  • dw task-queue:retirement <task-queue> [--build-id=X | --unversioned] sends one GET to /deployments/{namespace}/{queue}@{build}/retirement. With neither option it reads /task-queues/{queue}/retirement, which covers every cohort on the queue. The output shows:

    • whether the target is retirable, and the reason if not;
    • the inventory status, revision and time;
    • the count for every dependency;
    • each blocker with its details, recovery action and samples.

    When the target is retirable, the output prints the matching task-queue:retire ... --expected-revision=... command.

  • dw task-queue:retire <task-queue> [--build-id=X | --unversioned] [--expected-revision=R] sends one guarded POST and never resends it.

    • On success it reports retired_at/retired_by and the inventory.
    • On a 409 refusal nothing changes. stderr shows the reason, the blockers with recovery and samples, and the Server's expected_resolution as the next step. The command exits 2.
    • With --json, a refusal returns the usual error envelope, with the full body in server_response.

Both commands require capabilities.worker_build_retirement. Without it they exit 8 before sending any request. Each path part is sent as one encoded segment. A build id containing @, or equal to unversioned, would address a different cohort, so dw rejects it as a usage error before any request.

Like the other native-only commands, these are Rust-only catalog additions (parity skips them). The PHP 2.x implementation is unchanged. The docs updates are in docs/cli-reference.md and rust/README.md.

Testing

  • Seven new loopback-Server tests in rust/tests/queues_workers.rs cover paths, bodies, human and JSON output, the 409 refusal (exit 2, envelope), the missing capability (exit 8, no request), target usage errors and a lost response that is not resent. cargo fmt, cargo clippy -D warnings, the full cargo test and the parity unit tests pass locally (Docker, rust:1.99).
  • Manual run against the published ghcr.io/durable-workflow/server:3.28.0 image (SQLite). It covered:
    • an unknown queue (unknown_task_queue);
    • a promoted build with an open run (selected_for_new_starts);
    • a live dependency after promoting a replacement (live_dependencies, JSON);
    • a stale revision (inventory_changed);
    • a bound retire that succeeded;
    • --unversioned (unknown_deployment).

A CLI release is needed before this ships.

🤖 Generated with Claude Code

Native Server 3.14.0 inventories what still depends on a worker build or a
task queue and retires it only when nothing does (durable-workflow/server#519,
#1241). Expose it in the shipped Rust dw:

- task-queue:retirement <task-queue> [--build-id=X | --unversioned]: one GET of
  /deployments/{namespace}/{queue}@{build}/retirement, or of
  /task-queues/{queue}/retirement for every cohort. Human output shows
  whether it is retirable and why not, the inventory status, revision and
  observation time, the count of every dependency, and each blocker with
  its details, recovery action and sample identities. A retirable result
  prints the matching retire command bound to its inventory revision.
- task-queue:retire <task-queue> [--build-id=X | --unversioned]
  [--expected-revision=R]: one guarded POST to the matching /retire, never
  resent ({"expected_inventory_revision": R} or {}). Success reports
  retired_at/by and the inventory. A 409 refusal changed nothing: stderr
  shows the reason, the blockers with recovery and samples, and the
  Server's expected_resolution as the next step, and dw exits 2; --json
  keeps the error envelope with the full body in server_response.

Both check cluster info (the existing preflight) for
capabilities.worker_build_retirement and otherwise refuse with exit 8 before
any request. Each path part is one encoded segment. A build id containing
"@" or equal to "unversioned" would address another cohort, so it is refused
as a usage error before any request.

Like the other native-only commands they are Rust-only catalog additions.
Docs: cli-reference, rust/README.

Tests: 7 loopback-Server integration tests. Also run by hand against the
published Server 3.28.0 image (SQLite): unknown queue, selected build, live
run, stale revision and a successful bound retire.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant