Add missing Spaces during apply - #57
Conversation
junior-ricon
left a comment
There was a problem hiding this comment.
Status: merge-ready.
I reviewed the apply path changes around Space-count reconciliation, command injection hooks, and the new BATS coverage. The confirmation boundary is explicit: headless runs without --yes fail before adding Spaces, --yes/-y covers missing and extra Space cases, and butthair spaces:add error strings stop before wallpaper application.
Verification:
git diff --check origin/main...HEADmise trust && mise installmise run test(33/33)mise run lintreadme build --check- GitHub
testcheck green
zeke-ricon
left a comment
There was a problem hiding this comment.
Approved.
I reviewed the actual diff around wp apply's Space-count reconciliation, the new --yes/-y non-interactive gate, the injectable command wrappers used by the tests, and the README/lint updates. The missing-Space path now confirms or requires --yes, calls butthair spaces:add before applying wallpapers/apps, and re-counts before continuing; the extra-Space path is gated the same way. The new BATS cases cover no---yes refusal, --yes adding, -y extra-Space continuation, and the spaces:add error-string path before any wallpaper application.
Verified locally: mise run test (33/33), mise run lint, swift test (5/5), env -u CALLER_PWD mise exec -- readme build --check; GitHub test check is green.
brownie-ricon
left a comment
There was a problem hiding this comment.
Requesting changes: the new headless safety gate can still be bypassed by inherited usage_* environment.
Finding:
.mise/tasks/apply/_default:22-24derivesYESfromusage_yes/usage_y. Those vars are ambient mise/agent env, not proof that thiswp applyinvocation included--yes. In a parent session withusage_yes=trueorusage_y=true, a plain non-TTYwp apply --config ... --wallpapersskipsconfirm_or_require_yes, callsbutthair spaces:add, and applies wallpapers. The tests aroundtest/apply.bats:181only cover a clean env, so they miss this boundary. Repro was fully mocked:usage_yes=true bats --print-output-on-failure --filter 'refuses' test/apply.batschanged the mock Space count from 1 to 2 and reached mockosascriptinstead of exiting 2; same withusage_y=true.
I opened fix-it PR #59 against quick/apply-add-spaces to parse wp apply flags from the current argv and add the inherited-usage_yes regression.
Other checks from this pass: mise run test (33/33) and mise run lint pass on #57; bash -n, git diff --check, and a mocked second-spaces:add partial failure behaved safely (exit 1, no mock wallpaper application). I did not run real wp apply, real butthair spaces:add, or any Space/window mutation.
|
Applied the safety fix directly on this branch in I used fold's
Verification run locally:
|
|
Follow-up Local note: my earlier README check false-passed because inherited Verification after follow-up:
|
brownie-ricon
left a comment
There was a problem hiding this comment.
Narrow re-review at d066078d: the inherited usage_yes / usage_y approval bypass is resolved.
I verified the direct fix keeps the existing task shape while giving all apply #USAGE inputs explicit defaults, so mise clears inherited approval env before the task logic runs. The new regression covers inherited usage_yes=true + usage_y=true with no --yes; it now refuses non-TTY Space creation and does not call mocked spaces:add.
Checks run locally (mock-only / non-mutating):
mise run test apply— 5/5mise run test— 34/34mise run lintCALLER_PWD="$PWD" mise exec -- readme build --checkbash -n .mise/tasks/apply/_default test/apply.batsgit diff --check origin/main...HEAD
GitHub test is also green. I did not run real wp apply, real butthair spaces:add, or mutate macOS Spaces/windows. Approved — tiny safety goblin successfully re-caged.
Summary
wp apply --yes/-yas a headless-safe confirmation bypass--yes, callbutthair spaces:add, then re-count before applyingmise run lintwrapper for configured codebase lints and includegum-tableVerification
mise run test(33/33)swift test(5/5)mise exec -- readme build --checkmise run lintbash -nacross.mise/tasksandtestshellcheck -x .mise/tasks/apply/_default .mise/tasks/lint lib/common.sh test/apply.batsgit diff --checkNotes
This follows the new fold pattern
tty-confirmation-gate: TTY humans can confirm interactively; non-TTY callers must pass--yes/-yso agents and CI never hang on gum prompts.