| 1 | import { createRoot } from "react-dom/client"; |
| 2 | import { useState } from "react"; |
| 3 | import { WorkspaceTurnVerification } from "../src/components/WorkspaceTurnVerification"; |
| 4 | import { LocaleProvider, useI18n } from "../src/lib/i18n"; |
| 5 | import { createLegacyRemotePolicyNoticeTracker } from "../src/lib/legacyRemotePolicyNotice"; |
| 6 | import type { WireCompletionSummary } from "../src/lib/types"; |
| 7 | import "../src/styles.css"; |
| 8 | |
| 9 | // Isolated browser fixture: real presentation components, no service writes. |
| 10 | const base: WireCompletionSummary = { |
| 11 | preset: "standard", verdict: "unknown", mutations: 1, |
| 12 | checks_passed: 0, checks_failed: 0, checks_suppressed: 0, |
| 13 | review: "", constraint_degraded: false, |
| 14 | receipt: { assessmentKind: "facts", verdict: "unknown" }, |
| 15 | }; |
| 16 | const cases: [string, WireCompletionSummary][] = [ |
| 17 | ["No observed tests", base], |
| 18 | ["Model declaration", { ...base, receipt: { ...base.receipt!, gaps: [{ kind: "declared_unverified", detail: "The model reports that integration tests were not run." }] } }], |
| 19 | ["Failed command", { ...base, receipt: { ...base.receipt!, verifications: [{ command: "go test ./...", passed: false, exitCode: 1 }] } }], |
| 20 | ["Check predates edits", { ...base, receipt: { ...base.receipt!, verifications: [{ command: "pnpm test", passed: true, stale: true, exitCode: 0 }] } }], |
| 21 | ["Historical assessment", { ...base, verdict: "partial", review: "missing", receipt: { verdict: "partial", gaps: [{ kind: "missing_check", detail: "Historical missing verification" }] } }], |
| 22 | ]; |
| 23 | const warning = createLegacyRemotePolicyNoticeTracker()("fixture", "standard", "evaluator_unavailable")!; |
| 24 | function Fixture() { |
| 25 | const { t, setPref } = useI18n(); |
| 26 | const [selected, setSelected] = useState(0); |
| 27 | return <main style={{ maxWidth: 760, margin: "24px auto", padding: 24 }}> |
| 28 | <h1>Execution facts regression</h1> |
| 29 | <nav><button onClick={() => setPref("en")}>English</button><button onClick={() => setPref("zh")}>中文</button><button onClick={() => setPref("zh-TW")}>繁體中文</button></nav> |
| 30 | <p role="status">{t(warning)}</p> |
| 31 | <nav>{cases.map(([label], index) => <button key={label} onClick={() => setSelected(index)}>{label}</button>)}</nav> |
| 32 | <article style={{ marginTop: 24 }}><h2>{cases[selected][0]}</h2><WorkspaceTurnVerification summary={cases[selected][1]} /></article> |
| 33 | </main>; |
| 34 | } |
| 35 | createRoot(document.getElementById("root")!).render(<LocaleProvider><Fixture /></LocaleProvider>); |
| 36 |