Skip to content

0034: Namespace takedown fails closed on the tombstone; a seat change re-signs the single license

  • Status: accepted
  • Date: 2026-10-06

Context

Two behaviour changes landed with the review-nit follow-ups to add-cloud-service groups 4, 5, 7, 8 and 10 (branch cloud/review-nits, tickets 01M3Z5T56N1NTMSNDSRTXZSZ92 and 01M3GX24678D2ZMJPEMY7PD2FA). Both were ruled on by the reviewer against the baseline cloud spec (openspec/specs/cloud/spec.md) and the archived add-cloud-service design, and both found the spec silent, so the decisions are recorded here rather than only in a ticket.

  1. The group 5 implementer decided "every takedown step runs": a failed step of sync.Handler.TakedownNamespace (tombstone, blob deletion, audit deletion, push registration deletion) did not stop the later ones. PR #107's reviewer left the nit "namespace takedown continues after a failed tombstone write; decide fail-closed and pin it". The spec's "Rate limiting and abuse handling" requirement only says the service SHALL provide an operator-authenticated takedown path for share ids and blob namespaces, and its Takedown scenario covers a share id; neither says what a partially failed namespace takedown does.
  2. The group 7 reviewer left "re-issue the licence when a renewal changes the seat count": a renewal with a new seat count updated the workspace's seats but kept handing out the license signed for the old count. The spec's "Polar checkout and webhooks" requirement says a renewal "SHALL extend that subscription's existing workspace, keeping its single license, and SHALL never create another workspace or license", and a license "SHALL be revoked only when no non-refunded paid order remains". It does not say whether the license's content may change.

Decisions

  • A namespace takedown fails closed on its first step. When the tombstone cannot be recorded, TakedownNamespace returns an error wrapping sync.ErrTombstoneFailed at once, having closed no connection and deleted no blob, audit entry or push registration; the operator endpoint answers 500, logs the outcome failed, and the operator retries from an untouched namespace. Purging blobs without the tombstone would let a client re-create the namespace with a new genesis and would lose the in-flight put protection, which relies on every put consulting the tombstone after its writes. Once the tombstone is recorded, the group 5 rule stands: every later step runs even when an earlier one failed, the errors are joined, the outcome is failed and the tombstone stays. This refines, for the tombstone step only, the "Every takedown step runs" decision in the archived add-cloud-service design.
  • A seat change re-signs the subscription's single license under its same id. A renewal whose seat count differs from the workspace's stored seats updates the seats and re-signs the stored license with the new seat count and a new IssuedAt, replacing the stored key; the license id, the licenses row and the revocation path (by id) are unchanged, so the subscription still has exactly one license and the spec's "keeping its single license" is read as "one license, one id, never a second one", not "the signed bytes never change". A renewal with an unchanged seat count leaves the key byte-identical, and a replay of a renewal returns the key already stored. A re-sign refuses the renewal (and records nothing) when the stored key does not verify.

Consequences

  • A takedown that fails on the tombstone is now all-or-nothing, and a retry is idempotent. The operator log still records one failed entry per attempt.
  • A license key handed out before a seat change keeps verifying offline at its old seat count (ADR 0014: keys are offline and have no expiry). The seat count is ADR 0014's honor-system reminder, so a stale key with a higher count is a reminder shown too late, not an access grant. Revoking the id revokes old and new keys alike. If a seat decrease ever needs to invalidate the old key, that is an OpenSpec change (a license expiry or a per-key id), not a billing patch.
  • The spec text is unchanged: both readings are compatible with it. A future OpenSpec change that pins either behaviour should cite this ADR.

Alternatives considered

  • Keeping "every takedown step runs" for the tombstone too. Rejected: it deletes data while leaving the namespace creatable again, which is the one state a takedown must never produce.
  • Issuing a new license id on a seat change and revoking the old id. Rejected: it creates a second license per subscription, which the spec forbids, and it would push every seat change onto the license revocation list that applications poll.
  • Leaving the old key in place and only updating the seats row. Rejected: the key handed out would not cover the seats paid for.