Skip to content

fix(update): apply staged Windows replacement - #85

Merged
BB-fat merged 1 commit into
mainfrom
takeover/pr21-windows-staged-update
Aug 12, 2026
Merged

fix(update): apply staged Windows replacement#85
BB-fat merged 1 commit into
mainfrom
takeover/pr21-windows-staged-update

Conversation

@BB-fat

@BB-fat BB-fat commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Supersedes #21 — rebased onto current main (redundant port-fix hunks dropped, composed with #77 auto-update). All credit to @NianJiuZst.

Rebase / composition notes

  • The 12-file test port TOCTOU fix (bind 0 instead of probe-then-bind) and the Biome formatting commit were dropped during rebase: both already reached main independently (crates/bsk-cli/tests/cancel_forwarding.rs and friends already bind port 0).
  • The core commit applied onto main verbatim — no content conflicts with feat(update): auto-upgrade bsk when daemon finds a newer version #77's update rework. Verified the composition in crates/bsk-cli/src/cli/update.rs:
    • feat(update): auto-upgrade bsk when daemon finds a newer version #77's structure kept: self_install_candidate / replace_binary_at_path (daemon auto-update) and auto_update_step with its AutoUpdateOutcome::Staged mapping.
    • fix(update): apply staged Windows replacement #21's mechanism layered in: replace_binary_for_update now routes Windows through stage_windows_replacement, which writes the staged binary + .cmd and actually executes it via a detached cmd.exe helper (CREATE_NO_WINDOW, stdio nulled) that retries move until the running process exits, optionally restarts the daemon (bsk daemon start) when the CLI path stopped one, self-deletes, and cleans up + errors visibly if the helper fails to spawn.
    • Non-Windows keeps the atomic write/rename path untouched.

Verification

  • cargo fmt --all: clean (no changes)
  • cargo test -p bsk-protocol: 114 passed
  • cargo test -p bsk --lib: 228 passed, 1 failed — skill_install::sync::tests::sync_continues_on_partial_error, a pre-existing environment failure that fails identically on origin/main (unrelated to this change)
  • cargo clippy -p bsk-protocol -p bsk --all-targets -- -D warnings: clean
  • Windows-only code is #[cfg(windows)]-gated (imports included); a full x86_64-pc-windows-msvc check was not runnable in this Linux environment (aws-lc-sys needs an MSVC C toolchain).

@BB-fat
BB-fat merged commit 0ce497f into main Aug 12, 2026
4 checks passed
@BB-fat
BB-fat deleted the takeover/pr21-windows-staged-update branch August 12, 2026 11:45
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.

2 participants