The C1 fix (a45db52a) shipped with no committed test: the defect lives in
js/, and this repo has no JavaScript test surface - no package.json, no
eslint config, no tsconfig - so nothing in CI could notice a reinstatement
of the false "default channel" message. ruff covers only Python.
Rather than add a JS toolchain, the guard shells out to `node` and drives
the SHIPPED client modules (CustomNodesManager.installNodes,
uninstallNodes) through a stubbed 404, then reads the string that reached
app.ui.dialog.show() - the sink the user actually reads. Only the network
and the browser are stood in for; the client code that runs is the real
file, reached through a symlink under --preserve-symlinks so nothing is
copied.
The same predicate runs against both arms, so this is a guard rather than
a tautology: it must pass on the current client and FAIL on the client as
it was at 14de6304, on the false lead specifically. Verified by mutation
too - reinstating either 404 branch turns both GREEN nodes red.
Every node skips with a reason when `node` is absent, so a node-less
runner is not broken by this file.
18 lines
627 B
JavaScript
18 lines
627 B
JavaScript
// Stand-in for ComfyUI's `scripts/api.js`, for tests/test_batch_404_dialog_guard.py.
|
|
//
|
|
// `fetchApi` is the network boundary. The harness installs per-scenario
|
|
// responses through setRoutes(); nothing here reaches a real server.
|
|
let routes = {};
|
|
export function setRoutes(r) { routes = r; }
|
|
export const api = {
|
|
async fetchApi(path, options) {
|
|
for (const key of Object.keys(routes)) {
|
|
if (path.startsWith(key)) return routes[key](path, options);
|
|
}
|
|
return { status: 200, async json() { return {}; }, async text() { return ''; } };
|
|
},
|
|
addEventListener() {},
|
|
removeEventListener() {},
|
|
apiURL(p) { return p; },
|
|
};
|