salvage 2026-11-06: uncommitted work from scratch/darkwing-scratch/r55/gate (disk cleanup #824)
This commit is contained in:
1 parent
122b122374
commit
e1a42a5eac
9 files changed
+1932
-16
No files matched your search
@@ -1,8 +1,9 @@
|
||||
// `scripts/mosaic queue` (A2). The dispatch must leave every other call to
|
||||
// scripts/mosaic exactly as it was: the seat CLI sees the same argv, working
|
||||
// directory, environment and stdin under the new script as under the pre-A2
|
||||
// copy in fixtures/mosaic-pre-a2.sh. Both CLIs are fakes that record what
|
||||
// they got; nothing here runs a seat or touches a queue.
|
||||
// copy in fixtures/mosaic-pre-a2.sh. Row 55 (Sage, 2026-10-11) sends the call
|
||||
// with no argument to the app in packages/cli instead. The CLIs are fakes that
|
||||
// record what they got; nothing here runs a seat or touches a queue.
|
||||
import assert from "node:assert/strict";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
||||
@@ -23,13 +24,13 @@ process.stderr.write("fake err\\n");
|
||||
process.exitCode = Number(process.env.EXIT);
|
||||
`;
|
||||
|
||||
// A root holding `script` as scripts/mosaic and both fake CLIs.
|
||||
// A root holding `script` as scripts/mosaic and the fake CLIs.
|
||||
function root(t, script) {
|
||||
const r = realpathSync(mkdtempSync(join(tmpdir(), "mosaic-queue-dispatch-")));
|
||||
t.after(() => rmSync(r, { recursive: true, force: true }));
|
||||
mkdirSync(join(r, "scripts"));
|
||||
cpSync(script, join(r, "scripts/mosaic"));
|
||||
for (const pkg of ["seat", "queue"]) {
|
||||
for (const pkg of ["seat", "queue", "cli"]) {
|
||||
mkdirSync(join(r, `packages/${pkg}/src`), { recursive: true });
|
||||
writeFileSync(join(r, `packages/${pkg}/src/cli.mjs`), FAKE);
|
||||
}
|
||||
@@ -52,7 +53,6 @@ function call(r, args, exit = 7) {
|
||||
const SEAT_CALLS = [
|
||||
["launch", "--repo", "/srv/repo", "--harness", "pi", "darkwing"],
|
||||
["seat", "task", "darkwing", "text with two spaces", ""],
|
||||
[],
|
||||
[""],
|
||||
["launch", "queue"],
|
||||
["Queue", "list"],
|
||||
@@ -73,6 +73,19 @@ test("every call but `queue` reaches the seat CLI exactly as before A2", (t) =>
|
||||
}
|
||||
});
|
||||
|
||||
test("no argument reaches the app entry in packages/cli, and only that call", (t) => {
|
||||
const r = root(t, join(SCRIPTS, "mosaic"));
|
||||
const got = call(r, []);
|
||||
assert.deepEqual([got.status, got.out, got.err], [7, "fake out\n", "fake err\n"]);
|
||||
const c = JSON.parse(got.capture);
|
||||
assert.deepEqual([c.cli, c.argv, c.cwd, c.stdin], ["/packages/cli/src/cli.mjs", [], "<ROOT>/work", "stdin line\nsecond\n"]);
|
||||
// Before row 55 the same call went to the seat CLI, with the same
|
||||
// environment the app now gets.
|
||||
const before = call(root(t, join(HERE, "fixtures", "mosaic-pre-a2.sh")), []);
|
||||
assert.equal(JSON.parse(before.capture).cli, "/packages/seat/src/cli.mjs");
|
||||
assert.deepEqual(c.env, JSON.parse(before.capture).env);
|
||||
});
|
||||
|
||||
test("`queue` reaches the queue CLI with the rest of the arguments", (t) => {
|
||||
const r = root(t, join(SCRIPTS, "mosaic"));
|
||||
for (const rest of [["list"], [], ["note", "9", "text with spaces", "--op", "note-9-000001"], ["queue"], [""]]) {
|
||||
|
||||
Reference in new issue
Block a user