PEP-198: тесты под голос Аналитика

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
peppa-bot 2026-11-17 21:30:16 +05:00
parent 812e3c9341
commit 575c31ac42
3 changed files with 17 additions and 17 deletions

View File

@ -320,14 +320,7 @@ export const asIs = (text: string | null | undefined): string => (text ? `${AS_I
* left" matching rewrites free sentences («Сделано три задачи из пяти.»).
*/
export const ROLE_MESSAGE_KEYS: readonly string[] = [
"Аналитик",
"Продакт", // old messages of the product role (before PEP-198)
"Агент",
"Агент {name}",
"Завёл в бэклог:",
"Посмотрел рабочую версию: {url}",
"Посмотрел версию для проверки: {url}",
// PEP-198: one voice — the analyst; the acceptance agent's findings come through it.
// PEP-198: one voice — the analyst; the acceptance agent's findings come through it. First: «Агент {name}» below would take them.
"Агент приёмки",
"Агент приёмки посмотрел рабочую версию: {url}",
"Агент приёмки посмотрел версию для проверки: {url}",
@ -337,6 +330,13 @@ export const ROLE_MESSAGE_KEYS: readonly string[] = [
"За день готовы задачи: {n}. Примите их или напишите, что поправить.",
"Где посмотреть: {url}",
"Задача {key} задерживается на нашей стороне. От вас ничего не нужно — мы уже разбираемся.",
"Аналитик",
"Продакт", // old messages of the product role (before PEP-198)
"Агент",
"Агент {name}",
"Завёл в бэклог:",
"Посмотрел рабочую версию: {url}",
"Посмотрел версию для проверки: {url}",
"Как пользоваться:",
"Пока не настоящее:",
"Чтобы заработало по-настоящему, нужно от вас:",

View File

@ -70,18 +70,18 @@ describe("PEP-138: AI roles' messages in the reader's language", () => {
setScenario({});
});
test("Scenario: Сообщение продакта после приёмки на английском", async () => {
test("Scenario: Находки агента приёмки — от Аналитика, на английском (PEP-198)", async () => {
const text = core.productReviewMessage(
{ summary: "Продукт показывает список стажировок.", howto: ["Откройте адрес.", "Нажмите «Найти»."], notReal: ["Ответы — вымышленные примеры."], needs: [], stories: [] },
{ env: "staging", url: "https://demo-staging.telecom.quest", openNeeds: [{ ...need, open: true }], filed: ["DEMO-9 «Убрать служебное поле»"], webUrl: "http://peppa.test", projectKey: "DEMO" },
);
await runner.sayInDiscussion(db, project, chat.id, text, core.PRODUCT_AGENT_NAME);
const en = web("en", (await last()).text).split("\n");
assert.equal(en[0], "Looked at the review version: https://demo-staging.telecom.quest");
assert.equal(en[0], "The acceptance agent looked at the version to check: https://demo-staging.telecom.quest");
for (const line of ["How to use it:", "Not real yet:", "To make it work for real, we need from you:", " Where to get it: console.anthropic.com → API Keys", "Paste it or tick «Done» in the «Your product» card: http://peppa.test/p/DEMO", "Added improvements to the backlog:"]) assert.ok(en.includes(line), `${line}\n— in —\n${en.join("\n")}`);
assert.ok(en.includes("Продукт показывает список стажировок."), "the model's own text is left as written");
assert.match((await lastTelegram()).text, /Демо<\/b> · Product:\nLooked at the review version:[^]*\nПродукт показывает список стажировок\./);
assert.equal(web("en", core.productReviewMessage({ summary: "Ок.", howto: [], notReal: [], needs: [], stories: [] }, { env: "prod", url: "https://demo-prod.telecom.quest", openNeeds: [], filed: [], webUrl: "", projectKey: "DEMO" })), "Looked at the live version: https://demo-prod.telecom.quest\n\nОк.");
assert.match((await lastTelegram()).text, /Демо<\/b> · Analyst:\nThe acceptance agent looked at the version to check:[^]*\nПродукт показывает список стажировок\./);
assert.equal(web("en", core.productReviewMessage({ summary: "Ок.", howto: [], notReal: [], needs: [], stories: [] }, { env: "prod", url: "https://demo-prod.telecom.quest", openNeeds: [], filed: [], webUrl: "", projectKey: "DEMO" })), "The acceptance agent looked at the working version: https://demo-prod.telecom.quest\n\nОк.");
});
test("Scenario: Список нужного от владельца на казахском", () => {

View File

@ -235,7 +235,7 @@ describe("PEP-112: смена секрета перезапускает прод
});
});
describe("PEP-112: продакт-агент принимает выкаченный продукт", () => {
describe("PEP-112: агент приёмки принимает выкаченный продукт", () => {
test("Scenario: Приёмка после выкатки — сообщение, потребность, стори-доработка; Тот же коммит повторно не проверяется", async () => {
page = DEMO_PAGE;
const p = await proj();
@ -258,8 +258,8 @@ describe("PEP-112: продакт-агент принимает выкаченн
const talk = await chatOf(p.id);
assert.equal(talk.length, 1);
assert.deepEqual([talk[0]!.kind, talk[0]!.who], ["agent", "Продакт"]);
assert.match(talk[0]!.text, /Посмотрел версию для проверки: https:\/\/staging\.mock\.test/);
assert.deepEqual([talk[0]!.kind, talk[0]!.who], ["agent", "Аналитик"], "PEP-198: the findings come from the analyst");
assert.match(talk[0]!.text, /Агент приёмки посмотрел версию для проверки: https:\/\/staging\.mock\.test/);
assert.match(talk[0]!.text, /Как пользоваться:\n1\. Откройте адрес продукта/);
assert.match(talk[0]!.text, /Пока не настоящее:\n• Демо-режим: показаны вымышленные примеры/);
assert.match(talk[0]!.text, /Чтобы заработало по-настоящему, нужно от вас:\n• Ключ сервиса — без него показаны примеры/);
@ -271,7 +271,7 @@ describe("PEP-112: продакт-агент принимает выкаченн
assert.equal(filed.status, "backlog");
assert.equal(filed.proposed, true, "PEP-197: a story of the acceptance agent waits in «Предложено»");
assert.equal(filed.origin, "acceptance");
assert.match(filed.description ?? "", /Заведено продакт-агентом на приёмке/);
assert.match(filed.description ?? "", /Заведено агентом приёмки/);
assert.equal((await core.getIntakeState(db, filed.id))?.stage, "done", "already formulated: the intake roles skip it");
const review = (await core.lastProductReview(db, p.id))!;
assert.deepEqual([review.env, review.sha, review.howto.length, review.notReal.length], ["staging", "abc1234", 2, 1]);
@ -303,7 +303,7 @@ describe("PEP-112: продакт-агент принимает выкаченн
await tick();
const talk = await chatOf(p.id);
assert.equal(talk.length, 2);
assert.match(talk[1]!.text, /Посмотрел рабочую версию/);
assert.match(talk[1]!.text, /Агент приёмки посмотрел рабочую версию/);
assert.ok(!/Пока не настоящее/.test(talk[1]!.text));
assert.equal((await core.openNeeds(db, p.id)).length, 0, "the product agent's item is gone with the demo notice");
assert.equal((await core.listTasks(db, { projectId: p.id })).length, storiesBefore, "the «токен» story is not filed twice");