ac4af582301a4e8a29245dbba767eba31334ddf9
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b91bcf2606 |
library: a standalone Windows rtk gets rtk's own upgrade action (#2006, Edward4226; LoKi)
An rtk.exe that no package manager installed (rtk's own Windows release unzipped into %USERPROFILE%\.local\bin, say) had no upgrader, so the Library page showed RTK's update with no usable Upgrade. LoKi (lokic7123-star) hit it on v0.1.1285 and again on 0.1.1320; Edward4226 reproduced it and wrote this patch (his bc2056804, author kept). rtkUpgrader now gives such an rtk.exe the rtk-windows-release action (shown as "rtk's own Windows release"): on amd64, when winget's folders, cargo's folder and winget's own records/winget list didn't claim it. UpgradeRTK then takes RTKLatest's version, downloads checksums.txt and rtk-x86_64-pc-windows-msvc.zip from rtk-ai/rtk's release through source.DoOfficial, checks the zip's SHA-256 against checksums.txt, takes rtk.exe out of it, writes it beside the old one and swaps it in with steady.Rename, putting the old one back if the swap fails. Changed from Edward's patch in review: - The action no longer names a version: it read rtkLatest under the lock RTKLatest holds while it asks GitHub (up to ~16s), so ReadRTK, a page draw, would wait on it. UpgradeRTK already falls back to the last known version through RTKLatest. - A winget that couldn't say whether it owns the rtk (timed out, failed, couldn't run) is no answer, not "not winget's": askWingetOwns now returns (yes, known); only winget missing, exit 0 without rtk-ai.rtk, or 0x8A150014 (no package) count as known-no. The winget arm above is unchanged (yes only when winget listed it). Without this, a winget timeout handed a possibly winget-owned rtk to the standalone path. - Only a zip member named rtk.exe is taken (no "any .exe" fallback, which could pick rtk-proxy's), and an oversized one is refused rather than cut short. - An aside (rtk.exe.old-<pid>) an earlier upgrade couldn't remove, because an agent was running that rtk, is removed on the next upgrade. - The arch is a var (rtkArch) so the upgrader test runs on arm64 hosts instead of skipping; the redundant winget/cargo folder checks are gone (the switch's earlier cases already return for those). - Two of the patch's tests failed as written on macOS (ReplacesBinary counted VERSION as a leftover; UpgradeRunsTheInstall compared the script rtkPath finds there with rtk.exe's text); both fixed. - New tests: TestRTKWindowsStandaloneAsksWinget (no winget / unlisted / listed / failed / hung), TestRTKWindowsReleaseZipNeedsRTKExe, the arm64 case, and a stale aside in TestRTKWindowsReleaseSwapsTheFile. Run at the cherry-pick on origin/main |