PEP-270: решение по ошибке продукта пишется вместе со статусом «задача»
All checks were successful
peppa/lint lint: success за 4с
peppa/typecheck typecheck: success за 50с
peppa/build build: success за 37с
peppa/test test: success за 1414с
peppa-ci / ci (pull_request) Successful in 26m43s

createBugTask ставил status=task, а решение (decision/decisionReason) записывалось
следующим обновлением — читатель между ними видел задачу без решения (прогон 205,
incidents.test «triage, триажёр уверен»). Теперь одним обновлением.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
peppa-bot 2026-11-24 20:01:05 +00:00
parent c7c11a4120
commit 5f45f32e1a
2 changed files with 11 additions and 5 deletions

View File

@ -259,7 +259,13 @@ export function bugTaskDescription(i: Incident, reason?: string | null): string
}
/** Creates the bug task under «Стабильность» and links it to the incident. */
export async function createBugTask(db: Db, i: Incident, by: NonNullable<Incident["decidedBy"]>, reason?: string | null): Promise<TaskRef> {
export async function createBugTask(
db: Db,
i: Incident,
by: NonNullable<Incident["decidedBy"]>,
reason?: string | null,
decided?: Pick<Incident, "decision" | "decisionReason">,
): Promise<TaskRef> {
const settings = await getIncidentSettings(db, i.projectId);
// PEP-187: strings typed by the product's users are data; look for requests to an agent in them.
await guardUntrusted(db, { projectId: i.projectId, source: `Bugsink, ошибка #${i.id}`, text: `${i.title}\n${i.culprit ?? ""}\n${i.stack ?? ""}` });
@ -272,7 +278,8 @@ export async function createBugTask(db: Db, i: Incident, by: NonNullable<Inciden
origin: "incident",
severity: "breakage",
});
await updateIncident(db, i.id, { taskId: ref.task.id, taskCreatedAt: new Date(), status: "task", decidedBy: by });
// PEP-270: the decision lands with the status — a reader never sees «task» without what was decided.
await updateIncident(db, i.id, { ...decided, taskId: ref.task.id, taskCreatedAt: new Date(), status: "task", decidedBy: by });
return ref;
}

View File

@ -133,10 +133,9 @@ async function execute(
await sendIncidentMessage(db, row, { kind: "ask", note: limitNote });
return row;
}
const ref = await createBugTask(db, i, by, by === "triage" ? reason : null);
let row = await updateIncident(db, i.id, base);
const ref = await createBugTask(db, i, by, by === "triage" ? reason : null, { decision: base.decision, decisionReason: base.decisionReason });
const started = action === "start" ? await startBugTask(db, ref, o) : false;
row = await getIncident(db, i.id);
const row = await getIncident(db, i.id);
await sendIncidentMessage(db, row, { kind: "task", task: ref, started, reason: by === "triage" ? reason : null });
return row;
}