수동 접근성 기록 검사에 구멍이 둘 있다. - FE-GATE-028(`review:a11y-manual`)은 기록끼리 Release ID가 같은지만 본다 (05-01). 후보를 받는 입력이 없어, 첫 release에 세 기록을 서명한 뒤 화면을 바꾸고 기록을 그대로 둔 채 다음 release를 돌아도 통과한다. checklist의 "release 후보마다 한 번"이 지켜지지 않는다(결함 패턴 G7). - 제품은 WCAG 2.2 AA를 약속하는데 기록 양식은 M1~M7과 스크린 리더뿐이다 (05-05의 남은 것). axe에 규칙이 없는 2.4.11 포커스 가림과 일부만 보는 2.5.8 목표 크기를 볼 칸이 없다. 고른 방법: - 결정(2026-11-13, r9-fe·w2-fe-2: 후보 ID는 릴리스 태그)대로 `scripts/verify-a11y-manual.ts`가 env `RELEASE_TAG`를 읽고, 각 기록의 `Release ID`가 그 태그와 같지 않으면 실패한다. 태그가 비면 비교할 것이 없으니 모두 실패한다(fail-closed). release job은 이미 `RELEASE_TAG`를 넘기고 FE-GATE-028이 그것을 요구한다(main `000b5a35`). 규칙은 `releaseTagFailures`(`scripts/lib/manual-a11y-evidence.ts`)에 둔다. - 결정 R9-D9(2026-11-12, 총괄)대로 기록 양식에 `M8 Focus not obscured` (2.4.11)와 `M9 Target size`(2.5.8)를 더한다: 검사기의 필드 목록, checklist, 템플릿 기록 셋, `create:feature`가 만드는 기록. checklist의 `Release ID` 예는 "release tag"로 바꿨다. - 버린 대안: workflow의 `RELEASE_ID`와 대조(run마다 달라 사람이 미리 적을 수 없다), 칸 없이 태그만 더하기(2.2 AA 일부를 아무도 보지 않는다). 위험·한계: 다운스트림의 기존 route 기록에는 M8·M9가 없어 다음 동기화 뒤 FE-GATE-009 형식 검사가 그 필드 이름을 대며 실패한다. 기록마다 `M8 Focus not obscured: pending`, `M9 Target size: pending` 두 줄을 더하면 된다. 서명한 기록의 `Release ID`는 다음 release부터 태그(예 `v1.4.0`)로 적는다. 검증: `tests/unit/manual-a11y-evidence.test.ts`(M8·M9가 빠진 기록 거절, 태그 같음·다름·빔, `review:a11y-manual`을 실제로 띄워 태그로 통과·다음 태그와 빈 태그로 실패)가 고치기 전 코드에서 실패하고 고친 뒤 통과한다(desktop, PR 본문). Refs: 1112/05-01, 1112/05-05
123 lines
4.0 KiB
TypeScript
123 lines
4.0 KiB
TypeScript
import { ROUTE_REGISTRY } from "../../src/features/installed-feature-contracts.ts";
|
|
|
|
export const MANUAL_A11Y_ROUTE_IDS = Object.freeze(
|
|
Object.values(ROUTE_REGISTRY).map((route) => route.routeId),
|
|
);
|
|
|
|
const REVIEW_FIELDS = Object.freeze([
|
|
"M1 Keyboard",
|
|
"M2 Visible focus",
|
|
"M3 Route focus",
|
|
"M4 Modal focus",
|
|
"M5 Error association",
|
|
"M6 Color signal",
|
|
"M7 Reduced motion",
|
|
// 1112/05-05. WCAG 2.2 AA criteria axe has no rule for (focus not obscured
|
|
// 2.4.11) or covers only in part (target size 2.5.8).
|
|
"M8 Focus not obscured",
|
|
"M9 Target size",
|
|
"Screen reader",
|
|
]);
|
|
|
|
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<string, string> {
|
|
return Object.fromEntries(
|
|
content
|
|
.split(/\r?\n/)
|
|
.map((line) => /^([^:]+):\s*(.*)$/.exec(line))
|
|
.filter((match): match is RegExpExecArray => match !== null)
|
|
.map((match) => [
|
|
match[1].trim(),
|
|
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");
|
|
if (!fields["Release ID"]) failures.push("Release ID");
|
|
if (!fields.Reviewer) failures.push("Reviewer");
|
|
if (!fields.Signature) failures.push("Signature");
|
|
if (fields.Attestation !== "accepted") failures.push("Attestation");
|
|
if (
|
|
!fields["Reviewed at"] ||
|
|
!Number.isFinite(Date.parse(fields["Reviewed at"]))
|
|
) {
|
|
failures.push("Reviewed at");
|
|
}
|
|
|
|
for (const field of REVIEW_FIELDS) {
|
|
const result = fields[field];
|
|
if (
|
|
result !== "pass" &&
|
|
!NOT_APPLICABLE.test(result ?? "")
|
|
) {
|
|
failures.push(field);
|
|
}
|
|
}
|
|
return Object.freeze({
|
|
fields: Object.freeze(fields),
|
|
failures: Object.freeze(failures),
|
|
passed: failures.length === 0,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 1112/05-01. A signed record is evidence for one release only: the release
|
|
* tag the release job is building (`RELEASE_TAG`, e.g. `v1.4.0`). A record
|
|
* signed for an earlier tag does not pass a later one. With no tag there is
|
|
* nothing to compare with, so every record fails (fail-closed).
|
|
*/
|
|
export function releaseTagFailures(
|
|
releaseTag: string | undefined,
|
|
releaseId: string | null | undefined,
|
|
): string[] {
|
|
const tag = releaseTag?.trim() ?? "";
|
|
if (tag === "") return ["no release tag to compare the Release ID with (RELEASE_TAG is empty)"];
|
|
if (releaseId !== tag) {
|
|
return [`Release ID ${releaseId ? `"${releaseId}"` : "(empty)"} is not the release tag "${tag}"`];
|
|
}
|
|
return [];
|
|
}
|