From 4dec8247a268ac83fee7e6d86d8e85160857c422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=81=D0=B5=D0=BB=D1=8C?= Date: Mon, 16 Nov 2026 12:47:00 +0500 Subject: [PATCH] =?UTF-8?q?PEP-149:=20=C2=ABproduct=20released=C2=BB=20and?= =?UTF-8?q?=20=C2=ABbacklog=20is=20empty=C2=BB=20notices=20ask=20nothing?= =?UTF-8?q?=20=E2=80=94=20no=20answer=20form;=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.2 --- apps/web/components/cards.tsx | 6 ++++-- packages/testkit/test/agent-messages.test.ts | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/web/components/cards.tsx b/apps/web/components/cards.tsx index 47eb7afe..148c1594 100644 --- a/apps/web/components/cards.tsx +++ b/apps/web/components/cards.tsx @@ -1,7 +1,7 @@ // Domain cards shared by pages: agent questions, runners, project list. import Link from "next/link"; import { BellRing, CircleCheck, CircleHelp, FileCheck, Hourglass, Play, RotateCcw, Send, ShieldQuestion, Square, SquareTerminal } from "lucide-react"; -import { questionState, type Project, type Question, type SessionView, type StepView } from "@peppa/core"; +import { questionState, questionType, type Project, type Question, type SessionView, type StepView } from "@peppa/core"; import { db } from "@/lib/db"; import { SubscriptionName } from "@/components/SubscriptionName"; import { answerQuestion, messageSession, resumeTaskSession, stopTaskSession } from "@/app/(app)/actions"; @@ -37,6 +37,7 @@ export async function QuestionCard({ q, taskKey, taskStatus, back, compact = fal const t = await getT(); const review = q.kind === "attention" && taskStatus === "review"; const answered = !!q.answeredAt; + const notice = questionType(q, taskStatus) === null && q.taskId == null && q.sessionId == null; // PEP-149: a factory message with answers to choose from is a question for the person. const k = KIND[q.kind === "attention" && !review && q.options?.length ? "question" : q.kind]; const Icon = review ? CircleCheck : k.icon; @@ -71,12 +72,13 @@ export async function QuestionCard({ q, taskKey, taskStatus, back, compact = fal

{t("Повторов: {n} · первое сообщение {ago}", { n: state.repeats, ago: ago(q.createdAt, t) })}

)} + {/* PEP-149: a notice about the product as a whole (released, backlog is empty) asks nothing — no answer form. */} {answered ? (

{q.answeredVia === "system" ? : } {q.answeredVia === "system" ? t.text(q.answer) : t("Ответ ({via}): {answer}", { via: q.answeredVia, answer: q.answer })}

- ) : ( + ) : notice ? null : (
diff --git a/packages/testkit/test/agent-messages.test.ts b/packages/testkit/test/agent-messages.test.ts index 473f241d..48b51672 100644 --- a/packages/testkit/test/agent-messages.test.ts +++ b/packages/testkit/test/agent-messages.test.ts @@ -130,6 +130,21 @@ describe("Тип сообщения определяет маршрут", () => assert.equal(core.questionEvent(failure, { taskStatus: "review" }), "review"); }); + test("Сообщения «продукт обновлён» и «бэклог пуст» — не вопросы", async () => { + const tp = await project({ turns: [] }); + const p = await core.getProject(db, tp.key); + for (const text of ["🚀 Shop: ваш продукт обновлён и открыт для всех", "📭 Shop: все задачи сделаны, бэклог пуст — агентам нечего делать."]) { + const q = await core.askPmProject(db, p, { kind: "attention", text }); + assert.equal(q.msgType, null); + assert.equal(core.needsPerson(q), false, "not in «Ждут вашего ответа», not counted, no push"); + // Telegram: a plain notice — no buttons to press. + assert.deepEqual(renderQuestion(q, { taskKey: null, taskTitle: null, session: null, webUrl: "http://peppa.test" }).buttons, []); + } + // The offer to release has an answer to choose: it is a question. + const offer = await core.askPmProject(db, p, { kind: "question", text: "Показать всем?", options: ["🚀 Показать всем"] }); + assert.equal(core.needsPerson(offer), true); + }); + test("Счётчик открытых вопросов чата считает только вопросы", async () => { const tp = await project({ turns: [] }); const p = await core.getProject(db, tp.key);