diff --git a/.gitea/workflows/quality-gates.yml b/.gitea/workflows/quality-gates.yml index 172c120c..b979b3dd 100644 --- a/.gitea/workflows/quality-gates.yml +++ b/.gitea/workflows/quality-gates.yml @@ -93,6 +93,7 @@ jobs: - { gate: FE-GATE-014, name: config-compatibility, browser: false } - { gate: FE-GATE-019, name: hosting-header, browser: false } - { gate: FE-GATE-026, name: lab-performance, browser: true } + - { gate: FE-GATE-028, name: manual-accessibility-review, browser: false } steps: - uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 with: diff --git a/README.md b/README.md index e9c27a50..57cbe239 100644 --- a/README.md +++ b/README.md @@ -152,13 +152,15 @@ corepack pnpm exec playwright install --with-deps chromium firefox webkit Two gates intentionally need external evidence: -- `review:a11y-manual` needs a signed human keyboard/focus/screen-reader review - for all ten registered routes: `APP_HOME`, `EXAMPLES_PLATFORM`, +- `review:a11y-manual` (release gate FE-GATE-028) needs a signed human + keyboard/focus/screen-reader review for all ten registered routes: `APP_HOME`, `EXAMPLES_PLATFORM`, `EXAMPLES_UI`, `EXAMPLES_STATES`, `EXAMPLES_AUTH`, `NOT_FOUND`, `REFERENCE_RESOURCE_LIST`, `REFERENCE_RESOURCE_DETAIL`, `REFERENCE_RESOURCE_FORM` and `REFERENCE_RESOURCE_STATUS`. `verify:documentation` derives that list from the route registry and fails if - this paragraph falls behind it. + this paragraph falls behind it. The merge gate FE-GATE-009 runs only + `review:a11y-manual -- --format-only`, which checks that every route record + keeps the template's fields, reviewed or still pending. - `collect:web-vitals-evidence` stays `FAIL_UNVERIFIED` until a reviewed minimum eligible-sample threshold and 28 days of production data exist. @@ -166,7 +168,7 @@ Live release verification additionally requires `HOSTING_BASE_URL`. ## CI and evidence -The 27-gate registry is `config/ci/gates.json`; the Gitea workflow is +The 28-gate registry is `config/ci/gates.json`; the Gitea workflow is `.gitea/workflows/quality-gates.yml`. It follows: ```text diff --git a/config/ci/contract-baseline.json b/config/ci/contract-baseline.json index 4b0bf05b..66869356 100644 --- a/config/ci/contract-baseline.json +++ b/config/ci/contract-baseline.json @@ -1,11 +1,11 @@ { "schemaVersion": 1, "owner": "frontend-platform", - "reason": "12-04: FE-GATE-003 runs the image resolve-signal type fixture and FE-GATE-010 runs check:adapter-inventory", - "gates": 27, - "commands": 93, - "commandReferences": 105, - "artifacts": 109, + "reason": "08-06: the signed manual accessibility review moves to release gate FE-GATE-028; merge gate FE-GATE-009 checks only the record format", + "gates": 28, + "commands": 94, + "commandReferences": 106, + "artifacts": 110, "stages": 5, - "gateShapeSha256": "36d731b377e03518e744e2aea14f049bcf1286b6cd40ff24869a380db44d39b0" + "gateShapeSha256": "111e82fa1fd8341f8ee1f3d10d14365de382d83da5f8f9c5a1e3fcfecc5cafae" } diff --git a/config/ci/gates.json b/config/ci/gates.json index 5616b7ff..509bc4cb 100644 --- a/config/ci/gates.json +++ b/config/ci/gates.json @@ -292,6 +292,15 @@ "script": "review:a11y-manual", "expect": "pass" }, + { + "id": "check-a11y-manual-format", + "script": "review:a11y-manual", + "args": [ + "--", + "--format-only" + ], + "expect": "pass" + }, { "id": "check-architecture", "script": "check:architecture", @@ -1109,55 +1118,37 @@ "id": "artifact-artifacts-tests-a11y-manual-APP-HOME-md", "path": "artifacts/tests/a11y-manual/APP_HOME.md", "schemaId": "markdown", - "production": "command-generated", - "producerCommandIds": [ - "review-a11y-manual" - ] + "production": "source-controlled" }, { "id": "artifact-artifacts-tests-a11y-manual-EXAMPLES-UI-md", "path": "artifacts/tests/a11y-manual/EXAMPLES_UI.md", "schemaId": "markdown", - "production": "command-generated", - "producerCommandIds": [ - "review-a11y-manual" - ] + "production": "source-controlled" }, { "id": "artifact-artifacts-tests-a11y-manual-EXAMPLES-STATES-md", "path": "artifacts/tests/a11y-manual/EXAMPLES_STATES.md", "schemaId": "markdown", - "production": "command-generated", - "producerCommandIds": [ - "review-a11y-manual" - ] + "production": "source-controlled" }, { "id": "artifact-artifacts-tests-a11y-manual-EXAMPLES-AUTH-md", "path": "artifacts/tests/a11y-manual/EXAMPLES_AUTH.md", "schemaId": "markdown", - "production": "command-generated", - "producerCommandIds": [ - "review-a11y-manual" - ] + "production": "source-controlled" }, { "id": "artifact-artifacts-tests-a11y-manual-REFERENCE-RESOURCE-LIST-md", "path": "artifacts/tests/a11y-manual/REFERENCE_RESOURCE_LIST.md", "schemaId": "markdown", - "production": "command-generated", - "producerCommandIds": [ - "review-a11y-manual" - ] + "production": "source-controlled" }, { "id": "artifact-artifacts-tests-a11y-manual-NOT-FOUND-md", "path": "artifacts/tests/a11y-manual/NOT_FOUND.md", "schemaId": "markdown", - "production": "command-generated", - "producerCommandIds": [ - "review-a11y-manual" - ] + "production": "source-controlled" }, { "id": "artifact-artifacts-tests-a11y-manual-report-json", @@ -1717,6 +1708,12 @@ "path": "artifacts/quality/gates/FE-GATE-027.txt", "schemaId": "text", "production": "runner-generated" + }, + { + "id": "artifact-artifacts-quality-gates-FE-GATE-028-txt", + "path": "artifacts/quality/gates/FE-GATE-028.txt", + "schemaId": "text", + "production": "runner-generated" } ], "gates": [ @@ -1877,18 +1874,11 @@ "name": "accessibility", "commandIds": [ "test-a11y", - "review-a11y-manual" + "check-a11y-manual-format" ], "logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-009-txt", "evidenceArtifactIds": [ - "artifact-artifacts-tests-a11y-json", - "artifact-artifacts-tests-a11y-manual-APP-HOME-md", - "artifact-artifacts-tests-a11y-manual-EXAMPLES-UI-md", - "artifact-artifacts-tests-a11y-manual-EXAMPLES-STATES-md", - "artifact-artifacts-tests-a11y-manual-EXAMPLES-AUTH-md", - "artifact-artifacts-tests-a11y-manual-REFERENCE-RESOURCE-LIST-md", - "artifact-artifacts-tests-a11y-manual-NOT-FOUND-md", - "artifact-artifacts-tests-a11y-manual-report-json" + "artifact-artifacts-tests-a11y-json" ], "retentionClassId": "merge-cycle" }, @@ -2189,6 +2179,24 @@ "artifact-artifacts-release-deployment-admission-json" ], "retentionClassId": "release-coherence" + }, + { + "id": "FE-GATE-028", + "name": "manual-accessibility-review", + "commandIds": [ + "review-a11y-manual" + ], + "logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-028-txt", + "evidenceArtifactIds": [ + "artifact-artifacts-tests-a11y-manual-APP-HOME-md", + "artifact-artifacts-tests-a11y-manual-EXAMPLES-UI-md", + "artifact-artifacts-tests-a11y-manual-EXAMPLES-STATES-md", + "artifact-artifacts-tests-a11y-manual-EXAMPLES-AUTH-md", + "artifact-artifacts-tests-a11y-manual-REFERENCE-RESOURCE-LIST-md", + "artifact-artifacts-tests-a11y-manual-NOT-FOUND-md", + "artifact-artifacts-tests-a11y-manual-report-json" + ], + "retentionClassId": "release-coherence" } ], "stages": [ @@ -2224,7 +2232,8 @@ "FE-GATE-015", "FE-GATE-019", "FE-GATE-026", - "FE-GATE-027" + "FE-GATE-027", + "FE-GATE-028" ] }, { @@ -2329,7 +2338,8 @@ "FE-GATE-012", "FE-GATE-014", "FE-GATE-019", - "FE-GATE-026" + "FE-GATE-026", + "FE-GATE-028" ], "browserGateIds": [ "FE-GATE-026" diff --git a/docs/accessibility/manual-checklist.md b/docs/accessibility/manual-checklist.md index 4aaa7aa7..7e556367 100644 --- a/docs/accessibility/manual-checklist.md +++ b/docs/accessibility/manual-checklist.md @@ -10,6 +10,12 @@ registry: `APP_HOME`, `EXAMPLES_PLATFORM`, `EXAMPLES_UI`, `EXAMPLES_STATES`, blank identity/timestamp/signature fields, pending verdicts, mismatched release IDs, or missing routes. +The signed review is the release gate FE-GATE-028 (`review:a11y-manual`), so +it is required once per release candidate, not on every merge. The merge gate +FE-GATE-009 runs `review:a11y-manual -- --format-only`: each record must keep +the fields below with `pending`, `pass` or `not-applicable ()` verdicts, +and a record marked `reviewed` must be complete. + This list is not maintained by hand: `verify:documentation` compares it against the installed route registry and fails when a registered route is absent. It said six routes while ten were registered, which put the platform overview and diff --git a/docs/operations/ci-quality-gates.md b/docs/operations/ci-quality-gates.md index 6aca8304..4edb2fb5 100644 --- a/docs/operations/ci-quality-gates.md +++ b/docs/operations/ci-quality-gates.md @@ -1,6 +1,6 @@ # CI quality-gate orchestration -`config/ci/gates.json` is the executable registry for all 26 gates and the sole +`config/ci/gates.json` is the executable registry for all 28 gates and the sole workflow model. `.gitea/workflows/quality-gates.yml` is generated from that strict v2 contract; it is not an independent configuration authority. Update the registry, run `corepack pnpm generate:ci-workflow`, and commit the generated diff --git a/docs/testing/frontend-platform-testing-strategy.md b/docs/testing/frontend-platform-testing-strategy.md index 1b33612b..3e6f9fc5 100644 --- a/docs/testing/frontend-platform-testing-strategy.md +++ b/docs/testing/frontend-platform-testing-strategy.md @@ -1103,8 +1103,11 @@ validate한다. 외부 배포 주소나 28일 field evidence가 없는 skeleton 개발 단계에서는 해당 gate가 실제 프로젝트가 채울 계약으로 남는다. 이를 fake data로 통과시키지 않는다. -현재 `FE-GATE-009`의 signed manual accessibility review는 merge gate다. 이 -문서는 이를 production/field gate로 이동시키지 않는다. +signed manual accessibility review는 release gate `FE-GATE-028`이다 +(`config/ci/gates.json`, 리뷰 08-06). 사람의 서명은 릴리스 후보 하나에 대해 +하므로 merge마다 요구할 수 없다. merge gate `FE-GATE-009`는 자동 axe 검사와 +기록 형식 검사(`review:a11y-manual -- --format-only`, +`scripts/lib/manual-a11y-evidence.ts`의 `validateManualA11yRecordFormat`)만 한다. ### 16.4 병렬화와 shard diff --git a/scripts/check-ci-contract.ts b/scripts/check-ci-contract.ts index 08763793..5fb777ea 100644 --- a/scripts/check-ci-contract.ts +++ b/scripts/check-ci-contract.ts @@ -105,7 +105,7 @@ if (!architecture?.evidenceArtifactIds.some((id) => index.artifacts.get(id)?.pat } const expectedGateIds = Array.from( - { length: 27 }, + { length: 28 }, (_, index) => `FE-GATE-${String(index + 1).padStart(3, "0")}`, ); const passingResults: Record = Object.fromEntries( @@ -168,4 +168,4 @@ if (failures.length > 0) { process.stderr.write(`CI contract failed:\n${failures.join("\n")}\n`); process.exit(1); } -process.stdout.write("CI contract: 27 gates, strict v2 graph and generated workflow model PASS\n"); +process.stdout.write("CI contract: 28 gates, strict v2 graph and generated workflow model PASS\n"); diff --git a/scripts/contracts/ci-gates.ts b/scripts/contracts/ci-gates.ts index 52e23619..18f8bc85 100644 --- a/scripts/contracts/ci-gates.ts +++ b/scripts/contracts/ci-gates.ts @@ -790,11 +790,11 @@ function validateContractSemantics( } const expectedGateIds = Array.from( - { length: 27 }, + { length: 28 }, (_, index) => `FE-GATE-${String(index + 1).padStart(3, "0")}`, ); if (JSON.stringify(contract.gates.map(({ id }) => id)) !== JSON.stringify(expectedGateIds)) { - issue("gate registry must contain FE-GATE-001..027 in canonical order"); + issue("gate registry must contain FE-GATE-001..028 in canonical order"); } const expectedStages: ReadonlyArray = [ ["merge", "MERGE_READY", [], PROMOTION_FORMULA.MERGE_READY], @@ -864,7 +864,7 @@ function validateContractSemantics( } const expectedJobOwnership: Readonly> = { merge_gate: ["FE-GATE-001", "FE-GATE-002", "FE-GATE-003", "FE-GATE-004", "FE-GATE-005", "FE-GATE-006", "FE-GATE-007", "FE-GATE-008", "FE-GATE-009", "FE-GATE-010", "FE-GATE-011", "FE-GATE-013", "FE-GATE-020"], - release_gate: ["FE-GATE-012", "FE-GATE-014", "FE-GATE-019", "FE-GATE-026"], + release_gate: ["FE-GATE-012", "FE-GATE-014", "FE-GATE-019", "FE-GATE-026", "FE-GATE-028"], immutable_build: ["FE-GATE-015", "FE-GATE-027"], vulnerability_provider: [], provenance_provider: [], diff --git a/scripts/lib/ci-contract-report.ts b/scripts/lib/ci-contract-report.ts index 3aaf1d68..e208d668 100644 --- a/scripts/lib/ci-contract-report.ts +++ b/scripts/lib/ci-contract-report.ts @@ -4,7 +4,7 @@ export const ciContractReportSchema = z .object({ schemaVersion: z.literal(2), nodeVersion: z.string().regex(/^\d+\.\d+\.\d+$/u), - gateCount: z.literal(27), + gateCount: z.literal(28), commandDefinitionCount: z.number().int().positive(), commandReferenceCount: z.number().int().positive(), artifactCount: z.number().int().positive(), diff --git a/scripts/lib/manual-a11y-evidence.ts b/scripts/lib/manual-a11y-evidence.ts index 1a40c8f8..a254dd0e 100644 --- a/scripts/lib/manual-a11y-evidence.ts +++ b/scripts/lib/manual-a11y-evidence.ts @@ -15,8 +15,20 @@ const REVIEW_FIELDS = Object.freeze([ "Screen reader", ]); -export function validateManualA11yEvidence(content: string) { - const fields = Object.fromEntries( +const IDENTITY_FIELDS = Object.freeze([ + "Status", + "Route ID", + "Release ID", + "Reviewer", + "Reviewed at", + "Signature", + "Attestation", +]); + +const NOT_APPLICABLE = /^not-applicable \(.+\)$/; + +function parseRecordFields(content: string): Record { + return Object.fromEntries( content .split(/\r?\n/) .map((line) => /^([^:]+):\s*(.*)$/.exec(line)) @@ -26,6 +38,37 @@ export function validateManualA11yEvidence(content: string) { match[2].trim(), ]), ); +} + +/** + * 08-06. The merge-stage check: the record for `routeId` keeps the template's + * fields and vocabulary, whether or not a human has reviewed it yet. A record + * that claims `reviewed` must also be complete. Returns the offending fields. + */ +export function validateManualA11yRecordFormat(content: string, routeId: string): string[] { + const fields = parseRecordFields(content); + const failures = [...IDENTITY_FIELDS, ...REVIEW_FIELDS].filter( + (field) => !(field in fields), + ); + if (fields.Status !== undefined && !["pending-manual-review", "reviewed"].includes(fields.Status)) { + failures.push("Status"); + } + if (fields["Route ID"] !== undefined && fields["Route ID"] !== routeId) failures.push("Route ID"); + if (fields.Attestation !== undefined && !["pending", "accepted"].includes(fields.Attestation)) { + failures.push("Attestation"); + } + for (const field of REVIEW_FIELDS) { + const verdict = fields[field]; + if (verdict !== undefined && verdict !== "pass" && verdict !== "pending" && !NOT_APPLICABLE.test(verdict)) { + failures.push(field); + } + } + if (fields.Status === "reviewed") failures.push(...validateManualA11yEvidence(content).failures); + return [...new Set(failures)]; +} + +export function validateManualA11yEvidence(content: string) { + const fields = parseRecordFields(content); const failures: string[] = []; if (fields.Status !== "reviewed") failures.push("Status"); if (!fields["Route ID"]) failures.push("Route ID"); @@ -44,7 +87,7 @@ export function validateManualA11yEvidence(content: string) { const result = fields[field]; if ( result !== "pass" && - !/^not-applicable \(.+\)$/.test(result ?? "") + !NOT_APPLICABLE.test(result ?? "") ) { failures.push(field); } diff --git a/scripts/lib/promotion-readiness.ts b/scripts/lib/promotion-readiness.ts index 2f4f90f6..9d265741 100644 --- a/scripts/lib/promotion-readiness.ts +++ b/scripts/lib/promotion-readiness.ts @@ -23,6 +23,9 @@ export const PROMOTION_FORMULA = Object.freeze({ // FE-GATE-027. A candidate is only release-ready once it has been admitted // to a named environment; coherence alone never proved it belonged there. "FE-GATE-027", + // FE-GATE-028 (08-06). The signed human accessibility review belongs to a + // release candidate, so it gates release; merge checks the record format. + "FE-GATE-028", ]), PROD_PROMOTION_READY: Object.freeze([ "FE-GATE-016", diff --git a/scripts/verify-a11y-manual.ts b/scripts/verify-a11y-manual.ts index 793b1e68..5c562943 100644 --- a/scripts/verify-a11y-manual.ts +++ b/scripts/verify-a11y-manual.ts @@ -4,6 +4,7 @@ import { manualA11yReportArtifactSchema } from "./contracts/release-artifacts.ts import { MANUAL_A11Y_ROUTE_IDS, validateManualA11yEvidence, + validateManualA11yRecordFormat, } from "./lib/manual-a11y-evidence.ts"; import { writeValidatedJsonArtifact } from "./lib/validated-json-artifact.ts"; @@ -17,6 +18,27 @@ type ManualA11yResult = Readonly<{ passed: boolean; }>; +// 08-06: the signed review is a release-stage gate (FE-GATE-028). The merge +// stage (FE-GATE-009) runs `--format-only`: every route has a record in the +// template's shape, reviewed or not. +if (process.argv.includes("--format-only")) { + const failures: string[] = []; + for (const routeId of MANUAL_A11Y_ROUTE_IDS) { + const path = `artifacts/tests/a11y-manual/${routeId}.md`; + const record = await readFile(path, "utf8").catch(() => null); + const invalid = record === null ? ["missing record"] : validateManualA11yRecordFormat(record, routeId); + if (invalid.length > 0) failures.push(`${path}: ${invalid.join(", ")}`); + } + if (failures.length > 0) { + process.stderr.write(`Manual accessibility record format is invalid:\n${failures.join("\n")}\n`); + process.exit(1); + } + process.stdout.write( + `Manual accessibility record format: PASS (${MANUAL_A11Y_ROUTE_IDS.length} routes; signed review runs in FE-GATE-028)\n`, + ); + process.exit(0); +} + const results: ManualA11yResult[] = []; for (const routeId of MANUAL_A11Y_ROUTE_IDS) { const path = `artifacts/tests/a11y-manual/${routeId}.md`; diff --git a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap index 638d9b2a..a77fc42d 100644 --- a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap +++ b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap @@ -96,6 +96,7 @@ jobs: - { gate: FE-GATE-014, name: config-compatibility, browser: false } - { gate: FE-GATE-019, name: hosting-header, browser: false } - { gate: FE-GATE-026, name: lab-performance, browser: true } + - { gate: FE-GATE-028, name: manual-accessibility-review, browser: false } steps: - uses: https://github.com/actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 with: diff --git a/tests/unit/ci-workflow-generation.test.ts b/tests/unit/ci-workflow-generation.test.ts index 943bc6df..4c4e3105 100644 --- a/tests/unit/ci-workflow-generation.test.ts +++ b/tests/unit/ci-workflow-generation.test.ts @@ -189,22 +189,38 @@ describe("CI gate contract", () => { const index = indexCiGateContract(contract); expect(contract.schemaVersion).toBe(2); expect(contract.gates.map(({ id }) => id)).toEqual( - Array.from({ length: 27 }, (_, index) => + Array.from({ length: 28 }, (_, index) => `FE-GATE-${String(index + 1).padStart(3, "0")}`, ), ); expect(contract.jobs).toHaveLength(9); - expect(contract.commands).toHaveLength(93); - expect(contract.gates.reduce((total, gate) => total + gate.commandIds.length, 0)).toBe(105); + expect(contract.commands).toHaveLength(94); + expect(contract.gates.reduce((total, gate) => total + gate.commandIds.length, 0)).toBe(106); expect(contract.commands.filter(({ expect }) => expect === "fail")).toHaveLength(31); expect(contract.gates.reduce((total, gate) => total + gate.evidenceArtifactIds.length, 0)).toBe(88); - expect(contract.artifacts).toHaveLength(109); + expect(contract.artifacts).toHaveLength(110); expect(contract.stages).toHaveLength(5); expect(contract.retention.classes).toHaveLength(5); expect(index.gates.get("FE-GATE-015")?.commandIds).toHaveLength(2); expect(index.gates.get("FE-GATE-020")?.name).toBe("removability"); }); + it("runs the signed manual accessibility review at release, not merge (08-06)", async () => { + const contract = await loadCiGateContract(process.cwd()); + const index = indexCiGateContract(contract); + const scriptsOf = (gateId: string) => + (index.gates.get(gateId)?.commandIds ?? []).map((id) => { + const command = index.commands.get(id); + return [command?.script, ...(command?.args ?? [])].join(" "); + }); + const stageOf = (gateId: string) => + contract.stages.find(({ gateIds }) => gateIds.includes(gateId))?.id; + expect(scriptsOf("FE-GATE-009")).toEqual(["test:a11y", "review:a11y-manual -- --format-only"]); + expect(scriptsOf("FE-GATE-028")).toEqual(["review:a11y-manual"]); + expect(stageOf("FE-GATE-009")).toBe("merge"); + expect(stageOf("FE-GATE-028")).toBe("release"); + }); + it("keeps the action registry recursively immutable and resolves only known actions", () => { expect(Object.isFrozen(CI_ACTION_REGISTRY)).toBe(true); expect(Object.values(CI_ACTION_REGISTRY).every((action) => Object.isFrozen(action))).toBe(true); diff --git a/tests/unit/manual-a11y-evidence.test.ts b/tests/unit/manual-a11y-evidence.test.ts index ec91813a..dbd5672d 100644 --- a/tests/unit/manual-a11y-evidence.test.ts +++ b/tests/unit/manual-a11y-evidence.test.ts @@ -1,8 +1,11 @@ import { describe, expect, it } from "vitest"; +import { readFileSync } from "node:fs"; + import { MANUAL_A11Y_ROUTE_IDS, validateManualA11yEvidence, + validateManualA11yRecordFormat, } from "../../scripts/lib/manual-a11y-evidence.ts"; import { ROUTE_REGISTRY } from "../../src/features/installed-feature-contracts.ts"; @@ -64,4 +67,39 @@ describe("manual accessibility evidence", () => { passed: false, }); }); + + // 08-06: the merge stage checks only that each record keeps the template's + // shape; the signed review itself is a release-stage gate (FE-GATE-028). + describe("record format", () => { + const pending = reviewed + .replace("Status: reviewed", "Status: pending-manual-review") + .replace("Release ID: release-1", "Release ID:") + .replace("Reviewer: reviewer@example.test", "Reviewer:") + .replace("Reviewed at: 2026-07-25T12:00:00Z", "Reviewed at:") + .replace("Signature: review-record-1", "Signature:") + .replace("Attestation: accepted", "Attestation: pending") + .replace("M1 Keyboard: pass", "M1 Keyboard: pending"); + + it("accepts a pending template and a signed record", () => { + expect(validateManualA11yRecordFormat(pending, "APP_HOME")).toEqual([]); + expect(validateManualA11yRecordFormat(reviewed, "APP_HOME")).toEqual([]); + }); + + it("accepts every checked-in route record", () => { + for (const routeId of MANUAL_A11Y_ROUTE_IDS) { + const record = readFileSync(`artifacts/tests/a11y-manual/${routeId}.md`, "utf8"); + expect(validateManualA11yRecordFormat(record, routeId), routeId).toEqual([]); + } + }); + + it.each([ + ["a missing field", pending.replace("Signature:\n", ""), "APP_HOME", "Signature"], + ["an unknown status", pending.replace("Status: pending-manual-review", "Status: done"), "APP_HOME", "Status"], + ["an unknown verdict", pending.replace("M1 Keyboard: pending", "M1 Keyboard: ok"), "APP_HOME", "M1 Keyboard"], + ["another route's record", pending, "NOT_FOUND", "Route ID"], + ["a reviewed record that is not complete", reviewed.replace("Signature: review-record-1", "Signature:"), "APP_HOME", "Signature"], + ])("rejects %s", (_name, record, routeId, field) => { + expect(validateManualA11yRecordFormat(record, routeId)).toContain(field); + }); + }); });