fleetstate: a VM-mode device's Resources are the HOST's probe — the spec gate measures service floors against a machine the services never land on #1216

Closed
opened 2026-09-04 15:24:21 +00:00 by ben · 3 comments
Owner

Split out of #1215 (drive 20260904T105814Z evidence; did not cause that red — filed on its own so the fix is designed, not patched).

internal/fleetstate/projection.go:278-283 records a VM-mode device's Resources from the host probe (4 threads / 7 GB / 153 GB on the drive's droplet) with only the Allocated boolean flipped — but the guest actually holds the dedication (1 thread / 1 GB / 10 GB, vmSpecFromFloor). deviceReason (internal/provision/assess.go:424-435) then measures service floors against the HOST's numbers, so the spec gate is vacuous for every VM-mode device: it passed files (floor 2/4/60) onto a 1 GB / 10 GB guest.

The probe must stay the host's for vmHostFloor's admission arithmetic (ADR 0030, internal/enroll/ledger.go:1038-1051) — the defect is that the projection re-reads the same field with a second meaning ("capacity of the node the services land on").

Why this can't be patched gateway-side alone: the dedication is chosen (and user-adjustable) at join on the DEVICE (join-transcript.txt shows the editable CPUs [1] Memory [1 GB] Disk [10 GB] frames), and it never crosses the wire. The honest fix adds the dedicated spec to what the device reports (pairing fact or landing), stores it in the ledger, and has the projection use it when mode == VM — with the fake carrying the same refusal shape (GOTCHAS #158).

Suggested layer: internal/enroll (wire + ledger) → internal/fleetstate (projection reads the dedication) → internal/provision/assess.go untouched (it already reads Resources).

Split out of #1215 (drive `20260904T105814Z` evidence; did not cause that red — filed on its own so the fix is designed, not patched). `internal/fleetstate/projection.go:278-283` records a VM-mode device's `Resources` from the **host** probe (4 threads / 7 GB / 153 GB on the drive's droplet) with only the `Allocated` boolean flipped — but the guest actually holds the dedication (1 thread / 1 GB / 10 GB, `vmSpecFromFloor`). `deviceReason` (`internal/provision/assess.go:424-435`) then measures service floors against the HOST's numbers, so the spec gate is vacuous for every VM-mode device: it passed `files` (floor 2/4/60) onto a 1 GB / 10 GB guest. The probe **must** stay the host's for `vmHostFloor`'s admission arithmetic (ADR 0030, `internal/enroll/ledger.go:1038-1051`) — the defect is that the projection re-reads the same field with a second meaning ("capacity of the node the services land on"). Why this can't be patched gateway-side alone: the dedication is chosen (and user-adjustable) at join on the DEVICE (`join-transcript.txt` shows the editable `CPUs [1] Memory [1 GB] Disk [10 GB]` frames), and it never crosses the wire. The honest fix adds the dedicated spec to what the device reports (pairing fact or landing), stores it in the ledger, and has the projection use it when `mode == VM` — with the fake carrying the same refusal shape (GOTCHAS #158). Suggested layer: `internal/enroll` (wire + ledger) → `internal/fleetstate` (projection reads the dedication) → `internal/provision/assess.go` untouched (it already reads `Resources`).

This was generated by AI during triage.

Triage: bug + ready-for-agent

Verified against the code. The claim holds:

  • internal/fleetstate/projection.go:278-283 sets a device's Resources
    straight from f.probe.{CPUCores,MemBytes,DiskBytes} — the host probe —
    flipping only Allocated when f.mode == enroll.ModeVM.
  • internal/provision/assess.go:424-441 (deviceReason) reads d.Resources.*
    against the service Floor, so for a VM-mode device the spec gate measures
    the role floors against the host's capacity, never the guest's dedication.
    The gate is vacuous for every VM-mode device (a 1 GB / 10 GB guest passes the
    files floor of 2/4/60).
  • internal/enroll/enroll.go:130-146 (ProbeReport) confirms Ben's why-it-
    can't-be-patched-gateway-side note: the wire carries only host capacity.
    The chosen dedication (editable CPUs/Memory/Disk at join on the device) has
    no field on ProbeReport and is not stored on the ledger fact, so the
    projection currently has nothing else to read.
  • The host probe must stay the probe for vmHostFloor's admission arithmetic
    (internal/enroll/ledger.go:1031-1050, ADR 0030) — the defect is the second,
    conflated meaning the projection assigns the same field.

Agent brief

Goal. Make the fleetstate projection report a VM-mode device's dedicated
guest
spec (not the host probe) so deviceReason's spec gate measures service
floors against the machine the services actually land on.

Layers (Ben's suggested path, confirmed sound):

  1. internal/enroll — carry the chosen guest dedication (threads / mem / disk)
    from the device into the ledger fact. It is chosen and user-adjustable at
    join on the device and never crosses the wire today, so a new reported field
    is required. Implementation choice — pairing fact vs a landing fact — is
    the implementing agent's to make (two-way door, provable by the tests below);
    pick the one that keeps vmHostFloor's admission arithmetic reading the host
    probe unchanged.
  2. internal/fleetstate/projection.go:278-283 — when f.mode == ModeVM, read
    Resources from the stored dedication instead of the host probe; keep
    Allocated: true. Full-install (ModeFull) devices keep reading the host
    probe.
  3. internal/provision/assess.go — untouched; it already reads Resources.

Fake parity (GOTCHAS #158). The enroll seam fake must carry the same
refusal shape as the real adapter for the new dedication field — a fake that
answers a dedication where the real path would not is exactly the green-but-
unwired trap #158 documents. Add/extend the seam test so a VM-mode fact without
a dedication refuses rather than silently substituting the host probe.

Acceptance criteria:

  • A VM-mode device with a 1 GB / 10 GB dedication on a large host is gated out
    of a service whose floor exceeds 1 GB / 10 GB (regression proving the gate is
    no longer vacuous) — e.g. files (2/4/60) refuses.
  • A full-install device's Resources are unchanged (still the host probe).
  • vmHostFloor admission arithmetic still reads the host probe (ADR 0030 case
    from internal/enroll/enroll_test.go stays green).
  • The enroll seam fake refuses the missing-dedication case rather than answering
    with the host probe (GOTCHAS #158).

Context: split out of #1215; drive 20260904T105814Z evidence (did not
cause that red). ADR 0030 (VM-host arithmetic), GOTCHAS #158 (fake refusal
shape).

Ruled ready-for-agent under ADR 0174 — veto anytime. Two-way door: the fix is
a revertible code change, provable by the acceptance-criteria tests above, with
no one-way-door residue (no credentials, no security-posture widening — it
tightens an over-permissive gate — no member-facing trust accept, no data
destruction, no spend, no hardware). The one open choice (pairing fact vs
landing) is an implementation detail the implementing agent decides.

> *This was generated by AI during triage.* ## Triage: bug + ready-for-agent Verified against the code. The claim holds: - `internal/fleetstate/projection.go:278-283` sets a device's `Resources` straight from `f.probe.{CPUCores,MemBytes,DiskBytes}` — the **host** probe — flipping only `Allocated` when `f.mode == enroll.ModeVM`. - `internal/provision/assess.go:424-441` (`deviceReason`) reads `d.Resources.*` against the service `Floor`, so for a VM-mode device the spec gate measures the role floors against the **host's** capacity, never the guest's dedication. The gate is vacuous for every VM-mode device (a 1 GB / 10 GB guest passes the `files` floor of 2/4/60). - `internal/enroll/enroll.go:130-146` (`ProbeReport`) confirms Ben's why-it- can't-be-patched-gateway-side note: the wire carries **only** host capacity. The chosen dedication (editable `CPUs/Memory/Disk` at join on the device) has no field on `ProbeReport` and is not stored on the ledger fact, so the projection currently has nothing else to read. - The host probe must stay the probe for `vmHostFloor`'s admission arithmetic (`internal/enroll/ledger.go:1031-1050`, ADR 0030) — the defect is the second, conflated meaning the projection assigns the same field. ## Agent brief **Goal.** Make the fleetstate projection report a VM-mode device's *dedicated guest* spec (not the host probe) so `deviceReason`'s spec gate measures service floors against the machine the services actually land on. **Layers (Ben's suggested path, confirmed sound):** 1. `internal/enroll` — carry the chosen guest dedication (threads / mem / disk) from the device into the ledger fact. It is chosen and user-adjustable at join on the device and never crosses the wire today, so a new reported field is required. Implementation choice — **pairing fact vs a landing fact** — is the implementing agent's to make (two-way door, provable by the tests below); pick the one that keeps `vmHostFloor`'s admission arithmetic reading the host probe unchanged. 2. `internal/fleetstate/projection.go:278-283` — when `f.mode == ModeVM`, read `Resources` from the stored dedication instead of the host probe; keep `Allocated: true`. Full-install (`ModeFull`) devices keep reading the host probe. 3. `internal/provision/assess.go` — untouched; it already reads `Resources`. **Fake parity (GOTCHAS #158).** The enroll seam fake must carry the same refusal shape as the real adapter for the new dedication field — a fake that *answers* a dedication where the real path would not is exactly the green-but- unwired trap #158 documents. Add/extend the seam test so a VM-mode fact without a dedication refuses rather than silently substituting the host probe. **Acceptance criteria:** - A VM-mode device with a 1 GB / 10 GB dedication on a large host is *gated* out of a service whose floor exceeds 1 GB / 10 GB (regression proving the gate is no longer vacuous) — e.g. `files` (2/4/60) refuses. - A full-install device's `Resources` are unchanged (still the host probe). - `vmHostFloor` admission arithmetic still reads the host probe (ADR 0030 case from `internal/enroll/enroll_test.go` stays green). - The enroll seam fake refuses the missing-dedication case rather than answering with the host probe (GOTCHAS #158). **Context:** split out of #1215; drive `20260904T105814Z` evidence (did not cause that red). ADR 0030 (VM-host arithmetic), GOTCHAS #158 (fake refusal shape). _Ruled ready-for-agent under ADR 0174 — veto anytime. Two-way door: the fix is a revertible code change, provable by the acceptance-criteria tests above, with no one-way-door residue (no credentials, no security-posture widening — it *tightens* an over-permissive gate — no member-facing trust accept, no data destruction, no spend, no hardware). The one open choice (pairing fact vs landing) is an implementation detail the implementing agent decides._

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

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

close-report for #1216 — status success

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

envelope
{
  "issue": 1216,
  "status": "success",
  "commits": [
    "7d4fd21d5e6ecb5342b2dc5dda85be5722594e2a"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/compose_enroll_test.go",
    "internal/enroll/enroll.go",
    "internal/enroll/enroll_test.go",
    "internal/enroll/errors.go",
    "internal/enroll/ledger.go",
    "internal/fleetstate/projection.go",
    "internal/fleetstate/projection_test.go",
    "internal/founding/deploy_test.go",
    "internal/founding/manualpath_test.go",
    "internal/founding/privatepath.go",
    "internal/founding/seed_test.go",
    "internal/join/app.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci --command go test ./...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command go vet ./internal/enroll/... ./internal/fleetstate/... ./internal/join/... ./internal/founding/... ./control-plane/...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command gofmt -l internal/enroll internal/fleetstate internal/join internal/founding control-plane/cmd/control-plane",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A VM-mode device with a 1 GB / 10 GB dedication on a large host is gated out of a service whose floor exceeds 1 GB / 10 GB (files 2/4/60)": "internal/fleetstate/projection_test.go TestProjection_VMDeviceResourcesAreTheGuestDedicationNotTheHost: a 4/7GB/153GB host dedicating 1/1GB/10GB projects Resources=1/1GB/10GB, asserted under the files floor (2/4/60) so deviceReason (assess.go:428-435, already reads Resources) refuses",
    "A full-install device's Resources are unchanged (still the host probe)": "internal/fleetstate/projection.go device() reads the host probe for non-VM modes; TestProjection_DerivesFromInventoryAndLedger still asserts da.Resources = 8 threads/32GB (host probe), not Allocated",
    "vmHostFloor admission arithmetic still reads the host probe (ADR 0030 case stays green)": "internal/enroll/ledger.go Pair: the spec gate (need=vmHostFloor over r.Probe) runs BEFORE the new GuestSpec check; internal/enroll/enroll_test.go TestVMMode_RequiresGuestDedication asserts the host probe rides the paired view; control-plane compose_enroll spec-gate discrimination test green",
    "The enroll seam fake refuses the missing-dedication case rather than answering with the host probe (GOTCHAS #158)": "internal/fleetstate/projection_test.go TestProjection_VMFactWithoutDedicationRefusesRatherThanSubstitutingTheHostProbe: a fake ledger returns a VM Enrolled view with a generous host probe and nil GuestSpec; the projection marks it Degraded with zero Resources; internal/enroll/ledger.go returns ErrNoGuestSpec so the real adapter refuses this shape"
  },
  "summary": "A VM-mode device's fleet Resources are now the dedicated guest carried on the wire (enroll.GuestSpec), not the host probe, so the spec gate is no longer vacuous.",
  "blockers": []
}
**close-report** for #1216 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1216, "status": "success", "commits": [ "7d4fd21d5e6ecb5342b2dc5dda85be5722594e2a" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/compose_enroll_test.go", "internal/enroll/enroll.go", "internal/enroll/enroll_test.go", "internal/enroll/errors.go", "internal/enroll/ledger.go", "internal/fleetstate/projection.go", "internal/fleetstate/projection_test.go", "internal/founding/deploy_test.go", "internal/founding/manualpath_test.go", "internal/founding/privatepath.go", "internal/founding/seed_test.go", "internal/join/app.go" ], "tests": [ { "command": "nix develop .#go-ci --command go test ./...", "exit_code": 0 }, { "command": "nix develop .#go-ci --command go vet ./internal/enroll/... ./internal/fleetstate/... ./internal/join/... ./internal/founding/... ./control-plane/...", "exit_code": 0 }, { "command": "nix develop .#go-ci --command gofmt -l internal/enroll internal/fleetstate internal/join internal/founding control-plane/cmd/control-plane", "exit_code": 0 } ], "criteria": { "A VM-mode device with a 1 GB / 10 GB dedication on a large host is gated out of a service whose floor exceeds 1 GB / 10 GB (files 2/4/60)": "internal/fleetstate/projection_test.go TestProjection_VMDeviceResourcesAreTheGuestDedicationNotTheHost: a 4/7GB/153GB host dedicating 1/1GB/10GB projects Resources=1/1GB/10GB, asserted under the files floor (2/4/60) so deviceReason (assess.go:428-435, already reads Resources) refuses", "A full-install device's Resources are unchanged (still the host probe)": "internal/fleetstate/projection.go device() reads the host probe for non-VM modes; TestProjection_DerivesFromInventoryAndLedger still asserts da.Resources = 8 threads/32GB (host probe), not Allocated", "vmHostFloor admission arithmetic still reads the host probe (ADR 0030 case stays green)": "internal/enroll/ledger.go Pair: the spec gate (need=vmHostFloor over r.Probe) runs BEFORE the new GuestSpec check; internal/enroll/enroll_test.go TestVMMode_RequiresGuestDedication asserts the host probe rides the paired view; control-plane compose_enroll spec-gate discrimination test green", "The enroll seam fake refuses the missing-dedication case rather than answering with the host probe (GOTCHAS #158)": "internal/fleetstate/projection_test.go TestProjection_VMFactWithoutDedicationRefusesRatherThanSubstitutingTheHostProbe: a fake ledger returns a VM Enrolled view with a generous host probe and nil GuestSpec; the projection marks it Degraded with zero Resources; internal/enroll/ledger.go returns ErrNoGuestSpec so the real adapter refuses this shape" }, "summary": "A VM-mode device's fleet Resources are now the dedicated guest carried on the wire (enroll.GuestSpec), not the host probe, so the spec gate is no longer vacuous.", "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#1216
No description provided.