Remove chat rooms and agent loops before storage migration (#3053)
* refactor(storage): remove chat rooms and agent loops This is the prerequisite cleanup for the storage backend migration. Legacy wire schemas remain temporarily so mixed-version peers can still parse old messages, while daemon callers now use query-shaped AgentStorage methods that can map directly to SQL later. * test(cli): remove retired chat and loop coverage
This commit is contained in:
@@ -1,95 +0,0 @@
|
||||
#!/usr/bin/env npx tsx
|
||||
|
||||
import assert from "node:assert";
|
||||
import { rm } from "node:fs/promises";
|
||||
import { createE2ETestContext } from "./helpers/test-daemon.ts";
|
||||
|
||||
console.log("=== Chat Command Tests ===\n");
|
||||
|
||||
const ctx = await createE2ETestContext({ timeout: 30000 });
|
||||
|
||||
try {
|
||||
{
|
||||
console.log("Test 1: chat create/ls/inspect work");
|
||||
const created = await ctx.paseo(["chat", "create", "coord-room", "--purpose", "Coordination"]);
|
||||
assert.strictEqual(created.exitCode, 0, created.stderr);
|
||||
assert(created.stdout.includes("coord-room"), created.stdout);
|
||||
|
||||
const listed = await ctx.paseo(["chat", "ls"]);
|
||||
assert.strictEqual(listed.exitCode, 0, listed.stderr);
|
||||
assert(listed.stdout.includes("coord-room"), listed.stdout);
|
||||
|
||||
const inspected = await ctx.paseo(["chat", "inspect", "coord-room"]);
|
||||
assert.strictEqual(inspected.exitCode, 0, inspected.stderr);
|
||||
assert(inspected.stdout.includes("Coordination"), inspected.stdout);
|
||||
console.log("chat create/ls/inspect work\n");
|
||||
}
|
||||
|
||||
{
|
||||
console.log("Test 2: chat post/read/wait work");
|
||||
const posted = await ctx.paseo(["chat", "post", "coord-room", "first message for @agent-1"], {
|
||||
env: { PASEO_AGENT_ID: "00000000-0000-4000-8000-000000000111" },
|
||||
});
|
||||
assert.strictEqual(posted.exitCode, 0, posted.stderr);
|
||||
assert(posted.stdout.includes("first message"), posted.stdout);
|
||||
assert(posted.stdout.includes("00000000-0000-4000-8000-000000000111"), posted.stdout);
|
||||
|
||||
const read = await ctx.paseo(["chat", "read", "coord-room", "--limit", "10"]);
|
||||
assert.strictEqual(read.exitCode, 0, read.stderr);
|
||||
assert(read.stdout.includes("first message"), read.stdout);
|
||||
assert(read.stdout.includes("00000000-0000-4000-8000-000000000111"), read.stdout);
|
||||
|
||||
const readJson = await ctx.paseo(["chat", "read", "coord-room", "--limit", "10", "--json"]);
|
||||
assert.strictEqual(readJson.exitCode, 0, readJson.stderr);
|
||||
const readPayload = JSON.parse(readJson.stdout);
|
||||
assert.strictEqual(readPayload[0]?.author, "00000000-0000-4000-8000-000000000111");
|
||||
|
||||
// `chat wait` reads "latest message id" then subscribes for newer ones.
|
||||
// Under CI load the subprocess can take >1s to bootstrap, so a single
|
||||
// delayed post races against the read. Post repeatedly and race against
|
||||
// wait — every post is newer than the snapshot wait took, so one of them
|
||||
// always wakes it up.
|
||||
const waitPromise = ctx.paseo(["chat", "wait", "coord-room", "--timeout", "30s"]);
|
||||
const waitSentinel = waitPromise.then(() => "settled" as const);
|
||||
let postedSecond = false;
|
||||
for (let attempt = 0; attempt < 60; attempt++) {
|
||||
const post = await ctx.paseo(["chat", "post", "coord-room", "second message"]);
|
||||
assert.strictEqual(post.exitCode, 0, post.stderr);
|
||||
const tick = new Promise<"tick">((resolve) => setTimeout(() => resolve("tick"), 250));
|
||||
const result = await Promise.race([waitSentinel, tick]);
|
||||
if (result === "settled") {
|
||||
postedSecond = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(postedSecond, "chat wait did not return after repeated posts");
|
||||
|
||||
const waited = await waitPromise;
|
||||
assert.strictEqual(waited.exitCode, 0, waited.stderr);
|
||||
assert(waited.stdout.includes("second message"), waited.stdout);
|
||||
console.log("chat post/read/wait work\n");
|
||||
}
|
||||
|
||||
{
|
||||
console.log("Test 3: duplicate room create fails");
|
||||
const duplicate = await ctx.paseo(["chat", "create", "coord-room"]);
|
||||
assert.notStrictEqual(duplicate.exitCode, 0, "duplicate create should fail");
|
||||
const combined = `${duplicate.stdout}\n${duplicate.stderr}`;
|
||||
assert(combined.toLowerCase().includes("already exists"), combined);
|
||||
console.log("duplicate room create fails\n");
|
||||
}
|
||||
|
||||
{
|
||||
console.log("Test 4: chat delete works");
|
||||
const deleted = await ctx.paseo(["chat", "delete", "coord-room"]);
|
||||
assert.strictEqual(deleted.exitCode, 0, deleted.stderr);
|
||||
assert(deleted.stdout.includes("coord-room"), deleted.stdout);
|
||||
console.log("chat delete works\n");
|
||||
}
|
||||
} finally {
|
||||
await ctx.stop();
|
||||
await rm(ctx.paseoHome, { recursive: true, force: true });
|
||||
await rm(ctx.workDir, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
console.log("=== Chat Command Tests Passed ===");
|
||||
+2
-78
@@ -4,31 +4,7 @@ import assert from "node:assert";
|
||||
import { rm } from "node:fs/promises";
|
||||
import { createE2ETestContext } from "./helpers/test-daemon.ts";
|
||||
|
||||
function sleep(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
async function waitForLoopInList(
|
||||
ctx: Awaited<ReturnType<typeof createE2ETestContext>>,
|
||||
id: string,
|
||||
) {
|
||||
for (let attempt = 0; attempt < 20; attempt++) {
|
||||
const listed = await ctx.paseo(["loop", "ls", "--json"]);
|
||||
assert.strictEqual(listed.exitCode, 0, listed.stderr);
|
||||
const listedJson = JSON.parse(listed.stdout);
|
||||
assert(Array.isArray(listedJson), listed.stdout);
|
||||
if (listedJson.some((item: { id: string }) => item.id === id)) {
|
||||
return listedJson;
|
||||
}
|
||||
await sleep(250);
|
||||
}
|
||||
|
||||
const listed = await ctx.paseo(["loop", "ls", "--json"]);
|
||||
assert.strictEqual(listed.exitCode, 0, listed.stderr);
|
||||
return JSON.parse(listed.stdout);
|
||||
}
|
||||
|
||||
console.log("=== Loop And Schedule Command Tests ===\n");
|
||||
console.log("=== Schedule Command Tests ===\n");
|
||||
|
||||
const ctx = await createE2ETestContext({ timeout: 30000 });
|
||||
|
||||
@@ -171,62 +147,10 @@ try {
|
||||
assert.strictEqual(JSON.parse(deleted.stdout).id, createdJson.id);
|
||||
console.log("compatibility agent-target schedules remain deletable\n");
|
||||
}
|
||||
|
||||
{
|
||||
console.log("Test 2: loop run/ls/inspect/logs/stop work");
|
||||
const run = await ctx.paseo(
|
||||
[
|
||||
"loop",
|
||||
"run",
|
||||
"Return any response",
|
||||
"--name",
|
||||
"smoke-loop",
|
||||
"--verify-check",
|
||||
"true",
|
||||
"--json",
|
||||
],
|
||||
{ timeout: 30000 },
|
||||
);
|
||||
assert.strictEqual(run.exitCode, 0, run.stderr);
|
||||
const runJson = JSON.parse(run.stdout);
|
||||
assert.strictEqual(runJson.name, "smoke-loop");
|
||||
|
||||
const listedJson = await waitForLoopInList(ctx, runJson.id);
|
||||
assert(
|
||||
listedJson.some((item: { id: string }) => item.id === runJson.id),
|
||||
JSON.stringify(listedJson),
|
||||
);
|
||||
|
||||
async function pollStatus(attempt: number): Promise<string> {
|
||||
if (attempt >= 40) return "running";
|
||||
const inspect = await ctx.paseo(["loop", "inspect", runJson.id, "--json"]);
|
||||
assert.strictEqual(inspect.exitCode, 0, inspect.stderr);
|
||||
const inspectJson = JSON.parse(inspect.stdout);
|
||||
const current = inspectJson.status;
|
||||
if (current !== "running") {
|
||||
assert.strictEqual(current, "succeeded", inspect.stdout);
|
||||
return current;
|
||||
}
|
||||
await sleep(250);
|
||||
return pollStatus(attempt + 1);
|
||||
}
|
||||
const status = await pollStatus(0);
|
||||
assert.strictEqual(status, "succeeded");
|
||||
|
||||
const logs = await ctx.paseo(["loop", "logs", runJson.id], { timeout: 15000 });
|
||||
assert.strictEqual(logs.exitCode, 0, logs.stderr);
|
||||
assert(logs.stdout.includes("verify-check"), logs.stdout);
|
||||
|
||||
const stopped = await ctx.paseo(["loop", "stop", runJson.id, "--json"]);
|
||||
assert.strictEqual(stopped.exitCode, 0, stopped.stderr);
|
||||
const stoppedJson = JSON.parse(stopped.stdout);
|
||||
assert(["succeeded", "stopped"].includes(stoppedJson.status), stopped.stdout);
|
||||
console.log("loop commands work\n");
|
||||
}
|
||||
} finally {
|
||||
await ctx.stop();
|
||||
await rm(ctx.paseoHome, { recursive: true, force: true });
|
||||
await rm(ctx.workDir, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
console.log("=== Loop And Schedule Command Tests Passed ===");
|
||||
console.log("=== Schedule Command Tests Passed ===");
|
||||
Reference in New Issue
Block a user