device-add: intended roles server and storage have NO spec floor — the guest is dedicated 0 CPUs / 0 GB / 0 GB, the spec gate passes any machine, and Pair accepts the zero guest_spec #2005

Closed
opened 2026-09-30 01:12:32 +00:00 by ben · 3 comments
Owner

Symptom

A code minted with the intended role Server (or Storage) sizes a VM-mode guest at nothing:

Dedicate to the community:
  CPUs [0]   Memory [0 GB]   Disk [0 GB]

and the gateway accepted the pairing: GET /api/v1/enroll/pending on Whakatōhea Demo (2026-09-30) holds req-0002 with "mode":"vm","guest_spec":{"cores":0,"mem_bytes":0,"disk_bytes":0}. Had Create succeeded, qemu would have been asked for a 0-core, 0-byte guest.

Cause

The panel offers four role hints (dashboard/src/lib/deviceAdd.ts:31 — helper, storage, server, gateway; helper is the default) but catalogue.SpecFloors() (internal/catalogue/catalogue.go:1148) derives floors only from the roles the services declare, and every service declares RoleHelper or RoleGateway. So l.cfg.SpecFloors["server"] is the zero SpecFloor:

  • Redeem (internal/enroll/ledger.go:409) hands the device a zero floor → vmSpecFromFloor (internal/join/app.go:241) dedicates 0/0/0;
  • the spec gate (specShortfalls, vmHostFloor) has nothing to fail — any machine passes;
  • Pair refuses a VM-mode request only when GuestSpec == nil (ledger.go:490, ErrNoGuestSpec); a present-but-zero spec is accepted.

enroll_rent.go:198 mints rented devices as server too — a rented box takes full install, so it never dedicates a guest, which is why the zero floor never showed there.

Fix (proposed ruling — two-way door under ADR 0174, agent rules; veto anytime)

  1. Fail loud on a zero floor. Pair refuses a VM-mode GuestSpec with any zero dimension (extend ErrNoGuestSpec); MintCode refuses an intended role the ledger has no floor for, with the role named. The device end prints the refusal, never CPUs [0].
  2. Give server and storage a floor. Proposed default: server = the largest helper-role service floor that is not the gateway's (so a server guest can host any single non-gateway service — today 4 cores / 7.08 GiB for meetings, or 2 / 3.54 GiB if meetings is excluded as the outlier); storage = the backup-copy floor with the disk lifted to the community's archive share. Record the numbers in the catalogue beside deviceDiskFloor with the arithmetic in the comment, and pin them with the package test that already guards the helper invariant.
  3. The panel's role selector reads which roles carry a floor from GET /api/v1/enroll/config rather than a hard-coded four, so a role with no floor cannot be offered.

If 2 wants a human ruling, land 1 and 3 first — they close the hole on their own.

DDR 0224 / ADR 0055 (the hint selects the floor and sizes the guest). Found in the same hand run as the cold-install VM-create defect.

Siblings

Found in the one hand run (bens-mac-04 → Whakatōhea Demo, 2026-09-30): #2002 #2003 #2004 #2006 #2007

## Symptom A code minted with the intended role **Server** (or **Storage**) sizes a VM-mode guest at nothing: ``` Dedicate to the community: CPUs [0] Memory [0 GB] Disk [0 GB] ``` and the gateway accepted the pairing: `GET /api/v1/enroll/pending` on Whakatōhea Demo (2026-09-30) holds `req-0002` with `"mode":"vm","guest_spec":{"cores":0,"mem_bytes":0,"disk_bytes":0}`. Had Create succeeded, qemu would have been asked for a 0-core, 0-byte guest. ## Cause The panel offers four role hints (`dashboard/src/lib/deviceAdd.ts:31` — helper, storage, server, gateway; `helper` is the default) but `catalogue.SpecFloors()` (`internal/catalogue/catalogue.go:1148`) derives floors only from the roles the services declare, and every service declares `RoleHelper` or `RoleGateway`. So `l.cfg.SpecFloors["server"]` is the zero `SpecFloor`: - `Redeem` (`internal/enroll/ledger.go:409`) hands the device a zero floor → `vmSpecFromFloor` (`internal/join/app.go:241`) dedicates 0/0/0; - the spec gate (`specShortfalls`, `vmHostFloor`) has nothing to fail — any machine passes; - `Pair` refuses a VM-mode request only when `GuestSpec == nil` (`ledger.go:490`, `ErrNoGuestSpec`); a present-but-zero spec is accepted. `enroll_rent.go:198` mints rented devices as `server` too — a rented box takes full install, so it never dedicates a guest, which is why the zero floor never showed there. ## Fix (proposed ruling — two-way door under ADR 0174, agent rules; veto anytime) 1. **Fail loud on a zero floor.** `Pair` refuses a VM-mode `GuestSpec` with any zero dimension (extend `ErrNoGuestSpec`); `MintCode` refuses an intended role the ledger has no floor for, with the role named. The device end prints the refusal, never `CPUs [0]`. 2. **Give `server` and `storage` a floor.** Proposed default: `server` = the largest helper-role service floor that is not the gateway's (so a server guest can host any single non-gateway service — today 4 cores / 7.08 GiB for meetings, or 2 / 3.54 GiB if meetings is excluded as the outlier); `storage` = the backup-copy floor with the disk lifted to the community's archive share. Record the numbers in the catalogue beside `deviceDiskFloor` with the arithmetic in the comment, and pin them with the package test that already guards the helper invariant. 3. The panel's role selector reads which roles carry a floor from `GET /api/v1/enroll/config` rather than a hard-coded four, so a role with no floor cannot be offered. If 2 wants a human ruling, land 1 and 3 first — they close the hole on their own. ## Related DDR 0224 / ADR 0055 (the hint selects the floor and sizes the guest). Found in the same hand run as the cold-install VM-create defect. ## Siblings Found in the one hand run (bens-mac-04 → Whakatōhea Demo, 2026-09-30): #2002 #2003 #2004 #2006 #2007

swarm-claim host=elitebook-distributed-server-03 run=36142
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=36142 (automated multi-host claim — lowest live claim id works this ticket)

Ruled by agent under ADR 0174 — veto anytime.

The ticket flagged fix part 2 (the actual floor numbers for server/storage) as possibly wanting a human ruling. It is a two-way door: the numbers are catalogue config, reverted by a later commit and provable by a package test — not on the one-way-door list. Ruling it so I could land all three parts in one slice (part 1's MintCode refusal would otherwise break the rented-device path, which mints server).

The ruling (the numbers, with the arithmetic):

  • server = floor(4, 8, 20) — dominates every non-gateway service floor per dimension, so a server-hinted VM guest can host any single non-gateway service whole. Maxima over the v1 catalogue: threads 4 (Meetings), memory 8 GB (Meetings), disk 20 GB (Video's additive share). The gateway's own role keeps its RoleGateway floor.
  • storage = floor(1, 1, 20) — the backup-copy compute (1 thread / 1 GB — storage is I/O, not compute) with the disk lifted to the largest single-service data share (20 GB, Video), so a storage-hinted guest can hold any one service's data set.

Both sit at or above deviceDiskFloor (10 GB). I chose Meetings (the true max) over the "exclude Meetings" alternative the ticket offered, so the floor never under-promises what a server can host.

What proves it: catalogue_test.go pins both floors and the dominance invariant; enroll tests pin the two fail-loud guards (zero guest at Pair, floorless role at MintCode); compose/controlapi tests pin intended_roles on the config read. go test ./..., gofmt, vet, golangci-lint all green; dashboard 2145 tests + vue-tsc + eslint green.

Landed in 2d54833b. If the sizing is wrong for real donated hardware, retune the two floor(...) values in internal/catalogue/catalogue.go — the test names both numbers.

**Ruled by agent under ADR 0174 — veto anytime.** The ticket flagged fix part 2 (the actual floor numbers for `server`/`storage`) as possibly wanting a human ruling. It is a **two-way door**: the numbers are catalogue config, reverted by a later commit and provable by a package test — not on the one-way-door list. Ruling it so I could land all three parts in one slice (part 1's `MintCode` refusal would otherwise break the rented-device path, which mints `server`). **The ruling (the numbers, with the arithmetic):** - `server = floor(4, 8, 20)` — dominates every **non-gateway** service floor per dimension, so a server-hinted VM guest can host **any single** non-gateway service whole. Maxima over the v1 catalogue: threads 4 (Meetings), memory 8 GB (Meetings), disk 20 GB (Video's additive share). The gateway's own role keeps its `RoleGateway` floor. - `storage = floor(1, 1, 20)` — the backup-copy compute (1 thread / 1 GB — storage is I/O, not compute) with the disk lifted to the largest single-service data share (20 GB, Video), so a storage-hinted guest can hold any one service's data set. Both sit at or above `deviceDiskFloor` (10 GB). I chose Meetings (the true max) over the "exclude Meetings" alternative the ticket offered, so the floor never under-promises what a server can host. **What proves it:** `catalogue_test.go` pins both floors and the dominance invariant; `enroll` tests pin the two fail-loud guards (zero guest at `Pair`, floorless role at `MintCode`); `compose`/`controlapi` tests pin `intended_roles` on the config read. `go test ./...`, gofmt, vet, golangci-lint all green; dashboard 2145 tests + vue-tsc + eslint green. Landed in 2d54833b. If the sizing is wrong for real donated hardware, retune the two `floor(...)` values in `internal/catalogue/catalogue.go` — the test names both numbers.

close-report for #2005 — status success

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

envelope
{
  "issue": 2005,
  "status": "success",
  "commits": [
    "2d54833b16302adcd2649e178aed0f86d48afa4d"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/compose.go",
    "control-plane/cmd/control-plane/compose_enroll_rent_test.go",
    "dashboard/src/components/device-add/AddDeviceScreen.vue",
    "dashboard/src/components/device-add/DeviceAddSurface.vue",
    "dashboard/src/lib/api/enrollClient.ts",
    "dashboard/src/lib/deviceAdd.ts",
    "dashboard/tests/unit/deviceAdd.test.ts",
    "dashboard/tests/unit/enrollLive.test.ts",
    "internal/catalogue/catalogue.go",
    "internal/catalogue/catalogue_test.go",
    "internal/controlapi/enroll.go",
    "internal/controlapi/enroll_integration_test.go",
    "internal/enroll/enroll_test.go",
    "internal/enroll/errors.go",
    "internal/enroll/ledger.go",
    "internal/enrollwire/device_transport_integration_test.go",
    "internal/founding/connectcheck_test.go",
    "internal/join/land_test.go"
  ],
  "tests": [
    {
      "command": "go test ./...",
      "exit_code": 0
    },
    {
      "command": "gofmt -l (changed Go files)",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/catalogue/ ./internal/enroll/ ./internal/controlapi/ ./control-plane/cmd/control-plane/",
      "exit_code": 0
    },
    {
      "command": "golangci-lint run ./internal/catalogue/... ./internal/enroll/... ./internal/controlapi/...",
      "exit_code": 0
    },
    {
      "command": "npx vue-tsc -p tsconfig.json --noEmit (dashboard)",
      "exit_code": 0
    },
    {
      "command": "npx vitest run (dashboard, 2145 tests)",
      "exit_code": 0
    },
    {
      "command": "npx eslint (changed dashboard files)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "server/storage carry a non-zero spec floor (was the zero SpecFloor)": "internal/catalogue/catalogue.go — RoleServer/RoleStorage + serverFloor=floor(4,8,20)/storageFloor=floor(1,1,20); FloorFor/SpecFloors return them; pinned by TestFloorFor_ServerAndStorageHaveCapacityFloors in catalogue_test.go",
    "a VM guest is never sized 0/0/0": "server/storage floors are non-zero (guest sized by vmSpecFromFloor from the floor), AND Pair fails loud on any present-but-zero dimension — internal/enroll/ledger.go ErrZeroGuestSpec check, pinned by TestVMMode_RefusesZeroGuestDedication",
    "the spec gate is no longer vacuous for server/storage": "specShortfalls/vmHostFloor now run against a real floor; pinned indirectly by the non-zero floors and TestFloorFor_ServerAndStorageHaveCapacityFloors dominance invariant",
    "Pair refuses a present-but-zero guest_spec (was: only nil refused)": "internal/enroll/ledger.go — ErrZeroGuestSpec; TestVMMode_RefusesZeroGuestDedication (all-zero + each single-zero dimension)",
    "MintCode refuses an intended role with no floor, naming it": "internal/enroll/ledger.go + errors.go — RoleFloorError/ErrNoRoleFloor; TestMintCode_RefusesRoleWithNoFloor",
    "the panel offers only floor-carrying roles (reads config, not a hard-coded four)": "GET /api/v1/enroll/config carries intended_roles (internal/controlapi/enroll.go, compose.go sortedRoleNames); dashboard availableRoleOptions filters INTENDED_ROLE_OPTIONS (deviceAdd.ts), AddDeviceScreen reads availableRoles, DeviceAddSurface passes source.intendedRoles(); enrollClient exposes it. Pinned by deviceAdd.test.ts + enrollLive.test.ts + TestEnrollConfig_IntendedRolesAreTheFloorCarryingRoles + TestEnrollHandler_ConfigReadsInjectedConfig"
  },
  "summary": "server/storage intended roles now carry a real spec floor; Pair and MintCode fail loud on a zero guest / floorless role; the panel offers only floor-carrying roles from GET /enroll/config.",
  "blockers": [],
  "mirror_waiver": ""
}
**close-report** for #2005 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 2005, "status": "success", "commits": [ "2d54833b16302adcd2649e178aed0f86d48afa4d" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/compose.go", "control-plane/cmd/control-plane/compose_enroll_rent_test.go", "dashboard/src/components/device-add/AddDeviceScreen.vue", "dashboard/src/components/device-add/DeviceAddSurface.vue", "dashboard/src/lib/api/enrollClient.ts", "dashboard/src/lib/deviceAdd.ts", "dashboard/tests/unit/deviceAdd.test.ts", "dashboard/tests/unit/enrollLive.test.ts", "internal/catalogue/catalogue.go", "internal/catalogue/catalogue_test.go", "internal/controlapi/enroll.go", "internal/controlapi/enroll_integration_test.go", "internal/enroll/enroll_test.go", "internal/enroll/errors.go", "internal/enroll/ledger.go", "internal/enrollwire/device_transport_integration_test.go", "internal/founding/connectcheck_test.go", "internal/join/land_test.go" ], "tests": [ { "command": "go test ./...", "exit_code": 0 }, { "command": "gofmt -l (changed Go files)", "exit_code": 0 }, { "command": "go vet ./internal/catalogue/ ./internal/enroll/ ./internal/controlapi/ ./control-plane/cmd/control-plane/", "exit_code": 0 }, { "command": "golangci-lint run ./internal/catalogue/... ./internal/enroll/... ./internal/controlapi/...", "exit_code": 0 }, { "command": "npx vue-tsc -p tsconfig.json --noEmit (dashboard)", "exit_code": 0 }, { "command": "npx vitest run (dashboard, 2145 tests)", "exit_code": 0 }, { "command": "npx eslint (changed dashboard files)", "exit_code": 0 } ], "criteria": { "server/storage carry a non-zero spec floor (was the zero SpecFloor)": "internal/catalogue/catalogue.go — RoleServer/RoleStorage + serverFloor=floor(4,8,20)/storageFloor=floor(1,1,20); FloorFor/SpecFloors return them; pinned by TestFloorFor_ServerAndStorageHaveCapacityFloors in catalogue_test.go", "a VM guest is never sized 0/0/0": "server/storage floors are non-zero (guest sized by vmSpecFromFloor from the floor), AND Pair fails loud on any present-but-zero dimension — internal/enroll/ledger.go ErrZeroGuestSpec check, pinned by TestVMMode_RefusesZeroGuestDedication", "the spec gate is no longer vacuous for server/storage": "specShortfalls/vmHostFloor now run against a real floor; pinned indirectly by the non-zero floors and TestFloorFor_ServerAndStorageHaveCapacityFloors dominance invariant", "Pair refuses a present-but-zero guest_spec (was: only nil refused)": "internal/enroll/ledger.go — ErrZeroGuestSpec; TestVMMode_RefusesZeroGuestDedication (all-zero + each single-zero dimension)", "MintCode refuses an intended role with no floor, naming it": "internal/enroll/ledger.go + errors.go — RoleFloorError/ErrNoRoleFloor; TestMintCode_RefusesRoleWithNoFloor", "the panel offers only floor-carrying roles (reads config, not a hard-coded four)": "GET /api/v1/enroll/config carries intended_roles (internal/controlapi/enroll.go, compose.go sortedRoleNames); dashboard availableRoleOptions filters INTENDED_ROLE_OPTIONS (deviceAdd.ts), AddDeviceScreen reads availableRoles, DeviceAddSurface passes source.intendedRoles(); enrollClient exposes it. Pinned by deviceAdd.test.ts + enrollLive.test.ts + TestEnrollConfig_IntendedRolesAreTheFloorCarryingRoles + TestEnrollHandler_ConfigReadsInjectedConfig" }, "summary": "server/storage intended roles now carry a real spec floor; Pair and MintCode fail loud on a zero guest / floorless role; the panel offers only floor-carrying roles from GET /enroll/config.", "blockers": [], "mirror_waiver": "" } ``` </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#2005
No description provided.