Skip to content

feat(installer): provision Docker for the daily user during the elevated window (#418) - #493

Merged
shujaatTracebloc merged 5 commits into
developfrom
fix/418-provision-daily-user
Jul 30, 2026
Merged

feat(installer): provision Docker for the daily user during the elevated window (#418)#493
shujaatTracebloc merged 5 commits into
developfrom
fix/418-provision-daily-user

Conversation

@shujaatTracebloc

@shujaatTraceblocshujaatTracebloc commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What & why

Hospital/enterprise reality: the researcher gets a temporary admin window (or IT runs the install), then elevation is revoked. Today Docker Desktop only auto-adds the installing user to docker-users, autostart + the WSL memory budget are printed Hints — so the researcher's standard account can end up with a broken Docker, a cluster that doesn't recover after reboot, and a 50%-of-RAM VM that OOMs training. The installer runs elevated, so it should just do it.

Changes (scripts/install-k8s.ps1)

New Set-DailyUserProvisioning (warn-only; TRACEBLOC_SKIP_DAILY_USER opts out), run during the elevated session:

  • Resolves the daily user-DailyUser param, else a prompt when an admin installs for someone else, else the current account (Resolve-DailyUser strips the domain).
  • net localgroup docker-users <user> /add so the standard account can use Docker.
  • Docker Desktop autostart via the per-user Run key. (The engine also runs as a service from --always-run-service (feat(installer): control Docker Desktop install flags (--accept-license --backend=wsl-2) #419), so Docker is usable on sign-in regardless, and cluster nodes already carry restart=unless-stopped — so the cluster recovers.)
  • Training-sized %UserProfile%\.wslconfigGet-WslConfigMemoryGb = physical RAM − 4 GB (floored) — written for the daily user, preserving an existing tuned file. It applies at the daily user's next sign-in (the acceptance scenario), so we deliberately do notwsl --shutdown and tear down the just-built cluster mid-install.
  • Prints a "Configured for <user>: …" summary so IT can review what changed.

Acceptance (from #418)

  • Accept/prompt the daily username; docker-users add
  • Enable Docker Desktop autostart for that user
  • Write sized .wslconfig (capped at physical − 4 GB)
  • "configured for <user>" summary
  • Standard user next day: Docker starts (service + docker-users), cluster auto-recovers (restart=unless-stopped), budget training-capable — zero admin actions

Scope notes

Tests

Pure helpers (Get-WslConfigMemoryGb cap/floor, Get-WslConfigContent, Resolve-DailyUser) + source guards (docker-users add, .wslconfig preserve-existing, opt-out + wiring).

Local verification

Pester 309/0/9 · check-style pass · drift clean · manifest regenerated · PS parse OK. (No bash changes — bats unaffected.)

Closes#418


Note

Medium Risk
Changes local group membership and per-user registry/files on the host during install; failures are warn-only but mis-provisioned docker-users would block non-admin Docker use.

Overview
Adds daily-user provisioning to the Windows installer so IT can configure the researcher's standard account while elevation is still available, instead of leaving Docker usable only for whoever ran the install.

After a successful client install, Set-DailyUserProvisioning (warn-only; TRACEBLOC_SKIP_DAILY_USER to skip) resolves the target user via -DailyUser, an optional prompt, or the current account, then adds them to docker-users (verified with Test-LocalGroupMember, not localized net output), sets Docker Desktop autostart for the installing user when applicable, and merges a training-sized [wsl2] memory= into the user's .wslconfig (host RAM − 4 GB, preserving existing tuning). -DailyUser is forwarded through UAC self-elevation so it survives relaunch.

Pester coverage covers the pure helpers and source guards; scripts/manifest.sha256 is updated for install-k8s.ps1.

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

…indow
Hospital/enterprise reality: the researcher gets a temporary admin window (or IT
installs), then elevation is revoked -- leaving the standard account unable to use
Docker, a cluster that may not recover, and a 50%-of-RAM VM that OOMs training.
The installer runs elevated, so provision the day-to-day account now.
New Set-DailyUserProvisioning (warn-only; TRACEBLOC_SKIP_DAILY_USER opts out):
- Resolves the daily user (-DailyUser param, else prompt when an admin installs for
someone else, else the current account); Resolve-DailyUser strips the domain.
- net localgroup docker-users <user> /add so the standard account can use Docker.
- Docker Desktop autostart via the per-user Run key (current user). The engine also
runs as a service (--always-run-service, #419), so Docker is usable on sign-in
regardless; cluster nodes already carry restart=unless-stopped (Set-ClusterAutostart).
- Writes a training-sized %UserProfile%\.wslconfig (Get-WslConfigMemoryGb: physical
RAM - 4 GB, floored) for the daily user, preserving an existing tuned file. It
applies at the daily user's next sign-in -- the acceptance scenario -- so we do
NOT wsl --shutdown and tear down the just-built cluster mid-install.
- Prints a "Configured for <user>: ..." summary so IT can review what changed.
Tests: Get-WslConfigMemoryGb (cap/floor), Get-WslConfigContent, Resolve-DailyUser,
plus source guards for docker-users / .wslconfig-preserve / opt-out + wiring.
Closes#418
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shujaatTraceblocshujaatTracebloc self-assigned this Jul 30, 2026
@LukasWodka

Copy link
Copy Markdown
Contributor

👋 Heads-up — Code review queue is at 36 / 30

Above the WIP limit. The team convention is to review existing PRs before opening new work.

Open PRs currently in Code review (oldest first):

Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.)

@shujaatTracebloc
shujaatTracebloc marked this pull request as ready for review July 30, 2026 11:57
@LukasWodka

Copy link
Copy Markdown
Contributor

👋 Heads-up — Code review queue is at 37 / 30

Above the WIP limit. The team convention is to review existing PRs before opening new work.

Open PRs currently in Code review (oldest first):

Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.)

Comment threadscripts/install-k8s.ps1
Comment threadscripts/install-k8s.ps1
Comment threadscripts/install-k8s.ps1
Comment threadscripts/install-k8s.ps1
- .wslconfig merge: Add-WslMemorySetting keeps an existing memory= AND preserves
any other tuning (processors/swap/other sections) instead of overwriting the
whole file. Inserts under an existing [wsl2] header, else appends a section.
- missing profile: when the daily user has never signed in (Get-UserProfileDir
null), note ".wslconfig after first sign-in" in the summary instead of silently
skipping.
- elevation: forward -DailyUser through Get-ElevationCommand / Invoke-SelfElevate
so the choice survives the UAC relaunch.
- input hygiene: sanitize the prompted username via ConvertTo-SanitizedInput
before it reaches net localgroup and profile paths.
Tests: Add-WslMemorySetting (create/keep/insert-preserve/append-preserve),
Get-UserProfileDir null, plus wiring guards for the merge helper, the
no-profile note, the sanitize call, and -DailyUser elevation forwarding.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment threadscripts/install-k8s.ps1 Outdated
Comment threadscripts/install-k8s.ps1 Outdated
- Never hide a docker-users failure behind a green summary (High). Membership is
the make-or-break step; track $dockerUsersOk and, when it doesn't take, WARN
loudly (with the manual `net localgroup ... /add` to run while admin is still
available) even if autostart/.wslconfig succeeded. Green "Configured for" now
only prints when membership is confirmed.
- Verify membership by STATE QUERY instead of string-matching 2>&1-merged native
output (Medium; learned PS rule). New Test-LocalGroupMember (Get-LocalGroupMember,
falling back to `net localgroup <group>` STDOUT) + pure Test-NameInGroupOutput
(domain-stripped, case-insensitive) replace the locale-fragile
`-match 'already a member'` classification.
Tests: Test-NameInGroupOutput (bare-name/domain/case/empty), plus source guards
for the state-query verification and the loud-warn-on-failure summary.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment threadscripts/install-k8s.ps1
Bugbot round 3 (Medium): when Get-PfMemGb returns null the .wslconfig budget was
skipped with no summary note -- unlike the null-profile path -- so a green
"Configured for" could print while the training memory budget was never applied.
Add the matching note ("couldn't detect host RAM -- set [wsl2] memory manually")
so IT sees the gap. Guard test added.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cursorcursorBot 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 74f2885. Configure here.

Comment threadscripts/install-k8s.ps1
Bugbot round 4 (Medium): if the .wslconfig merge/write throws (permissions/disk),
the catch only Logged and recorded no summary note, so with docker-users already
confirmed the green "Configured for" line still printed as if the memory budget
was set. Add a "couldn't write .wslconfig -- set [wsl2] memory manually" note in
the catch, matching the null-profile / RAM-unknown paths. Guard test added.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shujaatTracebloc
shujaatTracebloc merged commit 0b56fcf into developJul 30, 2026
35 checks passed
@shujaatTracebloc
shujaatTracebloc deleted the fix/418-provision-daily-user branch July 30, 2026 13:13
Sign up for freeto 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.

4 participants

@shujaatTracebloc@LukasWodka@saadqbal@divyasinghds