fix(update): apply staged Windows replacement - #85
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #21 — rebased onto current main (redundant port-fix hunks dropped, composed with #77 auto-update). All credit to @NianJiuZst.
Rebase / composition notes
bind 0instead of probe-then-bind) and the Biome formatting commit were dropped during rebase: both already reached main independently (crates/bsk-cli/tests/cancel_forwarding.rsand friends already bind port 0).mainverbatim — no content conflicts with feat(update): auto-upgrade bsk when daemon finds a newer version #77's update rework. Verified the composition incrates/bsk-cli/src/cli/update.rs:self_install_candidate/replace_binary_at_path(daemon auto-update) andauto_update_stepwith itsAutoUpdateOutcome::Stagedmapping.replace_binary_for_updatenow routes Windows throughstage_windows_replacement, which writes the staged binary +.cmdand actually executes it via a detachedcmd.exehelper (CREATE_NO_WINDOW, stdio nulled) that retriesmoveuntil 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.Verification
cargo fmt --all: clean (no changes)cargo test -p bsk-protocol: 114 passedcargo 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 onorigin/main(unrelated to this change)cargo clippy -p bsk-protocol -p bsk --all-targets -- -D warnings: clean#[cfg(windows)]-gated (imports included); a fullx86_64-pc-windows-msvccheck was not runnable in this Linux environment (aws-lc-sys needs an MSVC C toolchain).