Skip to content

fix: Conform update, version, and shell-init to the shll toolkit standards - #49

Merged
sahil-noon merged 3 commits into
mainfrom
260719-32su-conform-update-version-shell-init
Jul 20, 2026
Merged

sahil-noon merged 3 commits into
mainfrom
260719-32su-conform-update-version-shell-init

Conversation

@sahil-noon

Copy link
Copy Markdown
Collaborator

Meta

Change ID Type Confidence Plan Review
32su fix 4.2/5.0 14/14 tasks, 18/18 acceptance ✓ ✓ 1 cycle
Impact +/− Net
raw +1020 / −206 +814
true +342 / −126 +216
└ impl +99 / −47 +52
└ tests +243 / −79 +164

excludes fab/, docs/ · generated by fab-kit v2.16.5

Pipeline: intake ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr

Summary

shll composes the toolkit — shll update delegates to wt update, shll version/shll doctor probe wt --version, and shll shell-init composes wt shell-init's stdout into an evaled blob. Each shll toolkit standard (update, version, shell-init) freezes a textual/behavioral contract that wt was breaking in specific, verified ways: a hidden --skip-brew-update flag broke shll update's substring probe, a 120s SIGKILL timeout on brew upgrade risked keg corruption, and wt shell-init emitted its wrapper with exit 0 even on unsupported/missing shell args instead of failing safely.

Changes

  • wt update flag surface: restore --skip-brew-update as a visible, non-deprecated flag (keeping --no-brew-update as an alias) so wt update --help contains the literal substring the standard requires.
  • Brew-handling safety: drop the hard timeout on brew upgrade entirely (plain exec.Command, Ctrl-C available); raise brew update/brew info bounds and switch their cancellation to SIGTERM + grace instead of SIGKILL.
  • wt shell-init strict argument contract: missing or unsupported shell argument now exits 2 with a usage message on stderr and empty stdout, instead of warning and still emitting the wrapper with exit 0. Removes $SHELL-inference.
  • Tests pinning the contracts: new/updated tests for the --skip-brew-update help substring, --version output shape, and shell-init's exit-2/empty-stdout/eval-in-subshell behavior.
  • Docs: updated every eval "$(wt shell-init)" (no-arg) reference to eval "$(wt shell-init zsh)" across README, docs/site, and docs/specs.

sahil87 added 2 commits July 20, 2026 05:08
Un-deprecate --skip-brew-update, replace brew upgrade/update/info SIGKILL
timeouts with SIGTERM+grace (or none), and make shell-init a strict
usage-error contract (exit 2, empty stdout, no $SHELL inference).
@sahil-noon
sahil-noon marked this pull request as ready for review July 19, 2026 23:42
@sahil-noon
sahil-noon requested a review from Copilot July 19, 2026 23:42

Copilot AI 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.

Pull request overview

This PR brings wt’s update, --version, and shell-init behaviors (plus their help/docs surfaces) into conformance with the shll toolkit standards, and adds tests that pin those contracts to prevent future regressions.

Changes:

  • Restores --skip-brew-update as a visible, non-deprecated flag (keeping --no-brew-update as a visible alias) and updates tests/docs accordingly.
  • Reworks Homebrew subprocess handling to avoid SIGKILL mid-transaction: brew upgrade becomes unbounded; bounded brew metadata calls use SIGTERM + grace.
  • Makes wt shell-init require an explicit zsh|bash arg with strict usage-error behavior (exit 2, stderr usage, empty stdout), and updates docs/hints + adds eval-in-subshell tests.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/internal/worktree/apps.go Updates wrapper hint text to the explicit shell-init <shell> form.
src/internal/worktree/apps_test.go Updates assertion to match the new wrapper hint text.
src/internal/update/update.go Introduces SIGTERM+grace bounded brew helper; removes timeout for brew upgrade.
src/internal/update/update_test.go Adds tests pinning brew bounds and verifying graceful SIGTERM cancellation.
src/cmd/wt/version_test.go Adds a contract test for wt --version first-line output shape.
src/cmd/wt/update.go Makes --skip-brew-update visible/non-deprecated; adds --no-brew-update alias.
src/cmd/wt/update_test.go Updates tests to assert both flags are visible and no deprecation warning is emitted.
src/cmd/wt/skill.md Updates embedded skill bundle to the explicit shell-init <shell> usage.
src/cmd/wt/shell_init.go Enforces explicit `zsh
src/cmd/wt/shell_init_test.go Rewrites tests for strict shell-init contract; adds eval-in-subshell checks.
src/cmd/wt/main.go Updates root help text to show explicit `shell-init zsh
src/cmd/wt/go.go Updates help/hints to reference explicit shell-init <shell> usage.
README.md Updates user-facing docs to require explicit `wt shell-init zsh
fab/changes/260719-32su-conform-update-version-shell-init/plan.md Adds/updates change plan documenting requirements, decisions, and acceptance checks.
fab/changes/260719-32su-conform-update-version-shell-init/intake.md Adds intake/audit record motivating the conformance work.
fab/changes/260719-32su-conform-update-version-shell-init/.status.yaml Records change tracking metadata/status for the fab pipeline.
fab/changes/260719-32su-conform-update-version-shell-init/.history.jsonl Records stage transition history for the fab pipeline.
docs/specs/cli-surface.md Updates CLI spec for update flags and strict shell-init <shell> contract.
docs/site/workflows.md Updates workflows docs for explicit shell-init usage and update-flag surface.
docs/site/skill.md Updates docs skill bundle to match embedded src/cmd/wt/skill.md.
docs/site/install.md Updates install instructions to the explicit `shell-init zsh
docs/memory/wt-cli/update-command-contract.md Updates the update-command contract (flag surface + brew-handling safety).
docs/memory/wt-cli/toolkit-standards-conformance.md Updates standards baseline/verdicts to include update/version/shell-init.
docs/memory/wt-cli/shell-init-contract.md Adds a new memory/contract doc for strict shell-init <shell> behavior.
docs/memory/wt-cli/index.md Adds the new shell-init contract doc to the memory index.
docs/memory/wt-cli/go-command-contract.md Updates shell-wrapper hint reference to explicit shell-init zsh form.
docs/memory/wt-cli/flag-naming-conventions.md Adds carve-out for standard-frozen contract flags (no MarkDeprecated hiding).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +49 to +56
func newBoundedBrewCmd(ctx context.Context, args ...string) *exec.Cmd {
cmd := exec.CommandContext(ctx, "brew", args...)
cmd.Cancel = func() error {
return cmd.Process.Signal(syscall.SIGTERM)
}
cmd.WaitDelay = brewGraceDelay
return cmd
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Skipped — already handled by the Go runtime: os.(*Process).Signal converts ESRCH / already-finished into os.ErrProcessDone, and os/exec's context watchdog explicitly treats an os.ErrProcessDone return from Cancel as a spurious exit race (no error recorded), so it can never override a successful exit or make the test flaky. Cancel is only invoked by the watchdog goroutine started after a successful Start, so cmd.Process is never nil in the hook — this is the canonical Cancel pattern from the os/exec docs.

@sahil-noon
sahil-noon merged commit 453c5b7 into main Jul 20, 2026
2 checks passed
@sahil-noon
sahil-noon deleted the 260719-32su-conform-update-version-shell-init branch July 20, 2026 04:14
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.

3 participants