provision: #2018's fix never removes a phantom backup-copy inventory instance written BEFORE it landed — a retry still fails eval, a removal leaves it behind #2023

Closed
opened 2026-09-30 05:46:24 +00:00 by ben · 2 comments
Owner

Symptom

After #2018 (47dd93aa) reached Whakatōhea Demo (release 2026.09.3124, control plane restarted 05:36Z on 2026-09-30), the demo's inventory.json still holds the phantom instance left by a deploy that ran before the fix:

"backup-copy@node-req-0003": {"module": {"name": "backup-copy", "input": "clan-core"}, "roles": {"helper": {"machines": {"node-req-0003": {}}}}}

The deploy (05:24–05:27Z, still on the pre-fix control plane 47275d9f) failed with the same flake input 'clan-core' doesn't provide clan-module with name 'backup-copy'. The fixed code only affects new attaches. Nothing removes the old instance.

Cause

The #2018 fix changed AttachService/DetachService for renderless services to write or remove a marker file (machines/<node>/backup-copy.nix). Neither touches an inventory.instances["backup-copy@<node>"] entry that an earlier attach wrote. So:

  • a retry writes the marker, but eval still fails on the leftover instance;
  • a removal deletes the marker file and leaves the instance;
  • every rollout that evaluates the whole flake is at risk for as long as the instance stays.

Any community that set up a member device with Backup copy before 47dd93aa is left like this.

Fix

  • On attach and detach of a renderless service, also delete any inventory.instances[<service>@<node>] (and drop the node from any instance of that module name). This is the migration the fix left out.
  • A one-shot sweep at control-plane start: remove an inventory instance whose module is a renderless service. Commit it with an honest message and log it once.
  • A test that starts from an inventory holding the phantom instance: retry → clean eval shape; detach → no instance, no marker.

Workaround on the demo

Remove backup-copy@node-req-0003 from /srv/idss/config/inventory.json by hand (revert 7aa5ac3), then retry the deploy from the panel.

#2018 (the fix this completes).

## Symptom After #2018 (`47dd93aa`) reached Whakatōhea Demo (release `2026.09.3124`, control plane restarted 05:36Z on 2026-09-30), the demo's `inventory.json` still holds the phantom instance left by a deploy that ran before the fix: ``` "backup-copy@node-req-0003": {"module": {"name": "backup-copy", "input": "clan-core"}, "roles": {"helper": {"machines": {"node-req-0003": {}}}}} ``` The deploy (05:24–05:27Z, still on the pre-fix control plane `47275d9f`) failed with the same `flake input 'clan-core' doesn't provide clan-module with name 'backup-copy'`. The fixed code only affects new attaches. Nothing removes the old instance. ## Cause The #2018 fix changed `AttachService`/`DetachService` for renderless services to write or remove a marker **file** (`machines/<node>/backup-copy.nix`). Neither touches an `inventory.instances["backup-copy@<node>"]` entry that an earlier attach wrote. So: - a retry writes the marker, but eval still fails on the leftover instance; - a removal deletes the marker file and leaves the instance; - every rollout that evaluates the whole flake is at risk for as long as the instance stays. Any community that set up a member device with Backup copy before `47dd93aa` is left like this. ## Fix - On attach and detach of a renderless service, also delete any `inventory.instances[<service>@<node>]` (and drop the node from any instance of that module name). This is the migration the fix left out. - A one-shot sweep at control-plane start: remove an inventory instance whose module is a renderless service. Commit it with an honest message and log it once. - A test that starts from an inventory holding the phantom instance: retry → clean eval shape; detach → no instance, no marker. ## Workaround on the demo Remove `backup-copy@node-req-0003` from `/srv/idss/config/inventory.json` by hand (revert `7aa5ac3`), then retry the deploy from the panel. ## Related #2018 (the fix this completes).

swarm-claim host=matou-dev-server-01 run=36341
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=36341 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #2023 — status success

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

envelope
{
  "issue": 2023,
  "status": "success",
  "commits": [
    "f6e6e6cf1c2f8be32857a0e05cf7bd51836a516a"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/main.go",
    "docs/GOTCHAS.md",
    "internal/clan/backupcopy.go",
    "internal/clan/backupcopy_test.go",
    "internal/clan/config.go",
    "internal/clan/inventory.go",
    "internal/clan/portroute.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci (gofmt/build/vet/go test ./.../golangci-lint, pre-push gate)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "On attach of a renderless service, also delete any inventory.instances[<service>@<node>] (and drop the node from any instance of that module name)": "internal/clan/config.go AttachService renderless branch now calls dropModuleInstance + writeInventory (internal/clan/inventory.go); proven by TestAttachService_BackupCopyRetryDropsThePhantomInstance",
    "On detach of a renderless service, also delete any inventory.instances[<service>@<node>]": "internal/clan/portroute.go detachModuleFile refactored onto dropModuleInstance (already dropped it; now the one shared spelling); proven by TestDetachService_BackupCopyDropsThePhantomInstance",
    "A one-shot sweep at control-plane start: remove an inventory instance whose module is a renderless service. Commit it with an honest message and log it once": "internal/clan/backupcopy.go Adapter.SweepRenderlessInstances (commit msg 'idss: sweep phantom renderless clan instances (#2023)'), wired + logged once in control-plane/cmd/control-plane/main.go productionConfigRepo; proven by TestSweepRenderlessInstances",
    "A test that starts from an inventory holding the phantom instance: retry -> clean eval shape; detach -> no instance, no marker": "internal/clan/backupcopy_test.go: TestAttachService_BackupCopyRetryDropsThePhantomInstance (retry -> no instance, marker present, deployed) and TestDetachService_BackupCopyDropsThePhantomInstance (detach -> no instance, no marker); plus TestSweepRenderlessInstances (idempotent)"
  },
  "summary": "Renderless-service attach + a one-shot control-plane-start sweep now remove the phantom backup-copy clan-core instance #2018's fix left behind, so a retry heals and a live community heals on restart.",
  "blockers": []
}
**close-report** for #2023 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 2023, "status": "success", "commits": [ "f6e6e6cf1c2f8be32857a0e05cf7bd51836a516a" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/main.go", "docs/GOTCHAS.md", "internal/clan/backupcopy.go", "internal/clan/backupcopy_test.go", "internal/clan/config.go", "internal/clan/inventory.go", "internal/clan/portroute.go" ], "tests": [ { "command": "go test ./internal/clan/", "exit_code": 0 }, { "command": "nix develop .#go-ci (gofmt/build/vet/go test ./.../golangci-lint, pre-push gate)", "exit_code": 0 } ], "criteria": { "On attach of a renderless service, also delete any inventory.instances[<service>@<node>] (and drop the node from any instance of that module name)": "internal/clan/config.go AttachService renderless branch now calls dropModuleInstance + writeInventory (internal/clan/inventory.go); proven by TestAttachService_BackupCopyRetryDropsThePhantomInstance", "On detach of a renderless service, also delete any inventory.instances[<service>@<node>]": "internal/clan/portroute.go detachModuleFile refactored onto dropModuleInstance (already dropped it; now the one shared spelling); proven by TestDetachService_BackupCopyDropsThePhantomInstance", "A one-shot sweep at control-plane start: remove an inventory instance whose module is a renderless service. Commit it with an honest message and log it once": "internal/clan/backupcopy.go Adapter.SweepRenderlessInstances (commit msg 'idss: sweep phantom renderless clan instances (#2023)'), wired + logged once in control-plane/cmd/control-plane/main.go productionConfigRepo; proven by TestSweepRenderlessInstances", "A test that starts from an inventory holding the phantom instance: retry -> clean eval shape; detach -> no instance, no marker": "internal/clan/backupcopy_test.go: TestAttachService_BackupCopyRetryDropsThePhantomInstance (retry -> no instance, marker present, deployed) and TestDetachService_BackupCopyDropsThePhantomInstance (detach -> no instance, no marker); plus TestSweepRenderlessInstances (idempotent)" }, "summary": "Renderless-service attach + a one-shot control-plane-start sweep now remove the phantom backup-copy clan-core instance #2018's fix left behind, so a retry heals and a live community heals on restart.", "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.

Dependencies

No dependencies set.

Reference
Matou/idss#2023
No description provided.