From 3067ae93ea3d36553d0b5e9b790ed089eceedc83 Mon Sep 17 00:00:00 2001 From: Dewey Date: Mon, 19 Oct 2026 18:03:15 -0500 Subject: [PATCH] row 175 (#1673): scripts/mosaic sends plugins, name, names, follow, threads and thread to packages/cli (sage-1081); the tester gate test sends bad keys to organization.set and organization.revision --- packages/bus/tests/tester-writes.test.mjs | 3 +++ packages/cli/tests/tester-reads.test.mjs | 20 ++++++++++++++++++++ scripts/mosaic | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/packages/bus/tests/tester-writes.test.mjs b/packages/bus/tests/tester-writes.test.mjs index 231cf4fe2..a9d1bce36 100644 --- a/packages/bus/tests/tester-writes.test.mjs +++ b/packages/bus/tests/tester-writes.test.mjs @@ -124,6 +124,9 @@ test('row 175: the human-only actions refuse a tester tester-refused, and the fi ['organization.set', { revision, limits: { total: 0 } }], ['routes', {}], ['organization.revision', {}], + // The gate runs before the argument checks: a bad key still refuses tester-refused. + ['organization.set', { revision, nope: 1 }], + ['organization.revision', { nope: 1 }], ['decision.resolve', { id: 'd-1', choice: 'yes' }], ['launch.revoke', {}], ['launch.restore', {}], diff --git a/packages/cli/tests/tester-reads.test.mjs b/packages/cli/tests/tester-reads.test.mjs index d26214c77..2f6413296 100644 --- a/packages/cli/tests/tester-reads.test.mjs +++ b/packages/cli/tests/tester-reads.test.mjs @@ -127,6 +127,26 @@ function mosaic(args, env) { child.on("close", (status) => resolve({ status, out, err })); }); } +// sage-1081: these six fell through to the seat CLI, which refused with its own usage, so W1 +// (`plugins set`) and W4 (`name`) failed through the wrapper. Each now reaches packages/cli. +test("row 175: scripts/mosaic sends plugins, name, names, follow, threads and thread to packages/cli, not the seat CLI", (t) => { + const root = tmp(t, "mosaic-cli-route-"); + const env = { PATH: process.env.PATH, HOME: join(root, "home"), MOSAIC_CONFIG: join(root, "none.json") }; + for (const [args, message] of [ + [["plugins", "x"], /^mosaic: mosaic plugins \[--business ID\]/], + [["name"], /^mosaic: name takes an instance and a name\n/], + [["names", "x"], /^mosaic: names takes no arguments\n/], + [["follow", "x"], /^mosaic: follow takes no arguments\n/], + [["threads", "x"], /^mosaic: threads takes no arguments\n/], + [["thread"], /^mosaic: usage:\n mosaic thread create /], + ]) { + const r = spawnSync(MOSAIC, args, { env, encoding: "utf8" }); + assert.equal(r.status, 4, args.join(" ")); + assert.match(r.stderr, message, args.join(" ")); + assert.doesNotMatch(r.stderr, /mosaic launch readdirSync(dir, { recursive: true }).map(String).sort(); async function w7(t, vars, edit) { const root = tmp(t, "mosaic-cli-tester-init-"); diff --git a/scripts/mosaic b/scripts/mosaic index 827c6ec29..34944880c 100755 --- a/scripts/mosaic +++ b/scripts/mosaic @@ -35,6 +35,6 @@ if [ "${1:-}" = business ]; then exec node "$REPO/packages/business/src/cli.mjs" "$@" fi case "${1:-}" in - usage|project|limits|inbox|decide|tasks|agents|trail|talk|stop|launches|bus) exec node "$REPO/packages/cli/src/cli.mjs" "$@" ;; + usage|project|limits|inbox|decide|tasks|agents|trail|talk|stop|launches|bus|plugins|name|names|follow|threads|thread) exec node "$REPO/packages/cli/src/cli.mjs" "$@" ;; esac exec node "$REPO/packages/seat/src/cli.mjs" "$@"