Skip to content

Commit af459e4

Browse files
committed
test(windows-updater): expand temporary diagnostics for in-app update repro
Capture updater state snapshots across check, prepare, install, and error transitions, then bump the app version to force a workflow-delivered test update for reproducing and debugging inner updater failures. Made-with: Cursor
1 parent 5062fc7 commit af459e4

File tree

5 files changed

+55
-3
lines changed

5 files changed

+55
-3
lines changed

backlogs/short_term_backlog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Home on Windowd did not display after the update
2+
Temporary test release: expanded in-app updater state logs (will revert after verification)
23
Login screen
34
Dealing with pool count
45
Updates on launch test

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"url": "https://github.com/HyperlinksSpace/HyperlinksSpaceProgram.git"
1717
},
1818
"main": "index.js",
19-
"version": "53.0.1392",
19+
"version": "53.0.1393",
2020
"type": "module",
2121
"engines": {
2222
"node": ">=18 <=22"

texts/windows-in-app-updater-debug.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The **Updater** window also shows a rolling activity log (last lines only); for
2828
- `[updater:prepare] FAILED` — zip download, verify, or unpack failed.
2929
- `update-downloaded: ignored on Windows` — expected: NSIS installer finished downloading but Windows uses the zip pipeline instead.
3030
- `requestInstallNow blocked: no staged build` — UI offered reload before staging completed, or staging was cleared; check `pending-update-versions` and zip assets on GitHub.
31+
- `[updater:state]` — compact state snapshots captured on check/start, update-available, prepare enter/complete/fail, install request, and updater errors.
3132

3233
## 2. GitHub release assets (maintainers)
3334

windows/build.cjs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ function setupAutoUpdater() {
933933
);
934934

935935
let installRequested = false;
936+
logUpdaterStateSnapshot("init");
936937

937938
const syncZipReadyUi = (v) => {
938939
if (!updateDialogState.window || updateDialogState.window.isDestroyed()) return;
@@ -967,6 +968,41 @@ function setupAutoUpdater() {
967968
};
968969

969970
const getVersionsStagingRoot = () => path.join(app.getPath("userData"), "pending-update-versions");
971+
const logUpdaterStateSnapshot = (reason, extra = {}) => {
972+
let stagedVersions = [];
973+
try {
974+
const root = getVersionsStagingRoot();
975+
if (fs.existsSync(root)) {
976+
stagedVersions = fs
977+
.readdirSync(root)
978+
.filter((name) => {
979+
try {
980+
return fs.statSync(path.join(root, name)).isDirectory();
981+
} catch (_) {
982+
return false;
983+
}
984+
})
985+
.sort((a, b) => compareSemverLike(a, b));
986+
}
987+
} catch (_) {}
988+
const state = {
989+
reason,
990+
currentVersion,
991+
manualCheckInProgress,
992+
manualDownloadInProgress,
993+
updaterCheckRetrying,
994+
zipPrepareInFlight,
995+
zipReadyVersion,
996+
zipStagingContentPath,
997+
stagedExeOk: zipStagingContentPath ? stagingHasMainExe(zipStagingContentPath) : false,
998+
stagedVersions,
999+
installRequested,
1000+
dialogOpen: Boolean(updateDialogState.window && !updateDialogState.window.isDestroyed()),
1001+
installEnabled: Boolean(updateDialogState.installEnabled),
1002+
...extra,
1003+
};
1004+
logUpdater("state", safeJson(state, 1600));
1005+
};
9701006

9711007
const restoreVersionsStagingFromDisk = () => {
9721008
const root = getVersionsStagingRoot();
@@ -1002,8 +1038,10 @@ function setupAutoUpdater() {
10021038
zipStagingContentPath = bestContent;
10031039
log(`[updater] restored staging from disk: ${bestVer} -> ${bestContent}`);
10041040
logUpdater("staging", `restore picked version=${bestVer} contentRoot=${bestContent}`);
1041+
logUpdaterStateSnapshot("restore/picked");
10051042
} else {
10061043
logUpdater("staging", "restore no valid staged build found");
1044+
logUpdaterStateSnapshot("restore/none");
10071045
}
10081046
};
10091047

@@ -1015,6 +1053,7 @@ function setupAutoUpdater() {
10151053
"prepare",
10161054
`tryBeginVersionsPrepare enter remote=${remoteV || "?"} feed=${safeJson(info)} opts=${safeJson(opts)}`,
10171055
);
1056+
logUpdaterStateSnapshot("prepare/enter", { remoteVersion: remoteV || null });
10181057
if (!useWinVersionsSidecar) {
10191058
logUpdater("prepare", "skip (not Windows zip sidecar mode)");
10201059
return;
@@ -1185,6 +1224,7 @@ function setupAutoUpdater() {
11851224
manualDownloadInProgress = false;
11861225
log(`[updater] staged update at ${contentRoot}`);
11871226
logUpdater("prepare", `COMPLETE readyVersion=${meta.version} staging=${contentRoot}`);
1227+
logUpdaterStateSnapshot("prepare/complete", { preparedVersion: meta.version });
11881228
// syncZipReadyUi needs an open dialog; background checks used uiActive=false and would skip UI.
11891229
if (!uiActive) {
11901230
openOrFocusUpdateDialog();
@@ -1224,6 +1264,7 @@ function setupAutoUpdater() {
12241264
installEnabled: false,
12251265
});
12261266
}
1267+
logUpdaterStateSnapshot("prepare/failed", { error: String(errMsg) });
12271268
} finally {
12281269
zipPrepareInFlight = false;
12291270
logUpdater(
@@ -1495,6 +1536,11 @@ function setupAutoUpdater() {
14951536
const exeOk =
14961537
Boolean(zipStagingContentPath) &&
14971538
stagingHasMainExe(zipStagingContentPath);
1539+
logUpdaterStateSnapshot("install/requested", {
1540+
useVersionsApply,
1541+
semverNewer: Boolean(semverNewer),
1542+
exeOk: Boolean(exeOk),
1543+
});
14981544
logUpdater(
14991545
"ipc",
15001546
`requestInstallNow useVersionsApply=${useVersionsApply} zipReady=${zipReadyVersion} path=${zipStagingContentPath}`,
@@ -1621,6 +1667,7 @@ function setupAutoUpdater() {
16211667
autoUpdater.on("update-available", (info) => {
16221668
log(`[updater] update-available version=${info?.version || "unknown"}`);
16231669
logUpdater("event", `update-available ${safeJson({ version: info?.version, path: info?.path })}`);
1670+
logUpdaterStateSnapshot("event/update-available", { remoteVersion: info?.version || null });
16241671
const wasManual = manualCheckInProgress;
16251672
if (manualCheckInProgress) {
16261673
manualCheckInProgress = false;
@@ -1684,6 +1731,7 @@ function setupAutoUpdater() {
16841731
return;
16851732
}
16861733
logUpdater("event", `error manualCheck=${manualCheckInProgress} download=${manualDownloadInProgress} ${err?.message || err}`);
1734+
logUpdaterStateSnapshot("event/error", { error: err?.message || String(err) });
16871735
if (manualCheckInProgress || manualDownloadInProgress) {
16881736
manualCheckInProgress = false;
16891737
manualDownloadInProgress = false;
@@ -1702,6 +1750,7 @@ function setupAutoUpdater() {
17021750
try {
17031751
log("[updater] manual check requested from menu");
17041752
logUpdater("ipc", "checkNow from menu");
1753+
logUpdaterStateSnapshot("checkNow/start");
17051754
downloadProgressLoggedSample = false;
17061755
if (
17071756
useWinVersionsSidecar &&
@@ -1727,6 +1776,7 @@ function setupAutoUpdater() {
17271776
updaterCheckRetrying = true;
17281777
try {
17291778
await checkForUpdatesWithRetry();
1779+
logUpdaterStateSnapshot("checkNow/checkForUpdates resolved");
17301780
} finally {
17311781
updaterCheckRetrying = false;
17321782
}

0 commit comments

Comments
 (0)