PEP-248: тест ревьюера ждёт подробности карточки «готово» — они пишутся сразу после сообщения
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
738495afc2
commit
ce70d764cb
@ -84,6 +84,12 @@ async function reviewTask(turns: Action[][], settings?: Parameters<typeof core.s
|
||||
const toReview: Action = { mcp: "update_task", args: { task: "1", status: "review" } };
|
||||
/** PEP-152: the reviewer's note is technical — it is in the details of «готово», not in its main text. */
|
||||
const cardDetails = async (q: { id: number }) => (await core.messageDetails(db, [q.id])).get(q.id) ?? "";
|
||||
/** The details are written right after the message (by the agent's MCP process): wait for them, then check. */
|
||||
const cardDetailsMatch = async (q: { id: number }, re: RegExp) => {
|
||||
let last = "";
|
||||
await waitFor("card details", async () => re.test((last = stripAsIs(await cardDetails(q)))), 10000).catch(() => {});
|
||||
assert.match(last, re);
|
||||
};
|
||||
const readyQuestions = async (t: ReviewTask) => (await core.pendingQuestions(db, t.proj.id)).filter((q) => q.kind === "attention" && q.text.includes("готова к ревью"));
|
||||
const stopAll = async (t: ReviewTask) => {
|
||||
for (const s of await core.listSessions(db, { active: true, taskId: (await t.ref()).task.id })) await runner.stopSession(db, s.id);
|
||||
@ -122,7 +128,7 @@ describe("Агент-ревьюер до ревью PM", () => {
|
||||
return qs.length ? qs : null;
|
||||
});
|
||||
assert.equal((await t.ref()).task.status, "review");
|
||||
assert.match(stripAsIs(await cardDetails(q!)), /Ревьюер: ок — деление и ошибка на ноль сделаны, тесты есть/);
|
||||
await cardDetailsMatch(q!, /Ревьюер: ок — деление и ошибка на ноль сделаны, тесты есть/);
|
||||
assert.ok(await runner.isReviewQuestion(db, q!), "«Принять» works on it");
|
||||
// Exactly one ready-for-review, whichever finished first (the agent's turn or the reviewer).
|
||||
await new Promise((r) => setTimeout(r, 1500));
|
||||
@ -148,7 +154,7 @@ describe("Агент-ревьюер до ревью PM", () => {
|
||||
return qs.length ? qs : null;
|
||||
});
|
||||
assert.equal((await t.ref()).task.status, "review");
|
||||
assert.match(await cardDetails(q!), /лимит итераций исчерпан[\s\S]*src\/divide\.ts — замечание 2/);
|
||||
await cardDetailsMatch(q!, /лимит итераций исчерпан[\s\S]*src\/divide\.ts — замечание 2/);
|
||||
assert.equal(calls().length, 0, "the reviewer was not called again");
|
||||
await stopAll(t);
|
||||
});
|
||||
@ -162,7 +168,7 @@ describe("Агент-ревьюер до ревью PM", () => {
|
||||
return qs.length ? qs : null;
|
||||
});
|
||||
assert.equal((await t.ref()).task.status, "review");
|
||||
assert.match(await cardDetails(q!), /Ревьюер не отработал: ревьюер завершился с кодом 1/);
|
||||
await cardDetailsMatch(q!, /Ревьюер не отработал: ревьюер завершился с кодом 1/);
|
||||
assert.equal((await core.latestReview(db, (await t.ref()).task.id))?.state, "error");
|
||||
await stopAll(t);
|
||||
});
|
||||
@ -204,7 +210,7 @@ describe("reviewer details", () => {
|
||||
assert.equal(done.error, "ревьюер ответил не по формату");
|
||||
// No runner: the PM gets "ready for review" directly.
|
||||
assert.equal((await t.ref()).task.status, "review");
|
||||
assert.match(await cardDetails((await readyQuestions(t))[0]!), /Ревьюер не отработал: ревьюер ответил не по формату/);
|
||||
await cardDetailsMatch((await readyQuestions(t))[0]!, /Ревьюер не отработал: ревьюер ответил не по формату/);
|
||||
|
||||
// Approved head → asking again goes straight to review with the note.
|
||||
await core.updateTask(db, await t.ref(), { status: "in_progress" });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user