From 32982e554746a98d5801458a0f6d12e98330ec18 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 20 Nov 2026 23:33:17 +0900 Subject: [PATCH 1/2] =?UTF-8?q?ci(gates):=20FE-GATE-029=EA=B0=80=20--grep-?= =?UTF-8?q?invert=20=EC=8B=A4=ED=96=89=EB=A7=88=EB=8B=A4=20=EA=B0=99?= =?UTF-8?q?=EC=9D=80=20testDir=EC=9D=98=20--grep=20=EC=A7=9D=EC=9D=84=20?= =?UTF-8?q?=EC=9A=94=EA=B5=AC=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: FE-GATE-029(check:ci:gating)는 게이트가 닿는 `playwright test` 실행마다 설정의 testDir을 gated로 셌고, `--grep`·`--grep-invert`·파일 필터를 읽지 않았다. FE-GATE-009의 test:a11y에서 Playwright 실행을 빼도 029는 통과했다. test:e2e(FE-GATE-008)가 tests/e2e를 `--grep-invert @a11y`로 돌기 때문에, 시험이 모두 @a11y인 tests/e2e/accessibility.spec.ts는 어느 게이트에서도 돌지 않는다. 설정도 `--config X`만 읽어서 `-c X`·`--config=X` 실행은 e2e 설정의 testDir로 셌다. result-paths 시험은 세 꼴을 따로 읽고 있었다. 고른 방법: 시험 본문이 아니라 게이트가 도는 인자만 본다. testDir 하나는 필터 없는 gated 실행이 있거나, `--grep-invert P` 실행마다 같은 testDir을 `--grep P`(같은 글자)로 도는 gated 실행이 있을 때만 gated다. 파일 필터가 있는 실행, `--grep`·`--grep-invert`를 합쳐 둘 이상 쓴 실행, 설정(또는 그 설정이 상대 경로로 import한 설정)의 글자에 `grep`·`grepInvert` 속성이 있는 실행은 나누지 않는 부분 실행으로 센다. 그런 testDir 아래 게이트 밖 파일은 testDir 한 줄로 알린다: testDir, 실행과 그 script, 빠진 짝. 인자 parser는 `scripts/lib/playwright-test-args.ts` 하나로 두고 029와 result-paths 시험이 같이 쓴다. `docs/operations/ci-quality-gates.md`의 029 설명에 이 규칙을 적는다. 버린 안: - `playwright test --list --reporter=json`으로 Playwright에 묻기: 시험 파일을 in-process로 불러 생성물(`src/features/*` 색인)에 기대고, 실행마다 수 초가 든다. - Babel로 시험 파일을 읽어 Playwright grep 판정을 흉내 내기: 제목 경로, 태그, forceRegExp 같은 Playwright 1.62 내부 규칙을 템플릿 안에 다시 만든다. 버전에 묶이고, 템플릿 리터럴 제목 때문에 파생 서비스에서 거짓 실패가 난다. 위험·한계: 짝은 글자로만 맞춘다. 정규식으로 같은 뜻이라도 글자가 다르면 실패한다(실패 쪽). 모르는 옵션 뒤 맨 토큰은 파일 필터로 센다(실패 쪽). `--project=X`·`--shard=X`처럼 `=`로 붙인 다른 옵션과 설정의 testMatch· testIgnore는 읽지 않는다. 필터는 package script 글자에서만 읽어, 게이트 계약의 `args`로 붙는 인자는 보지 않는다(전에도 읽지 않았다). Playwright 설정 파일의 주석에 `grep:` 꼴을 쓰면 부분 실행으로 센다. 검증: 고치기 전 desktop에서 009의 실행을 뺀 변이로 FE-GATE-029 rc=0, 새 단위 시험 17개 실패(변이 저장소에서 tests/e2e를 셈, -c·--config= 못 읽음, 짝 없는 실행을 셈). 고친 뒤 단위 시험 3파일 61개 통과, 같은 변이에서 FE-GATE-029 rc=1 (「Playwright testDir tests/e2e is only partly run … has no gated `--grep @a11y` run to pair with」). 리뷰에서 나온 `-cX`·`-gP`·`-GP` 꼴: parser만 고치기 전으로 되돌린 변이에서 새 시험 4개 실패, 되돌리면 61개 통과. 확인 리뷰에서 나온 `-xGP` 꼴(값 없는 `-x` 뒤에 붙인 옵션)과 `--grep-invert`를 두 번 쓴 실행: 두 고침을 되돌린 변이에서 새 시험 6개 실패, 되돌리면 67개 통과. --- docs/operations/ci-quality-gates.md | 4 + playwright.a11y.config.ts | 4 +- scripts/check-ci-gating.ts | 11 +- scripts/lib/playwright-test-args.ts | 84 +++++++ scripts/lib/ungated-tests.ts | 137 +++++++++++- tests/unit/playwright-result-paths.test.ts | 23 +- tests/unit/playwright-test-args.test.ts | 82 +++++++ tests/unit/ungated-tests.test.ts | 244 ++++++++++++++++++++- 8 files changed, 545 insertions(+), 44 deletions(-) create mode 100644 scripts/lib/playwright-test-args.ts create mode 100644 tests/unit/playwright-test-args.test.ts diff --git a/docs/operations/ci-quality-gates.md b/docs/operations/ci-quality-gates.md index 74d0137e..ef3fd3cc 100644 --- a/docs/operations/ci-quality-gates.md +++ b/docs/operations/ci-quality-gates.md @@ -58,6 +58,10 @@ production 게이트는 matrix check로 남는다. 실패를 무시하는(soft-f `check:ci:gating`(main 단계 FE-GATE-029)은 `tests/` 아래 테스트 파일(`tests/fixtures` 제외)이 모두 CI 게이트 명령에서 실행되는지 확인한다. 게이트 명령이 닿는 package script의 Vitest 경로와 Playwright 설정의 `testDir`를 모아 비교한다(`scripts/lib/ungated-tests.ts`). +Playwright 실행은 `--grep`·`--grep-invert`·파일 필터와 설정(그 설정이 import한 설정 포함)의 +`grep`·`grepInvert`도 읽는다. testDir은 필터 없는 gated 실행이 있거나, `--grep-invert P` +실행마다 같은 testDir을 `--grep P`(같은 글자)로 도는 gated 실행이 있을 때만 게이트 안으로 센다. +아니면 그 testDir의 게이트 밖 파일을 testDir·실행·빠진 짝을 대는 한 줄로 알리며 실패한다. `run-scale-profile.ts `를 부르는 명령은 그 tier의 Vitest 경로로 센다. 게이트가 돌리지 않는 테스트는 `config/ci/ungated-tests.json`에 이유와 함께 적어야 한다. 게이트가 이미 돌리는 파일을 이 목록에 남겨 두면 실패한다. diff --git a/playwright.a11y.config.ts b/playwright.a11y.config.ts index 1940ad0d..0a5bf0b5 100644 --- a/playwright.a11y.config.ts +++ b/playwright.a11y.config.ts @@ -12,7 +12,9 @@ import { testRunPath } from "./scripts/lib/run-isolation.ts"; export default defineConfig({ ...e2eConfig, // The e2e config's, as a literal: FE-GATE-029 reads testDir in the text of - // the config a gate runs (scripts/lib/ungated-tests.ts). + // the config a gate runs (scripts/lib/ungated-tests.ts). It counts + // tests/e2e as gated only with this run beside test:e2e's: each leaves out + // what the other runs. testDir: "./tests/e2e", forbidOnly: true, outputDir: testRunPath("artifacts/tests/a11y/results"), diff --git a/scripts/check-ci-gating.ts b/scripts/check-ci-gating.ts index 094b2558..cddf5a42 100644 --- a/scripts/check-ci-gating.ts +++ b/scripts/check-ci-gating.ts @@ -8,6 +8,7 @@ import { gatedTestTargets, listTestFiles, parseUngatedTestExclusions, + playwrightTestDirGaps, ungatedTestFailures, UNGATED_TESTS_PATH, } from "./lib/ungated-tests.ts"; @@ -36,17 +37,17 @@ const failures: string[] = []; // 12-04: every test file runs in a gate, or config/ci/ungated-tests.json says why not. try { + const entryScripts = [...contract.commands.map(({ script }) => script), ...productGateScripts]; + const readConfig = (file: string) => readFileSync(file, "utf8"); failures.push( ...ungatedTestFailures({ testFiles: await listTestFiles(process.cwd()), - gatedPaths: gatedTestTargets( - packageScripts, - [...contract.commands.map(({ script }) => script), ...productGateScripts], - (file) => readFileSync(file, "utf8"), - ), + gatedPaths: gatedTestTargets(packageScripts, entryScripts, readConfig), exclusions: parseUngatedTestExclusions( JSON.parse(await readFile(UNGATED_TESTS_PATH, "utf8")), ), + // fe-ci-next-12: a testDir the gates run only part of, with the runs that leave the rest out. + playwrightGaps: playwrightTestDirGaps(packageScripts, entryScripts, readConfig), }), ); } catch (error) { diff --git a/scripts/lib/playwright-test-args.ts b/scripts/lib/playwright-test-args.ts new file mode 100644 index 00000000..704fa575 --- /dev/null +++ b/scripts/lib/playwright-test-args.ts @@ -0,0 +1,84 @@ +/** + * fe-ci-next-12. The `playwright test` runs of a package script command, as + * FE-GATE-029 (scripts/lib/ungated-tests.ts) and the result path test + * (tests/unit/playwright-result-paths.test.ts) read them. Each reads the + * options that pick the config and the tests: `-c`/`--config`, `-g`/`--grep` + * and `-G`/`--grep-invert`, written as `-c X`, `-cX`, `--config X` or + * `--config=X` (commander reads all four), and the positional file filters. + * `-x`, the one short option of `playwright test` with no value, can lead the + * same token: commander reads `-xG@a11y` as `-x -G@a11y`. + * A bare token after any other option counts as a file filter: the parser + * cannot tell whether that option takes a value, and a filter it missed would + * count tests that do not run. + */ +export const DEFAULT_PLAYWRIGHT_CONFIG = "playwright.config.ts"; + +export type PlaywrightTestRun = Readonly<{ + /** The `&&` part of the command that is this run. */ + segment: string; + config: string; + grep: readonly string[]; + grepInvert: readonly string[]; + files: readonly string[]; + /** Options it does not read, as written. */ + otherOptions: readonly string[]; +}>; + +const VALUE_OPTIONS: Readonly> = { + "-c": "config", + "--config": "config", + "-g": "grep", + "--grep": "grep", + "-G": "grepInvert", + "--grep-invert": "grepInvert", +}; + +export function playwrightTestRuns(command: string): PlaywrightTestRun[] { + const runs: PlaywrightTestRun[] = []; + for (const part of command.split("&&")) { + const segment = part.trim(); + const tokens = segment.split(/\s+/u); + const test = tokens.findIndex((token, index) => token === "test" && tokens[index - 1] === "playwright"); + if (test >= 0) runs.push(parseRun(segment, tokens.slice(test + 1))); + } + return runs; +} + +function parseRun(segment: string, args: readonly string[]): PlaywrightTestRun { + const values = { config: [] as string[], grep: [] as string[], grepInvert: [] as string[] }; + const files: string[] = []; + const otherOptions: string[] = []; + for (let index = 0; index < args.length; index += 1) { + let token = args[index]!; + if (token === "--") { + files.push(...args.slice(index + 1)); + break; + } + while (/^-x[^-]/u.test(token)) { + otherOptions.push("-x"); + token = `-${token.slice(2)}`; + } + // Where a value written in the same token starts: after `=` of `--config=X`, + // after the letter of `-cX`. + const long = token.startsWith("--"); + const split = long ? token.indexOf("=") : /^-[^-]./u.test(token) ? 2 : -1; + const key = VALUE_OPTIONS[split >= 0 ? token.slice(0, split) : token]; + const value = key === undefined ? undefined : split >= 0 ? token.slice(long ? split + 1 : split) : args[index + 1]; + if (key !== undefined && value !== undefined) { + values[key].push(value); + if (split < 0) index += 1; + } else if (token.startsWith("-")) { + otherOptions.push(token); + } else { + files.push(token); + } + } + return { + segment, + config: values.config.at(-1) ?? DEFAULT_PLAYWRIGHT_CONFIG, + grep: values.grep, + grepInvert: values.grepInvert, + files, + otherOptions, + }; +} diff --git a/scripts/lib/ungated-tests.ts b/scripts/lib/ungated-tests.ts index b4cd322a..62f62e0c 100644 --- a/scripts/lib/ungated-tests.ts +++ b/scripts/lib/ungated-tests.ts @@ -5,6 +5,7 @@ import { z } from "zod"; import { SCALE_TIERS, type ScaleTier } from "../scale/run-scale-profile.ts"; import { reachablePackageScripts } from "./package-script-graph.ts"; +import { type PlaywrightTestRun, playwrightTestRuns } from "./playwright-test-args.ts"; /** * 12-04. A test file protects nothing unless a CI gate runs it. The gated set @@ -12,6 +13,15 @@ import { reachablePackageScripts } from "./package-script-graph.ts"; * path filters (`run-vitest.ts run `), the Vitest steps of a scale tier * (`run-scale-profile.ts `) and Playwright config `testDir`s. * A test outside that set needs a reasoned entry in config/ci/ungated-tests.json. + * + * fe-ci-next-12. A Playwright testDir is in the set only when the gates run all + * of it: one gated run has no `--grep`, `--grep-invert` or file filter, or each + * `--grep-invert P` run has a gated `--grep P` run (the same text P) of the + * same testDir. It reads the run's arguments, not the tests: matching titles + * and tags the way Playwright does would tie it to one Playwright version. + * A file filter, more than one `--grep` or `--grep-invert` in one run, or a + * config (or a config it imports) that sets `grep` or `grepInvert` makes a + * partial run it does not split. */ export const UNGATED_TESTS_PATH = "config/ci/ungated-tests.json"; @@ -26,6 +36,13 @@ const VITEST_TEST_FILE = /\.test\.tsx?$/u; */ export type GatedTestTarget = Readonly<{ path: string; runner: "vitest" | "playwright" }>; +/** A `playwright test` run a gate command reaches, with the testDir its config names. */ +export type GatedPlaywrightRun = PlaywrightTestRun & + Readonly<{ script: string; testDir: string | undefined; configSetsGrep: boolean }>; + +/** A testDir the gates run only part of, and the runs that leave the rest out. */ +export type PlaywrightTestDirGap = Readonly<{ testDir: string; runs: readonly string[] }>; + const ungatedTestsSchema = z .object({ schemaVersion: z.literal(1), @@ -93,27 +110,114 @@ export function gatedTestTargets( if (scaleProfile >= 0) { for (const step of SCALE_TIERS[tokens[scaleProfile + 1] as ScaleTier] ?? []) addVitestPaths(step.command); } - const playwrightTest = tokens.findIndex( - (token, index) => token === "test" && tokens[index - 1] === "playwright", - ); - if (playwrightTest >= 0) { - const configFlag = tokens.indexOf("--config"); - const config = configFlag >= 0 ? tokens[configFlag + 1]! : "playwright.config.ts"; - const testDir = /testDir:\s*["']\.?\/?([^"']+)["']/u.exec(readConfig(config))?.[1]; - if (testDir) add(testDir, "playwright"); - } } } + for (const testDir of playwrightCoverage(gatedPlaywrightRuns(scripts, entryScripts, readConfig)).gated) { + add(testDir, "playwright"); + } return [...targets.values()].sort( (left, right) => left.path.localeCompare(right.path) || left.runner.localeCompare(right.runner), ); } +/** Each `playwright test` run the entry scripts reach, in the order they reach them. */ +export function gatedPlaywrightRuns( + scripts: Readonly>, + entryScripts: readonly string[], + readConfig: (file: string) => string, +): GatedPlaywrightRun[] { + return reachablePackageScripts(scripts, entryScripts).flatMap((script) => + playwrightTestRuns(scripts[script]!).map((run) => ({ + ...run, + script, + testDir: /testDir:\s*["']\.?\/?([^"']+)["']/u.exec(readConfig(run.config))?.[1]?.replace(/\/$/u, ""), + configSetsGrep: configSetsGrep(run.config, readConfig, new Set()), + })), + ); +} + +export function playwrightTestDirGaps( + scripts: Readonly>, + entryScripts: readonly string[], + readConfig: (file: string) => string, +): PlaywrightTestDirGap[] { + return playwrightCoverage(gatedPlaywrightRuns(scripts, entryScripts, readConfig)).gaps; +} + +/** The config or a config it imports by a relative path names `grep` or `grepInvert`. */ +function configSetsGrep(config: string, readConfig: (file: string) => string, seen: Set): boolean { + if (seen.has(config)) return false; + seen.add(config); + const text = readConfig(config); + // A property, not a word in a comment: `grep: …`, `grep,` or `grep }`. + if (/\bgrep(?:Invert)?\s*[:,}]/u.test(text)) return true; + return [...text.matchAll(/\bfrom\s+["'](\.{1,2}\/[^"']+\.config\.[cm]?[jt]s)["']/gu)].some(([, specifier]) => + configSetsGrep(path.posix.join(path.posix.dirname(config), specifier!), readConfig, seen), + ); +} + +type RunFilter = + | Readonly<{ kind: "none" }> + | Readonly<{ kind: "grep" | "grepInvert"; pattern: string }> + | Readonly<{ kind: "partial"; why: string }>; + +function runFilter(run: GatedPlaywrightRun): RunFilter { + if (run.files.length > 0) return { kind: "partial", why: `file filter ${run.files.join(" ")}` }; + if (run.configSetsGrep) { + return { kind: "partial", why: `${run.config} or a config it imports sets grep or grepInvert` }; + } + if (run.grep.length + run.grepInvert.length > 1) { + return { kind: "partial", why: "more than one --grep or --grep-invert" }; + } + if (run.grep[0] !== undefined) return { kind: "grep", pattern: run.grep[0] }; + if (run.grepInvert[0] !== undefined) return { kind: "grepInvert", pattern: run.grepInvert[0] }; + return { kind: "none" }; +} + +function playwrightCoverage(runs: readonly GatedPlaywrightRun[]): { gated: string[]; gaps: PlaywrightTestDirGap[] } { + const byTestDir = new Map(); + for (const run of runs) { + if (run.testDir === undefined) continue; + byTestDir.set(run.testDir, [...(byTestDir.get(run.testDir) ?? []), { run, filter: runFilter(run) }]); + } + const gated: string[] = []; + const gaps: PlaywrightTestDirGap[] = []; + for (const [testDir, dirRuns] of byTestDir) { + const patterns = (kind: "grep" | "grepInvert") => + new Set(dirRuns.flatMap(({ filter }) => (filter.kind === kind ? [filter.pattern] : []))); + const greps = patterns("grep"); + const inverts = patterns("grepInvert"); + const unpaired = [...inverts].filter((pattern) => !greps.has(pattern)); + if (dirRuns.some(({ filter }) => filter.kind === "none") || (inverts.size > 0 && unpaired.length === 0)) { + gated.push(testDir); + continue; + } + const named = ({ run }: { run: GatedPlaywrightRun }) => `\`${run.segment}\` (${run.script})`; + gaps.push({ + testDir, + runs: dirRuns.flatMap((dirRun) => { + const { filter } = dirRun; + if (filter.kind === "grepInvert" && unpaired.includes(filter.pattern)) { + return [`${named(dirRun)} has no gated \`--grep ${filter.pattern}\` run to pair with`]; + } + if (filter.kind === "grep" && inverts.size === 0) { + return [`${named(dirRun)} has no gated \`--grep-invert ${filter.pattern}\` run to pair with`]; + } + if (filter.kind === "partial") return [`${named(dirRun)} is a partial run FE-GATE-029 does not read: ${filter.why}`]; + return []; + }), + }); + } + return { gated, gaps }; +} + export function ungatedTestFailures(input: Readonly<{ testFiles: readonly string[]; /** A bare string is a Vitest path. */ gatedPaths: readonly (string | GatedTestTarget)[]; exclusions: readonly UngatedTestExclusion[]; + /** Named once for the files they leave ungated, instead of once per file. */ + playwrightGaps?: readonly PlaywrightTestDirGap[]; }>): string[] { const targets = input.gatedPaths.map((target): GatedTestTarget => typeof target === "string" ? { path: target, runner: "vitest" } : target, @@ -125,11 +229,22 @@ export function ungatedTestFailures(input: Readonly<{ (runner === "playwright" || VITEST_TEST_FILE.test(file)), ); const excluded = new Set(input.exclusions.map(({ path: file }) => file)); - const failures = input.testFiles - .filter((file) => !gated(file) && !excluded.has(file)) + const ungated = input.testFiles.filter((file) => !gated(file) && !excluded.has(file)); + // The deepest testDir a file is in names it. + const gaps = [...(input.playwrightGaps ?? [])].sort((left, right) => right.testDir.length - left.testDir.length); + const gapOf = (file: string) => gaps.find(({ testDir }) => file.startsWith(`${testDir}/`)); + const failures = ungated + .filter((file) => gapOf(file) === undefined) .map((file) => `test file is not run by any CI gate command and is not in ${UNGATED_TESTS_PATH}: ${file}` ); + for (const gap of gaps) { + const files = ungated.filter((file) => gapOf(file) === gap).length; + if (files === 0) continue; + failures.push( + `Playwright testDir ${gap.testDir} is only partly run by the CI gate commands, so none of its ${files} test file${files === 1 ? "" : "s"} counts as gated: ${gap.runs.join("; ")}. Gate one run of it with no --grep, --grep-invert or file filter, or a \`--grep P\` run for each \`--grep-invert P\` run (package.json scripts)`, + ); + } // An entry for a file a removal deleted is harmless; one for a file a gate // now runs would hide the next regression, so it has to go. for (const { path: file } of input.exclusions) { diff --git a/tests/unit/playwright-result-paths.test.ts b/tests/unit/playwright-result-paths.test.ts index 75b73bb9..2ec525c3 100644 --- a/tests/unit/playwright-result-paths.test.ts +++ b/tests/unit/playwright-result-paths.test.ts @@ -5,6 +5,7 @@ import { afterEach, describe, expect, it } from "vitest"; import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts"; import { reachablePackageScripts } from "../../scripts/lib/package-script-graph.ts"; +import { playwrightTestRuns } from "../../scripts/lib/playwright-test-args.ts"; import { RELEASE_EVIDENCE_REGENERATED_TREES } from "../../scripts/lib/removal-fixture.ts"; import { loadConfigFile, outputs, releaseRuns } from "../helpers/playwright-run-isolation.ts"; @@ -26,22 +27,14 @@ afterEach(releaseRuns); type Writer = Readonly<{ name: string; paths: readonly string[] }>; -/** The config of each `playwright test` a script runs, following the scripts it calls. */ +/** + * The config of each `playwright test` a script runs, following the scripts it + * calls. FE-GATE-029 reads the runs with the same parser (fe-ci-next-12). + */ function playwrightConfigs(script: string, packageScripts: Readonly> = scripts): string[] { - const configs: string[] = []; - for (const reached of reachablePackageScripts(packageScripts, [script])) { - for (const segment of packageScripts[reached]!.split("&&")) { - const tokens = segment.trim().split(/\s+/u); - const test = tokens.findIndex((token, index) => token === "test" && tokens[index - 1] === "playwright"); - if (test < 0) continue; - const flag = tokens.findIndex((token, index) => index > test && (token === "--config" || token === "-c")); - const joined = tokens.find((token) => token.startsWith("--config=")); - configs.push( - flag >= 0 ? tokens[flag + 1]! : joined !== undefined ? joined.slice("--config=".length) : "playwright.config.ts", - ); - } - } - return configs; + return reachablePackageScripts(packageScripts, [script]).flatMap((reached) => + playwrightTestRuns(packageScripts[reached]!).map(({ config }) => config), + ); } const relative = (absolute: string) => path.relative(process.cwd(), absolute); diff --git a/tests/unit/playwright-test-args.test.ts b/tests/unit/playwright-test-args.test.ts new file mode 100644 index 00000000..b1dd768b --- /dev/null +++ b/tests/unit/playwright-test-args.test.ts @@ -0,0 +1,82 @@ +import { describe, expect, it } from "vitest"; + +import { playwrightTestRuns } from "../../scripts/lib/playwright-test-args.ts"; + +/** + * fe-ci-next-12. FE-GATE-029 read only `--config X`, so a gate run with + * `-c X` or `--config=X` counted the e2e config's testDir, and it read no + * `--grep`, `--grep-invert` or file filter. The result path test read the + * three config spellings on its own. Both now read the runs here. + */ +const run = (segment: string, fields: Partial[number]> = {}) => ({ + segment, + config: "playwright.config.ts", + grep: [], + grepInvert: [], + files: [], + otherOptions: [], + ...fields, +}); + +describe("playwright test runs", () => { + it.each([ + ["playwright test", [run("playwright test")]], + ["playwright test -c a.config.ts", [run("playwright test -c a.config.ts", { config: "a.config.ts" })]], + ["playwright test --config a.config.ts", [run("playwright test --config a.config.ts", { config: "a.config.ts" })]], + ["playwright test --config=a.config.ts", [run("playwright test --config=a.config.ts", { config: "a.config.ts" })]], + ["playwright test -ca.config.ts", [run("playwright test -ca.config.ts", { config: "a.config.ts" })]], + ["playwright test -g@a11y", [run("playwright test -g@a11y", { grep: ["@a11y"] })]], + ["playwright test -G@a11y", [run("playwright test -G@a11y", { grepInvert: ["@a11y"] })]], + ["playwright test -x -j2", [run("playwright test -x -j2", { otherOptions: ["-x", "-j2"] })]], + // commander reads the letters after `-x` (no value) as the next short option. + ["playwright test -xG@a11y", [run("playwright test -xG@a11y", { grepInvert: ["@a11y"], otherOptions: ["-x"] })]], + ["playwright test -xg @smoke", [run("playwright test -xg @smoke", { grep: ["@smoke"], otherOptions: ["-x"] })]], + [ + "playwright test -xcplaywright.storybook.config.ts", + [ + run("playwright test -xcplaywright.storybook.config.ts", { + config: "playwright.storybook.config.ts", + otherOptions: ["-x"], + }), + ], + ], + ["playwright test -xxj2", [run("playwright test -xxj2", { otherOptions: ["-x", "-x", "-j2"] })]], + ["playwright test -g @a11y", [run("playwright test -g @a11y", { grep: ["@a11y"] })]], + ["playwright test --grep @a11y", [run("playwright test --grep @a11y", { grep: ["@a11y"] })]], + ["playwright test --grep=@a11y", [run("playwright test --grep=@a11y", { grep: ["@a11y"] })]], + ["playwright test -G @a11y", [run("playwright test -G @a11y", { grepInvert: ["@a11y"] })]], + ["playwright test --grep-invert @a11y", [run("playwright test --grep-invert @a11y", { grepInvert: ["@a11y"] })]], + ["playwright test --grep-invert=@a11y", [run("playwright test --grep-invert=@a11y", { grepInvert: ["@a11y"] })]], + [ + "playwright test tests/e2e/app-shell.spec.ts --config a.config.ts", + [ + run("playwright test tests/e2e/app-shell.spec.ts --config a.config.ts", { + config: "a.config.ts", + files: ["tests/e2e/app-shell.spec.ts"], + }), + ], + ], + ["playwright test -- --odd-name.spec.ts", [run("playwright test -- --odd-name.spec.ts", { files: ["--odd-name.spec.ts"] })]], + // It cannot tell `--project`'s value from a file filter, so it counts a filter. + [ + "playwright test --update-snapshots --project chromium", + [ + run("playwright test --update-snapshots --project chromium", { + files: ["chromium"], + otherOptions: ["--update-snapshots", "--project"], + }), + ], + ], + ["playwright test --grep", [run("playwright test --grep", { otherOptions: ["--grep"] })]], + [ + "CI=1 playwright test -c a.config.ts --grep @a11y && node report.ts && pnpm exec playwright test --config=b.config.ts", + [ + run("CI=1 playwright test -c a.config.ts --grep @a11y", { config: "a.config.ts", grep: ["@a11y"] }), + run("pnpm exec playwright test --config=b.config.ts", { config: "b.config.ts" }), + ], + ], + ["node scripts/build.ts && playwright show-report && playwright install --with-deps", []], + ])("reads %s", (command, runs) => { + expect(playwrightTestRuns(command)).toEqual(runs); + }); +}); diff --git a/tests/unit/ungated-tests.test.ts b/tests/unit/ungated-tests.test.ts index 0080401a..a290cdca 100644 --- a/tests/unit/ungated-tests.test.ts +++ b/tests/unit/ungated-tests.test.ts @@ -6,10 +6,12 @@ import { describe, expect, it } from "vitest"; import { loadCiGateContract } from "../../scripts/contracts/ci-gates.ts"; import { reachablePackageScripts } from "../../scripts/lib/package-script-graph.ts"; import { + gatedPlaywrightRuns, gatedTestPaths, gatedTestTargets, listTestFiles, parseUngatedTestExclusions, + playwrightTestDirGaps, ungatedTestFailures, } from "../../scripts/lib/ungated-tests.ts"; @@ -23,16 +25,15 @@ async function repositoryInputs() { const packageDocument = JSON.parse(await readFile("package.json", "utf8")) as { scripts: Record; }; + const entryScripts = contract.commands.map(({ script }) => script); + const readConfig = (file: string) => readFileSync(file, "utf8"); return { testFiles: await listTestFiles(process.cwd()), - gatedPaths: gatedTestTargets( - packageDocument.scripts, - contract.commands.map(({ script }) => script), - (file) => readFileSync(file, "utf8"), - ), + gatedPaths: gatedTestTargets(packageDocument.scripts, entryScripts, readConfig), exclusions: parseUngatedTestExclusions( JSON.parse(await readFile("config/ci/ungated-tests.json", "utf8")), ), + playwrightGaps: playwrightTestDirGaps(packageDocument.scripts, entryScripts, readConfig), }; } @@ -112,7 +113,9 @@ describe("ungated test files", () => { // `--config` names, not in a config that file spreads. test:a11y // (FE-GATE-009) ran playwright.a11y.config.ts, which spread the e2e config // without the literal, so it gated no folder; tests/e2e passed only because - // test:e2e gates it too. + // test:e2e gates it too. fe-ci-next-12: a run alone may gate no folder now + // (test:e2e's --grep-invert needs test:a11y's --grep), so this asks for the + // testDir of each run, not for a gated folder. it("finds a Playwright testDir for every playwright test run a gate command reaches", async () => { const contract = await loadCiGateContract(process.cwd()); const { scripts } = JSON.parse(await readFile("package.json", "utf8")) as { scripts: Record }; @@ -126,12 +129,10 @@ describe("ungated test files", () => { expect(runs.map(({ name }) => name)).toEqual(expect.arrayContaining(["test:e2e", "test:a11y"])); const withoutTestDir = runs - .filter( - ({ segment }) => - !gatedTestTargets({ run: segment }, ["run"], (file) => readFileSync(file, "utf8")).some( - ({ runner }) => runner === "playwright", - ), - ) + .filter(({ segment }) => { + const found = gatedPlaywrightRuns({ run: segment }, ["run"], (file) => readFileSync(file, "utf8")); + return found.length !== 1 || found[0]!.testDir === undefined; + }) .map(({ name, segment }) => `${name}: ${segment}`); expect(withoutTestDir).toEqual([]); }); @@ -145,3 +146,222 @@ describe("ungated test files", () => { ).toThrow(/reason/u); }); }); + +/** + * fe-ci-next-12. 029 counted the testDir of every `playwright test` run a gate + * reaches and read none of its filters. With test:a11y's run taken out, it + * still passed: test:e2e runs tests/e2e with `--grep-invert @a11y`, and + * tests/e2e/accessibility.spec.ts, whose tests are all @a11y, ran in no gate. + * A testDir counts now when one gated run has no filter, or when each + * `--grep-invert P` run has a gated `--grep P` run of the same testDir. + */ +describe("Playwright runs that filter tests", () => { + const configs: Readonly> = { + "playwright.config.ts": 'export default defineConfig({ testDir: "./tests/e2e" });', + "playwright.a11y.config.ts": + 'import e2eConfig from "./playwright.config.ts";\nexport default defineConfig({ ...e2eConfig, testDir: "./tests/e2e" });', + "playwright.storybook.config.ts": 'export default defineConfig({ testDir: "./tests/storybook" });', + "playwright.visual.config.ts": 'export default defineConfig({ testDir: "./tests/visual" });', + "smoke.config.ts": + 'export default defineConfig({ testDir: "./tests/e2e", projects: [{ name: "smoke", grep: /@smoke/ }] });', + "smoke-spread.config.ts": + 'import smoke from "./smoke.config.ts";\nexport default defineConfig({ ...smoke, testDir: "./tests/e2e" });', + }; + const readConfig = (file: string) => { + const text = configs[file]; + if (text === undefined) throw new Error(`no config ${file}`); + return text; + }; + const playwrightDirs = (scripts: Readonly>) => + gatedTestTargets(scripts, Object.keys(scripts), readConfig) + .filter(({ runner }) => runner === "playwright") + .map(({ path }) => path); + const gaps = (scripts: Readonly>) => + playwrightTestDirGaps(scripts, Object.keys(scripts), readConfig); + + it("reads the config a run names with -c X, --config X or --config=X", () => { + expect( + playwrightDirs({ + storybook: "playwright test -c playwright.storybook.config.ts", + visual: "playwright test --config=playwright.visual.config.ts", + a11y: "playwright test --config playwright.a11y.config.ts", + }), + ).toEqual(["tests/e2e", "tests/storybook", "tests/visual"]); + }); + + it.each([ + ["a run with no filter", { e2e: "playwright test" }], + [ + "a --grep-invert P run and a --grep P run, through two configs", + { + e2e: "playwright test --grep-invert @a11y", + a11y: "playwright test --config playwright.a11y.config.ts --grep @a11y", + }, + ], + [ + "the same pair with short and joined options", + { e2e: "playwright test -G @a11y", a11y: "playwright test --config=playwright.a11y.config.ts -g @a11y" }, + ], + [ + "two pairs", + { + e2e: "playwright test --grep-invert @a11y && playwright test --grep-invert @slow", + a11y: "playwright test --grep @a11y && playwright test --grep=@slow", + }, + ], + [ + "a run with no filter beside an unpaired --grep-invert run", + { all: "playwright test", fast: "playwright test --grep-invert @slow" }, + ], + ])("counts a testDir all run by %s", (_, scripts) => { + expect(playwrightDirs(scripts)).toEqual(["tests/e2e"]); + expect(gaps(scripts)).toEqual([]); + }); + + it.each([ + [ + "a --grep-invert P run alone", + { e2e: "playwright test --grep-invert @a11y" }, + ["`playwright test --grep-invert @a11y` (e2e) has no gated `--grep @a11y` run to pair with"], + ], + [ + "a --grep-invert P run beside a --grep run of another pattern", + { e2e: "playwright test --grep-invert @a11y", a11y: "playwright test --grep @axe" }, + ["`playwright test --grep-invert @a11y` (e2e) has no gated `--grep @a11y` run to pair with"], + ], + [ + "one paired and one unpaired --grep-invert run", + { e2e: "playwright test --grep-invert @a11y && playwright test --grep-invert @slow", a11y: "playwright test --grep @a11y" }, + ["`playwright test --grep-invert @slow` (e2e) has no gated `--grep @slow` run to pair with"], + ], + [ + "--grep P runs", + { a11y: "playwright test --config playwright.a11y.config.ts --grep @a11y" }, + [ + "`playwright test --config playwright.a11y.config.ts --grep @a11y` (a11y) has no gated `--grep-invert @a11y` run to pair with", + ], + ], + [ + "a --grep P run written -gP", + { smoke: "playwright test -g@smoke" }, + ["`playwright test -g@smoke` (smoke) has no gated `--grep-invert @smoke` run to pair with"], + ], + [ + "a --grep-invert P run written -xGP", + { e2e: "playwright test -xG@a11y" }, + ["`playwright test -xG@a11y` (e2e) has no gated `--grep @a11y` run to pair with"], + ], + [ + "a run with a file filter", + { one: "playwright test tests/e2e/app-shell.spec.ts" }, + [ + "`playwright test tests/e2e/app-shell.spec.ts` (one) is a partial run FE-GATE-029 does not read: file filter tests/e2e/app-shell.spec.ts", + ], + ], + [ + "a run with --grep and --grep-invert", + { mixed: "playwright test --grep @a11y --grep-invert @slow" }, + [ + "`playwright test --grep @a11y --grep-invert @slow` (mixed) is a partial run FE-GATE-029 does not read: more than one --grep or --grep-invert", + ], + ], + // Playwright uses the last of two --grep-invert values, so pairing the first would count @a11y tests. + [ + "a run with --grep-invert twice", + { twice: "playwright test --grep-invert @slow --grep-invert @a11y", a11y: "playwright test --grep @slow" }, + [ + "`playwright test --grep-invert @slow --grep-invert @a11y` (twice) is a partial run FE-GATE-029 does not read: more than one --grep or --grep-invert", + "`playwright test --grep @slow` (a11y) has no gated `--grep-invert @slow` run to pair with", + ], + ], + [ + "a run whose config sets grep", + { smoke: "playwright test --config smoke.config.ts" }, + [ + "`playwright test --config smoke.config.ts` (smoke) is a partial run FE-GATE-029 does not read: smoke.config.ts or a config it imports sets grep or grepInvert", + ], + ], + [ + "a run whose config imports one that sets grep", + { smoke: "playwright test --config smoke-spread.config.ts" }, + [ + "`playwright test --config smoke-spread.config.ts` (smoke) is a partial run FE-GATE-029 does not read: smoke-spread.config.ts or a config it imports sets grep or grepInvert", + ], + ], + ])("does not count a testDir run only by %s", (_, scripts, runs) => { + expect(playwrightDirs(scripts)).toEqual([]); + expect(gaps(scripts)).toEqual([{ testDir: "tests/e2e", runs }]); + }); + + it("does not pair runs of two testDirs", () => { + const scripts = { + e2e: "playwright test --grep-invert @a11y", + storybook: "playwright test -c playwright.storybook.config.ts --grep @a11y", + }; + expect(playwrightDirs(scripts)).toEqual([]); + expect(gaps(scripts)).toEqual([ + { + testDir: "tests/e2e", + runs: ["`playwright test --grep-invert @a11y` (e2e) has no gated `--grep @a11y` run to pair with"], + }, + { + testDir: "tests/storybook", + runs: [ + "`playwright test -c playwright.storybook.config.ts --grep @a11y` (storybook) has no gated `--grep-invert @a11y` run to pair with", + ], + }, + ]); + }); + + it("names the testDir, the run and the missing pair, once for the testDir's ungated files", () => { + const scripts = { e2e: "playwright test --grep-invert @a11y" }; + expect( + ungatedTestFailures({ + testFiles: ["tests/e2e/accessibility.spec.ts", "tests/e2e/app-shell.spec.ts", "tests/e2e/nested/old.spec.ts", "tests/unit/a.test.ts"], + gatedPaths: [...gatedTestTargets(scripts, ["e2e"], readConfig), "tests/unit"], + exclusions: [{ path: "tests/e2e/nested/old.spec.ts", reason: "kept for a later drill" }], + playwrightGaps: gaps(scripts), + }), + ).toEqual([ + "Playwright testDir tests/e2e is only partly run by the CI gate commands, so none of its 2 test files counts as gated: `playwright test --grep-invert @a11y` (e2e) has no gated `--grep @a11y` run to pair with. Gate one run of it with no --grep, --grep-invert or file filter, or a `--grep P` run for each `--grep-invert P` run (package.json scripts)", + ]); + }); + + it("does not name a testDir whose files a wider testDir gates", () => { + const scripts = { all: "playwright test", sub: "playwright test --config sub.config.ts --grep-invert @a11y" }; + const read = (file: string) => (file === "sub.config.ts" ? 'testDir: "./tests/e2e/sub"' : readConfig(file)); + expect( + ungatedTestFailures({ + testFiles: ["tests/e2e/sub/a.spec.ts"], + gatedPaths: gatedTestTargets(scripts, ["all", "sub"], read), + exclusions: [], + playwrightGaps: playwrightTestDirGaps(scripts, ["all", "sub"], read), + }), + ).toEqual([]); + }); + + it("fails the repository with test:a11y's playwright run taken out", async () => { + const contract = await loadCiGateContract(process.cwd()); + const entryScripts = contract.commands.map(({ script }) => script); + const { scripts } = JSON.parse(await readFile("package.json", "utf8")) as { scripts: Record }; + const read = (file: string) => readFileSync(file, "utf8"); + const a11yRun = " && playwright test --config playwright.a11y.config.ts --grep @a11y"; + expect(scripts["test:a11y"]).toContain(a11yRun); + const mutated = { ...scripts, "test:a11y": scripts["test:a11y"]!.replace(a11yRun, "") }; + expect(gatedTestTargets(scripts, entryScripts, read)).toContainEqual({ path: "tests/e2e", runner: "playwright" }); + expect(gatedTestTargets(mutated, entryScripts, read)).not.toContainEqual({ path: "tests/e2e", runner: "playwright" }); + + expect(playwrightTestDirGaps(scripts, entryScripts, read)).toEqual([]); + expect( + ungatedTestFailures({ + ...(await repositoryInputs()), + gatedPaths: gatedTestTargets(mutated, entryScripts, read), + playwrightGaps: playwrightTestDirGaps(mutated, entryScripts, read), + }), + ).toEqual([ + expect.stringMatching( + /^Playwright testDir tests\/e2e is only partly run by the CI gate commands, so none of its \d+ test files counts as gated: `playwright test --grep-invert @a11y` \(test:e2e\) has no gated `--grep @a11y` run to pair with\. /u, + ), + ]); + }); +}); -- 2.54.0 From a3ec8cbbd2e2ca0b18637ac72d54dd9905714f39 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 20 Nov 2026 23:35:59 +0900 Subject: [PATCH 2/2] =?UTF-8?q?docs(changelog):=20FE-GATE-029=EA=B0=80=20P?= =?UTF-8?q?laywright=20=ED=95=84=ED=84=B0=EC=9D=98=20=EC=A7=9D=EC=9D=84=20?= =?UTF-8?q?=EB=B3=B4=EB=8A=94=20=EA=B2=83=EC=9D=84=20=EC=A0=81=EB=8A=94?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 32982e55의 계약 변경(FE-GATE-029가 `--grep-invert P` 실행마다 같은 testDir의 `--grep P` 실행을 요구한다)을 미출시 절 표와 "먼저 할 일"에 적는다. 파생 프로젝트가 자기 test:e2e·test:a11y 패턴을 바꿨으면 짝을 맞춰야 main push에서 실패하지 않는다. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e12a26b..5fd80144 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지 - merge job 셋과 main job(`main / self-tests and removal drills`)이 runner의 actions/cache 저장소에서 Node·corepack·pnpm store와 메타데이터 캐시를 복원하고, main run만 저장한다. runner에 캐시 서버가 없으면 복원 단계가 경고만 내고 설치가 그대로 돈다. 자기 runner의 캐시 크기 상한을 확인한다(항목 하나가 압축 전 약 0.7GB, lockfile이 바뀔 때마다 새 항목). - FE-GATE-005가 `test:unit`·`test:contract`를 따로 돌지 않는다. `tests/unit`·`tests/contract`는 `test:coverage`에서 한 번 돌고, 같은 실행이 `artifacts/tests/unit.xml`·`contract.xml`을 쓴다(`scripts/lib/coverage-bundle-junit-reporter.ts`). 계약에서 command `test-unit`·`test-contract`가 빠진다. 자기 `config/ci/gates.json`의 게이트가 그 id를 부르면 지운다. `test:coverage`의 경로에서 두 폴더 중 하나를 빼거나 그 reporter를 빼면 FE-GATE-005가 실패한다. 두 package script는 작업 중에 쓰는 명령으로 남는다. - FE-GATE-009의 `test:a11y`가 `playwright test --config playwright.a11y.config.ts --grep @a11y`로 돌고 결과를 `artifacts/tests/a11y/`에 쓴다. 자기 `test:a11y`를 고쳐 썼으면 `--config playwright.a11y.config.ts`를 넣는다. 빠지면 008과 009가 같은 결과 경로에 써서 `tests/unit/playwright-result-paths.test.ts`(FE-GATE-005)가 실패한다(`scripts/verify.sh gate FE-GATE-005`). +- FE-GATE-029가 `playwright test`의 `--grep-invert P` 실행마다 같은 testDir을 `--grep P`로 도는 게이트 실행을 요구한다. 자기 `test:e2e`·`test:a11y`의 패턴을 바꿨으면 두 글자를 같게 둔다. 게이트 명령에 파일 필터나 `grep`이 든 설정으로만 도는 testDir이 있으면 필터 없는 실행을 더한다. 짝이 없으면 main push의 FE-GATE-029가 그 testDir과 빠진 짝을 대며 실패한다(`scripts/verify.sh gate FE-GATE-029`). - 수동 접근성 기록(`docs/accessibility/route-reviews/`)에 WCAG 2.2 칸 둘이 생기고, `Release ID`를 릴리스 태그와 대조한다. - 옮기기 전: 자기 기록에 `M8`·`M9` 줄이 없으면 FE-GATE-009 형식 검사가 그 필드 이름을 대며 실패한다. release 단계를 태그 없이(브랜치에서 수동으로) 돌리면 FE-GATE-028이 `missing required environment: RELEASE_TAG`로 멈춘다. - 옮기는 법: 기록마다 `M8 Focus not obscured: pending`, `M9 Target size: pending` 두 줄을 더한다. 서명하는 기록의 `Release ID`는 다음 release부터 그 릴리스 태그(예 `v1.4.0`)로 적는다. release 단계는 태그 run에서 돈다. @@ -111,6 +112,7 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지 | [계약] | FE-GATE-009의 `test:a11y`가 `playwright.a11y.config.ts`로 돌아 결과 폴더·HTML report·`results.xml`을 `artifacts/tests/a11y/`에 쓴다. 전에는 e2e 설정을 그대로 써서, merge browser job이 008 다음 009를 돌고 올린 e2e 증거가 009 실행의 것이었다. FE-GATE-009 증거에 a11y `results.xml`·`report/index.html`(producer `test-a11y`)이 들어간다. 게이트 밖 `test:e2e:dev`는 `artifacts/tests/e2e-dev/`에 쓴다. 새 시험이 package script가 부르는 Playwright 설정끼리·게이트 명령끼리 결과 경로가 겹치거나, 게이트 명령이 쓰는 JUnit·report가 그 게이트의 증거가 아니면 실패한다. 제거 fixture 사본은 두 새 결과 폴더를 복사하지 않고, 같은 시험이 각 Playwright 설정의 결과 폴더가 그 제외 목록에 드는지 본다. a11y 설정은 FE-GATE-029가 읽도록 `testDir`을 글자로 둔다. 위 "먼저 할 일" (1106 영역 11의 3.2 (3) 증거 읽기 주의) | `package.json`, `playwright.a11y.config.ts`, `playwright.dev.config.ts`, `config/ci/gates.json`, `config/repository-layout.json`, `scripts/lib/removal-fixture.ts`, `tests/unit/playwright-result-paths.test.ts`, `tests/unit/removal-fixture.test.ts`, `tests/unit/ungated-tests.test.ts`, `tests/helpers/playwright-run-isolation.ts`, `tests/unit/ci-workflow-generation.test.ts`, `docs/testing/taxonomy.md`, `docs/work/reference/decisions.md` | `ede99cb9` | | [계약] | `dependency-cache` 단계를 main job(`main_gate`)에도 둔다. 키·경로·main run만 저장·frozen install은 merge job과 같다. release·promotion·provider job은 그대로 거절한다. 위 `7ed0af3d` 행의 「merge job 셋에만」을 바꾼다(decisions.md FE-7) | `config/ci/gates.json`, `scripts/contracts/ci-gates.ts`, `.gitea/workflows/quality-gates.yml`, `tests/unit/ci-workflow-generation.test.ts`, `docs/operations/ci-quality-gates.md` | `d254d70a` | | [계약] | FE-GATE-005의 명령이 `test:coverage`·`check:scale:pr` 둘이 된다. `tests/unit`·`tests/contract`의 JUnit 증거(`unit.xml`·`contract.xml`, 이름·형식 그대로)는 coverage 실행 안의 reporter가 쓰고, 두 증거의 producer는 `test-coverage`다. 한 폴더에서 시험 파일이 하나도 돌지 않거나 보고서가 그 폴더에서 돈 파일과 다른 파일을 담으면 그 실행이 실패한다. unit·contract 시험은 이제 coverage 계측 아래에서만 돈다. FE-GATE-004·006·007은 자기 실행을 그대로 둔다(decisions.md FE-4) | `config/ci/gates.json`, `package.json`, `scripts/lib/coverage-bundle-junit-reporter.ts`, `scripts/lib/feature-scaffold-drill.ts`, `tests/unit/coverage-bundle-junit-reporter.test.ts`, `docs/operations/ci-quality-gates.md` | `6cba1f50` | +| [계약] | `check:ci:gating`(FE-GATE-029)이 Playwright 실행의 `--grep`·`--grep-invert`·파일 필터를 읽는다. testDir은 필터 없는 gated 실행이 있거나, `--grep-invert P` 실행마다 같은 testDir을 `--grep P`(같은 글자)로 도는 gated 실행이 있을 때만 게이트 안으로 센다. 파일 필터가 있는 실행, `--grep`·`--grep-invert`를 합쳐 둘 이상 쓴 실행, 설정(또는 그 설정이 import한 설정)에 `grep`·`grepInvert`가 있는 실행은 부분 실행으로 센다. 그 testDir의 게이트 밖 파일은 testDir·실행·빠진 짝을 대는 한 줄로 실패한다. 전에는 009의 Playwright 실행을 빼도 통과해, 시험이 모두 `@a11y`인 `tests/e2e/accessibility.spec.ts`가 어느 게이트에서도 돌지 않았다. `-c X`·`-cX`·`--config=X`로 고른 설정도 이제 읽는다(전에는 e2e 설정의 testDir로 셌다). 위 "먼저 할 일" | `scripts/lib/playwright-test-args.ts`, `scripts/lib/ungated-tests.ts`, `scripts/check-ci-gating.ts`, `playwright.a11y.config.ts`, `tests/unit/playwright-test-args.test.ts`, `tests/unit/ungated-tests.test.ts`, `tests/unit/playwright-result-paths.test.ts`, `docs/operations/ci-quality-gates.md` | `32982e55` | ### 그 밖의 변경 -- 2.54.0