VA-13: apply staged self-update on Windows #58
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VA-13-windows-self-update"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Apply a staged self-update on Windows (VA-13).
apply_staged_updatepreviously returnedUpdateError::NotImplementedon non-Unix; Windows can't replace a running / service-held exe in place, so the swap is driven by a detached helper that is a copy of the agent.Flow
apply_staged_update(Windows) copies the running exe to<exe>.updater.exe(a separate, unlocked file), spawns it detached as the hiddenupdate-swapsubcommand, and exits so the service stops and the binary is released. Unix keeps the in-place swap +execv.update_swap::run_swap): stop thevervain-agentservice -> move exe to<exe>.old-> move the staged binary into place (retry while the handle drains) -> start the service -> confirm it stays Running within a timeout.<exe>.failed, restore<exe>.old, restart.<exe>.old/<exe>.updater.exe/<exe>.failedare deleted on the next agent startup (cleanup_stale), since they may be locked at swap time.Service control uses the
windows-serviceServiceManager(already a dep via VA-9), notsc+ shell quoting. Service name frominstall_windows::SERVICE_NAME.Decision
Self-copy + hidden
update-swapsubcommand (oversc+cmdor a separate helper binary): no extra build/package artifact, no shell quoting, and the swap/rollback sequence is driven by typed service-control calls. The three parked blockers are resolved - VA-9 (Windows service) merged, MinGW + the Windows cross-check are in CI (VA-9), and the open helper-mechanism question is decided here.Validation
Typecheck-only interim (agreed):
oci-build/check.Dockerfilepasses - fmt, clippy --deny warnings, build, the full test suite, and the Windows cross-check compiling the swap module. The full-cycle survives-a-restart and rollback ACs (AC#1/#2) and the integration test (AC#3) need a Windows host with the SCM and are validated there.Refs VA-13.