| … | … | @@ -163,8 +163,11 @@ test('a staged bundle that WILL boot is reported as applicable', async (t) => { |
| 163 | 163 | t.is(shell.refused, null, 'nothing refused') |
| 164 | 164 | }) |
| 165 | 165 | |
| 166 | | test('a staged bundle the APK supersedes is reported REFUSED, with the reason', async (t) => { |
| 167 | | // The 0.0.17-staged / 0.0.18-APK case exactly: legitimately un-appliable, for ever. |
| 166 | test('a staged bundle the APK supersedes is SILENT, not reported', async (t) => { |
| 167 | // ⛔ CORRECTED FROM MY OWN EARLIER EXPECTATION. I first had this report the refusal with its reason. |
| 168 | // On the handset that produced "this update cannot be applied" for a bundle older than the one |
| 169 | // running — accurate and unactionable. An APK newer than the staged bundle means that bundle was |
| 170 | // never a pending update; there is nothing to tell anyone. |
| 168 | 171 | const staged = { treeHash: 'b'.repeat(64), file: 'y.bundle', builtAt: 1000 } |
| 169 | 172 | const d = device({ |
| 170 | 173 | assets: { ...BASE, 'worklet.bundle.built': '9999' }, |
| … | … | @@ -174,8 +177,7 @@ test('a staged bundle the APK supersedes is reported REFUSED, with the reason', |
| 174 | 177 | const plan = await planBoot({ storage: STORAGE, io: d.io }) |
| 175 | 178 | const shell = JSON.parse(d.written[STORAGE + '/shell.json']) |
| 176 | 179 | t.is(shell.bundle, null, 'the APK bundle booted') |
| 177 | | t.is(shell.refused.hash, 'b'.repeat(64), 'and the staged one is named as refused') |
| 178 | | t.ok(shell.refused.reason.includes('more recently'), 'with the reason: ' + shell.refused.reason) |
| 180 | t.is(shell.refused, null, 'and nothing is said about a bundle that was never a candidate') |
| 179 | 181 | }) |
| 180 | 182 | |
| 181 | 183 | test('a CONDEMNED staged bundle is reported refused too', async (t) => { |
| … | … | @@ -201,3 +203,42 @@ test('nothing staged means nothing refused', async (t) => { |
| 201 | 203 | await planBoot({ storage: STORAGE, io: d.io }) |
| 202 | 204 | t.is(JSON.parse(d.written[STORAGE + '/shell.json']).refused, null) |
| 203 | 205 | }) |
| 206 | |
| 207 | test('a refused bundle OLDER than what booted is not reported at all', async (t) => { |
| 208 | // ⛔ SEEN ON THE HANDSET. After installing 0.0.22 the page said "this update cannot be applied — |
| 209 | // staged bundle previously failed at boot" while running 0.0.22. True, and useless: the condemned |
| 210 | // bundle was 0.0.21, older than what booted and permanently dead. A notice nobody can act on is |
| 211 | // noise, and noise in the update line is how a real one gets ignored. |
| 212 | // |
| 213 | // A refusal is only worth reporting when the staged bundle WOULD have been an update. |
| 214 | const staged = { treeHash: 'a'.repeat(64), file: 'x.bundle', builtAt: 1000 } |
| 215 | const d = device({ |
| 216 | assets: { ...BASE, 'worklet.bundle.built': '9000' }, |
| 217 | sizes: { [STORAGE + '/worklet.bundle']: 100 }, |
| 218 | files: { |
| 219 | [BDIR + '/current.json']: JSON.stringify(staged), |
| 220 | [BDIR + '/failed.json']: JSON.stringify(['a'.repeat(64)]), |
| 221 | [BDIR + '/x.bundle']: 'S' |
| 222 | } |
| 223 | }) |
| 224 | await planBoot({ storage: STORAGE, io: d.io }) |
| 225 | t.is(JSON.parse(d.written[STORAGE + '/shell.json']).refused, null, 'silent — it is history, not a pending update') |
| 226 | }) |
| 227 | |
| 228 | test('a refused bundle NEWER than what booted IS reported', async (t) => { |
| 229 | // The case worth saying out loud: a genuinely new release that cannot run. |
| 230 | const staged = { treeHash: 'b'.repeat(64), file: 'y.bundle', builtAt: 9000 } |
| 231 | const d = device({ |
| 232 | assets: { ...BASE, 'worklet.bundle.built': '1000' }, |
| 233 | sizes: { [STORAGE + '/worklet.bundle']: 100 }, |
| 234 | files: { |
| 235 | [BDIR + '/current.json']: JSON.stringify(staged), |
| 236 | [BDIR + '/failed.json']: JSON.stringify(['b'.repeat(64)]), |
| 237 | [BDIR + '/y.bundle']: 'S' |
| 238 | } |
| 239 | }) |
| 240 | await planBoot({ storage: STORAGE, io: d.io }) |
| 241 | const r = JSON.parse(d.written[STORAGE + '/shell.json']).refused |
| 242 | t.is(r.hash, 'b'.repeat(64)) |
| 243 | t.ok(r.reason.includes('failed to boot'), r.reason) |
| 244 | }) |