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.
This commit is contained in:
1 parent
867fd42972
commit
9f0601027c
400 files changed
+26401
-3
No files matched your search
@@ -0,0 +1,64 @@
|
||||
/* ── the weather ────────────────────────────────────────────────────────
|
||||
Thirty rounds of walk drove the happy path and nothing else: not one step
|
||||
ever made a command reject, and not one ever saw the client signed out.
|
||||
This mock IS the whole backend behind the browser walk, so it is the only
|
||||
place the unhappy paths can be driven from.
|
||||
|
||||
Four doors, all of them checked in mockInvoke BEFORE any dispatch, so a
|
||||
`plugin:` command and a catalog command arm exactly the same way:
|
||||
|
||||
__ssMock.fail(cmd, message) the next and every call to `cmd` rejects
|
||||
with that exact string; "" disarms it.
|
||||
__ssMock.answer(cmd, value) `cmd` resolves with `value` — an empty
|
||||
list, a null page — instead of its
|
||||
fixture, so the walk names what "empty"
|
||||
means rather than the mock guessing.
|
||||
__ssMock.forget(cmd) takes one armed answer away.
|
||||
__ssMock.offline(on) the client goes down: everything the
|
||||
backend funnels through with_client()
|
||||
answers "not connected to Soulseek",
|
||||
connect_stored / connect_and_login answer
|
||||
the server string, and soulseek:state
|
||||
goes out. off restores and re-connects.
|
||||
__ssMock.clear() all of it away, for the walk's last step.
|
||||
|
||||
They reject with a PLAIN STRING, because that is what Tauri rejects with:
|
||||
an Error would arrive as "Error: …" and hide half of what say() has to
|
||||
cope with. All of it sits behind `enabled`, so a real build never sees it. */
|
||||
const armedFail = new Map();
|
||||
const armedAnswer = new Map();
|
||||
let offlineNow = false;
|
||||
/* what src-tauri/src/commands.rs runs through with_client(), plus the two
|
||||
searches and a download, which check the connection themselves */
|
||||
const needsClient = (cmd) => /^(slsk_|buddy_)/.test(cmd) || cmd === "start_search" || cmd === "stop_search" || cmd === "download_file";
|
||||
function weather(cmd) {
|
||||
const f = armedFail.get(cmd);
|
||||
if (f != null) return Promise.reject(f);
|
||||
if (offlineNow) {
|
||||
if (cmd === "connect_stored" || cmd === "connect_and_login") {
|
||||
return Promise.reject("could not reach server: io: failed to lookup address information: no address associated with hostname");
|
||||
}
|
||||
if (needsClient(cmd)) return Promise.reject("not connected to Soulseek");
|
||||
}
|
||||
if (armedAnswer.has(cmd)) return Promise.resolve(armedAnswer.get(cmd));
|
||||
return undefined;
|
||||
}
|
||||
if (enabled && typeof window !== "undefined") {
|
||||
window.__ssMock = {
|
||||
emit: mockEmit,
|
||||
fail(cmd, message) { if (message) armedFail.set(cmd, String(message)); else armedFail.delete(cmd); return true; },
|
||||
answer(cmd, value) { armedAnswer.set(cmd, value); return true; },
|
||||
forget(cmd) { armedAnswer.delete(cmd); return true; },
|
||||
offline(on) {
|
||||
offlineNow = !!on;
|
||||
mockEmit("soulseek:state", offlineNow ? { kind: "disconnected" } : { kind: "connected", username: MOCK_USER });
|
||||
return offlineNow;
|
||||
},
|
||||
clear() {
|
||||
armedFail.clear();
|
||||
armedAnswer.clear();
|
||||
if (offlineNow) { offlineNow = false; mockEmit("soulseek:state", { kind: "connected", username: MOCK_USER }); }
|
||||
return true;
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user