From 188287b60f60a65c9e40f632e8daabdd6bf6efd2 Mon Sep 17 00:00:00 2001 From: Tevin2119 <48298711+Tevin2119@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:38:52 +0000 Subject: [PATCH 1/2] feat(web): show board seat hand-offs and QA receipts --- .../web/src/components/delivery/BoardPage.tsx | 2 + .../src/components/delivery/TaskDetails.tsx | 22 ++- .../components/delivery/TaskSeatResults.tsx | 129 ++++++++++++++++++ .../components/delivery/TaskTeamActivity.tsx | 45 ++++-- .../web/src/components/delivery/taskParts.tsx | 36 +++++ .../delivery/useTaskConversation.ts | 4 +- apps/web/src/i18n/translations/de.json | 25 +++- apps/web/src/i18n/translations/en.json | 25 +++- apps/web/src/i18n/translations/es.json | 25 +++- apps/web/src/i18n/translations/fr.json | 25 +++- apps/web/src/i18n/translations/ja.json | 25 +++- apps/web/src/i18n/translations/ko.json | 25 +++- apps/web/src/i18n/translations/pt-BR.json | 25 +++- apps/web/src/i18n/translations/ru.json | 25 +++- apps/web/src/i18n/translations/sv.json | 25 +++- apps/web/src/i18n/translations/zh.json | 25 +++- apps/web/src/lib/delivery.logic.test.ts | 92 +++++++++++++ apps/web/src/lib/delivery.ts | 95 ++++++++++++- apps/web/src/lib/taskConversation.test.ts | 14 ++ apps/web/src/lib/taskConversation.ts | 57 ++++++-- 20 files changed, 708 insertions(+), 38 deletions(-) create mode 100644 apps/web/src/components/delivery/TaskSeatResults.tsx create mode 100644 apps/web/src/lib/delivery.logic.test.ts diff --git a/apps/web/src/components/delivery/BoardPage.tsx b/apps/web/src/components/delivery/BoardPage.tsx index 0184d612a770..fe7faa782404 100644 --- a/apps/web/src/components/delivery/BoardPage.tsx +++ b/apps/web/src/components/delivery/BoardPage.tsx @@ -67,6 +67,7 @@ import { CardSigns, laneTone, PriorityPill, + QaReceiptCounts, QaVotes, TagList, WaitingOn, @@ -172,6 +173,7 @@ const CardFace = memo(function CardFace(props: { {showsKinds ? null : } + diff --git a/apps/web/src/components/delivery/TaskDetails.tsx b/apps/web/src/components/delivery/TaskDetails.tsx index ce75ed34d3c4..574ceca0ea0d 100644 --- a/apps/web/src/components/delivery/TaskDetails.tsx +++ b/apps/web/src/components/delivery/TaskDetails.tsx @@ -50,7 +50,8 @@ import { time, WaitingOn, } from "./taskParts"; -import { TaskPipelineStrip } from "./TaskTeamActivity"; +import { TaskAcceptanceReceipts, TaskSeatHandoffs } from "./TaskSeatResults"; +import { TaskPipelineStrip, TaskTeamActivity } from "./TaskTeamActivity"; import { ThreadTaskQuestions } from "./ThreadTaskQuestions"; const TASK_ITEM = THREAD_DETAILS_ITEMS.find((item) => item.id === "task")!; @@ -498,6 +499,19 @@ function TaskDetailsBody(props: { readonly board: BoardTask; readonly task: Task )} + {task.council?.seats.some( + (seat) => seat.threadId || seat.seatThread || seat.attestedModel || seat.actualModel, + ) ? ( + + ) : null} + + ) : null} - + {task.qaReceipts === null ? ( + + ) : ( + + )} {task.files.length > 0 ? (

diff --git a/apps/web/src/components/delivery/TaskSeatResults.tsx b/apps/web/src/components/delivery/TaskSeatResults.tsx new file mode 100644 index 000000000000..c5e5d86ac7d8 --- /dev/null +++ b/apps/web/src/components/delivery/TaskSeatResults.tsx @@ -0,0 +1,129 @@ +import { sha256 } from "@noble/hashes/sha2"; +import { bytesToHex } from "@noble/hashes/utils"; +import { useGT } from "gt-react"; + +import { isWebUrl } from "../../browser/webUrl"; +import { repeatKeys, type TaskQaReceipt, type TaskSeatHandoff } from "../../lib/delivery"; +import { Badge } from "../ui/badge"; +import { Row } from "./taskParts"; + +export function TaskSeatHandoffs(props: { readonly handoffs: ReadonlyArray }) { + const gt = useGT(); + if (props.handoffs.length === 0) return null; + const stages = { build: gt("Build"), review: gt("Review"), qa: gt("QA") }; + return ( +
+

{gt("Seat hand-offs")}

+ {props.handoffs.map(({ stage, seat, state, reason }) => ( + + {state === "handed" ? gt("Handed to {seat}", { seat }) : null} + {state === "delivered" ? gt("Delivered by {seat}", { seat }) : null} + {state === "fallen-back" ? ( + + {reason + ? gt("Fell back to the pipeline ({reason})", { reason }) + : gt("Fell back to the pipeline")} + + ) : null} + + ))} +
+ ); +} + +function EvidenceRef({ reference }: { readonly reference: string }) { + return isWebUrl(reference) ? ( + + {reference} + + ) : ( + reference + ); +} + +function QaReceipt(props: { readonly receipt: TaskQaReceipt; readonly acceptanceHash: string }) { + const gt = useGT(); + const { acceptance, evidence, independenceChecked, model, modelSource, seat, verdict } = + props.receipt; + const verdicts = { pass: gt("Pass"), fail: gt("Fail"), blocked: gt("Blocked") }; + const variants = { pass: "success", fail: "destructive", blocked: "warning" } as const; + const sources = { attested: gt("Attested"), picked: gt("Picked"), requested: gt("Requested") }; + return ( +
  • +
    + {seat} + {verdicts[verdict]} +
    + {model || modelSource ? ( +

    + {model && modelSource + ? gt("{model} ({source})", { model, source: sources[modelSource] }) + : (model ?? (modelSource && sources[modelSource]))} +

    + ) : null} + {independenceChecked === false ? ( +

    {gt("Not independence-checked")}

    + ) : null} + {acceptance.hash && acceptance.hash.toLowerCase() !== props.acceptanceHash ? ( +

    {gt("Filed for earlier acceptance text")}

    + ) : null} + {evidence.length > 0 ? ( +
      + {repeatKeys(evidence).map((key, index) => ( +
    • + +
    • + ))} +
    + ) : null} +
  • + ); +} + +export function TaskAcceptanceReceipts(props: { + readonly acceptance: ReadonlyArray; + readonly receipts: ReadonlyArray; +}) { + const gt = useGT(); + if (props.acceptance.length === 0) return null; + const byItem = new Map(); + for (const receipt of props.receipts) { + const index = receipt.acceptance.index; + const group = byItem.get(index); + if (group) group.push(receipt); + else byItem.set(index, [receipt]); + } + return ( +
    +

    + {gt("Acceptance criteria")} +

    +
      + {repeatKeys(props.acceptance).map((key, index) => { + const value = props.acceptance[index]!; + const receipts = byItem.get(index); + const hash = receipts?.some((receipt) => receipt.acceptance.hash) + ? bytesToHex(sha256(new TextEncoder().encode(value)).subarray(0, 8)) + : ""; + return ( +
    1. + {value} + {receipts ? ( +
        + {receipts.map((receipt) => ( + + ))} +
      + ) : ( +

      {gt("No receipt")}

      + )} +
    2. + ); + })} +
    +
    + ); +} diff --git a/apps/web/src/components/delivery/TaskTeamActivity.tsx b/apps/web/src/components/delivery/TaskTeamActivity.tsx index 7e9936f7eb9b..ba2a1bb33104 100644 --- a/apps/web/src/components/delivery/TaskTeamActivity.tsx +++ b/apps/web/src/components/delivery/TaskTeamActivity.tsx @@ -126,14 +126,21 @@ function SeatRow(props: { readonly seat: CouncilSeat; readonly catalog: ReturnType; readonly conversations?: SeatConversations | undefined; + readonly openConversationLabel?: string | undefined; }) { const { seat, catalog, conversations } = props; const thread = conversations?.thread(seat.seat) ?? null; + const showOpenAction = thread !== null && props.openConversationLabel !== undefined; const m = useMessages(); const status = seatStatus(seat.activity); - const entry = entryForHarness(catalog.entries, seat.harness); + const actualModel = seat.attestedModel?.model ?? seat.actualModel; + const harness = + props.openConversationLabel !== undefined + ? (seat.attestedModel?.harness ?? seat.harness) + : seat.harness; + const entry = entryForHarness(catalog.entries, harness); const provider = catalog.providers.find((item) => item.instanceId === entry?.instanceId); - const fallback = driverOfHarness(seat.harness); + const fallback = driverOfHarness(harness); const driver = entry?.driverKind ?? (fallback ? ProviderDriverKind.make(fallback) : undefined); const live = isOrchestrationV2WorkActive(status); const timing = { @@ -149,6 +156,11 @@ function SeatRow(props: { ? "unavailable" : (seat.stage ?? threadRelationshipStatusLabel(status, m)); const latest = seat.live?.items.at(-1)?.text ?? null; + const seatName = ( + + {seat.seat} + + ); return (
  • } aria-current={sameThread(thread, conversations?.current ?? null) ? "true" : undefined} onClick={thread ? () => conversations?.open(thread) : undefined} @@ -175,9 +188,16 @@ function SeatRow(props: { providerEntries={catalog.entries} status={status} /> - - {seat.seat} - + {showOpenAction ? ( + + {seatName} + + {props.openConversationLabel} + + + ) : ( + seatName + )} {seat.activity}
    - {harnessLabel(seat.harness)}, {seat.requestedModel ?? "its own model"} + {harnessLabel(harness)},{" "} + {props.openConversationLabel !== undefined && actualModel + ? actualModel + : (seat.requestedModel ?? "its own model")} {seat.reasoning ? `, ${seat.reasoning}` : ""} {seat.access && seat.access !== "full" ? `, ${seat.access}` : ""} @@ -237,6 +260,7 @@ export function TaskTeamActivity(props: { readonly task: TaskView; readonly conversations?: SeatConversations | undefined; readonly flow?: boolean | undefined; + readonly conversationLabels?: { readonly title: string; readonly open: string } | undefined; }) { const { task } = props; const catalog = useSeatCatalog(props.environmentId); @@ -256,8 +280,10 @@ export function TaskTeamActivity(props: { )} 0 ? `${team} · ${running} running` : team} + headingId={`${props.conversationLabels ? "task-seats" : "task-team"}-${task.id}`} + title={ + props.conversationLabels?.title ?? (running > 0 ? `${team} · ${running} running` : team) + } data-task-roster > {task.council ? ( @@ -268,6 +294,7 @@ export function TaskTeamActivity(props: { seat={seat} catalog={catalog} conversations={props.conversations} + openConversationLabel={props.conversationLabels?.open} /> ))} diff --git a/apps/web/src/components/delivery/taskParts.tsx b/apps/web/src/components/delivery/taskParts.tsx index 2c391a9bad33..58fc18533eeb 100644 --- a/apps/web/src/components/delivery/taskParts.tsx +++ b/apps/web/src/components/delivery/taskParts.tsx @@ -10,6 +10,7 @@ import { SendIcon, UserIcon, } from "lucide-react"; +import { useGT } from "gt-react"; import type { ReactNode } from "react"; import { @@ -301,6 +302,41 @@ export function QaVotes(props: { readonly qa: DeliveryCard["qa"] }) { ); } +export function QaReceiptCounts({ receipts }: { readonly receipts: DeliveryCard["qaReceipts"] }) { + const gt = useGT(); + if (!receipts || receipts.count === 0) return null; + const { count, pass, fail, blocked } = receipts; + const summary = gt("QA receipts: {pass} pass, {fail} fail, {blocked} blocked", { + pass, + fail, + blocked, + }); + return ( + + + } + > + {gt("QA receipts ({count})", { count })} + + + {pass} + + {fail} + + {blocked} + + + {summary} + + ); +} + /** Who holds the task now: the seats working on it, or who it waits for. */ export function CardPeople(props: { readonly card: DeliveryCard }) { const { card } = props; diff --git a/apps/web/src/components/delivery/useTaskConversation.ts b/apps/web/src/components/delivery/useTaskConversation.ts index a2161fa1947f..78db19209344 100644 --- a/apps/web/src/components/delivery/useTaskConversation.ts +++ b/apps/web/src/components/delivery/useTaskConversation.ts @@ -8,6 +8,7 @@ import { openSeatThread, sameSeatView, sameThread, + seatChildrenWithAttestations, seatConversation, seatOfThread, steadySeatThread, @@ -91,7 +92,8 @@ export function useTaskConversation(environmentId: EnvironmentId | null, task: T const ref = conversation.kind === "thread" ? conversation.ref : null; const environment = useEnvironment(ref?.environmentId ?? null); const reachable = environment?.connection.phase === "connected"; - const children = useQuietThreadProjection(ref)?.projection.subagents ?? NO_CHILDREN; + const projected = useQuietThreadProjection(ref)?.projection.subagents ?? NO_CHILDREN; + const children = seatChildrenWithAttestations(ref, projected, task?.council?.seats); const { presentationById } = useEnvironments(); const ownConnection = (id: EnvironmentId) => { const own = presentationById.get(id); diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 1867d2a793c9..a35876c6772b 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -12942,5 +12942,28 @@ "99d51127f573296b": "Weiteres Konto", "8ec2c57414669b79": "Verbinde einen zweiten {tracker}-Workspace oder -Nutzer.", "99963c0142e17f00": "Für das neue {tracker}-Konto.", - "6d8e4ebc889bace9": "Konto hinzufügen" + "6d8e4ebc889bace9": "Konto hinzufügen", + "96a753f0cab1e537": "QA-Nachweise: {pass} bestanden, {fail} fehlgeschlagen, {blocked} blockiert", + "c9a52ce32ac4807a": "QA-Nachweise ({count})", + "4cd3a0ae6907eec5": "Überprüfung", + "7213e50013a80337": "QA", + "fda780ea06c8b245": "Rollenübergaben", + "2fb7ee5910642691": "An {seat} übergeben", + "77630b9bc43c4009": "Von {seat} abgeschlossen", + "581b6ce5cd838b40": "Zurück zum Ablauf ({reason})", + "45eebc3c16557469": "Zurück zum Ablauf", + "9f5ae188dadd7afc": "Bestanden", + "b977dd83a9fc1847": "Fehlgeschlagen", + "4dccb48528cb04d2": "Blockiert", + "acf45c3852a3e112": "Bestätigt", + "7974c56ac8f50e27": "Ausgewählt", + "0c94ae885a0dbf4a": "Angefordert", + "8bb0da6684fbeb66": "{model} ({source})", + "f948d1c3140b97bf": "Unabhängigkeit nicht geprüft", + "18941a9767f49cf9": "Für eine frühere Fassung des Kriteriums eingereicht", + "558a9d0b38fa9258": "Nachweise", + "e08c37434e7fbfbf": "Abnahmekriterien", + "867ed85dc890c39b": "Kein Nachweis", + "e930f65d1606dd38": "Unterhaltung öffnen", + "d8532b5c00f44081": "Rollen" } diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index eb8a39659475..ac7035a1250e 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -12951,5 +12951,28 @@ "99d51127f573296b": "Another account", "8ec2c57414669b79": "Connect a second {tracker} workspace or user.", "99963c0142e17f00": "For the new {tracker} account.", - "6d8e4ebc889bace9": "Add account" + "6d8e4ebc889bace9": "Add account", + "96a753f0cab1e537": "QA receipts: {pass} pass, {fail} fail, {blocked} blocked", + "c9a52ce32ac4807a": "QA receipts ({count})", + "4cd3a0ae6907eec5": "Review", + "7213e50013a80337": "QA", + "fda780ea06c8b245": "Seat hand-offs", + "2fb7ee5910642691": "Handed to {seat}", + "77630b9bc43c4009": "Delivered by {seat}", + "581b6ce5cd838b40": "Fell back to the pipeline ({reason})", + "45eebc3c16557469": "Fell back to the pipeline", + "9f5ae188dadd7afc": "Pass", + "b977dd83a9fc1847": "Fail", + "4dccb48528cb04d2": "Blocked", + "acf45c3852a3e112": "Attested", + "7974c56ac8f50e27": "Picked", + "0c94ae885a0dbf4a": "Requested", + "8bb0da6684fbeb66": "{model} ({source})", + "f948d1c3140b97bf": "Not independence-checked", + "18941a9767f49cf9": "Filed for earlier acceptance text", + "558a9d0b38fa9258": "Evidence", + "e08c37434e7fbfbf": "Acceptance criteria", + "867ed85dc890c39b": "No receipt", + "e930f65d1606dd38": "Open conversation", + "d8532b5c00f44081": "Seats" } diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 0ffca2cd3828..37baa43cbc66 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -12937,5 +12937,28 @@ "99d51127f573296b": "Otra cuenta", "8ec2c57414669b79": "Conecta un segundo espacio de trabajo o usuario de {tracker}.", "99963c0142e17f00": "Para la nueva cuenta de {tracker}.", - "6d8e4ebc889bace9": "Añadir cuenta" + "6d8e4ebc889bace9": "Añadir cuenta", + "96a753f0cab1e537": "Comprobantes de QA: {pass} aprobados, {fail} fallidos, {blocked} bloqueados", + "c9a52ce32ac4807a": "Comprobantes de QA ({count})", + "4cd3a0ae6907eec5": "Revisión", + "7213e50013a80337": "QA", + "fda780ea06c8b245": "Traspasos a roles", + "2fb7ee5910642691": "Traspasado a {seat}", + "77630b9bc43c4009": "Completado por {seat}", + "581b6ce5cd838b40": "Se volvió al flujo automático ({reason})", + "45eebc3c16557469": "Se volvió al flujo automático", + "9f5ae188dadd7afc": "Aprobado", + "b977dd83a9fc1847": "Fallido", + "4dccb48528cb04d2": "Bloqueado", + "acf45c3852a3e112": "Certificado", + "7974c56ac8f50e27": "Seleccionado", + "0c94ae885a0dbf4a": "Solicitado", + "8bb0da6684fbeb66": "{model} ({source})", + "f948d1c3140b97bf": "Independencia sin verificar", + "18941a9767f49cf9": "Registrado para una versión anterior del criterio", + "558a9d0b38fa9258": "Evidencias", + "e08c37434e7fbfbf": "Criterios de aceptación", + "867ed85dc890c39b": "Sin comprobante", + "e930f65d1606dd38": "Abrir conversación", + "d8532b5c00f44081": "Roles" } diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index dbf5e074cbce..2e1aa5dbfcb6 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -12942,5 +12942,28 @@ "99d51127f573296b": "Autre compte", "8ec2c57414669b79": "Connectez un second espace de travail ou utilisateur {tracker}.", "99963c0142e17f00": "Pour le nouveau compte {tracker}.", - "6d8e4ebc889bace9": "Ajouter un compte" + "6d8e4ebc889bace9": "Ajouter un compte", + "96a753f0cab1e537": "Résultats QA : {pass} réussis, {fail} échoués, {blocked} bloqués", + "c9a52ce32ac4807a": "Résultats QA ({count})", + "4cd3a0ae6907eec5": "Revue", + "7213e50013a80337": "QA", + "fda780ea06c8b245": "Passages de relais", + "2fb7ee5910642691": "Confié à {seat}", + "77630b9bc43c4009": "Terminé par {seat}", + "581b6ce5cd838b40": "Retour au flux automatique ({reason})", + "45eebc3c16557469": "Retour au flux automatique", + "9f5ae188dadd7afc": "Réussi", + "b977dd83a9fc1847": "Échoué", + "4dccb48528cb04d2": "Bloqué", + "acf45c3852a3e112": "Attesté", + "7974c56ac8f50e27": "Sélectionné", + "0c94ae885a0dbf4a": "Demandé", + "8bb0da6684fbeb66": "{model} ({source})", + "f948d1c3140b97bf": "Indépendance non vérifiée", + "18941a9767f49cf9": "Déposé pour une version antérieure du critère", + "558a9d0b38fa9258": "Éléments de preuve", + "e08c37434e7fbfbf": "Critères d’acceptation", + "867ed85dc890c39b": "Aucun résultat", + "e930f65d1606dd38": "Ouvrir la conversation", + "d8532b5c00f44081": "Rôles" } diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index c4d06e86beae..6096eb1e31aa 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -12883,5 +12883,28 @@ "99d51127f573296b": "別のアカウント", "8ec2c57414669b79": "2つ目の {tracker} ワークスペースまたはユーザーを接続します。", "99963c0142e17f00": "新しい {tracker} アカウント用です。", - "6d8e4ebc889bace9": "アカウントを追加" + "6d8e4ebc889bace9": "アカウントを追加", + "96a753f0cab1e537": "QA 記録:合格 {pass} 件、不合格 {fail} 件、ブロック {blocked} 件", + "c9a52ce32ac4807a": "QA 記録({count} 件)", + "4cd3a0ae6907eec5": "レビュー", + "7213e50013a80337": "QA", + "fda780ea06c8b245": "担当への引き継ぎ", + "2fb7ee5910642691": "{seat} に引き継ぎ済み", + "77630b9bc43c4009": "{seat} が完了", + "581b6ce5cd838b40": "パイプラインに戻りました({reason})", + "45eebc3c16557469": "パイプラインに戻りました", + "9f5ae188dadd7afc": "合格", + "b977dd83a9fc1847": "不合格", + "4dccb48528cb04d2": "ブロック中", + "acf45c3852a3e112": "確認済み", + "7974c56ac8f50e27": "選択済み", + "0c94ae885a0dbf4a": "要求済み", + "8bb0da6684fbeb66": "{model}({source})", + "f948d1c3140b97bf": "独立性未確認", + "18941a9767f49cf9": "変更前の合格基準に対する記録", + "558a9d0b38fa9258": "証拠", + "e08c37434e7fbfbf": "合格基準", + "867ed85dc890c39b": "記録なし", + "e930f65d1606dd38": "会話を開く", + "d8532b5c00f44081": "担当" } diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index 1a391f82bffd..ba70bb4ecc80 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -12879,5 +12879,28 @@ "99d51127f573296b": "다른 계정", "8ec2c57414669b79": "두 번째 {tracker} 워크스페이스 또는 사용자를 연결합니다.", "99963c0142e17f00": "새 {tracker} 계정용입니다.", - "6d8e4ebc889bace9": "계정 추가" + "6d8e4ebc889bace9": "계정 추가", + "96a753f0cab1e537": "QA 기록: 통과 {pass}건, 실패 {fail}건, 차단 {blocked}건", + "c9a52ce32ac4807a": "QA 기록 ({count}건)", + "4cd3a0ae6907eec5": "검토", + "7213e50013a80337": "QA", + "fda780ea06c8b245": "역할 인계", + "2fb7ee5910642691": "{seat}에 인계됨", + "77630b9bc43c4009": "{seat}에서 완료함", + "581b6ce5cd838b40": "파이프라인으로 복귀함 ({reason})", + "45eebc3c16557469": "파이프라인으로 복귀함", + "9f5ae188dadd7afc": "통과", + "b977dd83a9fc1847": "실패", + "4dccb48528cb04d2": "차단됨", + "acf45c3852a3e112": "확인됨", + "7974c56ac8f50e27": "선택됨", + "0c94ae885a0dbf4a": "요청됨", + "8bb0da6684fbeb66": "{model} ({source})", + "f948d1c3140b97bf": "독립성 검증 안 됨", + "18941a9767f49cf9": "이전 수락 기준을 대상으로 제출됨", + "558a9d0b38fa9258": "증거", + "e08c37434e7fbfbf": "수락 기준", + "867ed85dc890c39b": "기록 없음", + "e930f65d1606dd38": "대화 열기", + "d8532b5c00f44081": "역할" } diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 13ecc21a1a6c..f939c02c0f4e 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -12942,5 +12942,28 @@ "99d51127f573296b": "Outra conta", "8ec2c57414669b79": "Conecte um segundo espaço de trabalho ou usuário do {tracker}.", "99963c0142e17f00": "Para a nova conta do {tracker}.", - "6d8e4ebc889bace9": "Adicionar conta" + "6d8e4ebc889bace9": "Adicionar conta", + "96a753f0cab1e537": "Registros de QA: {pass} aprovados, {fail} reprovados, {blocked} bloqueados", + "c9a52ce32ac4807a": "Registros de QA ({count})", + "4cd3a0ae6907eec5": "Revisão", + "7213e50013a80337": "QA", + "fda780ea06c8b245": "Transferências para funções", + "2fb7ee5910642691": "Transferido para {seat}", + "77630b9bc43c4009": "Concluído por {seat}", + "581b6ce5cd838b40": "Retornou ao fluxo automático ({reason})", + "45eebc3c16557469": "Retornou ao fluxo automático", + "9f5ae188dadd7afc": "Aprovado", + "b977dd83a9fc1847": "Reprovado", + "4dccb48528cb04d2": "Bloqueado", + "acf45c3852a3e112": "Atestado", + "7974c56ac8f50e27": "Selecionado", + "0c94ae885a0dbf4a": "Solicitado", + "8bb0da6684fbeb66": "{model} ({source})", + "f948d1c3140b97bf": "Independência não verificada", + "18941a9767f49cf9": "Registrado para uma versão anterior do critério", + "558a9d0b38fa9258": "Evidências", + "e08c37434e7fbfbf": "Critérios de aceitação", + "867ed85dc890c39b": "Sem registro", + "e930f65d1606dd38": "Abrir conversa", + "d8532b5c00f44081": "Funções" } diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 0d5e2ce0aaae..b03f21caa0bc 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -12942,5 +12942,28 @@ "99d51127f573296b": "Другой аккаунт", "8ec2c57414669b79": "Подключите второе рабочее пространство или пользователя {tracker}.", "99963c0142e17f00": "Для нового аккаунта {tracker}.", - "6d8e4ebc889bace9": "Добавить аккаунт" + "6d8e4ebc889bace9": "Добавить аккаунт", + "96a753f0cab1e537": "Отчёты QA: успешно — {pass}, неуспешно — {fail}, заблокировано — {blocked}", + "c9a52ce32ac4807a": "Отчёты QA ({count})", + "4cd3a0ae6907eec5": "Проверка", + "7213e50013a80337": "QA", + "fda780ea06c8b245": "Передача этапов ролям", + "2fb7ee5910642691": "Передано роли {seat}", + "77630b9bc43c4009": "Выполнено ролью {seat}", + "581b6ce5cd838b40": "Возврат к конвейеру ({reason})", + "45eebc3c16557469": "Возврат к конвейеру", + "9f5ae188dadd7afc": "Успешно", + "b977dd83a9fc1847": "Неуспешно", + "4dccb48528cb04d2": "Заблокировано", + "acf45c3852a3e112": "Подтверждённая", + "7974c56ac8f50e27": "Выбранная", + "0c94ae885a0dbf4a": "Запрошенная", + "8bb0da6684fbeb66": "{model} ({source})", + "f948d1c3140b97bf": "Независимость не проверена", + "18941a9767f49cf9": "Отчёт подан для прежней формулировки критерия", + "558a9d0b38fa9258": "Доказательства", + "e08c37434e7fbfbf": "Критерии приёмки", + "867ed85dc890c39b": "Отчёта нет", + "e930f65d1606dd38": "Открыть разговор", + "d8532b5c00f44081": "Роли" } diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index 3f3b4dd717e5..e2c0bcadfcb6 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -12949,5 +12949,28 @@ "99d51127f573296b": "Ett konto till", "8ec2c57414669b79": "Anslut en andra {tracker}-arbetsyta eller användare.", "99963c0142e17f00": "För det nya {tracker}-kontot.", - "6d8e4ebc889bace9": "Lägg till konto" + "6d8e4ebc889bace9": "Lägg till konto", + "96a753f0cab1e537": "QA-resultat: {pass} godkända, {fail} underkända, {blocked} blockerade", + "c9a52ce32ac4807a": "QA-resultat ({count})", + "4cd3a0ae6907eec5": "Granskning", + "7213e50013a80337": "QA", + "fda780ea06c8b245": "Överlämningar till roller", + "2fb7ee5910642691": "Överlämnat till {seat}", + "77630b9bc43c4009": "Slutfört av {seat}", + "581b6ce5cd838b40": "Återgick till arbetsflödet ({reason})", + "45eebc3c16557469": "Återgick till arbetsflödet", + "9f5ae188dadd7afc": "Godkänt", + "b977dd83a9fc1847": "Underkänt", + "4dccb48528cb04d2": "Blockerat", + "acf45c3852a3e112": "Bekräftad", + "7974c56ac8f50e27": "Vald", + "0c94ae885a0dbf4a": "Begärd", + "8bb0da6684fbeb66": "{model} ({source})", + "f948d1c3140b97bf": "Oberoendet ej kontrollerat", + "18941a9767f49cf9": "Inlämnat för en tidigare version av kriteriet", + "558a9d0b38fa9258": "Underlag", + "e08c37434e7fbfbf": "Acceptanskriterier", + "867ed85dc890c39b": "Inget resultat", + "e930f65d1606dd38": "Öppna konversation", + "d8532b5c00f44081": "Roller" } diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 53ac0dbcf2eb..db198432e114 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -12961,5 +12961,28 @@ "99d51127f573296b": "其他账号", "8ec2c57414669b79": "连接第二个 {tracker} 工作区或用户。", "99963c0142e17f00": "用于新的 {tracker} 账号。", - "6d8e4ebc889bace9": "添加账号" + "6d8e4ebc889bace9": "添加账号", + "96a753f0cab1e537": "QA 记录:{pass} 项通过,{fail} 项失败,{blocked} 项受阻", + "c9a52ce32ac4807a": "QA 记录({count} 项)", + "4cd3a0ae6907eec5": "审查", + "7213e50013a80337": "QA", + "fda780ea06c8b245": "角色交接", + "2fb7ee5910642691": "已交给 {seat}", + "77630b9bc43c4009": "由 {seat} 完成", + "581b6ce5cd838b40": "已回退到流水线({reason})", + "45eebc3c16557469": "已回退到流水线", + "9f5ae188dadd7afc": "通过", + "b977dd83a9fc1847": "失败", + "4dccb48528cb04d2": "受阻", + "acf45c3852a3e112": "已证实", + "7974c56ac8f50e27": "已选定", + "0c94ae885a0dbf4a": "已请求", + "8bb0da6684fbeb66": "{model}({source})", + "f948d1c3140b97bf": "未核验独立性", + "18941a9767f49cf9": "针对旧版验收标准提交", + "558a9d0b38fa9258": "证据", + "e08c37434e7fbfbf": "验收标准", + "867ed85dc890c39b": "暂无记录", + "e930f65d1606dd38": "打开对话", + "d8532b5c00f44081": "角色" } diff --git a/apps/web/src/lib/delivery.logic.test.ts b/apps/web/src/lib/delivery.logic.test.ts new file mode 100644 index 000000000000..e70f9a19fdbd --- /dev/null +++ b/apps/web/src/lib/delivery.logic.test.ts @@ -0,0 +1,92 @@ +import { describe, expect, it } from "vite-plus/test"; + +import { parseTask } from "./delivery"; + +describe("task seat results", () => { + it("keeps hand-off, receipt, and model facts from the engine", () => { + const task = parseTask({ + id: "task-a0b1c2", + acceptance: ["First check", "Second check", "Third check"], + card: { qaReceipts: { count: 2, pass: 1, fail: 1, blocked: 0 } }, + council: { + seats: [ + { + seat: "qa", + harness: "claude", + threadId: "seat-thread", + seatThread: { environmentId: "remote", threadId: "seat-thread" }, + currentModel: { model: "gpt-6.2-sol", harness: "codex", source: "attested" }, + }, + ], + }, + handoffs: [ + { stage: "review", seat: "reviewer", state: "fallen-back", reason: "seat-failed" }, + { stage: "review", seat: "reviewer", state: "handed" }, + { stage: "build", seat: "builder", state: "delivered" }, + { stage: "qa", seat: "qa", state: "unexpected" }, + ], + qaReceipts: [ + { + seat: "qa", + acceptance: { index: 0, hash: "abc" }, + verdict: "pass", + modelSource: "attested", + model: "gpt-6.2-sol", + independenceChecked: true, + }, + { + seat: "qa", + acceptance: { index: 1 }, + verdict: "fail", + modelSource: "picked", + independenceChecked: false, + evidence: ["report.log", "https://example.com/evidence", {}], + }, + { seat: "qa", acceptance: { index: -1 }, verdict: "fail" }, + { seat: "qa", acceptance: {}, verdict: "blocked" }, + ], + }); + + expect(task?.council?.seats[0]).toMatchObject({ + threadId: "seat-thread", + seatThread: { environmentId: "remote", threadId: "seat-thread" }, + attestedModel: { harness: "codex", model: "gpt-6.2-sol" }, + }); + expect(task?.handoffs).toEqual([ + { stage: "review", seat: "reviewer", state: "fallen-back", reason: "seat-failed" }, + { stage: "build", seat: "builder", state: "delivered", reason: null }, + ]); + expect(task?.qaReceipts).toEqual([ + { + seat: "qa", + acceptance: { index: 0, hash: "abc" }, + verdict: "pass", + model: "gpt-6.2-sol", + modelSource: "attested", + independenceChecked: true, + evidence: [], + }, + { + seat: "qa", + acceptance: { index: 1, hash: null }, + verdict: "fail", + model: null, + modelSource: "picked", + independenceChecked: false, + evidence: ["report.log", "https://example.com/evidence"], + }, + ]); + expect(task?.card.qaReceipts).toEqual({ count: 2, pass: 1, fail: 1, blocked: 0 }); + }); + + it("distinguishes an older engine from a checklist with no receipts yet", () => { + const task = { id: "task-a0b1c2", card: {}, acceptance: ["First check"] }; + expect(parseTask(task)).toMatchObject({ + acceptance: ["First check"], + handoffs: [], + qaReceipts: null, + card: { qaReceipts: null }, + }); + expect(parseTask({ ...task, qaReceipts: [] })?.qaReceipts).toEqual([]); + }); +}); diff --git a/apps/web/src/lib/delivery.ts b/apps/web/src/lib/delivery.ts index 4900830d0f97..ad0c00079b42 100644 --- a/apps/web/src/lib/delivery.ts +++ b/apps/web/src/lib/delivery.ts @@ -1059,6 +1059,12 @@ export interface DeliveryCard { }>; readonly needed: number | null; } | null; + readonly qaReceipts: { + readonly count: number; + readonly pass: number; + readonly fail: number; + readonly blocked: number; + } | null; readonly findings: { readonly open: number; readonly all: number }; readonly approvals: ReadonlyArray<{ readonly actor: string; @@ -1322,6 +1328,14 @@ export const parseCard = (value: Json): DeliveryCard => { needed: typeof qa.needed === "number" ? qa.needed : null, } : null, + qaReceipts: isRecord(value.qaReceipts) + ? { + count: count(value.qaReceipts.count), + pass: count(value.qaReceipts.pass), + fail: count(value.qaReceipts.fail), + blocked: count(value.qaReceipts.blocked), + } + : null, findings: { open: count(findings.open), all: count(findings.all) }, approvals: records(value.approvals).map((approval) => ({ actor: text(approval.actor), @@ -1430,6 +1444,7 @@ export interface CouncilSeat { readonly required: boolean; readonly requestedModel: string | null; readonly actualModel: string | null; + readonly attestedModel?: { readonly model: string; readonly harness: string | null } | null; readonly reasoning: string | null; readonly access: string | null; readonly activity: string; @@ -1441,8 +1456,25 @@ export interface CouncilSeat { readonly attempts: number; /** What it is doing now, from its own output, while it works; null otherwise. */ readonly live: SeatLive | null; - /** The seat's own conversation as the engine records it, in the task's environment. */ readonly threadId: string | null; + readonly seatThread?: Pick | null; +} + +export interface TaskSeatHandoff { + readonly stage: "build" | "review" | "qa"; + readonly seat: string; + readonly state: "handed" | "delivered" | "fallen-back"; + readonly reason: string | null; +} + +export interface TaskQaReceipt { + readonly seat: string; + readonly acceptance: { readonly index: number; readonly hash: string | null }; + readonly verdict: "pass" | "fail" | "blocked"; + readonly model: string | null; + readonly modelSource: "attested" | "picked" | "requested" | null; + readonly independenceChecked: boolean | null; + readonly evidence: ReadonlyArray; } /** What a seat at work last did: the tools it called and what it said, newest last. */ @@ -1766,6 +1798,8 @@ export interface TaskView { readonly whole: boolean; }>; readonly council: TaskCouncil | null; + readonly handoffs: ReadonlyArray; + readonly qaReceipts: ReadonlyArray | null; readonly pendingFromPerson: number; /** Every publication of this task's approved runs, oldest first. */ readonly publications: ReadonlyArray; @@ -1813,6 +1847,61 @@ export function parseSeatLive(value: unknown): SeatLive | null { }; } +const parseSeatHandoffs = (value: unknown): ReadonlyArray => { + const handoffs = new Map(); + for (const { stage, seat, state, reason } of records(value)) { + if ( + (stage === "build" || stage === "review" || stage === "qa") && + (state === "handed" || state === "delivered" || state === "fallen-back") && + typeof seat === "string" && + seat && + !handoffs.has(stage) + ) { + handoffs.set(stage, { stage, seat, state, reason: textOrNull(reason) }); + } + } + return [...handoffs.values()]; +}; + +const parseQaReceipts = (value: unknown): ReadonlyArray | null => { + if (!Array.isArray(value)) return null; + const receipts: TaskQaReceipt[] = []; + for (const row of records(value)) { + const { verdict, modelSource } = row; + const acceptance = isRecord(row.acceptance) ? row.acceptance : null; + const seat = text(row.seat); + const index = acceptance?.index; + if ( + !seat || + typeof index !== "number" || + !Number.isSafeInteger(index) || + index < 0 || + (verdict !== "pass" && verdict !== "fail" && verdict !== "blocked") + ) + continue; + receipts.push({ + seat, + acceptance: { index, hash: textOrNull(acceptance?.hash) }, + verdict, + model: textOrNull(row.model), + modelSource: + modelSource === "attested" || modelSource === "picked" || modelSource === "requested" + ? modelSource + : null, + independenceChecked: + typeof row.independenceChecked === "boolean" ? row.independenceChecked : null, + evidence: strings(row.evidence), + }); + } + return receipts; +}; + +const parseAttestedModel = (value: unknown): NonNullable | null => { + if (!isRecord(value) || value.source !== "attested") return null; + const model = text(value.model); + return model ? { model, harness: textOrNull(value.harness) } : null; +}; + const parseCouncil = (council: Json): TaskCouncil => { const concurrency = isRecord(council.concurrency) ? council.concurrency : {}; return { @@ -1831,6 +1920,7 @@ const parseCouncil = (council: Json): TaskCouncil => { required: flag(seat.required), requestedModel: textOrNull(seat.requestedModel), actualModel: textOrNull(seat.actualModel), + attestedModel: parseAttestedModel(seat.currentModel), reasoning: textOrNull(seat.reasoning), access: textOrNull(seat.access), activity: text(seat.activity, "waiting"), @@ -1842,6 +1932,7 @@ const parseCouncil = (council: Json): TaskCouncil => { live: parseSeatLive(seat.live), // Blank is none: `ThreadId` refuses a blank id. threadId: text(seat.threadId).trim() || null, + seatThread: parseBoardThread(seat.seatThread), })), documents: [...new Set(strings(council.documents))], steers: records(council.steers).map((steer) => ({ @@ -2006,6 +2097,8 @@ export function parseTask(body: unknown): TaskView | null { whole: flag(child.whole), })), council: council ? parseCouncil(council) : null, + handoffs: parseSeatHandoffs(body.handoffs), + qaReceipts: parseQaReceipts(body.qaReceipts), pendingFromPerson: count(body.pendingFromPerson), publications: records(body.publications).flatMap((item) => parsePublication(item) ?? []), publishing: (() => { diff --git a/apps/web/src/lib/taskConversation.test.ts b/apps/web/src/lib/taskConversation.test.ts index c9c074bf16c2..20df59e91057 100644 --- a/apps/web/src/lib/taskConversation.test.ts +++ b/apps/web/src/lib/taskConversation.test.ts @@ -9,6 +9,7 @@ import { conversationState, queueWait, openSeatThread, + seatChildrenWithAttestations, seatConversation, seatOfThread, steadySeatThread, @@ -188,6 +189,19 @@ describe("a seat's conversation", () => { expect(seatConversation(ref, children, "remote-qa", reach(undefined, false))).toEqual( throughLink, ); + + const withAttestation = seatChildrenWithAttestations(ref, children, [ + { seat: "qa", seatThread: { environmentId: remote, threadId: "attested-qa" } }, + ]); + const attested = { environmentId: remote, threadId: id("attested-qa") }; + expect(seatConversation(ref, withAttestation, "qa", reach({ connected: true }, true))).toEqual( + attested, + ); + expect(openSeatThread(ref, withAttestation, attested, reach(undefined, true))).toEqual({ + ...attested, + linked: { viaEnvironmentId: ref.environmentId, label: remote }, + }); + expect(seatOfThread(ref, withAttestation, attested)).toBe("qa"); }); it("names the seat a child thread was given, telling two environments' threads apart", () => { diff --git a/apps/web/src/lib/taskConversation.ts b/apps/web/src/lib/taskConversation.ts index 8461ec450b23..580d46dba41f 100644 --- a/apps/web/src/lib/taskConversation.ts +++ b/apps/web/src/lib/taskConversation.ts @@ -6,7 +6,7 @@ import type { ScopedThreadRef } from "@t3tools/contracts"; import { EnvironmentId, ThreadId } from "@t3tools/contracts"; import { BOARD_LANE, boardLaneOf } from "./boardLanes"; -import type { DeliveryCard, TaskView } from "./delivery"; +import type { CouncilSeat, DeliveryCard, TaskView } from "./delivery"; /** * The one place that says which conversation is a task's: the thread the engine links it to @@ -90,6 +90,39 @@ interface SeatChild { readonly teamChat?: { readonly seat: string } | undefined; } +export function seatChildrenWithAttestations( + conversation: ScopedThreadRef | null, + children: ReadonlyArray, + seats: ReadonlyArray> | undefined, +): ReadonlyArray { + if (!conversation || !seats) return children; + const attested = seats.flatMap(({ seat, seatThread }): SeatChild[] => { + if (!seatThread) return []; + const target = { + environmentId: EnvironmentId.make(seatThread.environmentId), + threadId: ThreadId.make(seatThread.threadId), + }; + const latest = children.findLast( + (child) => + child.teamChat?.seat === seat && + (child.childThreadId !== null || child.remoteChild !== undefined), + ); + if (latest && isChildThread(conversation, latest, target)) { + return []; + } + return [ + target.environmentId === conversation.environmentId + ? { childThreadId: target.threadId, teamChat: { seat } } + : { + childThreadId: null, + remoteChild: { ...target, label: target.environmentId }, + teamChat: { seat }, + }, + ]; + }); + return attested.length ? [...children, ...attested] : children; +} + /** What places a seat that runs in a linked environment: see `subagentThreadTarget`. */ export interface SeatReach { readonly ownConnection: ( @@ -126,18 +159,11 @@ export function seatConversation( } // A thread id alone names no thread: the same id can exist in two environments. -const childOfThread = ( - conversation: ScopedThreadRef, - children: ReadonlyArray, - thread: ScopedThreadRef, -) => - children.find((item) => - item.childThreadId !== null - ? item.childThreadId === thread.threadId && - conversation.environmentId === thread.environmentId - : item.remoteChild?.threadId === thread.threadId && - item.remoteChild.environmentId === thread.environmentId, - ); +const isChildThread = (conversation: ScopedThreadRef, child: SeatChild, thread: ScopedThreadRef) => + child.childThreadId !== null + ? child.childThreadId === thread.threadId && conversation.environmentId === thread.environmentId + : child.remoteChild?.threadId === thread.threadId && + child.remoteChild.environmentId === thread.environmentId; /** * The seat a child thread was given, for the line above a seat conversation. A thread the engine @@ -150,7 +176,8 @@ export function seatOfThread( engineSeats: ReadonlyArray<{ readonly seat: string; readonly threadId: string | null }> = [], ): string | null { if (!conversation || !thread) return null; - const spawned = childOfThread(conversation, children, thread)?.teamChat?.seat; + const spawned = children.findLast((child) => isChildThread(conversation, child, thread))?.teamChat + ?.seat; if (spawned) return spawned; if (thread.environmentId !== conversation.environmentId) return null; return engineSeats.find((item) => item.threadId === thread.threadId)?.seat ?? null; @@ -164,7 +191,7 @@ export function openSeatThread( reach: SeatReach, ): SeatThread | null { if (!conversation || !thread) return thread; - const child = childOfThread(conversation, children, thread); + const child = children.findLast((child) => isChildThread(conversation, child, thread)); const target = child && subagentThreadTarget(child, conversation.environmentId, reach.ownConnection, reach.isLinked); From 8b22d78ce90420b12c5a6794166b2767f55722f6 Mon Sep 17 00:00:00 2001 From: Tevin2119 <48298711+Tevin2119@users.noreply.github.com> Date: Mon, 23 Nov 2026 22:51:03 +0000 Subject: [PATCH 2/2] fix(web): QA fixes for the seat hand-off panel Co-Authored-By: Claude Opus 5.5 --- .../src/components/delivery/TaskDetails.tsx | 2 +- .../components/delivery/TaskSeatResults.tsx | 2 +- apps/web/src/lib/delivery.logic.test.ts | 92 --------------- apps/web/src/lib/delivery.test.ts | 108 +++++++++++++++++- apps/web/src/lib/delivery.ts | 9 +- 5 files changed, 114 insertions(+), 99 deletions(-) delete mode 100644 apps/web/src/lib/delivery.logic.test.ts diff --git a/apps/web/src/components/delivery/TaskDetails.tsx b/apps/web/src/components/delivery/TaskDetails.tsx index 574ceca0ea0d..06647a4c4ffa 100644 --- a/apps/web/src/components/delivery/TaskDetails.tsx +++ b/apps/web/src/components/delivery/TaskDetails.tsx @@ -544,7 +544,7 @@ function TaskDetailsBody(props: { readonly board: BoardTask; readonly task: Task ) : null} {task.qaReceipts === null ? ( - + ) : ( )} diff --git a/apps/web/src/components/delivery/TaskSeatResults.tsx b/apps/web/src/components/delivery/TaskSeatResults.tsx index c5e5d86ac7d8..e403436c0b53 100644 --- a/apps/web/src/components/delivery/TaskSeatResults.tsx +++ b/apps/web/src/components/delivery/TaskSeatResults.tsx @@ -61,7 +61,7 @@ function QaReceipt(props: { readonly receipt: TaskQaReceipt; readonly acceptance : (model ?? (modelSource && sources[modelSource]))}

    ) : null} - {independenceChecked === false ? ( + {independenceChecked !== true ? (

    {gt("Not independence-checked")}

    ) : null} {acceptance.hash && acceptance.hash.toLowerCase() !== props.acceptanceHash ? ( diff --git a/apps/web/src/lib/delivery.logic.test.ts b/apps/web/src/lib/delivery.logic.test.ts deleted file mode 100644 index e70f9a19fdbd..000000000000 --- a/apps/web/src/lib/delivery.logic.test.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { describe, expect, it } from "vite-plus/test"; - -import { parseTask } from "./delivery"; - -describe("task seat results", () => { - it("keeps hand-off, receipt, and model facts from the engine", () => { - const task = parseTask({ - id: "task-a0b1c2", - acceptance: ["First check", "Second check", "Third check"], - card: { qaReceipts: { count: 2, pass: 1, fail: 1, blocked: 0 } }, - council: { - seats: [ - { - seat: "qa", - harness: "claude", - threadId: "seat-thread", - seatThread: { environmentId: "remote", threadId: "seat-thread" }, - currentModel: { model: "gpt-6.2-sol", harness: "codex", source: "attested" }, - }, - ], - }, - handoffs: [ - { stage: "review", seat: "reviewer", state: "fallen-back", reason: "seat-failed" }, - { stage: "review", seat: "reviewer", state: "handed" }, - { stage: "build", seat: "builder", state: "delivered" }, - { stage: "qa", seat: "qa", state: "unexpected" }, - ], - qaReceipts: [ - { - seat: "qa", - acceptance: { index: 0, hash: "abc" }, - verdict: "pass", - modelSource: "attested", - model: "gpt-6.2-sol", - independenceChecked: true, - }, - { - seat: "qa", - acceptance: { index: 1 }, - verdict: "fail", - modelSource: "picked", - independenceChecked: false, - evidence: ["report.log", "https://example.com/evidence", {}], - }, - { seat: "qa", acceptance: { index: -1 }, verdict: "fail" }, - { seat: "qa", acceptance: {}, verdict: "blocked" }, - ], - }); - - expect(task?.council?.seats[0]).toMatchObject({ - threadId: "seat-thread", - seatThread: { environmentId: "remote", threadId: "seat-thread" }, - attestedModel: { harness: "codex", model: "gpt-6.2-sol" }, - }); - expect(task?.handoffs).toEqual([ - { stage: "review", seat: "reviewer", state: "fallen-back", reason: "seat-failed" }, - { stage: "build", seat: "builder", state: "delivered", reason: null }, - ]); - expect(task?.qaReceipts).toEqual([ - { - seat: "qa", - acceptance: { index: 0, hash: "abc" }, - verdict: "pass", - model: "gpt-6.2-sol", - modelSource: "attested", - independenceChecked: true, - evidence: [], - }, - { - seat: "qa", - acceptance: { index: 1, hash: null }, - verdict: "fail", - model: null, - modelSource: "picked", - independenceChecked: false, - evidence: ["report.log", "https://example.com/evidence"], - }, - ]); - expect(task?.card.qaReceipts).toEqual({ count: 2, pass: 1, fail: 1, blocked: 0 }); - }); - - it("distinguishes an older engine from a checklist with no receipts yet", () => { - const task = { id: "task-a0b1c2", card: {}, acceptance: ["First check"] }; - expect(parseTask(task)).toMatchObject({ - acceptance: ["First check"], - handoffs: [], - qaReceipts: null, - card: { qaReceipts: null }, - }); - expect(parseTask({ ...task, qaReceipts: [] })?.qaReceipts).toEqual([]); - }); -}); diff --git a/apps/web/src/lib/delivery.test.ts b/apps/web/src/lib/delivery.test.ts index 646301b2482f..cb195d0ee11d 100644 --- a/apps/web/src/lib/delivery.test.ts +++ b/apps/web/src/lib/delivery.test.ts @@ -728,14 +728,116 @@ describe("parseTask", () => { card: card({}), council: { seats: [ - { seat: "builder", threadId: "thread-builder" }, - { seat: "qa", threadId: null }, - { seat: "reviewer", threadId: " " }, + { + seat: "builder", + threadId: "thread-builder", + seatThread: { environmentId: " remote ", threadId: " thread-builder " }, + }, + { seat: "qa", threadId: null, seatThread: { environmentId: " ", threadId: "qa" } }, + { + seat: "reviewer", + threadId: " ", + seatThread: { environmentId: "remote", threadId: " " }, + }, { seat: "lead" }, ], }, })?.council?.seats; expect(seats?.map((seat) => seat.threadId)).toEqual(["thread-builder", null, null, null]); + expect(seats?.map((seat) => seat.seatThread)).toEqual([ + { environmentId: "remote", threadId: "thread-builder", setBy: "", setAt: "" }, + null, + null, + null, + ]); + }); + + it("keeps hand-off, receipt, and model facts from the engine", () => { + const task = parseTask({ + id: "task-a0b1c2", + acceptance: ["First check", "Second check", "Third check"], + card: { qaReceipts: { count: 2, pass: 1, fail: 1, blocked: 0 } }, + council: { + seats: [ + { + seat: "qa", + harness: "claude", + threadId: "seat-thread", + seatThread: { environmentId: "remote", threadId: "seat-thread" }, + currentModel: { model: "gpt-6.2-sol", harness: "codex", source: "attested" }, + }, + ], + }, + handoffs: [ + { stage: "review", seat: "reviewer", state: "fallen-back", reason: "seat-failed" }, + { stage: "review", seat: "reviewer", state: "handed" }, + { stage: "build", seat: "builder", state: "delivered" }, + { stage: "qa", seat: "qa", state: "unexpected" }, + ], + qaReceipts: [ + { + seat: "qa", + acceptance: { index: 0, hash: "abc" }, + verdict: "pass", + modelSource: "attested", + model: "gpt-6.2-sol", + independenceChecked: true, + }, + { + seat: "qa", + acceptance: { index: 1 }, + verdict: "fail", + modelSource: "picked", + independenceChecked: false, + evidence: ["report.log", "https://example.com/evidence", {}], + }, + { seat: "qa", acceptance: { index: 0, hash: "old" }, verdict: "fail" }, + { seat: "qa", acceptance: { index: -1 }, verdict: "fail" }, + { seat: "qa", acceptance: {}, verdict: "blocked" }, + ], + }); + + expect(task?.council?.seats[0]).toMatchObject({ + threadId: "seat-thread", + seatThread: { environmentId: "remote", threadId: "seat-thread" }, + attestedModel: { harness: "codex", model: "gpt-6.2-sol" }, + }); + expect(task?.handoffs).toEqual([ + { stage: "review", seat: "reviewer", state: "fallen-back", reason: "seat-failed" }, + { stage: "build", seat: "builder", state: "delivered", reason: null }, + ]); + expect(task?.qaReceipts).toEqual([ + { + seat: "qa", + acceptance: { index: 0, hash: "abc" }, + verdict: "pass", + model: "gpt-6.2-sol", + modelSource: "attested", + independenceChecked: true, + evidence: [], + }, + { + seat: "qa", + acceptance: { index: 1, hash: null }, + verdict: "fail", + model: null, + modelSource: "picked", + independenceChecked: false, + evidence: ["report.log", "https://example.com/evidence"], + }, + ]); + expect(task?.card.qaReceipts).toEqual({ count: 2, pass: 1, fail: 1, blocked: 0 }); + }); + + it("distinguishes an older engine from a checklist with no receipts yet", () => { + const task = { id: "task-a0b1c2", card: {}, acceptance: ["First check"] }; + expect(parseTask(task)).toMatchObject({ + acceptance: ["First check"], + handoffs: [], + qaReceipts: null, + card: { qaReceipts: null }, + }); + expect(parseTask({ ...task, qaReceipts: [] })?.qaReceipts).toEqual([]); }); it("names the one mirrored environment only on an engine that is not source-scoped", () => { diff --git a/apps/web/src/lib/delivery.ts b/apps/web/src/lib/delivery.ts index 256c80f36876..b544d08a6af7 100644 --- a/apps/web/src/lib/delivery.ts +++ b/apps/web/src/lib/delivery.ts @@ -949,8 +949,8 @@ export interface BoardThreadLink { export function parseBoardThread(value: unknown): BoardThreadLink | null { if (!isRecord(value)) return null; - const environmentId = text(value.environmentId); - const threadId = text(value.threadId); + const environmentId = text(value.environmentId).trim(); + const threadId = text(value.threadId).trim(); return environmentId && threadId ? { environmentId, threadId, setBy: text(value.setBy), setAt: text(value.setAt) } : null; @@ -1866,6 +1866,7 @@ const parseSeatHandoffs = (value: unknown): ReadonlyArray => { const parseQaReceipts = (value: unknown): ReadonlyArray | null => { if (!Array.isArray(value)) return null; const receipts: TaskQaReceipt[] = []; + const seen = new Set(); for (const row of records(value)) { const { verdict, modelSource } = row; const acceptance = isRecord(row.acceptance) ? row.acceptance : null; @@ -1879,6 +1880,10 @@ const parseQaReceipts = (value: unknown): ReadonlyArray | null => (verdict !== "pass" && verdict !== "fail" && verdict !== "blocked") ) continue; + // The engine serves receipts newest first. + const key = `${index}:${seat}`; + if (seen.has(key)) continue; + seen.add(key); receipts.push({ seat, acceptance: { index, hash: textOrNull(acceptance?.hash) },