provision: removing Document editing or Calendar & contacts never leaves the box — both fall through to the bare inventory detach (the GOTCHAS #207 class, left open for these two slugs) #1589

Closed
opened 2026-09-18 16:08:18 +00:00 by ben · 3 comments
Owner

What is wrong

Removing Document editing (docs-editing) or Calendar & contacts (calendar) from a device through provisioning's change mode (P4-S2 untick → P4-S3 Review impact → deploy) has no removal mirror. Both fall through to the bare Config().DetachService at the foot of the removed loop in deployServicesOnly (internal/provision/deploy.go), which only deletes a clan inventory row. Neither service was ever written as an inventory instance (#351), so the removal edits nothing the node evaluates.

This is the GOTCHAS #207 defect class (#1348/#1349), left open for exactly these two slugs: routablePortModule excludes files, docs-editing and calendar "to their own coupled placement paths", but only files has such a path (detachCohostFiles / detachMemberFilesPlacement).

docs-editing

  • attachDocsEditing lands docs-editing.nix in machines/<node>/ and re-runs the files render with the WOPI coupling on.
  • On removal the module file stays on disk, ComposeGatewayCohost / composeMemberEntry still import it, the front door keeps the Collabora route, the switch never stops coolwsd, and ReadDeployedServices (internal/clan/deployedservices.go — file presence is the deployed-set signal) keeps reporting it. The picker re-ticks it next cycle, so the operator's removal silently undoes itself and the box never gets its memory back.
  • The files render is also left with the WOPI coupling pointing at a service the operator removed.

calendar

  • attachCalendar ships no module: it re-runs the files render with FilesConfig.Calendar set.
  • On removal nothing re-renders files with the flag cleared, so Nextcloud's Calendar and Contacts apps stay enabled on the node.

What done looks like

  • Unticking docs-editing on a gateway co-host drops docs-editing.nix, re-renders files with the WOPI coupling off (when files stays on the node), rewrites the front door without the Collabora route from the reduced fleet-wide union (#1172), and recomposes the gateway entry module — one switch carries all of it, and coolwsd stops.
  • The same removal on a real member device does the member-side mirror (module dropped, composeMemberEntry without it, gateway front door rewritten without the mesh route), as detachMemberPort does for the routable ports.
  • Unticking calendar re-runs the files render with Calendar: false on the node that holds files, on both placements.
  • Removing files together with docs-editing and/or calendar in ONE deploy still evaluates — the order of unwinding matters (the #790 eval-error class: never drop a module another still-present module references).
  • ReadDeployedServices loses docs-editing after the removal (the TestDetachPort_RemovesModuleFromDeployedSet shape), and a deploy-level test proves each removal drives the real mirror, not DetachService (the TestDeploy_GatewayCohostPortRemovalDropsTheModule shape).
  • The bare DetachService fall-through can no longer be reached by a service that ships a render: a removed slug with a module file and no mirror FAILS the deploy loudly rather than greening a removal that never left the box.
  • GOTCHAS #207 is amended in the same commit to record the two slugs closed.

Notes

  • Found by code reading on 2026-09-18, not by a red drive: the brand-reach walk (provision-brands.live.spec.ts) proves install → remove on the guest for the seven routable ports only, so nothing live has ever exercised these two removals.
  • What signal the fleet projection reads for calendar being deployed needs confirming as part of this — it has no module file in deployedModuleFiles.
  • Related: the Services-tab uninstall act (filed alongside) routes operators onto this path far more often than change mode does today, so this should land first or with it.
## What is wrong Removing **Document editing** (`docs-editing`) or **Calendar & contacts** (`calendar`) from a device through provisioning's change mode (P4-S2 untick → P4-S3 Review impact → deploy) has no removal mirror. Both fall through to the bare `Config().DetachService` at the foot of the `removed` loop in `deployServicesOnly` (`internal/provision/deploy.go`), which only deletes a clan **inventory** row. Neither service was ever written as an inventory instance (#351), so the removal edits nothing the node evaluates. This is the GOTCHAS #207 defect class (#1348/#1349), left open for exactly these two slugs: `routablePortModule` excludes `files`, `docs-editing` and `calendar` "to their own coupled placement paths", but only `files` has such a path (`detachCohostFiles` / `detachMemberFilesPlacement`). ### docs-editing - `attachDocsEditing` lands `docs-editing.nix` in `machines/<node>/` and re-runs the files render with the WOPI coupling on. - On removal the module file stays on disk, `ComposeGatewayCohost` / `composeMemberEntry` still import it, the front door keeps the Collabora route, the switch never stops coolwsd, and `ReadDeployedServices` (`internal/clan/deployedservices.go` — file presence is the deployed-set signal) keeps reporting it. The picker re-ticks it next cycle, so the operator's removal silently undoes itself and the box never gets its memory back. - The files render is also left with the WOPI coupling pointing at a service the operator removed. ### calendar - `attachCalendar` ships no module: it re-runs the files render with `FilesConfig.Calendar` set. - On removal nothing re-renders files with the flag cleared, so Nextcloud's Calendar and Contacts apps stay enabled on the node. ## What done looks like - [ ] Unticking `docs-editing` on a **gateway co-host** drops `docs-editing.nix`, re-renders files with the WOPI coupling off (when files stays on the node), rewrites the front door without the Collabora route from the reduced fleet-wide union (#1172), and recomposes the gateway entry module — one switch carries all of it, and coolwsd stops. - [ ] The same removal on a real **member device** does the member-side mirror (module dropped, `composeMemberEntry` without it, gateway front door rewritten without the mesh route), as `detachMemberPort` does for the routable ports. - [ ] Unticking `calendar` re-runs the files render with `Calendar: false` on the node that holds files, on both placements. - [ ] Removing `files` together with `docs-editing` and/or `calendar` in ONE deploy still evaluates — the order of unwinding matters (the #790 eval-error class: never drop a module another still-present module references). - [ ] `ReadDeployedServices` loses `docs-editing` after the removal (the `TestDetachPort_RemovesModuleFromDeployedSet` shape), and a deploy-level test proves each removal drives the real mirror, not `DetachService` (the `TestDeploy_GatewayCohostPortRemovalDropsTheModule` shape). - [ ] The bare `DetachService` fall-through can no longer be reached by a service that ships a render: a removed slug with a module file and no mirror FAILS the deploy loudly rather than greening a removal that never left the box. - [ ] GOTCHAS #207 is amended in the same commit to record the two slugs closed. ## Notes - Found by code reading on 2026-09-18, not by a red drive: the brand-reach walk (`provision-brands.live.spec.ts`) proves install → remove on the guest for the seven routable ports only, so nothing live has ever exercised these two removals. - What signal the fleet projection reads for `calendar` being deployed needs confirming as part of this — it has no module file in `deployedModuleFiles`. - Related: the Services-tab uninstall act (filed alongside) routes operators onto this path far more often than change mode does today, so this should land first or with it.

swarm-claim host=bens-mac-04 run=26650
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=26650 (automated multi-host claim — lowest live claim id works this ticket)

Ruled by agent under ADR 0174 — veto anytime.

Implementing #1589, one design call needed a ruling: the ACs and the defect text ("the front door keeps the Collabora route" / "rewrites the front door without the Collabora route from the reduced fleet-wide union") assume docs-editing already earns a front-door route through the fleet-wide union (#1172). It does not today: routableLiveService/fleetFrontDoorServices emit files and the seven forward-auth ports, but nothing ever builds a docs-editing LiveService, so docs-editing.<apex> is never routed — even though the files render points wopi_url at that host and docsediting.go documents that "the front door fronts it over the mesh (ADR 0074)". So browser WOPI editing has a latent reachability gap, and the removal AC has no route to drop.

Ruling: add docs-editing to the front-door union — a co-host routes to 127.0.0.1:9980 (loopback), a member device to <mesh>:9980, WOPI exempt paths on the public path (DocsEditingExemptPaths) — so attach routes it and removal drops it from the reduced union, symmetric with files and the ports. This completes the ADR 0074 posture the design already intends (Collabora binds mesh-only, the front door fronts it, forward_auth + WOPI-token exempt paths gate entry); it is not a new public surface beyond the documented design.

Why two-way door: revertible in a later commit (drop the union branch), and provable by tests — attach routes docs-editing on the front door, removal rewrites it without the route. Not on the one-way-door list (no personal credentials, no posture widening beyond the documented ADR 0074 design, no member-facing trust accept, no data destruction, no spend). Proven by new TestDeploy_DocsEditingGetsFrontDoorRoute (present on attach) + TestDeploy_GatewayCohostDocsEditingRemovalDropsTheModule / ...MemberDevice... (absent after removal).

**Ruled by agent under ADR 0174 — veto anytime.** Implementing #1589, one design call needed a ruling: the ACs and the defect text ("the front door **keeps** the Collabora route" / "rewrites the front door **without** the Collabora route from the reduced fleet-wide union") assume docs-editing already earns a front-door route through the fleet-wide union (#1172). It does not today: `routableLiveService`/`fleetFrontDoorServices` emit files and the seven forward-auth ports, but **nothing ever builds a `docs-editing` LiveService**, so `docs-editing.<apex>` is never routed — even though the files render points `wopi_url` at that host and `docsediting.go` documents that "the front door fronts it over the mesh (ADR 0074)". So browser WOPI editing has a latent reachability gap, and the removal AC has no route to drop. **Ruling:** add docs-editing to the front-door union — a co-host routes to `127.0.0.1:9980` (loopback), a member device to `<mesh>:9980`, WOPI exempt paths on the public path (`DocsEditingExemptPaths`) — so **attach routes it and removal drops it from the reduced union**, symmetric with files and the ports. This completes the ADR 0074 posture the design already intends (Collabora binds mesh-only, the front door fronts it, forward_auth + WOPI-token exempt paths gate entry); it is not a new public surface beyond the documented design. **Why two-way door:** revertible in a later commit (drop the union branch), and provable by tests — attach routes docs-editing on the front door, removal rewrites it without the route. Not on the one-way-door list (no personal credentials, no posture widening beyond the documented ADR 0074 design, no member-facing trust accept, no data destruction, no spend). Proven by new `TestDeploy_DocsEditingGetsFrontDoorRoute` (present on attach) + `TestDeploy_GatewayCohostDocsEditingRemovalDropsTheModule` / `...MemberDevice...` (absent after removal).

close-report for #1589 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1589,
  "status": "success",
  "commits": [
    "771736b37aed848a75ebecd1591e8fbde6d671cc"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "internal/clan/docsediting.go",
    "internal/clan/portroute_detach_test.go",
    "internal/provision/change_test.go",
    "internal/provision/deploy.go",
    "internal/provision/deploy_docsediting_removal_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/provision/ ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "go test ./...",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/provision/ ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/provision/ internal/clan/",
      "exit_code": 0
    },
    {
      "command": "golangci-lint run ./internal/provision/... ./internal/clan/...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Unticking docs-editing on a gateway co-host drops docs-editing.nix, re-renders files with WOPI off (when files stays), rewrites the front door without the Collabora route from the reduced union, recomposes the gateway entry module (one switch, coolwsd stops)": "detachDocsEditing (internal/provision/deploy.go) drives DetachPort + attachFilesPlacement(docsEditing=false) which rewrites the front door from the reduced fleet-wide union and recomposes; proven by TestDeploy_GatewayCohostDocsEditingRemovalDropsTheModule",
    "The same removal on a real member device does the member-side mirror (module dropped, composeMemberEntry without it, gateway front door rewritten without the mesh route)": "detachDocsEditing member branch (DetachPort + attachFilesPlacement -> attachMemberFilesPlacement, or composeMemberEntry + gateway front-door de-route when files also gone); proven by TestDeploy_MemberDeviceDocsEditingRemovalDropsTheModule",
    "Unticking calendar re-runs the files render with Calendar:false on the node that holds files, on both placements": "the removed loop's calendar branch re-runs attachFilesPlacement(..., calendar=false, ...) when files remains; proven by TestDeploy_CalendarRemovalRerendersFilesWithoutTheApps",
    "Removing files together with docs-editing and/or calendar in ONE deploy still evaluates (order of unwinding matters, the #790 class)": "detachDocsEditing skips the files re-render when remaining[files] is false; files removal (detachCohostFiles) unwinds the export before dropping files.nix; proven by TestDeploy_FilesDocsCalendarRemovedTogetherEvaluates (asserts unwire-before-drop and a routeless final front door)",
    "ReadDeployedServices loses docs-editing after removal (TestDetachPort_RemovesModuleFromDeployedSet shape), and a deploy-level test proves each removal drives the real mirror not DetachService (TestDeploy_GatewayCohostPortRemovalDropsTheModule shape)": "clan TestDetachPort_RemovesDocsEditingFromDeployedSet (ReadDeployedServices loses docs-editing, the file is gone) + deploy-level TestDeploy_GatewayCohostDocsEditingRemovalDropsTheModule / ...MemberDevice... assert DetachPort + routeless front door + recompose and no detach-service edit",
    "The bare DetachService fall-through can no longer be reached by a service that ships a render: a removed slug with a module file and no mirror FAILS the deploy loudly": "the fall-through now refuses (clan.PortModuleFile(slug) && CanDeployService(slug), scoped to !removal); proven by TestDeploy_ModuleShippingRemovalWithNoMirrorFailsLoud",
    "GOTCHAS #207 amended in the same commit to record the two slugs closed": "docs/GOTCHAS.md entry 207 gains the #1589 amendment recording docs-editing + calendar closed, in commit 771736b3"
  },
  "summary": "docs-editing and calendar removals now drive real removal mirrors (module dropped / files re-rendered with the flag off / front door de-routed) instead of the bare inventory detach, and the fall-through fails loud for any unmirrored module-shipping change-mode removal.",
  "blockers": []
}
**close-report** for #1589 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1589, "status": "success", "commits": [ "771736b37aed848a75ebecd1591e8fbde6d671cc" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "internal/clan/docsediting.go", "internal/clan/portroute_detach_test.go", "internal/provision/change_test.go", "internal/provision/deploy.go", "internal/provision/deploy_docsediting_removal_test.go" ], "tests": [ { "command": "go test ./internal/provision/ ./internal/clan/", "exit_code": 0 }, { "command": "go test ./...", "exit_code": 0 }, { "command": "go vet ./internal/provision/ ./internal/clan/", "exit_code": 0 }, { "command": "gofmt -l internal/provision/ internal/clan/", "exit_code": 0 }, { "command": "golangci-lint run ./internal/provision/... ./internal/clan/...", "exit_code": 0 } ], "criteria": { "Unticking docs-editing on a gateway co-host drops docs-editing.nix, re-renders files with WOPI off (when files stays), rewrites the front door without the Collabora route from the reduced union, recomposes the gateway entry module (one switch, coolwsd stops)": "detachDocsEditing (internal/provision/deploy.go) drives DetachPort + attachFilesPlacement(docsEditing=false) which rewrites the front door from the reduced fleet-wide union and recomposes; proven by TestDeploy_GatewayCohostDocsEditingRemovalDropsTheModule", "The same removal on a real member device does the member-side mirror (module dropped, composeMemberEntry without it, gateway front door rewritten without the mesh route)": "detachDocsEditing member branch (DetachPort + attachFilesPlacement -> attachMemberFilesPlacement, or composeMemberEntry + gateway front-door de-route when files also gone); proven by TestDeploy_MemberDeviceDocsEditingRemovalDropsTheModule", "Unticking calendar re-runs the files render with Calendar:false on the node that holds files, on both placements": "the removed loop's calendar branch re-runs attachFilesPlacement(..., calendar=false, ...) when files remains; proven by TestDeploy_CalendarRemovalRerendersFilesWithoutTheApps", "Removing files together with docs-editing and/or calendar in ONE deploy still evaluates (order of unwinding matters, the #790 class)": "detachDocsEditing skips the files re-render when remaining[files] is false; files removal (detachCohostFiles) unwinds the export before dropping files.nix; proven by TestDeploy_FilesDocsCalendarRemovedTogetherEvaluates (asserts unwire-before-drop and a routeless final front door)", "ReadDeployedServices loses docs-editing after removal (TestDetachPort_RemovesModuleFromDeployedSet shape), and a deploy-level test proves each removal drives the real mirror not DetachService (TestDeploy_GatewayCohostPortRemovalDropsTheModule shape)": "clan TestDetachPort_RemovesDocsEditingFromDeployedSet (ReadDeployedServices loses docs-editing, the file is gone) + deploy-level TestDeploy_GatewayCohostDocsEditingRemovalDropsTheModule / ...MemberDevice... assert DetachPort + routeless front door + recompose and no detach-service edit", "The bare DetachService fall-through can no longer be reached by a service that ships a render: a removed slug with a module file and no mirror FAILS the deploy loudly": "the fall-through now refuses (clan.PortModuleFile(slug) && CanDeployService(slug), scoped to !removal); proven by TestDeploy_ModuleShippingRemovalWithNoMirrorFailsLoud", "GOTCHAS #207 amended in the same commit to record the two slugs closed": "docs/GOTCHAS.md entry 207 gains the #1589 amendment recording docs-editing + calendar closed, in commit 771736b3" }, "summary": "docs-editing and calendar removals now drive real removal mirrors (module dropped / files re-rendered with the flag off / front door de-routed) instead of the bare inventory detach, and the fall-through fails loud for any unmirrored module-shipping change-mode removal.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#1589
No description provided.