Compare commits

...

5 Commits

Author SHA1 Message Date
Prabhaav Pillai 3b1ce61fb8 fix updater 2026-10-20 01:19:32 -04:00
Prabhaav Pillai 6c93a41942 Test update 2026-10-20 01:14:30 -04:00
Prabhaav Pillai b4154fdc5b Merge commit '0e7503448c2f3fd2678ceeb6ab3799be0f517c65' into test_updates 2026-10-20 01:12:15 -04:00
Prabhaav Pillai ea7de662dc test update 2026-10-20 01:07:24 -04:00
Prabhaav Pillai cc5b618884 update 2026-10-20 01:05:44 -04:00
5 changed files with 17 additions and 16 deletions
@@ -86,7 +86,13 @@ await restartingUpdate.reply(0, snapshot({ operations: { ...operations, canFastU
restartingUpdate.feed.action("update", "Dom")
assert.equal(preparedUpdates.length, 1, "update intent is saved before the request can disconnect")
await restartingUpdate.reply(1, snapshot({ operations: { ...operations, canFastUpdate: true, request: request("update", "pending", "Dom") } }))
assert.equal(restartScreens.at(-1).target, "Dom", "accepted updates show the reconnect screen before disconnect")
assert.deepEqual(restartScreens, [], "accepted updates keep their progress page visible")
restartingUpdate.fire(1000)
await restartingUpdate.reply(2, { error: "Updater status is unavailable" }, 503)
assert.deepEqual(restartScreens, [], "an updater status error does not mean the device restarted")
restartingUpdate.fire(2000)
await restartingUpdate.fail(3)
assert.equal(restartScreens.at(-1).target, "Dom", "connection loss starts the reconnect screen")
restartingUpdate.feed.stop()
let canceledPreparation = 0
@@ -128,19 +128,15 @@ kept.recovery.start({ ...baseline, instance: 'one' })
kept.recovery.start({ ...baseline, instance: 'two' })
assert.equal(JSON.parse(kept.values.get(UPDATE_RESTART_KEY)).instance, 'one')
// Only update-related restarts/disconnects trigger the full-screen handoff.
// Keep update progress visible until Galaxy actually loses the device connection.
const restarts = []
const feed = new SoftwareStatusFeed({ publish() {}, restarting: value => restarts.push(value) })
feed.data = status(baseline.commit, pending)
feed.error = 'Connection lost'
feed.installBaseline = baseline
feed.data = status(baseline.commit, { action: 'update', state: 'pending' })
feed.emit('ready')
feed.error = 'Updater status is unavailable'
feed.emit('ready')
assert.equal(restarts.length, 0)
feed.installBaseline = baseline
feed.error = 'Server rejected request'
feed.emit('ready')
assert.equal(restarts.length, 1)
feed.data.operations.request = null
feed.error = 'Connection lost'
feed.connectionLost = true
feed.emit('ready')
assert.equal(restarts.length, 2)
assert.deepEqual(restarts, [baseline])
+2 -1
View File
@@ -101,7 +101,8 @@ createApp({
return authState.status === "checking" ? "Connecting…" : "Not connected"
},
},
errorCaptured() {
errorCaptured(error, _instance, info) {
console.error("Galaxy page error", info, error)
if (updateRestart.prepared) updateRestart.start(updateRestart.prepared, { provisional: true })
else state.pageError = "This page could not finish loading."
return false
@@ -104,9 +104,7 @@ export class SoftwareStatusFeed {
}
emit(status) {
if (this.installBaseline && (this.connectionLost || this.error === "Updater status is unavailable" ||
this.data?.operations?.request?.state === "pending" &&
["update", "fast", "rollback", "version", "install"].includes(this.data.operations.request.action))) this.restarting(this.installBaseline)
if (this.installBaseline && this.connectionLost) this.restarting(this.installBaseline)
this.publish({ status, data: this.data, busy: this.busy, uncertain: this.uncertain,
notice: this.notice, error: this.error }) }
@@ -72,7 +72,7 @@ export const ToggleBackup = {
},
},
template: `<section class="gx-card gx-panel gx-stack" :inert="busy" :aria-busy="busy || undefined">
<h3>Toggle backup</h3><p class="gx-note">Save your editable toggles, onroad layout and colors. Restore compatible settings while parked.</p>
<h3>Toggle backup</h3><p class="gx-note">AAASavesssssss your editable toggles, onroad layout and colors. Restore compatible settings while parked.</p>
<div class="gx-actions"><button type="button" class="gx-btn gx-btn--tonal" @click="exportBackup">Back up toggles</button>
<button type="button" class="gx-btn gx-btn--tonal" @click="$refs.file.click()">Restore toggles</button>
<input ref="file" type="file" accept=".json,application/json" class="gx-sr-only" tabindex="-1" aria-label="Choose toggle backup" @change="chooseFile"></div>