Files
DeepSeek-Reasonix/desktop/internal/update/install_args.go
T
yhh 1db3c9082b feat(desktop): let a bad release be rolled back from inside the app
A release that turns out to be bad currently leaves the user hunting for an
old installer. The version panel lists what has been published and installs
any of them — the same code path forward or back, because a rollback that took
its own path would be the less-tested one. The chosen version is pinned before
the download starts: if the machine dies mid-install, the next launch must not
helpfully update past what the user picked.

The update core moves out of the old shell into desktop/internal/update so
both shells share it. Beyond deduplication that finally makes it compile on
every platform — updater_mac.go could not even be type-checked from Windows,
so the macOS half was only ever verified by CI.

Publishing writes a per-tag index alongside the artifacts, so the catalog the
panel reads is produced by the release itself rather than maintained by hand.

Two things the transport learned the hard way, now covered by tests: a 404 is
not transient and must not burn the full retry budget, and a resumed download
has to verify the range it was actually given — a middle box that answers
`bytes 0-` to a range request will otherwise append the whole file to what is
already on disk.
2026-08-14 05:03:02 -07:00

53 lines
1.5 KiB
Go

package update
import (
"fmt"
"strconv"
)
func installerCommandLine(installer, dir string) string {
// Keep this in sync with cmd/update-helper/args.go. The desktop uses it for
// its Windows command invariant tests; the copied helper extracts to a
// transaction-owned staging directory after the desktop exits.
line := fmt.Sprintf(`"%s" /REASONIXUPDATE=1 /REASONIXSTAGE=1`, installer)
if dir != "" {
line += " /D=" + dir
}
return line
}
func windowsUpdateHandoffArgs(parentPID int, installer, installerSHA256, installDir, relaunch, toVersion, createdAt, transactionID string) []string {
args := []string{
"--parent-pid", strconv.Itoa(parentPID),
"--installer", installer,
"--installer-sha256", installerSHA256,
"--to-version", toVersion,
"--created-at", createdAt,
"--transaction-id", transactionID,
}
if installDir != "" {
args = append(args, "--install-dir", installDir)
}
if relaunch != "" {
args = append(args, "--relaunch", relaunch)
}
return args
}
func windowsVersionedUpdateHandoffArgs(parentPID int, installer, installerSHA256, installDir, relaunch, toVersion string) []string {
args := []string{
"--parent-pid", strconv.Itoa(parentPID),
"--installer", installer,
"--installer-sha256", installerSHA256,
"--to-version", toVersion,
"--install-layout", "versioned-v1",
}
if installDir != "" {
args = append(args, "--install-dir", installDir)
}
if relaunch != "" {
args = append(args, "--relaunch", relaunch)
}
return args
}