From ac2881a6a65aa7cc752bd9bbe2ebe62d038928ac Mon Sep 17 00:00:00 2001 From: peppa-bot Date: Tue, 17 Nov 2026 21:32:56 +0500 Subject: [PATCH] =?UTF-8?q?PEP-198:=20=D1=87=D0=B0=D1=81=D1=82=D1=8C=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=B1=D0=B8=D0=B2=D0=BA=D0=B8=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B4=D0=B0=D1=87=D0=B8=20=D1=87=D0=B5=D0=BB=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D0=BA=D0=B0=20=E2=80=94=20=C2=AB=D0=B3=D0=BE=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=C2=BB=20=D1=81=D1=80=D0=B0=D0=B7=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- packages/core/src/ready-digest.ts | 7 +++++-- packages/testkit/test/one-analyst.test.ts | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/core/src/ready-digest.ts b/packages/core/src/ready-digest.ts index f09f4a5c..9a15ebe5 100644 --- a/packages/core/src/ready-digest.ts +++ b/packages/core/src/ready-digest.ts @@ -10,11 +10,14 @@ import { formatTaskKey } from "@peppa/shared"; import { questionType, type MessageType } from "./questions.ts"; import { getSetting, setSetting } from "./settings.ts"; import { COMMENT_EVENT } from "./tasks.ts"; +import { splitParent } from "./task-decisions.ts"; -/** Does a person wait for this story (its «готово» goes at once)? */ -export async function taskAwaited(db: Db, taskId: number): Promise { +/** Does a person wait for this story (its «готово» goes at once)? A part of a split — when its first story is awaited. */ +export async function taskAwaited(db: Db, taskId: number, depth = 0): Promise { const [t] = await db.select({ origin: tasks.origin }).from(tasks).where(eq(tasks.id, taskId)); if (!t || t.origin === "human") return true; + const parent = depth < 3 ? await splitParent(db, taskId) : null; + if (parent && (await taskAwaited(db, parent, depth + 1))) return true; const [e] = await db .select({ id: events.id }) .from(events) diff --git a/packages/testkit/test/one-analyst.test.ts b/packages/testkit/test/one-analyst.test.ts index 1bf06305..8d081f26 100644 --- a/packages/testkit/test/one-analyst.test.ts +++ b/packages/testkit/test/one-analyst.test.ts @@ -124,6 +124,10 @@ describe("Готовые задачи сводкой", () => { // A comment makes the owner wait for the story: its «готово» goes at once. await core.addStoryComment(db, await core.resolveTask(db, a.key), owner, "Жду это"); assert.equal(await heldForDigest(db, open.find((q) => q.taskId === a.task.id)!, "review"), false); + // A part of a split of the owner's own story is awaited like the story itself. + const part = await core.createTask(db, { projectId: p.id, title: "Часть разбивки", origin: "analyst" }); + await core.markSplitPart(db, part.task.id, human.task.id); + assert.equal(await core.taskAwaited(db, part.task.id), true); delete process.env.PEPPA_READY_DIGEST; }); });