From 4a9f643b079d69c43c44a3baddbf637965a42e30 Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Sun, 29 Nov 2026 13:07:34 +0800 Subject: [PATCH 01/13] feat(models): keep service capability detail folded in the service form Selecting many models in the add-service form expanded every capability card, so a single screen held one or two models while the user only wanted to know whether the service answers. Fold the availability and capability detail behind a per-row summary, keep the test result on the row, and drop the duplicated fetch status line and the selection filter from this dense form. Refs #574 --- src/canvas/ModelPicker.tsx | 41 +++++++++++++++------- src/canvas/ModelServiceForm.tsx | 48 +++++++++++++++----------- src/canvas/model-settings.css | 15 ++++++++ src/i18n/messages/en-US/models.ts | 1 + src/i18n/messages/zh-CN/models.ts | 1 + tests/browser/capability_discovery.mjs | 9 +++++ tests/browser/higgsfield_open.mjs | 1 + tests/browser/kling_video.mjs | 7 ++++ tests/browser/provider_settings.mjs | 19 ++++++++-- 9 files changed, 107 insertions(+), 35 deletions(-) diff --git a/src/canvas/ModelPicker.tsx b/src/canvas/ModelPicker.tsx index eb5ded86e..75ff3a533 100644 --- a/src/canvas/ModelPicker.tsx +++ b/src/canvas/ModelPicker.tsx @@ -23,6 +23,7 @@ export function ModelPicker({ onTest, results, renderDetails, + compact = false, }: { modelPlaceholder: string; available: string[]; @@ -38,6 +39,9 @@ export function ModelPicker({ onTest?: (id: string) => void; results: Record; renderDetails?: (id: string) => ReactNode; + /** Denser form layout: the count row carries the fetch result and the + selection filter stays out of the way. */ + compact?: boolean; }) { const t = useT(); const manualFieldId = useId(); @@ -55,6 +59,11 @@ export function ModelPicker({ ); const allSelected = visible.length > 0 && visible.every((id) => selected.includes(id)); + // The count row only exists for longer lists; without it the status line is + // the only fetch feedback and must stay. + const denseCount = compact && ids.length > 4; + const redundantStatus = + denseCount && loaded && !loading && !error && available.length > 0; const fetchLabel = loadsPreset ? "models.service.loadSupportedModels" : loaded ? "generation.picker.refresh" : "generation.picker.fetch"; @@ -119,9 +128,13 @@ export function ModelPicker({ -
- {status &&

{status}

} -
+ {/* The dense form shows the fetch result in the count row, so only a + pending, empty or failed fetch keeps its own status line. */} + {(!compact || !redundantStatus) && ( +
+ {status &&

{status}

} +
+ )} {error && (

{error} @@ -186,18 +199,22 @@ export function ModelPicker({ onChange={(event) => setQuery(event.target.value)} /> - + {!compact && ( + + )}

- {t("generation.picker.count", { count: visible.length })} + {denseCount && loaded && !loading && !error && available.length + ? t("generation.picker.fetched", { count: visible.length }) + : t("generation.picker.count", { count: visible.length })} + )} + + {children} + + ); +} diff --git a/src/canvas/ModelServiceForm.tsx b/src/canvas/ModelServiceForm.tsx index 724448c9c..b23f54832 100644 --- a/src/canvas/ModelServiceForm.tsx +++ b/src/canvas/ModelServiceForm.tsx @@ -1,4 +1,3 @@ -import { DraftAvailabilityCheck } from "./DraftAvailabilityCheck"; import { ProviderPicker } from "./ProviderPicker"; import { useId, useLayoutEffect, useState, type FormEvent, type Ref } from "react"; import { errorMessage } from "../backend/api.ts"; @@ -16,6 +15,7 @@ import { type ModelKind, } from "../backend/rules.ts"; import { ModelCapabilityCard } from "./ModelCapabilityCard"; +import { ModelRowDetails } from "./ModelRowDetails"; import { PROVIDER_PRESETS, matchingConnections, @@ -552,13 +552,11 @@ export function ModelServiceForm({ results={results} compact renderDetails={(id) => ( -
- {t("models.service.capabilityDetails")} - + ({ ...current, [id]: message })) } /> -
+ )} /> {segmentation && ( diff --git a/src/canvas/model-settings.css b/src/canvas/model-settings.css index 511e39b41..23acfb825 100644 --- a/src/canvas/model-settings.css +++ b/src/canvas/model-settings.css @@ -673,9 +673,56 @@ .cw-model-availability { padding: 12px 0; font-size: var(--settings-label-size, 13px); } .cw-model-option > .cw-model-availability { flex-basis: 100%; width: 100%; min-width: 0; border-top: 1px solid var(--settings-border); } .cw-model-availability-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; } +.cw-model-availability-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; } +.cw-availability-chips { display: flex; flex-wrap: wrap; gap: 6px; } +.cw-availability-chip { + display: inline-flex; + align-items: center; + gap: 7px; + padding: 3px 10px; + border: 1px solid var(--settings-border); + border-radius: 999px; + background: var(--settings-input); + color: var(--settings-text); + font-size: var(--settings-caption-size); + line-height: 1.5; + white-space: nowrap; +} +.cw-availability-chip .cw-availability-op { color: inherit; } +.cw-availability-chip[data-availability="available"] { + border-color: color-mix(in srgb, var(--settings-positive) 45%, transparent); + background: var(--settings-positive-background); + color: var(--settings-positive); +} +.cw-availability-chip[data-availability="unavailable"] { + border-color: color-mix(in srgb, var(--settings-negative) 45%, transparent); + background: var(--settings-negative-background); + color: var(--settings-negative); +} +.cw-availability-chip[data-availability="unknown"] { color: var(--settings-text); } .cw-model-availability p, .cw-model-availability small { color: var(--settings-muted); } .cw-model-availability ul { display: grid; gap: 8px; margin: 10px 0; padding: 0; list-style: none; } .cw-model-availability li { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(0, 3fr); gap: 12px; overflow-wrap: anywhere; } +.cw-availability-state { + display: inline-flex; + align-items: center; + gap: 5px; + color: var(--settings-muted); +} +.cw-availability-state::before { + content: ""; + width: 5px; + height: 5px; + flex: none; + border-radius: 50%; + background: currentColor; +} +.cw-availability-state[data-availability="available"] { color: var(--settings-positive); } +.cw-availability-state[data-availability="unavailable"] { + color: var(--settings-negative); + font-weight: 500; +} +.cw-availability-state[data-availability="unknown"] { color: var(--settings-muted); } .cw-model-availability-details { padding: 12px 16px; border-top: 1px solid var(--settings-border); } .cw-model-availability-details summary { cursor: pointer; } .cw-model-availability [data-availability="unavailable"] { color: var(--cw-danger, #b45336); } @@ -688,17 +735,6 @@ .cw-model-input-details small { display: block; } .cw-model-input-details summary small { display: inline; margin-inline-start: 8px; } -/* A selected model row shows its test result; capability detail stays folded. */ -.cw-model-row-details { - grid-column: 1 / -1; - margin: 2px 0 0 24px; -} -.cw-model-row-details > summary { - cursor: pointer; - width: fit-content; - padding: 2px 0; - color: var(--settings-muted); - font-size: var(--settings-caption-size); -} -.cw-model-row-details > summary:hover { color: var(--settings-text); } -.cw-model-row-details[open] > summary { margin-bottom: 6px; } +/* The check action rides on the model line; the capability card follows it on + its own line, so a row costs one line until the service answers. */ +.cw-model-row-test { margin-inline-start: auto; } diff --git a/src/canvas/themes.css b/src/canvas/themes.css index 6aaf75228..c8c581d70 100644 --- a/src/canvas/themes.css +++ b/src/canvas/themes.css @@ -10,6 +10,10 @@ --settings-input: #19191b; --settings-warning: #f3b7a6; --settings-warning-background: #45332c; + --settings-positive: #8ed3a8; + --settings-positive-background: #24382e; + --settings-negative: #f0a3a3; + --settings-negative-background: #43282a; } :root[data-theme="light"] { color-scheme: light; @@ -25,6 +29,10 @@ --settings-input: #fafbfc; --settings-warning: #9a4d36; --settings-warning-background: #fff1e9; + --settings-positive: #2f7a4f; + --settings-positive-background: #eaf6ee; + --settings-negative: #a63c3c; + --settings-negative-background: #fdeeee; } :root[data-theme="light"] .cw-workspace { background: #f7f8fa; diff --git a/src/i18n/messages/en-US/availability.ts b/src/i18n/messages/en-US/availability.ts index d54d31528..01efc4f8a 100644 --- a/src/i18n/messages/en-US/availability.ts +++ b/src/i18n/messages/en-US/availability.ts @@ -50,6 +50,9 @@ export const availability = { "availability.checkedAt": "Last checked: {time}", "availability.status.available": "Supported", "availability.status.unknown": "Unknown", + "availability.rowTest": "Test", + "availability.rowTested": "Tested", + "availability.rowExpired": "Expired", "availability.reason.not_checked": "Not checked", "availability.reason.supported": "Supported", "availability.reason.operation_unsupported": "Not supported", diff --git a/src/i18n/messages/zh-CN/availability.ts b/src/i18n/messages/zh-CN/availability.ts index 0f453af53..6b9bca899 100644 --- a/src/i18n/messages/zh-CN/availability.ts +++ b/src/i18n/messages/zh-CN/availability.ts @@ -50,6 +50,9 @@ export const availability = { "availability.checkedAt": "最近检查:{time}", "availability.status.available": "支持", "availability.status.unknown": "待确认", + "availability.rowTest": "测试", + "availability.rowTested": "已测试", + "availability.rowExpired": "已过期", "availability.reason.not_checked": "尚未检查", "availability.reason.supported": "支持", "availability.reason.operation_unsupported": "不支持", diff --git a/tests/browser/capability_discovery.mjs b/tests/browser/capability_discovery.mjs index e4881b76b..67a78b830 100644 --- a/tests/browser/capability_discovery.mjs +++ b/tests/browser/capability_discovery.mjs @@ -260,15 +260,14 @@ try { .locator(".cw-model-manual") .getByRole("button", { name: "Add", exact: true }) .click(); - // The selected row keeps its capability detail folded by default. - const rowDetails = page.locator(".cw-model-row-details").first(); - await rowDetails.waitFor(); + // The check action rides on the model line; the capability card follows it. + const test = page.locator(".cw-model-row-test").first(); + await test.waitFor(); assert.equal( - await rowDetails.evaluate((element) => element.hasAttribute("open")), - false, - "selecting a model must not expand its capability detail", + (await test.textContent())?.trim(), + "Test", + "a model that was never checked offers the check action", ); - await rowDetails.locator("summary").first().click(); const draft = page.locator(".cw-model-editor .cw-model-availability"); async function presentInBothLanguages(state, expected) { for (const locale of ["en-US", "zh-CN"]) { @@ -456,8 +455,16 @@ try { "Single-image editing", "Multi-image editing", ]) - assert.equal(await draft.getByText(label, { exact: true }).count(), 1); - assert.equal(await draft.locator("[data-availability=available]").count(), 3); + assert.equal( + await draft.getByText(label, { exact: true }).count(), + 1, + `${label} appears once, with its state beside it`, + ); + assert.equal( + await draft.locator(".cw-availability-chip[data-availability=available]").count(), + 3, + "every supported capability is marked on its chip", + ); await draft.getByText("Input requirements", { exact: true }).click(); await presentInBothLanguages("normal", null); assert.equal( @@ -483,7 +490,7 @@ try { }), ); }); - await draft.getByText("多图编辑", { exact: true }).waitFor(); + await draft.locator(".cw-availability-op", { hasText: "多图编辑" }).waitFor(); assert.equal(await draft.getByText("选区输入", { exact: true }).count(), 1); assert.equal(await draft.getByText("1–3 张", { exact: true }).count(), 1); assert.equal(await draft.getByText("服务声明", { exact: true }).count(), 1); @@ -500,7 +507,7 @@ try { }), ); }); - await draft.getByText("Multi-image editing", { exact: true }).waitFor(); + await draft.locator(".cw-availability-op", { hasText: "Multi-image editing" }).waitFor(); await checkDraft("partial"); assert.equal(await draft.getByRole("status").count(), 0); assert.equal( @@ -514,7 +521,10 @@ try { await draft.getByText("Service paused", { exact: true }).count(), 0, ); - assert.equal(await draft.locator("[data-availability=available]").count(), 3); + assert.equal( + await draft.locator(".cw-availability-chip[data-availability=available]").count(), + 3, + ); await checkDraft("partial"); await presentInBothLanguages("partial", { "en-US": "Image count not confirmed", @@ -582,7 +592,7 @@ try { 0, ); assert.equal( - await draft.locator("li [data-availability=unknown]").count(), + await draft.locator(".cw-availability-chip[data-availability=unknown]").count(), 3, ); } @@ -639,25 +649,16 @@ try { 0, ); assert.equal( - await draft.locator("[data-availability=available]").count(), + await draft.locator(".cw-availability-chip[data-availability=available]").count(), 3, "pause expiry restores the retained declaration", ); await page.clock.fastForward(25100); - await draft - .getByText("Results expired. Refresh to check again.", { exact: true }) - .waitFor(); - assert.equal( - await draft - .getByText("Results expired. Refresh to check again.", { exact: true }) - .count(), - 1, - ); - assert.equal(await draft.locator("li[data-stale]").count(), 3); - await presentInBothLanguages("expired", { - "en-US": "Results expired. Refresh to check again.", - "zh-CN": "检查结果已过期,请刷新", - }); + // An expired observation marks every capability and the row instead of + // repeating one banner line. + await draft.locator(".cw-availability-chip[data-stale]").first().waitFor(); + assert.equal(await draft.locator(".cw-availability-chip[data-stale]").count(), 3); + await presentInBothLanguages("expired", null); assert.equal(await draftUrl.inputValue(), serviceUrl); await page.clock.resume(); await page.clock.setSystemTime(new Date()); @@ -839,7 +840,10 @@ try { await page.unroute(refreshUrl); await page.waitForTimeout(100); assert.equal(await serviceCard.getByText("Not supported", { exact: true }).count(), 0); - assert.equal(await serviceCard.locator("[data-availability=available]").count(), 3); + assert.equal( + await serviceCard.locator(".cw-availability-chip[data-availability=available]").count(), + 3, + ); // A remote negative declaration already 21 days old must not block this // saved selection or the actual generation performed below. diff --git a/tests/browser/higgsfield_open.mjs b/tests/browser/higgsfield_open.mjs index 05f518f39..ee9689299 100644 --- a/tests/browser/higgsfield_open.mjs +++ b/tests/browser/higgsfield_open.mjs @@ -80,7 +80,6 @@ try { assert.equal(await page.getByLabel("API Key", { exact: true }).getAttribute("placeholder"), "KEY_ID:KEY_SECRET"); await page.getByLabel("API Key", { exact: true }).fill("fixture-id:fixture-secret"); await page.getByRole("checkbox", { name: "sand/magi-2", exact: true }).check(); - await page.locator(".cw-model-row-details summary").first().click(); await page.getByText(text.summary, { exact: true }).waitFor(); await page.getByText("1080P", { exact: true }).waitFor(); await page.screenshot({ path: join(output, `provider-${locale}.png`), fullPage: true }); diff --git a/tests/browser/kling_video.mjs b/tests/browser/kling_video.mjs index 4f1747249..fb7244f11 100644 --- a/tests/browser/kling_video.mjs +++ b/tests/browser/kling_video.mjs @@ -176,7 +176,6 @@ try { await page .getByLabel("API Key", { exact: true }) .fill("kling-browser-fixture-only"); - await page.locator(".cw-model-row-details summary").first().click(); await page.getByText(text.summary, { exact: true }).waitFor(); await page.getByText("720P / 1080P", { exact: true }).waitFor(); await page @@ -185,12 +184,13 @@ try { await page .getByRole("checkbox", { name: "kling-4.0-flash", exact: true }) .check(); - await page + const flashCard = page .locator(".cw-model-option") .filter({ hasText: "kling-4.0-flash" }) - .locator("summary") - .first() - .click(); + .locator(".cw-model-capability-card") + .first(); + if (!(await flashCard.evaluate((element) => element.open))) + await flashCard.locator("summary").click(); await page.getByText(text.flashSummary, { exact: true }).waitFor(); await page.getByText("720P", { exact: true }).waitFor(); await page diff --git a/tests/browser/provider_settings.mjs b/tests/browser/provider_settings.mjs index 148509a80..1a5929312 100644 --- a/tests/browser/provider_settings.mjs +++ b/tests/browser/provider_settings.mjs @@ -104,15 +104,9 @@ try { } finally { await page.unroute(discoveryEndpoint); } - // Capability detail stays folded until the row is expanded. - const capabilityRow = page.locator(".cw-model-row-details").first(); - await capabilityRow.waitFor(); - assert.equal( - await capabilityRow.evaluate((element) => element.hasAttribute("open")), - false, - "a selected model must not expand its capability detail by default", - ); - await capabilityRow.locator("summary").first().click(); + // The check action rides on the model line; the card is already visible. + await page.locator(".cw-model-row-test").first().waitFor(); + await page.locator(".cw-model-editor .cw-model-availability").first().waitFor(); await page .getByText("Text-to-video / first-last frame / multimodal references", { exact: true }).first() .waitFor(); @@ -144,11 +138,12 @@ try { .locator(".cw-model-option") .filter({ hasText: "image-card" }); const textCard = page.locator(".cw-model-option").filter({ hasText: "text-card" }); - // The row folds its capability detail; the card folds its own options inside. + // The row has no fold of its own; the capability card folds its options. const openDetails = async (option) => { - await option.locator("summary").first().click(); - const inner = option.locator("summary").nth(1); - if (await inner.count()) await inner.click(); + const card = option.locator(".cw-model-capability-card").first(); + if (!(await card.count())) return; + if (!(await card.evaluate((element) => element.open))) + await card.locator("summary").click(); }; await openDetails(textCard); await textCard.getByRole("checkbox", { name: "Image understanding", exact: true }).uncheck(); From 7510d13b14d6c3f4a5013c7288da8a071d76a6e6 Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Mon, 30 Nov 2026 22:46:45 +0800 Subject: [PATCH 03/13] refactor(providers): drop the unused draft check wrapper and its dead label ModelRowDetails reads useDraftAvailability directly, so the wrapper component and the summary label for a details element that no longer exists had no reader. --- src/canvas/DraftAvailabilityCheck.tsx | 21 --------------------- src/i18n/messages/en-US/models.ts | 1 - src/i18n/messages/zh-CN/models.ts | 1 - 3 files changed, 23 deletions(-) diff --git a/src/canvas/DraftAvailabilityCheck.tsx b/src/canvas/DraftAvailabilityCheck.tsx index 4a5b5da1f..c96e8b614 100644 --- a/src/canvas/DraftAvailabilityCheck.tsx +++ b/src/canvas/DraftAvailabilityCheck.tsx @@ -5,7 +5,6 @@ import { } from "../backend/models.ts"; import type { ModelAvailability } from "../backend/availability.ts"; import { errorMessage } from "../backend/api.ts"; -import { ModelAvailabilityCard } from "./ModelAvailabilityCard"; /** * A draft check never publishes an observation into the saved model catalog. @@ -76,23 +75,3 @@ export function useDraftAvailability({ check: () => void check(), }; } - -export function DraftAvailabilityCheck({ - connection, - configId, - modelId, -}: { - connection: ModelConfigInput; - configId?: string; - modelId: string; -}) { - const draft = useDraftAvailability({ connection, configId, modelId }); - return ( - - ); -} diff --git a/src/i18n/messages/en-US/models.ts b/src/i18n/messages/en-US/models.ts index d9f2a4c65..70f5c5557 100644 --- a/src/i18n/messages/en-US/models.ts +++ b/src/i18n/messages/en-US/models.ts @@ -129,7 +129,6 @@ export const models = { }, "models.service.selectAtLeastOne": "Select at least one model", "models.service.saving": "Saving…", - "models.service.capabilityDetails": "Capabilities and parameters", "models.service.cancel": "Cancel", "models.service.advancedConnection": "Advanced connection settings", "models.service.existingConnections": diff --git a/src/i18n/messages/zh-CN/models.ts b/src/i18n/messages/zh-CN/models.ts index a79018459..4734a16a0 100644 --- a/src/i18n/messages/zh-CN/models.ts +++ b/src/i18n/messages/zh-CN/models.ts @@ -107,7 +107,6 @@ export const models = { "models.service.willEnable": "将启用 {count} 个模型", "models.service.selectAtLeastOne": "请选择至少一个模型", "models.service.saving": "保存中…", - "models.service.capabilityDetails": "服务能力与参数", "models.service.cancel": "取消", "models.service.advancedConnection": "高级连接设置", "models.service.existingConnections": "已有相同地址的连接", From fe1e912f4f1a6d03ba13580c3a67b815e820955f Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Mon, 30 Nov 2026 23:16:47 +0800 Subject: [PATCH 04/13] ci: retrigger after a publication-lock timeout in the python lane tests/test_agent_job_lineage.py::test_one_turn_records_every_job_it_accepted_and_nothing_else failed with filelock.Timeout under load; the same test passes locally on this tip in 3.5s. From a17a9d63533bd757d78b57c2fc0eec23bd9e438a Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Wed, 2 Dec 2026 00:41:11 +0800 Subject: [PATCH 05/13] fix(providers): fold the capability detail and keep one check entry per row MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The row action and the card's refresh button called the same draft check, and the card stayed open under every selected model. Fold the card and the per-kind parameters behind the '服务能力与参数' summary, keep the row action as the only check entry, keep a readable sentence when an observation expires, and count the models the service returned instead of the filtered view. Refs #574 --- src/canvas/ModelAvailabilityCard.tsx | 15 +++++------ src/canvas/ModelPicker.tsx | 2 +- src/canvas/ModelRowDetails.tsx | 22 +++++++++------- src/canvas/model-settings.css | 35 ++++++++++++++++++++++++++ src/i18n/messages/en-US/models.ts | 1 + src/i18n/messages/zh-CN/models.ts | 1 + tests/browser/capability_discovery.mjs | 34 ++++++++++++++++++++++++- tests/browser/provider_settings.mjs | 4 +++ 8 files changed, 96 insertions(+), 18 deletions(-) diff --git a/src/canvas/ModelAvailabilityCard.tsx b/src/canvas/ModelAvailabilityCard.tsx index 83b85bfb8..0c9542ec6 100644 --- a/src/canvas/ModelAvailabilityCard.tsx +++ b/src/canvas/ModelAvailabilityCard.tsx @@ -20,12 +20,15 @@ export function ModelAvailabilityCard({ checking = false, title, error, + actions = true, }: { value?: ModelAvailability | null; onRefresh?: () => void; checking?: boolean; title?: string; error?: string; + /** The service form owns the single check entry on the row itself. */ + actions?: boolean; }) { const { t, locale } = useI18n(); const [tick, setTick] = useState(0); @@ -40,14 +43,12 @@ export function ModelAvailabilityCard({ }, [value, tick]); const current = value ? currentAvailability(value) : null; const notice = availabilityNotice(current); - // An expired observation shows on every chip and on the row, so a banner would - // only repeat it. A model that was never checked still needs the sentence. + // Every shared notice keeps one readable sentence. Chips alone are not enough: + // an expired observation greys them out and the row still reads "tested", so + // the reason has to stay in words. const message = checking ? null - : error || - (notice && notice !== "observation_expired" - ? availabilityReason(notice) - : null); + : error || (notice ? availabilityReason(notice) : null); const details = availabilityCardDetails(current?.operations ?? []); const commonSource = details.length > 0 && @@ -88,7 +89,7 @@ export function ModelAvailabilityCard({ ) : null}
- {onRefresh && ( + {actions && onRefresh && ( - {/* The dense form shows the fetch result in the count row, so only a - pending, empty or failed fetch keeps its own status line. */} {(!compact || !redundantStatus) && (
{status &&

{status}

} diff --git a/src/canvas/ModelRowDetails.tsx b/src/canvas/ModelRowDetails.tsx index 23a1a783c..da63f6aa4 100644 --- a/src/canvas/ModelRowDetails.tsx +++ b/src/canvas/ModelRowDetails.tsx @@ -1,16 +1,36 @@ -import type { ReactNode } from "react"; +import { useEffect, useState, type ReactNode } from "react"; +import { + availabilityDelay, + availabilityReason, + currentAvailability, + type ModelAvailability, +} from "../backend/availability.ts"; import type { ModelConfigInput } from "../backend/models.ts"; -import { useT } from "../i18n/I18nProvider"; +import { useT, type Translate } from "../i18n/I18nProvider"; +import { availabilityNotice } from "./availabilityPresentation"; import { useDraftAvailability } from "./DraftAvailabilityCheck"; import { ModelAvailabilityCard } from "./ModelAvailabilityCard"; -/** One model row of the service form. - * - * The check action sits on the model line: it offers the check until the - * service answers, then reports the result. Everything else — chips, input - * rules, the per-kind parameters — stays folded behind one summary, so a list - * of selected models keeps one line per model until the row is opened. - */ +function rowOutcome( + value: ModelAvailability, + notice: string | null, + t: Translate, +) { + if (notice === "observation_expired" || notice === "stale_declaration") + return t("availability.rowExpired"); + if (notice) return availabilityReason(notice); + const states = new Set(value.operations.map((item) => item.status)); + if (states.size === 1 && states.has("available")) + return t("availability.rowOutcome.passed"); + if (states.has("unavailable")) + return t("availability.rowOutcome.unsupported"); + return t("availability.rowOutcome.unknown"); +} + +function elapsed(ms: number) { + return ms < 1000 ? `${ms} ms` : `${(ms / 1000).toFixed(1)} s`; +} + export function ModelRowDetails({ modelId, connection, @@ -24,7 +44,18 @@ export function ModelRowDetails({ }) { const t = useT(); const draft = useDraftAvailability({ connection, configId, modelId }); - // Chat rows already carry the picker's own connection test. + const [tick, setTick] = useState(0); + useEffect(() => { + const delay = draft.value ? availabilityDelay(draft.value) : null; + if (delay === null) return; + const timer = setTimeout( + () => setTick((previous) => previous + 1), + Math.max(1, delay + 1), + ); + return () => clearTimeout(timer); + }, [draft.value, tick]); + const current = draft.value ? currentAvailability(draft.value) : null; + const notice = availabilityNotice(current); const showTest = connection.kind !== "agent"; return ( <> @@ -36,15 +67,17 @@ export function ModelRowDetails({ aria-busy={draft.checking || undefined} onClick={draft.check} > - {t( - draft.checking - ? "availability.checking" - : draft.error - ? "availability.reason.query_failed" - : draft.value - ? "availability.rowTested" - : "availability.rowTest", - )} + {draft.checking + ? t("availability.checking") + : draft.error + ? t("availability.reason.query_failed") + : current + ? `${rowOutcome(current, notice, t)}${ + draft.durationMs === undefined + ? "" + : ` · ${elapsed(draft.durationMs)}` + }` + : t("availability.rowTest")} )}
diff --git a/src/canvas/model-settings.css b/src/canvas/model-settings.css index 017de9bf6..bc3d68d3f 100644 --- a/src/canvas/model-settings.css +++ b/src/canvas/model-settings.css @@ -676,8 +676,6 @@ .cw-model-editor-scroll > .cw-model-connection-details { margin: 0 0 16px; } .cw-model-editor-scroll > .cw-provider-key { margin: 0 0 18px; } -/* The row keeps one line until the summary is opened: the fold label sits - inline with the model name and the test action. */ .cw-model-option > .cw-model-row-details { flex: 0 0 auto; margin-left: auto; @@ -776,6 +774,4 @@ .cw-model-input-details small { display: block; } .cw-model-input-details summary small { display: inline; margin-inline-start: 8px; } -/* The check action rides on the model line; the capability card follows it on - its own line, so a row costs one line until the service answers. */ .cw-model-row-test { margin-inline-start: auto; } diff --git a/src/i18n/messages/en-US/availability.ts b/src/i18n/messages/en-US/availability.ts index 01efc4f8a..0d51b48e3 100644 --- a/src/i18n/messages/en-US/availability.ts +++ b/src/i18n/messages/en-US/availability.ts @@ -52,7 +52,10 @@ export const availability = { "availability.status.unknown": "Unknown", "availability.rowTest": "Test", "availability.rowTested": "Tested", - "availability.rowExpired": "Expired", + "availability.rowExpired": "Expired — refresh", + "availability.rowOutcome.passed": "Passed", + "availability.rowOutcome.unsupported": "Not supported", + "availability.rowOutcome.unknown": "Unknown", "availability.reason.not_checked": "Not checked", "availability.reason.supported": "Supported", "availability.reason.operation_unsupported": "Not supported", diff --git a/src/i18n/messages/zh-CN/availability.ts b/src/i18n/messages/zh-CN/availability.ts index 6b9bca899..de95020e0 100644 --- a/src/i18n/messages/zh-CN/availability.ts +++ b/src/i18n/messages/zh-CN/availability.ts @@ -52,7 +52,10 @@ export const availability = { "availability.status.unknown": "待确认", "availability.rowTest": "测试", "availability.rowTested": "已测试", - "availability.rowExpired": "已过期", + "availability.rowExpired": "已过期,请刷新", + "availability.rowOutcome.passed": "通过", + "availability.rowOutcome.unsupported": "不支持", + "availability.rowOutcome.unknown": "待确认", "availability.reason.not_checked": "尚未检查", "availability.reason.supported": "支持", "availability.reason.operation_unsupported": "不支持", diff --git a/tests/browser/capability_discovery.mjs b/tests/browser/capability_discovery.mjs index 5c3afae71..6deac139e 100644 --- a/tests/browser/capability_discovery.mjs +++ b/tests/browser/capability_discovery.mjs @@ -260,7 +260,6 @@ try { .locator(".cw-model-manual") .getByRole("button", { name: "Add", exact: true }) .click(); - // The check action rides on the model line; the capability card follows it. const test = page.locator(".cw-model-row-test").first(); await test.waitFor(); assert.equal( @@ -268,8 +267,6 @@ try { "Test", "a model that was never checked offers the check action", ); - // #574: a selected model keeps one line until its summary is opened, and the - // only check entry on that line is the row action. const row = page.locator(".cw-model-option").first(); const fold = row.locator(".cw-model-row-details"); await fold.waitFor(); @@ -291,7 +288,6 @@ try { await fold.locator("> summary").click(); const draft = page.locator(".cw-model-editor .cw-model-availability"); await draft.waitFor(); - // The row action is the only check entry, so every workflow click goes there. const checkRow = () => page.locator(".cw-model-row-test").first().click(); assert.equal( await row.locator("button").count(), @@ -439,6 +435,11 @@ try { delay = 0; await checkRow(); await draft.getByText("Not supported").first().waitFor(); + assert.match( + (await page.locator(".cw-model-row-test").first().textContent())?.trim() ?? "", + /^Not supported · (?:\d+ ms|\d+\.\d s)$/, + "the folded row reports an unsupported outcome without opening the card", + ); assert.equal( (await call("/api/model-configs")).some((item) => item.modelId === served), false, @@ -470,6 +471,11 @@ try { ); } await checkDraft("supported"); + assert.match( + (await page.locator(".cw-model-row-test").first().textContent())?.trim() ?? "", + /^Passed · (?:\d+ ms|\d+\.\d s)$/, + "the folded row reports a passing outcome and the check duration", + ); assert.equal( await draft.getByRole("status").count(), 0, @@ -683,16 +689,46 @@ try { "pause expiry restores the retained declaration", ); await page.clock.fastForward(25100); - // An expired observation marks every capability and the row instead of - // repeating one banner line. await draft.locator(".cw-availability-chip[data-stale]").first().waitFor(); assert.equal(await draft.locator(".cw-availability-chip[data-stale]").count(), 3); - // #574 review: an expired observation keeps a readable sentence, not just grey - // chips, because the row action still reads "Tested". await presentInBothLanguages("expired", { "en-US": "Results expired. Refresh to check again.", "zh-CN": "检查结果已过期,请刷新", }); + for (const [locale, expected] of [ + ["en-US", "Expired — refresh"], + ["zh-CN", "已过期,请刷新"], + ]) { + await page.evaluate((next) => { + localStorage.setItem("opendirector.locale.v1", next); + window.dispatchEvent( + new StorageEvent("storage", { + key: "opendirector.locale.v1", + newValue: next, + }), + ); + }, locale); + await until( + async () => (await page.locator("html").getAttribute("lang")) === locale, + ); + assert.equal( + (await page.locator(".cw-model-row-test").first().textContent())?.trim(), + expected, + `an expired row stays readable in ${locale}`, + ); + } + await page.evaluate(() => { + localStorage.setItem("opendirector.locale.v1", "en-US"); + window.dispatchEvent( + new StorageEvent("storage", { + key: "opendirector.locale.v1", + newValue: "en-US", + }), + ); + }); + await until( + async () => (await page.locator("html").getAttribute("lang")) === "en-US", + ); assert.equal(await draftUrl.inputValue(), serviceUrl); await page.clock.resume(); await page.clock.setSystemTime(new Date()); diff --git a/tests/browser/provider_settings.mjs b/tests/browser/provider_settings.mjs index 5b5ce1b80..87f345003 100644 --- a/tests/browser/provider_settings.mjs +++ b/tests/browser/provider_settings.mjs @@ -105,7 +105,6 @@ try { } finally { await page.unroute(discoveryEndpoint); } - // The check action rides on the model line; the card is already visible. await page.locator(".cw-model-row-test").first().waitFor(); const firstFold = page.locator(".cw-model-row-details").first(); await firstFold.waitFor(); @@ -143,7 +142,6 @@ try { .locator(".cw-model-option") .filter({ hasText: "image-card" }); const textCard = page.locator(".cw-model-option").filter({ hasText: "text-card" }); - // The row folds its capability detail; the card inside folds its options. const openDetails = async (option) => { const rowFold = option.locator(".cw-model-row-details").first(); if ( From ff7e556d85acafff74e3dc1a361c9681f9eaa488 Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Sat, 5 Dec 2026 14:31:37 +0800 Subject: [PATCH 10/13] fix(models): show the row outcome as a compact mark with its duration --- node_modules | 1 + src/canvas/ModelRowDetails.tsx | 60 +++++++++++++++++++------ src/canvas/model-settings.css | 2 +- src/i18n/messages/en-US/availability.ts | 2 +- src/i18n/messages/zh-CN/availability.ts | 2 +- tests/browser/capability_discovery.mjs | 41 ++++++++++++++--- 6 files changed, 84 insertions(+), 24 deletions(-) create mode 120000 node_modules diff --git a/node_modules b/node_modules new file mode 120000 index 000000000..5b63a7658 --- /dev/null +++ b/node_modules @@ -0,0 +1 @@ +/home/ubuntu/projects/OpenDirector/node_modules \ No newline at end of file diff --git a/src/canvas/ModelRowDetails.tsx b/src/canvas/ModelRowDetails.tsx index da63f6aa4..925de021c 100644 --- a/src/canvas/ModelRowDetails.tsx +++ b/src/canvas/ModelRowDetails.tsx @@ -11,24 +11,48 @@ import { availabilityNotice } from "./availabilityPresentation"; import { useDraftAvailability } from "./DraftAvailabilityCheck"; import { ModelAvailabilityCard } from "./ModelAvailabilityCard"; +type RowOutcome = "passed" | "unsupported" | "unknown" | "expired"; + +const UNSUPPORTED_REASONS = new Set([ + "operation_unsupported", + "profile_unsupported", + "output_unsupported", + "route_disabled", + "operation_disabled", +]); + function rowOutcome( value: ModelAvailability, notice: string | null, t: Translate, -) { +): { kind: RowOutcome; text: string } { if (notice === "observation_expired" || notice === "stale_declaration") - return t("availability.rowExpired"); - if (notice) return availabilityReason(notice); + return { kind: "expired", text: t("availability.rowExpired") }; + if (notice) + return { + kind: UNSUPPORTED_REASONS.has(notice) ? "unsupported" : "unknown", + text: availabilityReason(notice), + }; const states = new Set(value.operations.map((item) => item.status)); if (states.size === 1 && states.has("available")) - return t("availability.rowOutcome.passed"); + return { kind: "passed", text: t("availability.rowOutcome.passed") }; if (states.has("unavailable")) - return t("availability.rowOutcome.unsupported"); - return t("availability.rowOutcome.unknown"); + return { + kind: "unsupported", + text: t("availability.rowOutcome.unsupported"), + }; + return { kind: "unknown", text: t("availability.rowOutcome.unknown") }; } +const rowMark: Record = { + passed: "✓", + unsupported: "✕", + unknown: "?", + expired: "", +}; + function elapsed(ms: number) { - return ms < 1000 ? `${ms} ms` : `${(ms / 1000).toFixed(1)} s`; + return ms < 1000 ? `${ms}ms` : `${(ms / 1000).toFixed(1)}s`; } export function ModelRowDetails({ @@ -56,6 +80,17 @@ export function ModelRowDetails({ }, [draft.value, tick]); const current = draft.value ? currentAvailability(draft.value) : null; const notice = availabilityNotice(current); + const outcome = current ? rowOutcome(current, notice, t) : null; + const duration = + draft.durationMs === undefined ? "" : elapsed(draft.durationMs); + const rowLabel = outcome + ? outcome.kind === "expired" + ? outcome.text + : `${rowMark[outcome.kind]}${duration}` + : undefined; + const rowTitle = outcome + ? `${outcome.kind === "expired" && notice ? availabilityReason(notice) : outcome.text}${duration && ` · ${duration}`}` + : undefined; const showTest = connection.kind !== "agent"; return ( <> @@ -65,19 +100,16 @@ export function ModelRowDetails({ className="cw-settings-button cw-settings-button-quiet cw-model-row-test" disabled={draft.checking} aria-busy={draft.checking || undefined} + aria-label={rowTitle} + title={rowTitle} + data-outcome={outcome?.kind} onClick={draft.check} > {draft.checking ? t("availability.checking") : draft.error ? t("availability.reason.query_failed") - : current - ? `${rowOutcome(current, notice, t)}${ - draft.durationMs === undefined - ? "" - : ` · ${elapsed(draft.durationMs)}` - }` - : t("availability.rowTest")} + : rowLabel ?? t("availability.rowTest")} )}
diff --git a/src/canvas/model-settings.css b/src/canvas/model-settings.css index bc3d68d3f..87179b855 100644 --- a/src/canvas/model-settings.css +++ b/src/canvas/model-settings.css @@ -416,7 +416,7 @@ } .cw-model-editor .cw-model-row-test { min-height: 28px; - padding: 2px 6px; + padding: 2px; font-size: var(--settings-caption-size); } .cw-model-empty-state { diff --git a/src/i18n/messages/en-US/availability.ts b/src/i18n/messages/en-US/availability.ts index 0d51b48e3..b3560cb69 100644 --- a/src/i18n/messages/en-US/availability.ts +++ b/src/i18n/messages/en-US/availability.ts @@ -52,7 +52,7 @@ export const availability = { "availability.status.unknown": "Unknown", "availability.rowTest": "Test", "availability.rowTested": "Tested", - "availability.rowExpired": "Expired — refresh", + "availability.rowExpired": "Expired", "availability.rowOutcome.passed": "Passed", "availability.rowOutcome.unsupported": "Not supported", "availability.rowOutcome.unknown": "Unknown", diff --git a/src/i18n/messages/zh-CN/availability.ts b/src/i18n/messages/zh-CN/availability.ts index de95020e0..03a533542 100644 --- a/src/i18n/messages/zh-CN/availability.ts +++ b/src/i18n/messages/zh-CN/availability.ts @@ -52,7 +52,7 @@ export const availability = { "availability.status.unknown": "待确认", "availability.rowTest": "测试", "availability.rowTested": "已测试", - "availability.rowExpired": "已过期,请刷新", + "availability.rowExpired": "已过期", "availability.rowOutcome.passed": "通过", "availability.rowOutcome.unsupported": "不支持", "availability.rowOutcome.unknown": "待确认", diff --git a/tests/browser/capability_discovery.mjs b/tests/browser/capability_discovery.mjs index 6deac139e..0934fcc05 100644 --- a/tests/browser/capability_discovery.mjs +++ b/tests/browser/capability_discovery.mjs @@ -289,6 +289,18 @@ try { const draft = page.locator(".cw-model-editor .cw-model-availability"); await draft.waitFor(); const checkRow = () => page.locator(".cw-model-row-test").first().click(); + async function captureFoldedRow(state) { + if (!process.env.CREATION_SCREENSHOT) return; + const target = process.env.CREATION_SCREENSHOT; + await fold.locator("> summary").click(); + await row.screenshot({ + path: join( + dirname(target), + `${basename(target, extname(target))}-row-${state}${extname(target)}`, + ), + }); + await fold.locator("> summary").click(); + } assert.equal( await row.locator("button").count(), 1, @@ -369,7 +381,7 @@ try { ); assert.ok( bounds.labelWidth >= bounds.cardWidth * 0.9, - `${state}: model identity retains the available width`, + `${state}: model identity retains the available width ${JSON.stringify(bounds)}`, ); assert.ok( bounds.cardTop >= bounds.visibleTop - 1 && @@ -435,11 +447,16 @@ try { delay = 0; await checkRow(); await draft.getByText("Not supported").first().waitFor(); + assert.equal( + await page.locator(".cw-model-row-test").first().getAttribute("data-outcome"), + "unsupported", + "the folded row reports an unsupported outcome without opening the card", + ); assert.match( (await page.locator(".cw-model-row-test").first().textContent())?.trim() ?? "", - /^Not supported · (?:\d+ ms|\d+\.\d s)$/, - "the folded row reports an unsupported outcome without opening the card", + /^✕(?:\d+ms|\d+\.\d s)$/, ); + await captureFoldedRow("unsupported"); assert.equal( (await call("/api/model-configs")).some((item) => item.modelId === served), false, @@ -471,11 +488,17 @@ try { ); } await checkDraft("supported"); + assert.equal( + await page.locator(".cw-model-row-test").first().getAttribute("data-outcome"), + "passed", + "the folded row reports a passing outcome", + ); assert.match( (await page.locator(".cw-model-row-test").first().textContent())?.trim() ?? "", - /^Passed · (?:\d+ ms|\d+\.\d s)$/, - "the folded row reports a passing outcome and the check duration", + /^✓(?:\d+ms|\d+\.\d s)$/, + "the folded row shows the check duration", ); + await captureFoldedRow("passed"); assert.equal( await draft.getByRole("status").count(), 0, @@ -696,8 +719,8 @@ try { "zh-CN": "检查结果已过期,请刷新", }); for (const [locale, expected] of [ - ["en-US", "Expired — refresh"], - ["zh-CN", "已过期,请刷新"], + ["en-US", "Expired"], + ["zh-CN", "已过期"], ]) { await page.evaluate((next) => { localStorage.setItem("opendirector.locale.v1", next); @@ -711,6 +734,10 @@ try { await until( async () => (await page.locator("html").getAttribute("lang")) === locale, ); + assert.equal( + await page.locator(".cw-model-row-test").first().getAttribute("data-outcome"), + "expired", + ); assert.equal( (await page.locator(".cw-model-row-test").first().textContent())?.trim(), expected, From 49ad4d02a4d7dc1f717c07d11c59faf1f6c795bd Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Sat, 5 Dec 2026 14:31:43 +0800 Subject: [PATCH 11/13] chore: drop the local dependency symlink --- node_modules | 1 - 1 file changed, 1 deletion(-) delete mode 120000 node_modules diff --git a/node_modules b/node_modules deleted file mode 120000 index 5b63a7658..000000000 --- a/node_modules +++ /dev/null @@ -1 +0,0 @@ -/home/ubuntu/projects/OpenDirector/node_modules \ No newline at end of file From ec5e395c8e9ec2e711275c0c9a8ab0dd2d7aa262 Mon Sep 17 00:00:00 2001 From: Zhangbo-cn <60600082+Zhangbo-cn@users.noreply.github.com> Date: Sat, 5 Dec 2026 14:55:33 +0800 Subject: [PATCH 12/13] [ci] python: list the test modules main added without a shard --- scripts/ci/python_shards.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/ci/python_shards.json b/scripts/ci/python_shards.json index c2b76342c..470bc6a29 100644 --- a/scripts/ci/python_shards.json +++ b/scripts/ci/python_shards.json @@ -4,6 +4,7 @@ "core": [ "tests/test_a2_repros.py", "tests/test_app_settings.py", + "tests/test_ark_availability.py", "tests/test_ark_plan_models.py", "tests/test_asset_names.py", "tests/test_atlascloud.py", @@ -103,6 +104,7 @@ "tests/test_self_hosted_proxy.py", "tests/test_self_hosted_queue.py", "tests/test_structure_reference.py", + "tests/test_trace_job_queries.py", "tests/test_vllm_omni_h3.py", "tests/test_vllm_omni_image.py", "tests/test_voice_library.py", @@ -136,7 +138,8 @@ "tests/test_native_runtime.py", "tests/test_native_sessions.py", "tests/test_pi_runtime.py", - "tests/test_skill_snapshot.py" + "tests/test_skill_snapshot.py", + "tests/test_wait_outcome.py" ], "media": [ "tests/test_canvas_text_cli_http.py", From 7889c0f3335480808c2b1ecc7f240dc77cd876c7 Mon Sep 17 00:00:00 2001 From: Zhangbo-cn Date: Sat, 5 Dec 2026 15:58:21 +0800 Subject: [PATCH 13/13] [bugfix] providers: report a failed capability check with its own duration --- src/canvas/DraftAvailabilityCheck.tsx | 4 ++++ src/canvas/ModelRowDetails.tsx | 13 +++++------ tests/browser/capability_discovery.mjs | 30 ++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/canvas/DraftAvailabilityCheck.tsx b/src/canvas/DraftAvailabilityCheck.tsx index d6cf5b6ae..9d93d86a4 100644 --- a/src/canvas/DraftAvailabilityCheck.tsx +++ b/src/canvas/DraftAvailabilityCheck.tsx @@ -67,6 +67,10 @@ export function useDraftAvailability({ serial.current === attempt ) { setValue(null); + setDuration({ + signature, + ms: Math.max(0, Math.round(performance.now() - started)), + }); setFailure({ signature, message: errorMessage(error) }); } } finally { diff --git a/src/canvas/ModelRowDetails.tsx b/src/canvas/ModelRowDetails.tsx index 925de021c..df84b2b98 100644 --- a/src/canvas/ModelRowDetails.tsx +++ b/src/canvas/ModelRowDetails.tsx @@ -91,6 +91,9 @@ export function ModelRowDetails({ const rowTitle = outcome ? `${outcome.kind === "expired" && notice ? availabilityReason(notice) : outcome.text}${duration && ` · ${duration}`}` : undefined; + const failureLabel = draft.error + ? `${t("availability.reason.query_failed")}${duration && ` · ${duration}`}` + : undefined; const showTest = connection.kind !== "agent"; return ( <> @@ -100,16 +103,14 @@ export function ModelRowDetails({ className="cw-settings-button cw-settings-button-quiet cw-model-row-test" disabled={draft.checking} aria-busy={draft.checking || undefined} - aria-label={rowTitle} - title={rowTitle} - data-outcome={outcome?.kind} + aria-label={failureLabel ?? rowTitle} + title={failureLabel ?? rowTitle} + data-outcome={failureLabel ? "failed" : outcome?.kind} onClick={draft.check} > {draft.checking ? t("availability.checking") - : draft.error - ? t("availability.reason.query_failed") - : rowLabel ?? t("availability.rowTest")} + : failureLabel ?? rowLabel ?? t("availability.rowTest")} )}
diff --git a/tests/browser/capability_discovery.mjs b/tests/browser/capability_discovery.mjs index 0934fcc05..9a2e0ce38 100644 --- a/tests/browser/capability_discovery.mjs +++ b/tests/browser/capability_discovery.mjs @@ -584,6 +584,36 @@ try { "en-US": "Image count not confirmed", "zh-CN": "多图数量待确认", }); + await page.route( + draftCheckUrl, + async (route) => { + await new Promise((resolve) => setTimeout(resolve, 300)); + await route.fulfill({ + status: 503, + contentType: "application/json", + body: JSON.stringify({ detail: "Fixture check failed" }), + }); + }, + { times: 1 }, + ); + await checkRow(); + await until( + async () => + (await page.locator(".cw-model-row-test").first().getAttribute("data-outcome")) === + "failed", + ); + const failureRow = + (await page.locator(".cw-model-row-test").first().textContent())?.trim() ?? ""; + assert.match( + failureRow, + /^Check failed · (\d+)ms$/, + "a failed check reports a duration", + ); + assert.ok( + Number(/^Check failed · (\d+)ms$/.exec(failureRow)?.[1]) >= 250, + `a failed check times the failed attempt, not the last success: ${failureRow}`, + ); + await page.unroute(draftCheckUrl); // Error observations last two seconds. Hold browser time so both screenshots // inspect the same response, without issuing another check on a locale change. await page.clock.install();