Lands Gizmoduck's round 3 candidate, manifest 4782c8b5ecb7 (c783d5e39on gizmoduck/row234-r3, one commit on57f59e0c3), approved by Duckworth: content on round 1 (861182fa6, 29919), the round 2 rebase check (29928, rev 2670) and round 3 (REVIEW-r3.md7c8c38b69, posted 29935, rev 2683). 41 paths. Round 3 fixes the two failures in Sage's combined gate with row 233: bus schema.test.mjs now counts 18 tables and 71 triggers for the new hosts and host_grants tables, and stack-release.test.mjs T46 puts both tables in the untimed restore-guard list, since every write shares a transaction with a grant.* event. Round 3 rebuilt on the row 233 landing as one commit. 38 of the 39 round 2 blobs are unchanged and BUILD.md is append-only. Gizmoduck's singles on round 3: stack-release 196/0, schema 1/0. Evidence: Gizmoduck's slot runs, 25 of 25 mutants killed (A22b and A23 included, A9 structural), singles on r2 387/0 over 47 files. Sage's landing gate on thec783d5e39tree: 06:02:12Z to 06:15:26Z, every package except queue 2890 pass, 0 fail (15 packages; bus 539, cli 622), and all ten scripts/test-*.sh 585 pass, 0 fail. This is code only. The live stack runs from a pinned copy at schema 3i. The 3i to 3j migration runs in the 10-24 window (mos-1145), agent-run under Q173, with a backup first. Duckworth's N10 (hosts.mjs Object.hasOwn) and N12 (doc-only) go to row 235's carry list.
45 lines
2.1 KiB
JavaScript
45 lines
2.1 KiB
JavaScript
// `mosaic hosts` (row 234, #1740, r6 E4): the broker's hosts.status, hosts.check and hosts.remove. The
|
|
// human runs all three. With --tester the tester's session runs them. check logs in as mosaic-installer
|
|
// and runs `list` on the host, then marks the host ready. remove drops a host no grant uses. Nothing here
|
|
// reads a key: the answers carry fingerprints only.
|
|
import { CliError } from "./errors.mjs";
|
|
|
|
export const HOSTS_USAGE = "mosaic hosts [status] [--json] [--tester] [--business ID] | check|remove HOST [--tester] [--business ID]";
|
|
|
|
function parse(args) {
|
|
const out = { positional: [], flags: new Set(), values: {} };
|
|
for (let i = 0; i < args.length; i++) {
|
|
const arg = args[i];
|
|
if (arg === "--json" || arg === "--tester") out.flags.add(arg);
|
|
else if (arg === "--business") {
|
|
if (!args[i + 1] || Object.hasOwn(out.values, arg)) throw new CliError(HOSTS_USAGE, 4);
|
|
out.values[arg] = args[++i];
|
|
} else if (arg.startsWith("--")) throw new CliError(HOSTS_USAGE, 4);
|
|
else out.positional.push(arg);
|
|
}
|
|
return out;
|
|
}
|
|
|
|
const line = (h) =>
|
|
[h.host, h.state, `${h.user}@${h.address}:${h.port}`, h.sudo ? "sudo" : "no-sudo", h.checkedAt ?? "unchecked",
|
|
...(h.hostLineLeft.length ? [`line left: ${h.hostLineLeft.join(" ")}`] : [])].join("\t");
|
|
|
|
export async function hostsCommand(args, io, callFor) {
|
|
const parsed = parse(args);
|
|
const [verb = "status", host, ...extra] = parsed.positional;
|
|
const shape = { status: host === undefined, check: host !== undefined, remove: host !== undefined };
|
|
if (extra.length || !shape[verb] || (parsed.flags.has("--json") && verb !== "status")) throw new CliError(HOSTS_USAGE, 4);
|
|
try {
|
|
const call = callFor(parsed);
|
|
if (verb === "status") {
|
|
const rows = await call("hosts.status", {});
|
|
io.stdout.write(parsed.flags.has("--json") ? JSON.stringify(rows, null, 2) + "\n" : rows.map(line).join("\n") + (rows.length ? "\n" : ""));
|
|
return;
|
|
}
|
|
io.stdout.write(JSON.stringify(await call(`hosts.${verb}`, { host }), null, 2) + "\n");
|
|
} catch (error) {
|
|
if (error instanceof CliError) throw error;
|
|
throw new CliError(error.message, 2);
|
|
}
|
|
}
|