Skip to content

fix(installer): memory truth — machine RAM vs Docker's budget, advice clamped to the machine (Windows half of #417) - #444

Open
LukasWodka wants to merge 2 commits into
developfrom
fix/417-memory-truth-ps
Open

fix(installer): memory truth — machine RAM vs Docker's budget, advice clamped to the machine (Windows half of #417)#444
LukasWodka wants to merge 2 commits into
developfrom
fix/417-memory-truth-ps

Conversation

@LukasWodka

@LukasWodka LukasWodka commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Windows half of #417. Three memory-reporting bugs seen live across all three test environments (7 GB / 6 GB / 15 GB readings, and a 15 GB laptop told to "give Docker ≥ 16 GB"):

  1. Flip-flop: the "Memory:" line preferred docker info MemTotal (the WSL2 VM's 50%-of-RAM default) over physical RAM — same machine, different numbers across re-runs depending on whether Docker happened to be up.
  2. Impossible advice: recommendations used the raw 16 GB constant regardless of what the machine has.
  3. Diverging copy: Step 1 and the Step-2 post-Docker re-check printed different warnings for the same condition, and could both fire in one run.

Change

  • Get-PfHostMemGb (CIM only) replaces the runtime-preferring Get-PfMemGb. Step 1 prints two labeled truths: Memory: 15 GB (machine) always, and Docker's memory budget: 7 GB … when a runtime is up.
  • Get-PfMemTargets clamps Docker-budget advice to host − 2 GB (floor 4) → the 15 GB laptop now gets [wsl2] memory=13GB. Hardware statements ("16 GB of RAM recommended to train") stay unclamped — they describe the machine, not a setting.
  • Write-PfRuntimeMemStatus is the single shared copy for the budget line (Step 1 + Step 2), with a latch so one run warns once.
  • Tests: clamp matrix (15/8/32/unknown GB hosts), two-line integration assertion, Step-2 dedupe latch, existing preflight tests rewired to the new readers; the old "prefers docker MemTotal" test is deleted — that preference was the bug.
  • manifest.sha256 regenerated.

Out of scope, noted: Get-PfCpu still prefers the runtime view (same class, milder — cores don't halve); macOS floor enforcement + VM sizing is #428; the bash half of this ticket follows separately (same labels + clamp in preflight.sh).

Stacked on #440#439#438#437 — merge in that order; this branch contains all of them.

Type

Bug fix

Test plan

Full Pester suite locally on pwsh 7.5 (CI invocation): 181 passed, 0 failed, 8 skipped (9 new). gen-manifest.sh --check clean.

🤖 Generated with Claude Code


Note

Low Risk
Installer preflight messaging and warn-only memory checks only; no cluster, auth, or data-path changes.

Overview
Fixes Windows installer memory reporting (#417) so preflight no longer mixes up physical RAM with Docker/WSL2's VM budget.

Get-PfHostMemGb (CIM-only) replaces the old runtime-preferring reader. Step 1 always prints Memory: N GB (machine); when Docker is already running it adds a second line for Docker's memory budget via Write-PfRuntimeMemStatus.

Get-PfMemTargets clamps Docker-setting hints to host − 2 GB (floor 4), so a 15 GB laptop gets memory=13GB in .wslconfig instead of impossible "give Docker ≥ 16 GB". Training RAM recommendations for the machine itself stay at the full defaults.

Test-PreflightRuntimeMem reuses the same budget copy and $script:RuntimeMemWarned so Step 1 and the post-Docker re-check don't double-warn in one run.

Pester coverage adds clamp matrices, two-line preflight assertions, and latch behavior; scripts/manifest.sha256 is updated for install-k8s.ps1.

Reviewed by Cursor Bugbot for commit 3143e1c. Bugbot is set up for automated code reviews on this repo. Configure here.

@LukasWodka
LukasWodka requested a review from saadqbal as a code owner July 27, 2026 14:36
@LukasWodka LukasWodka self-assigned this Jul 27, 2026
@LukasWodka

Copy link
Copy Markdown
Contributor Author

bugbot run

Comment thread scripts/install-k8s.ps1
Base automatically changed from fix/413-docker-wait to fix/412-create-deadline July 27, 2026 15:06
@LukasWodka

Copy link
Copy Markdown
Contributor Author

Converted to draft to disable the merge button while the base is a feature branch (the #438-#440 mis-merge trap). Plan: once #447 (re-land of #412/#413) merges to develop, rebase this onto develop, retarget, regen manifest.sha256, re-run Pester, flip ready.

… lines; advice clamped to the machine (#417, Windows half)

The single 'Memory:' line preferred docker info MemTotal over physical
RAM, so the same laptop reported 7 GB (Docker up: the WSL2 VM's
50%-of-RAM default) or 15 GB (Docker down) across re-runs — and its
remediation told a 15 GB machine to 'give Docker >= 16 GB', which it
cannot.

- Get-PfHostMemGb (CIM only) replaces the runtime-preferring
  Get-PfMemGb; Step 1 now always prints the machine's RAM, labeled
  '(machine)', and — when a runtime is already up — a second line for
  Docker's actual budget.
- Get-PfMemTargets clamps every Docker-budget recommendation to
  host - 2 GB (floor 4): a 15 GB laptop is now told memory=13GB.
  Hardware statements ('16 GB of RAM recommended to train') stay
  unclamped — they describe the machine, not a setting.
- Write-PfRuntimeMemStatus is the ONE copy for the budget line, shared
  by Step 1 and the Step-2 post-Docker re-check (their warnings used to
  diverge), and a latch stops the same warning printing twice per run.

Windows half of #417; the bash half (preflight.sh, same labels + clamp)
follows separately.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@LukasWodka
LukasWodka force-pushed the fix/417-memory-truth-ps branch from 5dc09fa to 3143e1c Compare July 27, 2026 15:34
@LukasWodka
LukasWodka changed the base branch from fix/412-create-deadline to develop July 27, 2026 15:34
@LukasWodka

Copy link
Copy Markdown
Contributor Author

Rebased onto develop as a single clean commit (the tangled pre-squash history and the duplicate #440 copy-fix are gone — develop already carries that content byte-identically via #447). Manifest regenerated; full Pester green locally. bugbot run

@LukasWodka

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3143e1c. Configure here.

Comment thread scripts/install-k8s.ps1
…gbot #444)

Get-PfMemTargets used Max(4, host-2): on <=6 GB hosts it paired 'below
the 5 GB the client needs' with 'give Docker 4 GB' (advice that can
never clear the warning), and on <=4 GB hosts the floor exceeded the
machine. The floor is now PF_MIN_MEM_GB (5, env-overridable) — the
exact twin of the bash fix on #445.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
Contributor Author

bugbot run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant