Files
SoulStream/handoff/tools/realign-wait.cjs
T
KeelrLeek 9f0601027c android: the handoff — the pending rounds, the pipeline, and what is unverified
Everything written this session that has not been through the device: rounds 43
to 48 (each patch adversarially verified, 43's transient-notice expectation
fixed), a partial round 49, the pipeline scripts, the Android Auto design and
the icon comparison mock. Also the two harness changes that were never A/B'd —
adaptive waits, which may only shorten a declared wait and never lengthen it,
and a ship that runs the mock walk and the deploy at the same time. The A/B and
its 255-step baseline are in handoff/tools; main stays at what the phone has
actually walked.
2026-09-14 07:57:41 -05:00

41 lines
2.0 KiB
JavaScript

// Carry the two harness fixes (a8adce0, 9bfbcfc) into a snapshot: the attach
// retry in cdp.mjs, and the wait-for-the-app block in smoke.mjs. cdp.mjs is
// copied wholesale (no round touches it); smoke.mjs is edited in place,
// because rounds applied to the snapshot own the rest of that file.
const fs = require('fs');
const snap = process.argv[process.argv.length - 1];
const repo = 'F:/Coding/SoulStream';
fs.copyFileSync(repo + '/tests/mobile/cdp.mjs', snap + '/tests/mobile/cdp.mjs');
const f = snap + '/tests/mobile/smoke.mjs';
let s = fs.readFileSync(f, 'utf8');
const anchor = ` console.log("attached to the phone's WebView (pid " + pid + ")");`;
if (s.includes('the app never came up on the phone')) {
console.log('already carries the wait');
} else if (!s.includes(anchor)) {
throw new Error('anchor missing in ' + f);
} else {
const block = anchor + `
/* A walk follows a fresh install, so the app is always cold here: the
shell mounts, the library loads, Soulseek logs in and the share
index is built. Attaching only proves the WebView answers — it says
nothing about the app being up. Starting anyway means the first
steps run against a half-mounted page and get reported as broken
features, which is exactly how an hour went once. Wait for the
handle the walk actually drives. */
const upFrom = Date.now();
let up = false;
while (Date.now() - upFrom < 90_000) {
try {
if (await cdp.evaluate(\`!!(window.__ss && document.querySelector('.app'))\`) === true) { up = true; break; }
} catch { /* a page mid-navigation answers nothing; ask again */ }
await sleep(1000);
}
if (!up) throw new Error("the app never came up on the phone (no __ss and no .app after 90s)");
console.log("the app is up (" + ((Date.now() - upFrom) / 1000).toFixed(1) + "s after attaching)");`;
s = s.replace(anchor, () => block);
fs.writeFileSync(f, s);
console.log('wait inserted');
}