Repository navigation
Add namespace:retention-plan and namespace:retention-apply (server#522) - #178
Merged
Merged
Conversation
Native Server 3.30.0 previews a proposed namespace retention policy and applies it only while that plan still holds (durable-workflow/server#522, #1332, #1350). Expose it in the shipped Rust dw: - namespace:retention-plan <name> [--retention=N] [--retention-mode=bounded|forever] [--scan-limit=N] [--hold-scan-limit=N]: one read-only POST of /namespaces/{name}/retention-plan. Human output shows the current and proposed policy with cutoffs, whether it is retroactive, complete, both revisions, a count for every change and exclusion ("at least N" when a count reached its bound), the incomplete fields, the hold inspection, example runs, the scope sentence and the exact apply command for the plan. --json returns the Server document unchanged. - namespace:retention-apply <name> [--retention=N] [--retention-mode=...] --policy-revision=R --plan-revision=R [--confirm-retroactive-pruning] [--plan-file=plan.json]: one guarded POST of .../retention-plan/apply, never resent. --plan-file takes the resolved proposal and both revisions from a saved plan (namespace and schema checked) and cannot be combined with those four options. A stale (409), mismatched (409) or unconfirmed (422) apply changed nothing: dw prints the reason and the next step (re-plan, with the current policy_revision, for stale) and exits 2; --json keeps the error envelope with the full body. A 404 that is not namespace_not_found means the Server lacks the routes and points at native Server 3.30.0. Option names follow namespace:create/update (--retention for days). Invalid options are refused with exit 2 before any request. Server 3.30.0 advertises no capability for these routes, so there is no capability preflight. namespace:update is unchanged. Like the other native-only commands they are Rust-only catalog additions; the PHP 2.3.x maintenance line is unchanged. Docs: cli-reference, README, rust/README. Tests: 9 loopback-Server integration tests (tests/namespace_retention.rs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Member
Author
|
Independent review: PASS at head 5ccd3e4 I reviewed the change at 9f0ff8d. The head 5ccd3e4 only adds a merge of current main (the 2.13.0 release prep and the parity version normalization), because the strict status check rule required the branch to be up to date. The PR's own diff is unchanged. What I verified against durable-workflow/server main (
Non-blocking suggestions for a follow-up:
|
This was referenced Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



For durable-workflow/server#522. Native Server 3.30.0 can now preview a namespace retention change and then apply it only while that preview still holds (server#1332, #1350; documented in the server reference under "Retention plan" and "Guarded apply"). This PR adds both routes to the shipped Rust
dw.Commands
namespace:retention-plan <name> [--retention=N] [--retention-mode=bounded|forever] [--scan-limit=N] [--hold-scan-limit=N] [--json]POST /api/namespaces/{name}/retention-plan. Any field you leave out keeps its current value.RetroactiveandCompletechanges.*andexclusions.*count. A count that hit its bound shows asat least N.incompletefields and the hold inspectiondw namespace:retention-apply …command for this plan, with--confirm-retroactive-pruningadded when the plan is retroactive--jsonreturns thedurable-workflow.v2.retention-plan.v1document unchanged.namespace:retention-apply <name> [--retention=N] [--retention-mode=…] --policy-revision=… --plan-revision=… [--confirm-retroactive-pruning] [--plan-file=plan.json] [--json]POST …/retention-plan/applyand never resends it.confirm_retroactive_pruningis always sent, astrueorfalse.--plan-filetakes the resolved proposal and both revisions from a plan saved withnamespace:retention-plan --json. It checks the plan's schema and namespace first. Because the file supplies the proposal and both revisions, it can't be combined with--retention,--retention-modeor the revision options.409 retention_policy_revision_stale: shows the currentpolicy_revisionand suggestsdw namespace:retention-plan <name>to plan again.409 retention_plan_revision_mismatch: apply the plan's exact proposal, or plan this one.422 retention_pruning_confirmation_required: reviewnewly_eligible, then repeat with--confirm-retroactive-pruning.--json, a refusal returns the usual error envelope:reason,status_code,server_response, andrecommendations[0].idset toretention_plan.stale,retention_plan.mismatchorretention_plan.confirmation_required.namespace_not_foundmeans the Server doesn't have these routes. dw exits 5 and says native Server 3.30.0 or later is needed. Server 3.30.0 advertises no capability for these routes, so there is no capability preflight.Bad option values (non-positive integers, an unknown mode,
--retentiontogether withforever, missing revisions, a bad or mismatched plan file) are refused with exit 2 before any request. Each name is sent as one encoded path segment.namespace:updateis unchanged.Notes for review
--retention(days) matchesnamespace:createandnamespace:update, and--retention-modeis its companion. I used these instead of--retention-daysand--mode.task-queue:retireandworkflow:history-archive. They are registered inrust/parity/catalog-additions.json,rust/src/catalog.json,main.rs, the rust-only list intest_parity.py, and the parity script comments. The PHP 2.3.x maintenance line is untouched.docs/cli-reference.mdhas a new "Retention plan and guarded apply" section with the refusal table, and bothREADME.mdandrust/README.mdmention the commands.Local checks (Rust 1.99, Docker)
cargo fmt --check: passcargo clippy --locked --all-targets -- -D warnings: passcargo test --test namespace_retention: 9/9 pass. The tests cover the plan request and full human output, a forever plan, apply bodies,--plan-file, all three refusals in human and JSON form, a Server without the routes, local validation, path encoding and a lost response.cargo test --bin dw: 139 pass.queues_workers,namespace_listandsystem_debug: pass.python3 -m unittest test_parity: 27/27 pass.🤖 Generated with Claude Code