device-add: a Helper guest's 950 MB dedication prints as 'Memory [0 GB]' — gib() truncates by >>30, so a correct sub-GiB floor looks like the #2005 zero bug #2014

Closed
opened 2026-09-30 03:35:25 +00:00 by ben · 2 comments
Owner

Symptom

The VM-mode consent on the device end prints the Helper dedication as

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

while the guest is started with -m 905 (905 MiB) and the paired view carries mem_bytes: 950000000. "0 GB" reads as the #2005 zero-spec bug to anyone who saw it once (bens-mac-04, 2026-09-30, release 3061).

Cause

internal/join/app.go:292 — gib(b) = fmt.Sprintf("%d GB", b>>30): an integer shift by 30 truncates 950,000,000 to 0. The helper floor is 0.88 GiB by design (BytesPerMarketingGB = 950_000_000, #1776), so any role floor under 1 GiB prints as zero. The same formatter prints the probe line's memory.

Fix

  • Print in the unit the floor is written in: marketing GB with one decimal below 10 (0.9 GB, 3.5 GB), or MB below 1 GB (950 MB). One formatter shared by the consent line, the probe line and the offerFor consent copy (which carries the same %s memory).
  • A table test over 950 MB, 1 GiB, 3.54 GiB, 8 GB.

#2005 (zero-spec guest, fixed) — this is the display half that makes a correct floor look like that bug.

## Symptom The VM-mode consent on the device end prints the Helper dedication as ``` Dedicate to the community: CPUs [1] Memory [0 GB] Disk [10 GB] ``` while the guest is started with `-m 905` (905 MiB) and the paired view carries `mem_bytes: 950000000`. "0 GB" reads as the #2005 zero-spec bug to anyone who saw it once (bens-mac-04, 2026-09-30, release 3061). ## Cause `internal/join/app.go:292` — `gib(b) = fmt.Sprintf("%d GB", b>>30)`: an integer shift by 30 truncates 950,000,000 to 0. The helper floor is 0.88 GiB by design (`BytesPerMarketingGB = 950_000_000`, #1776), so any role floor under 1 GiB prints as zero. The same formatter prints the probe line's memory. ## Fix - Print in the unit the floor is written in: marketing GB with one decimal below 10 (`0.9 GB`, `3.5 GB`), or MB below 1 GB (`950 MB`). One formatter shared by the consent line, the probe line and the `offerFor` consent copy (which carries the same `%s memory`). - A table test over 950 MB, 1 GiB, 3.54 GiB, 8 GB. ## Related #2005 (zero-spec guest, fixed) — this is the display half that makes a correct floor look like that bug.

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

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

close-report for #2014 — status success

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

envelope
{
  "issue": 2014,
  "status": "success",
  "commits": [
    "8446bb7903409ae43ee73436659b6a01d3b60163"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/join/app.go",
    "internal/join/app_test.go",
    "internal/join/cli.go",
    "internal/join/cli_test.go",
    "internal/join/memsize_test.go"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci --command go test ./internal/join/",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command go vet ./internal/join/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Print in the unit the floor is written in: marketing GB with one decimal below 10, or MB below 1 GB": "internal/join/app.go memSize(): b<1e9 -> '%d MB'; b/1e9<10 -> '%.1f GB'; else whole enroll.MarketingGB. Table test asserts 950_000_000->'950 MB', 1<<30->'1.1 GB', 3_801_046_057->'3.8 GB', 8e9->'8.0 GB', 16<<30->'17 GB' (TestMemSize).",
    "One formatter shared by the consent line, the probe line and the offerFor consent copy (same %s memory)": "memSize used at internal/join/app.go offerFor consent copy, internal/join/cli.go consent line (CPUs/Memory/Disk) and probe line; disk still uses gib (exact-GiB floors).",
    "A table test over 950 MB, 1 GiB, 3.54 GiB, 8 GB": "internal/join/memsize_test.go TestMemSize covers all four plus 16 GiB for the >=10 whole-GB branch."
  },
  "summary": "A sub-GiB Helper memory dedication prints its real marketing size (950 MB / 3.8 GB) instead of the '0 GB' that gib's >>30 truncation produced.",
  "blockers": []
}
**close-report** for #2014 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 2014, "status": "success", "commits": [ "8446bb7903409ae43ee73436659b6a01d3b60163" ], "changed_files": [ "STATUS.md", "internal/join/app.go", "internal/join/app_test.go", "internal/join/cli.go", "internal/join/cli_test.go", "internal/join/memsize_test.go" ], "tests": [ { "command": "nix develop .#go-ci --command go test ./internal/join/", "exit_code": 0 }, { "command": "nix develop .#go-ci --command go vet ./internal/join/", "exit_code": 0 } ], "criteria": { "Print in the unit the floor is written in: marketing GB with one decimal below 10, or MB below 1 GB": "internal/join/app.go memSize(): b<1e9 -> '%d MB'; b/1e9<10 -> '%.1f GB'; else whole enroll.MarketingGB. Table test asserts 950_000_000->'950 MB', 1<<30->'1.1 GB', 3_801_046_057->'3.8 GB', 8e9->'8.0 GB', 16<<30->'17 GB' (TestMemSize).", "One formatter shared by the consent line, the probe line and the offerFor consent copy (same %s memory)": "memSize used at internal/join/app.go offerFor consent copy, internal/join/cli.go consent line (CPUs/Memory/Disk) and probe line; disk still uses gib (exact-GiB floors).", "A table test over 950 MB, 1 GiB, 3.54 GiB, 8 GB": "internal/join/memsize_test.go TestMemSize covers all four plus 16 GiB for the >=10 whole-GB branch." }, "summary": "A sub-GiB Helper memory dedication prints its real marketing size (950 MB / 3.8 GB) instead of the '0 GB' that gib's >>30 truncation produced.", "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#2014
No description provided.