Spec: Destroy community — give up a community from Settings; the panel drives it, the page reports its own ending, the app backstops it (#1781, DDR 0274) #1784

Open
opened 2026-09-23 17:39:14 +00:00 by ben · 0 comments
Owner

Parent

#1781 (the gap and Ben's rulings). There is no wayfinder map: this is a standalone feature.

Design contract:

  • DDR 0274 (accepted; amends DDR 0099)
  • flow docs/ux/flows/destroy-community.mermaid
  • frames docs/ux/wireframes/destroy-community/ (DC1–DC6u, DCA1–DCA3), plus the amended shell/shell-ds-settings.html and shell/shell-hox-operator-home-unreachable.html

Specced in auto mode. Every call below not already ruled by Ben is an agent call under ADR 0174 (veto anytime).

Problem Statement

An operator can found a community from the app but can never give it up.

Once founding hands off, nothing in the operator app or the control panel releases the rented gateway they are billed for or frees the <slug>.idss.nz name they claimed. Two facts make this so:

  • The broker's release verb is called only when an operator re-chooses away from a rented gateway mid-founding.
  • The offboard verb has no product caller at all.

The broker's own terms, shown at founding, promise "you can leave any time". Today the only way out is a hand repair: decrypt the sealed claim secret, then curl the broker. Once the gateway is dead even that is gone, because the credential died with it (#1751). Every torn-down trial, demo and rehearsal community has burned its name.

Solution

A Destroy community door, last on the control panel's Settings, opens one dialog in three parts.

  1. Understand. The dialog names exactly what goes:
    • every service;
    • every dataset and its size;
    • the member count;
    • the name, which anyone may then claim;
    • the server's fate.
  2. Back up. The dialog recommends a backup and takes one in place. Every dataset's portable export downloads into the browser, with size shown before it starts and progress while it runs.
  3. Type the word. Confirm arms only when the operator types the destroy word printed in the dialog, in the interface's own language.

Confirm is one request. The gateway uses its claim secret to ask the broker to leave in one act: free the name, release the rented gateway and any rented devices. The panel is served by the box it is destroying, so it draws its own ending:

  • the gateway's reply says the server was released;
  • the page's own call to the broker's public availability check confirms the name is free;
  • if the gateway goes quiet before it replies, an honest not confirmed state says only what the page can confirm.

The operator app backstops it:

  • When the gateway is unreachable, the app offers the same act using its own sealed copy of the claim secret.
  • It notices a destroyed community on its own and can finish an unconfirmed release.
  • It forgets the community's local state as a separate, explicit step.

User Stories

Acceptance criteria are sourced from the flow's nodes and edges (the node IDs in brackets).

The door (DS)

  1. As an operator, I want a Destroy community section at the bottom of Settings, so that the one irreversible act has a findable home that sits apart from everyday work.
    • Given the operator is on Settings, when the page renders, then a destroy-community-section appears after the not-here signpost. It holds one sentence and a destroy-community action, and no other control.
    • Given the operator presses destroy-community, then the destroy dialog opens (DC1) and nothing has changed on the fleet.
  2. As an operator, I want the Settings inventory to stay closed otherwise, so that Settings does not grow into a junk drawer (DDR 0099).
    • Given Settings, then the brand kit, the updates mount, the community details and the not-here list are unchanged, and the destroy section is the only addition.
  3. As a non-operator (a steward without the operator role, or a member), I must not see or reach the door, so that no one but the operator can end the community.
    • Given a session without the operator role, when Settings renders, then there is no destroy-community-section.
    • Given such a session calls the destroy endpoint directly, then it is refused, and nothing is sent to the broker.

Understand (DC1)

  1. As an operator, I want the dialog to name the services that will be deleted, so that I understand this is not a service removal.
    • Given DC1, then goes-services shows the count and names of every installed service, taken from the catalogue's truth.
  2. As an operator, I want to see how much data will be lost, so that I can judge whether I need a backup.
    • Given DC1, then goes-data shows the dataset count and total size from the backups inventory.
    • Given a size is unknown, then the size says it is unknown rather than showing 0.
  3. As an operator, I want to know how many members lose their accounts, so that I know who I have to tell.
    • Given DC1, then goes-members shows the member count.
    • Given DC1, then members-note says IDSS won't notify them.
  4. As an operator, I want to be told the name will be freed for anyone, so that I don't expect to keep it.
    • Given a community holding an idss.nz name, then goes-name names the host and says anyone can claim it afterwards, including the operator.
  5. As an operator, I want the dialog to say what happens to my gateway according to where it lives, so that what I'm told is true.
    • Given the gateway's place, then gateway-fate renders exactly one variant:
      • rented: released, billing stops;
      • own VPS: IDSS stops and the machine is yours to wipe;
      • home: Forget removes it.
    • Given the place is own VPS, then destroy-headline uses the own-VPS variant, which says the server and its data are not deleted.
  6. As an operator with devices I own in the fleet, I want to be told their disks aren't wiped, so that the headline doesn't over-promise.
    • Given the fleet holds owned (not rented) devices, then goes-owned-devices names their count and says their data stays until wiped.
    • Given there are none, then the row is absent.
    • Given rented devices, then they are released with the gateway and get no row.
  7. As an operator, I want to close the dialog without consequence, so that opening it is safe.
    • Given DC1, DC2 (before any destroy), DC3, DC3x or DC4, when cancel or close is pressed, then the dialog closes on Settings (DS), and nothing was sent to the broker.
    • Given a backup is running, when the operator closes the dialog, then the backup stops and archives already downloaded are kept.

Back up (DC1 → DC2 → DC3 / DC3x)

  1. As an operator, I want a backup offered inside the dialog, so that I don't have to leave, go elsewhere and come back.
    • Given DC1, then backup-section shows backup-size (before anything starts), backup-contents and create-and-download-backup.
  2. As an operator, I want to know my existing backups won't save me, so that I don't skip the download believing they will.
    • Given DC1, then sealed-copies-note says the IDSS offsite storage and This computer copies are sealed with this community's keys and are not a way to keep the data.
  3. As an operator, I want to watch the backup progress per dataset with time remaining, so that I'm never waiting blind.
    • Given the operator pressed create-and-download-backup, then DC2 shows:
      • backup-progress with one row per dataset (downloaded, current or waiting);
      • backup-remaining with bytes done, bytes total, rate and time left.
    • Each dataset is the existing per-dataset export: a fresh snapshot packaged as a portable archive, downloaded to the browser, one dataset after another.
  4. As an operator, I want destroy locked while the backup runs, so that I can't cut my own backup off halfway.
    • Given DC2, then confirm-destroy is disabled even if the word matches, and confirm-locked-note says why.
  5. As an operator, I want to stop a backup without losing what finished, so that I can change my mind.
    • Given DC2, when cancel-backup is pressed, then the export in flight stops, finished archives stay downloaded, and the dialog returns to DC1.
  6. As an operator, I want to see exactly which files I have, so that I can check the set is whole.
    • Given every dataset downloaded, then DC3 lists backup-files: a manifest plus one archive per dataset, with names and sizes.
    • Given DC3, then backup-unencrypted-note says the files are not encrypted.
  7. As an operator, I want the backup manifest to name every dataset, so that the backup describes itself.
    • Given DC3, then the manifest file lists each dataset, its archive name, its size and the time it was taken.
  8. As an operator, I want a failed dataset named with its reason and retried alone, so that one failure costs one dataset.
    • Given one dataset's export fails, then DC3x marks it backup-failed-dataset with backup-failure-reason, and the other datasets keep their state.
    • When retry-dataset is pressed, then only that dataset re-exports (→ DC2).
  9. As an operator, I want to go on without a failed dataset, knowingly, so that a broken export can't hold my community hostage.
    • Given DC3x, when continue-without is pressed, then the dialog returns to DC1 with a standing backup-missing line naming what the backup lacks, still visible at confirm.
  10. As an operator, I want the backup to be a recommendation, not a gate, so that I can destroy a community with nothing worth keeping.
    • Given no backup was taken, when the word is typed, then confirm arms, and the backup line reads "No backup taken".
  11. As an operator, I want the backup and its download logged, so that community data leaving the fleet is audit-visible like every other export.
    • Given any dataset export in the dialog, then it is recorded in the activity log exactly as a Backups → Export is.

Type the word (DC1 ↔ DC4)

  1. As an operator, I want to type a word printed in the dialog, so that confirming is a deliberate act.
    • Given DC1, then confirm-word prints the destroy word in the interface's language, and destroy-word-input is empty.
  2. As an operator using the panel in Spanish, Dutch or French, I want the word in my language, so that I'm not asked to type English at the gravest moment.
    • Given the locale is es, nl or fr, then confirm-word shows that locale's translation of the word, drawn from the translation catalogue.
    • Given a locale without a translation, then it falls back to the English word, and the printed word and the match agree.
  3. As an operator, I want the match to forgive case and diacritics, so that keyboard layout never blocks me.
    • Given the input equals the printed word ignoring case, surrounding whitespace and diacritics or macrons, then confirm-destroy becomes armed (DC4).
    • Anything else leaves it disabled.
  4. As an operator, I want confirm to disarm the moment the word stops matching, so that the arming act is always current.
    • Given DC4, when the input is edited so it no longer matches, then confirm-destroy returns to disabled (→ DC1).
  5. As an operator, I want nothing but the word to arm confirm, so that the arming is unambiguous.
    • Given any other state (backup done, a checkbox, anything else), then confirm stays disabled unless the word matches.

Destroying (DC5)

  1. As an operator, I want confirm to send one request that cannot be half-done, so that I never end with a freed name and a billing server, or the other way round.
    • Given DC4, when confirm-destroy is pressed, then DC5 shows, exactly one destroy request goes to the control plane, and the control plane makes exactly one broker leave call.
  2. As an operator, I want to be warned the page will lose its server, so that the aftermath is expected rather than frightening.
    • Given DC5, then page-will-lose-server-note is shown, and there is no cancel.
  3. As an operator, I want the destroy request to name my community, so that a stray or forged call can't end it.
    • Given a destroy request whose body does not name this community's host exactly, then the control plane refuses it with 400, and nothing is sent to the broker.
  4. As an operator, I want a second click or a retried request not to double-act, so that the destroy is safe to repeat.
    • Given a leave is already in flight or has landed, when another destroy request arrives, then it returns the same outcome, and no second broker act is made that could do harm.

The ending (DC6 / DC6x / DC6u)

  1. As an operator, I want the page to tell me it worked after its server is gone, so that I'm not left looking at a browser error.
    • Given the gateway replied that it left, then DC6 renders client-side and replaces the whole panel frame, showing:
      • destroyed-at;
      • server-released;
      • name-freed;
      • backup-recap;
      • next-step-forget;
      • open-operator-app;
      • reload-warning.
    • The page offers no link back into the panel.
  2. As an operator, I want the freed name confirmed by IDSS itself, not just by the dying gateway, so that I can trust it.
    • Given DC6, then the page calls the broker's public availability check for the host directly from the browser, and name-freed shows the time of that confirmation.
    • Given that call fails, then name-freed says it couldn't be confirmed from this page, and never shows a hopeful tick.
  3. As an operator whose provider teardown lagged, I want to be told the release is under way, so that I'm not told "released" when it's owed.
    • Given the broker accepted the leave but the provider refused the teardown (the release is owed and the reaper finishes it), then server-released reads "release under way — IDSS finishes it".
  4. As an operator, I want a refused destroy to leave everything intact, in the broker's own words, so that I can try again.
    • Given the broker refused (claim secret mismatch or missing) or was unreachable, then DC6x shows nothing-released and refusal-reason verbatim.
    • try-again re-runs the act (→ DC5) without retyping the word within the same dialog; close returns to DS.
  5. As an operator whose gateway went quiet before it could reply, I want an honest unconfirmed state, so that I'm neither falsely reassured nor falsely alarmed.
    • Given the destroy request errored or timed out with no reply, then DC6u shows name-check from the page's own availability call, in one of three variants: free / still reserved / couldn't ask.
    • server-check says it can't be confirmed from here, check-again repeats the name check, and open-operator-app is offered.
  6. As an operator on an own-VPS or home gateway whose box survives, I want the panel to stop acting like a live community, so that nothing keeps running as if nothing happened.
    • Given the leave landed, then the control plane enters a durable terminal left state:
      • its broker heartbeats (re-point, renew) stand down;
      • every control API answers 410 with a "this community was destroyed" body;
      • a reload of the panel lands on a DC6-equivalent screen, not a broken dashboard.

The operator app (DCA1–DCA3)

  1. As an operator, I want the operator app to notice my community was destroyed, so that its home stops pretending.
    • Given the app's community name reads available at the broker (a name is freed only by a claim-secret-authorised leave), and the gateway does not answer, then the operator home shows DCA1 with destroyed-summary, name-freed and server-released.
  2. As an operator whose panel ending was unconfirmed, I want the app to finish the release, so that no server stays billing.
    • Given the app cannot confirm the release, then server-released reads "Not confirmed" and finish-releasing is the primary action.
    • When it is pressed, the app re-runs the idempotent leave with its own sealed claim secret and shows the broker's outcome.
  3. As an operator, I want a quiet Destroy community… on the unreachable home, so that I can give up a community whose gateway is already gone.
    • Given HOx, then a quiet destroy-community action sits last, and pressing it opens DCA2.
  4. As an operator destroying from the app, I want the same understanding and the same word, so that the act is as deliberate as in the panel.
    • Given DCA2, then goes-name, gateway-fate and goes-members render (from what the app knows), along with confirm-word-prompt.
    • no-backup-possible says a backup can't be taken from here.
    • gateway-unreachable names since when.
    • confirm-destroy arms only on the word.
  5. As an operator, I want the app to perform the leave with its own sealed claim secret, so that a dead gateway doesn't lock my name forever (#1751).
    • Given DCA2 is confirmed, then the app reveals the claim secret from its own sealed config, calls the broker leave, and lands on DCA1 with the outcome.
  6. As an operator whose app holds no readable claim secret, I want to be told honestly that it can't release, so that nothing appears to work when it hasn't.
    • Given no readable claim secret, then DCA2x shows why, what-stays-reserved, server-lapse and matou-recovery, with nothing sent.
    • close returns to HOx.
  7. As an operator, I want forgetting my community to be a separate, explicit step, so that a destroy never silently erases the credential I might still need.
    • Given DCA1, then forget-community and keep-for-now are offered.
    • Keep for now leaves DCA1 standing across relaunches.
  8. As an operator, I want to see exactly what Forget removes and what it doesn't, so that I don't lose my downloaded backup or mistake sealed copies for readable ones.
    • Given DCA3, then forget-list names the keys, the config replica, the This computer copies (sealed to those keys) and, for a home community only, the gateway on this computer.
    • untouched says downloaded backup files are not touched.
  9. As an operator, I want Forget to wait behind an unfinished release, so that I don't throw away the only credential that can finish it.
    • Given the release is unconfirmed, then forget carries a warning that the name may stay reserved, and finish-releasing stays the primary action on DCA1.
  10. As an operator, I want Forget to return me to a clean start, so that I can found again (perhaps under the same name).
    • Given DCA3 is confirmed, then the community's local state (and a home gateway's VM and its disk) is removed, and the app lands on Welcome (W).
    • Given DCA3 is cancelled, then the app returns to DCA1.

The broker

  1. As Mātou running the broker, I want one leave verb that frees the name and releases every rental under the community host, so that no order of two calls can strand a credential or a server.
    • Given leave with a valid claim secret:
      • the gateway rental and every device rental under the host are released (destroyed at the provider, or marked release-owed for the reaper);
      • the host's records are deleted;
      • the slug is freed;
      • a tombstone is recorded;
      • it answers with {released | release_owed, name_freed, at}.
        47a. Given a missing or wrong secret, then the broker answers 401 or 403, and nothing changes.
        47b. Given a zone-delete failure (after the rentals are settled), then the broker answers 502. The name is not freed and the host's record and claim secret remain, while the rentals stay released or owed. So a retry still authenticates and completes the leave. The name is always freed last for exactly this reason.
  2. As an operator retrying a leave, I want the broker to recognise a community that already left, so that a retry reports the truth instead of "unknown host".
    • Given a tombstone for the host, when leave is called with the secret that left, then it returns the recorded outcome and re-asks any owed teardown.
    • Given the name has since been claimed again, then it answers 410 "this community already left; the name has since been claimed". This is itself a truthful witness that the leave happened.
  3. As an operator's browser, I want to call the availability check across origins, so that the page's second witness works from the panel's origin.
    • Given a browser call to POST /v1/subdomains/available from any origin, then the broker answers the CORS preflight and the call.
    • No other route gains CORS, and the check stays a snapshot with nothing written (#1404).

Implementation Decisions

  • Seams: three, each the highest available.

    1. The broker HTTP surface: a new leave route, a tombstone in the issuer/rentals ledger, CORS on available.
    2. The control API surface (dashboard ↔ control plane): a destroy preview read and a destroy act. Both are operator-only.
    3. The operator app's helper/IPC surface: a destroy act, a leave-status read, forget.

    The dashboard and the app UIs are built against their clients through the existing fake-client patterns. No new seam is introduced beyond these.

  • Broker: one leave verb (under the gateways routes, authorised by the claim secret exactly as release and offboard are, ADR 0135). Order inside the act:

    1. authenticate;
    2. release every rental under the host (gateway, then devices), each through the existing release path, so a provider refusal becomes release-owed for the reaper (#756);
    3. delete the host's records and free the slug;
    4. write a tombstone: host, secret hash, outcome, time.

    The response carries released / release_owed, name_freed and at. release and offboard stay as they are; leave composes them. A host with no rental (a home or own-VPS gateway) leaves with just the name freed. The ledger schema change is additive (the tombstones set), following the release_owed precedent.

  • Broker CORS: only POST /v1/subdomains/available answers CORS preflight with a wildcard origin. The route is public, uncredentialed and writes nothing.

  • brokerclient gains a Leave call returning the outcome shape, with the existing error mapping, so a refusal's words pass through verbatim (ADR 0100).

  • Control plane: destroy preview (read, operator-only). It returns the facts DC1 renders:

    • services (catalogue);
    • datasets with sizes (backups inventory);
    • member count;
    • host and whether it is an idss.nz name;
    • the gateway's place (rented / own VPS / home);
    • owned devices (count);
    • whether a claim secret is present.

    It composes existing seams and adds no new store. When no claim secret is present, the preview says so, and the dialog shows a DC6x-style honest refusal before the word is ever typed.

  • Control plane: destroy act (operator-only). The body must name this community's host exactly; anything else is a 400. It calls brokerclient.Leave with IDSS_CLAIM_SECRET synchronously and replies with the outcome before doing anything else. On success it writes a durable left marker, and from then on:

    • the address heartbeat and the gateway renewal loop rest;
    • every control API route answers 410 with a destroyed body;
    • the SPA's static shell still serves, so a reload of a surviving box shows the ending.

    The act is idempotent: a second call while one is in flight joins it, and after left it returns the recorded outcome. It is logged in the activity log.

  • Dashboard: a destroy dialog owned by the frame's dialog state (the device-add precedent), opened from the Settings screen's new section. The terminal DC6 / DC6u screens replace the whole frame, like the unreachable screen (DDR 0096), and never route back into the panel.

    The backup drives the existing per-dataset export endpoints in sequence and downloads each archive via the existing export-download route. The manifest is generated client-side from those results. The time-left figure is derived from bytes received over elapsed time.

    The browser's availability call goes straight to the broker's public URL, which the control plane exposes to the SPA as config.

  • i18n: the destroy word is one catalogue key in the dashboard's (and app's) existing vue-i18n catalogues (en/es/nl/fr, #1377). The match normalises case, whitespace and diacritics (Unicode NFD with combining marks stripped).

  • Operator app:

    • Leave from the app: the helper reveals the claim secret from the community's sealed clan vars (the existing headless vars-get path) and calls brokerclient.Leave.
    • Destroyed detection: the app treats "its host reads available at the broker, and the gateway does not answer" as destroyed. Only a claim-secret leave frees a name, so this is a sound witness.
    • Forget: removes the community's state directory (keys, config replica, logs, This computer copies) and, for a home community, the gateway VM and its disk, then returns the app to first run.
    • Forget never talks to the broker.
  • Places:

    • Rented gateway — fully offered.
    • Home gateway — the name is freed; the VM goes at Forget.
    • Own VPS — the name is freed and IDSS stops managing it; the headline variant says the data is not deleted.
    • Communities on their own apex domain with no idss.nz name — there is nothing to free at the broker. The act is limited to going terminal. goes-name is absent, and the rented-release still happens if the gateway is rented.

Testing Decisions

  • Test external behaviour at the seam, never internals. A good test drives the HTTP route, the client or the component the way its caller does, and asserts what the caller observes: the response, the ledger state through the public read, the rendered data-field / data-action / data-status contract. It never asserts private call order.

  • Broker (prior art: the rent/release shape tests, the offboard-frees-slug test, the release-owed and reaper tests). leave:

    • authenticates (401 / 403 / 400);
    • releases the gateway and device rentals under the host, sparing other hosts;
    • frees the name last;
    • a provider refusal lands as release_owed and the reaper finishes it;
    • a zone failure leaves the name held and rentals intact;
    • a retry returns the tombstone outcome;
    • a re-claimed name answers 410.

    CORS: the preflight and response headers exist on available and nowhere else.

  • brokerclient (prior art: its existing HTTP-fake tests): outcome parsing and verbatim refusal words.

  • Control API (prior art: the community-app and backups controlapi seam tests with fakes):

    • the preview composes its facts, including absent-secret, own-VPS, owned-device and no-idss-name variants;
    • the act refuses a non-matching host, refuses non-operators, replies with the broker's outcome, goes left, and answers 410 thereafter;
    • the heartbeat rests after left;
    • the act is idempotent.
  • Dashboard (prior art: the Settings, device-add dialog and backups overview vitest suites; the unreachable screen's tests). Each DC frame's contract fields render for its state:

    • the word arms and disarms, including es/nl/fr and diacritic-insensitive matches;
    • the backup sequence, a failure with retry, go on without, and the lock while running;
    • the DC6 / DC6x / DC6u selection from a reply, a refusal and a timeout;
    • the availability witness success and failure.
  • Operator app (prior art: the operator-home and unreachable-home screen tests; the helper's founding-orchestrator tests with a fake broker):

    • the HOx action;
    • the DCA2 leave with a sealed secret, and DCA2x with none;
    • destroyed detection;
    • finish releasing;
    • Forget removes exactly the listed state and lands on Welcome.
  • Live proof (a drive ticket, not a unit): found a rented community on a throwaway name, destroy it from the panel, and assert:

    • the broker ledger shows the rental released and the name free;
    • the droplet is gone at the provider;
    • DC6 was photographed;
    • the app's DCA1 and Forget work.

    Re-founding under the same name then succeeds. That is the #1751 regression, proven in the positive.

Out of Scope

  • Recovering a name whose claim secret is gone everywhere (#1751 item 2, the verified-founding-email release) and the stale-reservation report (#1751 item 3). DCA2x names support as the path.
  • Notifying members automatically (Ben, 2026-09-23: the operator tells them).
  • Wiping owned devices' or an own-VPS gateway's disks. The dialog says they are not wiped.
  • A grace period or scheduled destroy, or an undo.
  • Whether IDSS offsite storage deletes a destroyed community's sealed copies (ADR 0269's retention question).
  • Rehearsal and drive afterAll teardowns switching to leave. It is worth doing, but separately.

Further Notes

  • Agent calls to veto (ADR 0174):
    • confirm locked while a backup runs;
    • one export per dataset plus a client-side manifest;
    • the leave verb and its tombstone;
    • the 410 terminal left state;
    • availability-at-the-broker as the app's destroyed witness;
    • the own-VPS headline variant and the owned-devices row (a DC1 frame amendment in this spec's commit);
    • CORS on available only.
  • The DC1 wireframe gains goes-owned-devices and the own-VPS destroy-headline variant in the same commit that publishes this spec.
  • Relates to #1751, ADR 0189 ("leave any time" becomes true), ADR 0135, DDR 0142 §4 (the founding re-choice release is unchanged), #1377, DDR 0268 / ADR 0269, #756.
## Parent #1781 (the gap and Ben's rulings). There is no wayfinder map: this is a standalone feature. Design contract: - DDR 0274 (accepted; amends DDR 0099) - flow `docs/ux/flows/destroy-community.mermaid` - frames `docs/ux/wireframes/destroy-community/` (DC1–DC6u, DCA1–DCA3), plus the amended `shell/shell-ds-settings.html` and `shell/shell-hox-operator-home-unreachable.html` Specced in auto mode. Every call below not already ruled by Ben is an agent call under ADR 0174 (veto anytime). ## Problem Statement An operator can found a community from the app but can never give it up. Once founding hands off, nothing in the operator app or the control panel releases the rented gateway they are billed for or frees the `<slug>.idss.nz` name they claimed. Two facts make this so: - The broker's release verb is called only when an operator re-chooses away from a rented gateway mid-founding. - The offboard verb has no product caller at all. The broker's own terms, shown at founding, promise *"you can leave any time"*. Today the only way out is a hand repair: decrypt the sealed claim secret, then curl the broker. Once the gateway is dead even that is gone, because the credential died with it (#1751). Every torn-down trial, demo and rehearsal community has burned its name. ## Solution A **Destroy community** door, last on the control panel's Settings, opens one dialog in three parts. 1. **Understand.** The dialog names exactly what goes: - every service; - every dataset and its size; - the member count; - the name, which anyone may then claim; - the server's fate. 2. **Back up.** The dialog recommends a backup and takes one in place. Every dataset's portable export downloads into the browser, with size shown before it starts and progress while it runs. 3. **Type the word.** Confirm arms only when the operator types the destroy word printed in the dialog, in the interface's own language. Confirm is **one request**. The gateway uses its claim secret to ask the broker to **leave** in one act: free the name, release the rented gateway and any rented devices. The panel is served by the box it is destroying, so it draws its **own ending**: - the gateway's reply says the server was released; - the page's own call to the broker's public availability check confirms the name is free; - if the gateway goes quiet before it replies, an honest *not confirmed* state says only what the page can confirm. The **operator app backstops** it: - When the gateway is unreachable, the app offers the same act using its own sealed copy of the claim secret. - It notices a destroyed community on its own and can finish an unconfirmed release. - It forgets the community's local state as a separate, explicit step. ## User Stories Acceptance criteria are sourced from the flow's nodes and edges (the node IDs in brackets). ### The door (DS) 1. As an operator, I want a Destroy community section at the bottom of Settings, so that the one irreversible act has a findable home that sits apart from everyday work. - Given the operator is on Settings, when the page renders, then a `destroy-community-section` appears **after** the not-here signpost. It holds one sentence and a `destroy-community` action, and no other control. - Given the operator presses `destroy-community`, then the destroy dialog opens (DC1) and nothing has changed on the fleet. 2. As an operator, I want the Settings inventory to stay closed otherwise, so that Settings does not grow into a junk drawer (DDR 0099). - Given Settings, then the brand kit, the updates mount, the community details and the not-here list are unchanged, and the destroy section is the only addition. 3. As a non-operator (a steward without the operator role, or a member), I must not see or reach the door, so that no one but the operator can end the community. - Given a session without the operator role, when Settings renders, then there is no `destroy-community-section`. - Given such a session calls the destroy endpoint directly, then it is refused, and nothing is sent to the broker. ### Understand (DC1) 4. As an operator, I want the dialog to name the services that will be deleted, so that I understand this is not a service removal. - Given DC1, then `goes-services` shows the count and names of every installed service, taken from the catalogue's truth. 5. As an operator, I want to see how much data will be lost, so that I can judge whether I need a backup. - Given DC1, then `goes-data` shows the dataset count and total size from the backups inventory. - Given a size is unknown, then the size says it is unknown rather than showing 0. 6. As an operator, I want to know how many members lose their accounts, so that I know who I have to tell. - Given DC1, then `goes-members` shows the member count. - Given DC1, then `members-note` says IDSS won't notify them. 7. As an operator, I want to be told the name will be freed for anyone, so that I don't expect to keep it. - Given a community holding an idss.nz name, then `goes-name` names the host and says anyone can claim it afterwards, including the operator. 8. As an operator, I want the dialog to say what happens to my gateway according to where it lives, so that what I'm told is true. - Given the gateway's place, then `gateway-fate` renders exactly one variant: - rented: released, billing stops; - own VPS: IDSS stops and the machine is yours to wipe; - home: Forget removes it. - Given the place is own VPS, then `destroy-headline` uses the own-VPS variant, which says the server and its data are **not** deleted. 9. As an operator with devices I own in the fleet, I want to be told their disks aren't wiped, so that the headline doesn't over-promise. - Given the fleet holds owned (not rented) devices, then `goes-owned-devices` names their count and says their data stays until wiped. - Given there are none, then the row is absent. - Given rented devices, then they are released with the gateway and get no row. 10. As an operator, I want to close the dialog without consequence, so that opening it is safe. - Given DC1, DC2 (before any destroy), DC3, DC3x or DC4, when `cancel` or `close` is pressed, then the dialog closes on Settings (DS), and nothing was sent to the broker. - Given a backup is running, when the operator closes the dialog, then the backup stops and archives already downloaded are kept. ### Back up (DC1 → DC2 → DC3 / DC3x) 11. As an operator, I want a backup offered inside the dialog, so that I don't have to leave, go elsewhere and come back. - Given DC1, then `backup-section` shows `backup-size` (before anything starts), `backup-contents` and `create-and-download-backup`. 12. As an operator, I want to know my existing backups won't save me, so that I don't skip the download believing they will. - Given DC1, then `sealed-copies-note` says the IDSS offsite storage and This computer copies are sealed with this community's keys and are not a way to keep the data. 13. As an operator, I want to watch the backup progress per dataset with time remaining, so that I'm never waiting blind. - Given the operator pressed `create-and-download-backup`, then DC2 shows: - `backup-progress` with one row per dataset (downloaded, current or waiting); - `backup-remaining` with bytes done, bytes total, rate and time left. - Each dataset is the existing per-dataset export: a fresh snapshot packaged as a portable archive, downloaded to the browser, one dataset after another. 14. As an operator, I want destroy locked while the backup runs, so that I can't cut my own backup off halfway. - Given DC2, then `confirm-destroy` is disabled even if the word matches, and `confirm-locked-note` says why. 15. As an operator, I want to stop a backup without losing what finished, so that I can change my mind. - Given DC2, when `cancel-backup` is pressed, then the export in flight stops, finished archives stay downloaded, and the dialog returns to DC1. 16. As an operator, I want to see exactly which files I have, so that I can check the set is whole. - Given every dataset downloaded, then DC3 lists `backup-files`: a manifest plus one archive per dataset, with names and sizes. - Given DC3, then `backup-unencrypted-note` says the files are not encrypted. 17. As an operator, I want the backup manifest to name every dataset, so that the backup describes itself. - Given DC3, then the manifest file lists each dataset, its archive name, its size and the time it was taken. 18. As an operator, I want a failed dataset named with its reason and retried alone, so that one failure costs one dataset. - Given one dataset's export fails, then DC3x marks it `backup-failed-dataset` with `backup-failure-reason`, and the other datasets keep their state. - When `retry-dataset` is pressed, then only that dataset re-exports (→ DC2). 19. As an operator, I want to go on without a failed dataset, knowingly, so that a broken export can't hold my community hostage. - Given DC3x, when `continue-without` is pressed, then the dialog returns to DC1 with a standing `backup-missing` line naming what the backup lacks, still visible at confirm. 20. As an operator, I want the backup to be a recommendation, not a gate, so that I can destroy a community with nothing worth keeping. - Given no backup was taken, when the word is typed, then confirm arms, and the backup line reads "No backup taken". 21. As an operator, I want the backup and its download logged, so that community data leaving the fleet is audit-visible like every other export. - Given any dataset export in the dialog, then it is recorded in the activity log exactly as a Backups → Export is. ### Type the word (DC1 ↔ DC4) 22. As an operator, I want to type a word printed in the dialog, so that confirming is a deliberate act. - Given DC1, then `confirm-word` prints the destroy word in the interface's language, and `destroy-word-input` is empty. 23. As an operator using the panel in Spanish, Dutch or French, I want the word in my language, so that I'm not asked to type English at the gravest moment. - Given the locale is es, nl or fr, then `confirm-word` shows that locale's translation of the word, drawn from the translation catalogue. - Given a locale without a translation, then it falls back to the English word, and the printed word and the match agree. 24. As an operator, I want the match to forgive case and diacritics, so that keyboard layout never blocks me. - Given the input equals the printed word ignoring case, surrounding whitespace and diacritics or macrons, then `confirm-destroy` becomes `armed` (DC4). - Anything else leaves it `disabled`. 25. As an operator, I want confirm to disarm the moment the word stops matching, so that the arming act is always current. - Given DC4, when the input is edited so it no longer matches, then `confirm-destroy` returns to `disabled` (→ DC1). 26. As an operator, I want nothing but the word to arm confirm, so that the arming is unambiguous. - Given any other state (backup done, a checkbox, anything else), then confirm stays disabled unless the word matches. ### Destroying (DC5) 27. As an operator, I want confirm to send one request that cannot be half-done, so that I never end with a freed name and a billing server, or the other way round. - Given DC4, when `confirm-destroy` is pressed, then DC5 shows, exactly one destroy request goes to the control plane, and the control plane makes exactly one broker **leave** call. 28. As an operator, I want to be warned the page will lose its server, so that the aftermath is expected rather than frightening. - Given DC5, then `page-will-lose-server-note` is shown, and there is no cancel. 29. As an operator, I want the destroy request to name my community, so that a stray or forged call can't end it. - Given a destroy request whose body does not name this community's host exactly, then the control plane refuses it with 400, and nothing is sent to the broker. 30. As an operator, I want a second click or a retried request not to double-act, so that the destroy is safe to repeat. - Given a leave is already in flight or has landed, when another destroy request arrives, then it returns the same outcome, and no second broker act is made that could do harm. ### The ending (DC6 / DC6x / DC6u) 31. As an operator, I want the page to tell me it worked after its server is gone, so that I'm not left looking at a browser error. - Given the gateway replied that it left, then DC6 renders client-side and replaces the whole panel frame, showing: - `destroyed-at`; - `server-released`; - `name-freed`; - `backup-recap`; - `next-step-forget`; - `open-operator-app`; - `reload-warning`. - The page offers no link back into the panel. 32. As an operator, I want the freed name confirmed by IDSS itself, not just by the dying gateway, so that I can trust it. - Given DC6, then the page calls the broker's public availability check for the host directly from the browser, and `name-freed` shows the time of that confirmation. - Given that call fails, then `name-freed` says it couldn't be confirmed from this page, and never shows a hopeful tick. 33. As an operator whose provider teardown lagged, I want to be told the release is under way, so that I'm not told "released" when it's owed. - Given the broker accepted the leave but the provider refused the teardown (the release is owed and the reaper finishes it), then `server-released` reads "release under way — IDSS finishes it". 34. As an operator, I want a refused destroy to leave everything intact, in the broker's own words, so that I can try again. - Given the broker refused (claim secret mismatch or missing) or was unreachable, then DC6x shows `nothing-released` and `refusal-reason` verbatim. - `try-again` re-runs the act (→ DC5) without retyping the word within the same dialog; `close` returns to DS. 35. As an operator whose gateway went quiet before it could reply, I want an honest unconfirmed state, so that I'm neither falsely reassured nor falsely alarmed. - Given the destroy request errored or timed out with no reply, then DC6u shows `name-check` from the page's own availability call, in one of three variants: free / still reserved / couldn't ask. - `server-check` says it can't be confirmed from here, `check-again` repeats the name check, and `open-operator-app` is offered. 36. As an operator on an own-VPS or home gateway whose box survives, I want the panel to stop acting like a live community, so that nothing keeps running as if nothing happened. - Given the leave landed, then the control plane enters a durable terminal *left* state: - its broker heartbeats (re-point, renew) stand down; - every control API answers 410 with a "this community was destroyed" body; - a reload of the panel lands on a DC6-equivalent screen, not a broken dashboard. ### The operator app (DCA1–DCA3) 37. As an operator, I want the operator app to notice my community was destroyed, so that its home stops pretending. - Given the app's community name reads available at the broker (a name is freed only by a claim-secret-authorised leave), and the gateway does not answer, then the operator home shows DCA1 with `destroyed-summary`, `name-freed` and `server-released`. 38. As an operator whose panel ending was unconfirmed, I want the app to finish the release, so that no server stays billing. - Given the app cannot confirm the release, then `server-released` reads "Not confirmed" and `finish-releasing` is the primary action. - When it is pressed, the app re-runs the idempotent leave with its own sealed claim secret and shows the broker's outcome. 39. As an operator, I want a quiet Destroy community… on the unreachable home, so that I can give up a community whose gateway is already gone. - Given HOx, then a quiet `destroy-community` action sits last, and pressing it opens DCA2. 40. As an operator destroying from the app, I want the same understanding and the same word, so that the act is as deliberate as in the panel. - Given DCA2, then `goes-name`, `gateway-fate` and `goes-members` render (from what the app knows), along with `confirm-word-prompt`. - `no-backup-possible` says a backup can't be taken from here. - `gateway-unreachable` names since when. - `confirm-destroy` arms only on the word. 41. As an operator, I want the app to perform the leave with its own sealed claim secret, so that a dead gateway doesn't lock my name forever (#1751). - Given DCA2 is confirmed, then the app reveals the claim secret from its own sealed config, calls the broker leave, and lands on DCA1 with the outcome. 42. As an operator whose app holds no readable claim secret, I want to be told honestly that it can't release, so that nothing appears to work when it hasn't. - Given no readable claim secret, then DCA2x shows `why`, `what-stays-reserved`, `server-lapse` and `matou-recovery`, with nothing sent. - `close` returns to HOx. 43. As an operator, I want forgetting my community to be a separate, explicit step, so that a destroy never silently erases the credential I might still need. - Given DCA1, then `forget-community` and `keep-for-now` are offered. - Keep for now leaves DCA1 standing across relaunches. 44. As an operator, I want to see exactly what Forget removes and what it doesn't, so that I don't lose my downloaded backup or mistake sealed copies for readable ones. - Given DCA3, then `forget-list` names the keys, the config replica, the This computer copies (sealed to those keys) and, for a home community only, the gateway on this computer. - `untouched` says downloaded backup files are not touched. 45. As an operator, I want Forget to wait behind an unfinished release, so that I don't throw away the only credential that can finish it. - Given the release is unconfirmed, then `forget` carries a warning that the name may stay reserved, and `finish-releasing` stays the primary action on DCA1. 46. As an operator, I want Forget to return me to a clean start, so that I can found again (perhaps under the same name). - Given DCA3 is confirmed, then the community's local state (and a home gateway's VM and its disk) is removed, and the app lands on Welcome (W). - Given DCA3 is cancelled, then the app returns to DCA1. ### The broker 47. As Mātou running the broker, I want one leave verb that frees the name and releases every rental under the community host, so that no order of two calls can strand a credential or a server. - Given `leave` with a valid claim secret: - the gateway rental and every device rental under the host are released (destroyed at the provider, or marked release-owed for the reaper); - the host's records are deleted; - the slug is freed; - a tombstone is recorded; - it answers with `{released | release_owed, name_freed, at}`. 47a. Given a missing or wrong secret, then the broker answers 401 or 403, and nothing changes. 47b. Given a zone-delete failure (after the rentals are settled), then the broker answers 502. The name is **not** freed and the host's record and claim secret remain, while the rentals stay released or owed. So a retry still authenticates and completes the leave. The name is always freed last for exactly this reason. 48. As an operator retrying a leave, I want the broker to recognise a community that already left, so that a retry reports the truth instead of "unknown host". - Given a tombstone for the host, when `leave` is called with the secret that left, then it returns the recorded outcome and re-asks any owed teardown. - Given the name has since been claimed again, then it answers 410 "this community already left; the name has since been claimed". This is itself a truthful witness that the leave happened. 49. As an operator's browser, I want to call the availability check across origins, so that the page's second witness works from the panel's origin. - Given a browser call to `POST /v1/subdomains/available` from any origin, then the broker answers the CORS preflight and the call. - No other route gains CORS, and the check stays a snapshot with nothing written (#1404). ## Implementation Decisions - **Seams: three, each the highest available.** 1. The **broker HTTP surface**: a new `leave` route, a tombstone in the issuer/rentals ledger, CORS on `available`. 2. The **control API surface** (dashboard ↔ control plane): a destroy **preview** read and a destroy **act**. Both are operator-only. 3. The **operator app's helper/IPC surface**: a destroy act, a leave-status read, forget. The dashboard and the app UIs are built against their clients through the existing fake-client patterns. No new seam is introduced beyond these. - **Broker: one `leave` verb** (under the gateways routes, authorised by the claim secret exactly as `release` and `offboard` are, ADR 0135). Order inside the act: 1. authenticate; 2. release every rental under the host (gateway, then devices), each through the existing release path, so a provider refusal becomes release-owed for the reaper (#756); 3. delete the host's records and free the slug; 4. write a **tombstone**: host, secret hash, outcome, time. The response carries `released` / `release_owed`, `name_freed` and `at`. `release` and `offboard` stay as they are; `leave` composes them. A host with no rental (a home or own-VPS gateway) leaves with just the name freed. The ledger schema change is additive (the tombstones set), following the `release_owed` precedent. - **Broker CORS:** only `POST /v1/subdomains/available` answers CORS preflight with a wildcard origin. The route is public, uncredentialed and writes nothing. - **brokerclient** gains a `Leave` call returning the outcome shape, with the existing error mapping, so a refusal's words pass through verbatim (ADR 0100). - **Control plane: destroy preview** (read, operator-only). It returns the facts DC1 renders: - services (catalogue); - datasets with sizes (backups inventory); - member count; - host and whether it is an idss.nz name; - the gateway's place (rented / own VPS / home); - owned devices (count); - whether a claim secret is present. It composes existing seams and adds no new store. When no claim secret is present, the preview says so, and the dialog shows a DC6x-style honest refusal before the word is ever typed. - **Control plane: destroy act** (operator-only). The body must name this community's host exactly; anything else is a 400. It calls `brokerclient.Leave` with `IDSS_CLAIM_SECRET` synchronously and replies with the outcome **before** doing anything else. On success it writes a durable **left** marker, and from then on: - the address heartbeat and the gateway renewal loop rest; - every control API route answers 410 with a destroyed body; - the SPA's static shell still serves, so a reload of a surviving box shows the ending. The act is idempotent: a second call while one is in flight joins it, and after `left` it returns the recorded outcome. It is logged in the activity log. - **Dashboard:** a destroy dialog owned by the frame's dialog state (the device-add precedent), opened from the Settings screen's new section. The terminal DC6 / DC6u screens replace the whole frame, like the unreachable screen (DDR 0096), and never route back into the panel. The backup drives the existing per-dataset export endpoints in sequence and downloads each archive via the existing export-download route. The manifest is generated client-side from those results. The time-left figure is derived from bytes received over elapsed time. The browser's availability call goes straight to the broker's public URL, which the control plane exposes to the SPA as config. - **i18n:** the destroy word is one catalogue key in the dashboard's (and app's) existing vue-i18n catalogues (en/es/nl/fr, #1377). The match normalises case, whitespace and diacritics (Unicode NFD with combining marks stripped). - **Operator app:** - **Leave from the app:** the helper reveals the claim secret from the community's sealed clan vars (the existing headless vars-get path) and calls `brokerclient.Leave`. - **Destroyed detection:** the app treats "its host reads available at the broker, and the gateway does not answer" as destroyed. Only a claim-secret leave frees a name, so this is a sound witness. - **Forget:** removes the community's state directory (keys, config replica, logs, This computer copies) and, for a home community, the gateway VM and its disk, then returns the app to first run. - Forget never talks to the broker. - **Places:** - **Rented gateway** — fully offered. - **Home gateway** — the name is freed; the VM goes at Forget. - **Own VPS** — the name is freed and IDSS stops managing it; the headline variant says the data is not deleted. - **Communities on their own apex domain with no idss.nz name** — there is nothing to free at the broker. The act is limited to going terminal. `goes-name` is absent, and the rented-release still happens if the gateway is rented. ## Testing Decisions - **Test external behaviour at the seam, never internals.** A good test drives the HTTP route, the client or the component the way its caller does, and asserts what the caller observes: the response, the ledger state through the public read, the rendered `data-field` / `data-action` / `data-status` contract. It never asserts private call order. - **Broker** (prior art: the rent/release shape tests, the offboard-frees-slug test, the release-owed and reaper tests). `leave`: - authenticates (401 / 403 / 400); - releases the gateway **and** device rentals under the host, sparing other hosts; - frees the name last; - a provider refusal lands as `release_owed` and the reaper finishes it; - a zone failure leaves the name held and rentals intact; - a retry returns the tombstone outcome; - a re-claimed name answers 410. CORS: the preflight and response headers exist on `available` and nowhere else. - **brokerclient** (prior art: its existing HTTP-fake tests): outcome parsing and verbatim refusal words. - **Control API** (prior art: the community-app and backups controlapi seam tests with fakes): - the preview composes its facts, including absent-secret, own-VPS, owned-device and no-idss-name variants; - the act refuses a non-matching host, refuses non-operators, replies with the broker's outcome, goes `left`, and answers 410 thereafter; - the heartbeat rests after `left`; - the act is idempotent. - **Dashboard** (prior art: the Settings, device-add dialog and backups overview vitest suites; the unreachable screen's tests). Each DC frame's contract fields render for its state: - the word arms and disarms, including es/nl/fr and diacritic-insensitive matches; - the backup sequence, a failure with retry, go on without, and the lock while running; - the DC6 / DC6x / DC6u selection from a reply, a refusal and a timeout; - the availability witness success and failure. - **Operator app** (prior art: the operator-home and unreachable-home screen tests; the helper's founding-orchestrator tests with a fake broker): - the HOx action; - the DCA2 leave with a sealed secret, and DCA2x with none; - destroyed detection; - finish releasing; - Forget removes exactly the listed state and lands on Welcome. - **Live proof (a drive ticket, not a unit):** found a rented community on a throwaway name, destroy it from the panel, and assert: - the broker ledger shows the rental released and the name free; - the droplet is gone at the provider; - DC6 was photographed; - the app's DCA1 and Forget work. Re-founding under the **same name** then succeeds. That is the #1751 regression, proven in the positive. ## Out of Scope - Recovering a name whose claim secret is gone everywhere (#1751 item 2, the verified-founding-email release) and the stale-reservation report (#1751 item 3). DCA2x names support as the path. - Notifying members automatically (Ben, 2026-09-23: the operator tells them). - Wiping owned devices' or an own-VPS gateway's disks. The dialog says they are not wiped. - A grace period or scheduled destroy, or an undo. - Whether IDSS offsite storage deletes a destroyed community's sealed copies (ADR 0269's retention question). - Rehearsal and drive `afterAll` teardowns switching to `leave`. It is worth doing, but separately. ## Further Notes - **Agent calls to veto** (ADR 0174): - confirm locked while a backup runs; - one export per dataset plus a client-side manifest; - the `leave` verb and its tombstone; - the 410 terminal *left* state; - availability-at-the-broker as the app's destroyed witness; - the own-VPS headline variant and the owned-devices row (a DC1 frame amendment in this spec's commit); - CORS on `available` only. - The DC1 wireframe gains `goes-owned-devices` and the own-VPS `destroy-headline` variant in the same commit that publishes this spec. - Relates to #1751, ADR 0189 ("leave any time" becomes true), ADR 0135, DDR 0142 §4 (the founding re-choice release is unchanged), #1377, DDR 0268 / ADR 0269, #756.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1784
No description provided.