diff --git a/CHANGELOG.md b/CHANGELOG.md index f4bde1b7..2ce1f407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,7 @@ #### 옮긴 뒤 확인 1. 로컬 merge 게이트 14개를 돈다. 이 절 때문에 먼저 볼 것: `test:unit`(1단계), `check:i18n`(2단계), `check:ci`(5단계), `check:types`(6단계), `test:a11y`(FE-GATE-009. 한 자원을 읽는 상세 라우트에 실패 화면 기록이 없으면 `a11y.json not written:`으로 실패한다), `check:bundle`(셸에 `RUN_OUTPUT_ROOT`가 있으면 멈춘다. 지우고 돈다). -2. 제품 기능 제거 드릴(`test:sample-removal -- --feature=`)은 본문에 그 기능 ID를 한 이름으로 적은 Playwright spec을 잔여로 센다. +2. 제품 기능 제거 드릴(`test:sample-removal -- --feature=`)은 본문에 그 기능 ID를 적힌 그대로 한 이름으로 적은 Playwright spec을 잔여로 센다. `-`가 없는 한 단어 ID는 spec 본문에서 찾지 않는다. 3. 시각 골든: `base.css`·`primitives.css`를 받은 제품은 열린 modal을 찍은 자기 골든을 다시 찍는다(`corepack pnpm test:visual:update`). 새 시각 검사 `tests/visual/scrollbar-gutter.visual.spec.ts`는 템플릿 셸의 메뉴 버튼과 `/not-found`를 쓴다. 셸을 바꾼 제품은 그 spec을 자기 셸에 맞춘다. 제품 셸에서는 돌려 보지 않았다. 4. 배포가 있는 제품: `/service-worker.js`를 redirect 뒤에 주는 호스트는 FE-GATE-019가 FAIL이다. 그런 호스트에서는 지금도 워커 등록·업데이트·kill switch가 실패한다. 5. 초기 JS 기록(`config/scale/feature-shape-ceilings.json`)이 충돌하면 `node scripts/scale/measure-feature-shape-growth.ts --initial-baseline --write`를 다시 돌려 푼다. @@ -47,7 +47,7 @@ | [계약] | `check:bundle`의 `generate-supply-chain.ts`·`check-bundle.ts`가 `RUN_OUTPUT_ROOT`가 비어 있지 않고 `.`도 아니면 변수 값과 이유를 적고 exit 1로 멈춘다. 빌드는 그 경로 아래에 쓰는데 두 스크립트는 checkout의 `dist`·`artifacts/`를 읽어서, 예산을 넘는 새 빌드 대신 이전 빌드로 PASS했다. `ci:gate -- FE-GATE-012`도 check-bundle 단계에서 멈춘다 (1106/12-02) | `scripts/lib/run-isolation.ts`, `scripts/check-bundle.ts`, `scripts/generate-supply-chain.ts`, `docs/testing/frontend-platform-testing-strategy.md` | `68fde02` | | [계약] | `test:a11y`(FE-GATE-009)의 report(`scripts/write-a11y-report.ts`)가 설치된 descriptor로 한 자원을 읽는 라우트를 찾는다. 로그인이 필요한 라우트의 `paramsSchema`가, 경로 파라미터가 있고 빈 목록을 거부하는 GET의 입력 스키마인 경우다. 그 라우트에 실패 화면 기록(`artifacts/tests/a11y-data-state/`)이 없으면 `a11y.json not written:`으로 실패하고 `a11y.json`을 쓰지 않는다. 접근성 spec의 라우트 test는 시작할 때 자기 기록을 지운다. `paramsSchema`가 GET 입력과 다른 상세 라우트는 전처럼 기록만으로 정해진다 (1106/11-01) | `scripts/lib/a11y-data-state.ts`, `scripts/write-a11y-report.ts`, `tests/e2e/accessibility.spec.ts` | `9c4cddc` | | [계약] | `tests/unit/schema-metadata-policy.test.ts`가 descriptor의 입력·응답·실패 검증기로 쓰인 스키마 행이 `direction`·`unknownFieldPolicy`를 적지 않으면 실패한다. 전에는 건너뛰어서, 응답 DTO를 strict로 바꿔도 `check:registries`와 `test:unit` 어느 쪽도 보지 않았다. 템플릿 HTTP 행과 생성기가 쓰는 행은 이미 두 칸을 적는다. 위 "먼저 할 일" 1단계 (1106/07-02) | `tests/unit/schema-metadata-policy.test.ts`, `docs/manual/01-add-a-feature.md`, `docs/manual/reference/errors.md` | `e7b1b01` | -| [계약] | 제품 기능 제거 드릴의 `tests` 잔여에, 본문이 기능 ID나 폴더 이름을 한 이름(앞뒤가 영문·숫자·`-`가 아님)으로 적은 Playwright spec(`*.spec.[cm]?[jt]sx?`)이 든다. vitest는 spec을 돌지 않아 `test:all`도 잡지 못했다. vitest 테스트 본문은 전처럼 보지 않는다. 매뉴얼 01 11단계와 `errors.md`의 판정 문장을 고쳤다 (1106/16-01) | `scripts/lib/feature-residue.ts`, `docs/manual/` | `af3344b` | +| [계약] | 제품 기능 제거 드릴의 `tests` 잔여에, 본문이 기능 ID나 폴더 이름을 적힌 그대로(대소문자 구분) 한 이름(앞뒤가 `[A-Za-z0-9_-]`가 아님)으로 적은 Playwright spec(`*.spec.[cm]?[jt]sx?`)이 든다. `-`가 든 이름만 찾는다. `messages`·`status` 같은 한 단어 ID는 템플릿 spec이 평범한 단어로 쓰므로 찾지 않는다. vitest는 spec을 돌지 않아 `test:all`도 잡지 못했다. vitest 테스트 본문은 전처럼 보지 않는다. 매뉴얼 01 11단계와 `errors.md`의 판정 문장을 고쳤다 (1106/16-01) | `scripts/lib/feature-residue.ts`, `docs/manual/` | `af3344b` | | [계약] | KEYED 결과 불명 요청을 같은 키로 다시 보낸 시도가 쓰기 전 거절(429, 503 `RATE_LIMIT_*`, 401)이나 보내기 전 실패(`NOT_STARTED`)로 끝나면, 훅이 결과 불명과 intent·키를 남긴다. 전에는 그 판정을 논리 요청 전체의 판정으로 써서 다음 저장이 새 키로 나갔다. 실패는 그대로 돌려주고, `Retry-After`는 다음 재전송의 대기 시각이 되고, 낙관적 층은 되돌리지 않고 불확실로 둔다. 폼은 결과 불명 화면을 그대로 두고 `form.resendLater` 문구로 feedback에 포커스를 옮긴다. 처음 보낸 요청의 `NOT_APPLIED`와 재전송의 성공은 전처럼 정리한다. 메인 세션 결정 D10이다. 위 "먼저 할 일" 2단계 (1106/03-01) | `src/presentation/adapters/query/application-query.ts`, `src/presentation/forms/use-app-form.ts`, `src/presentation/i18n/catalog.ts`, `docs/operations/api-contract-and-server-state-recovery.md` | `2568587` | | [계약] | `commandMutationIdentity`가 `resendSafe`(`retrySemantics`가 `KEYED`나 `IDEMPOTENT`)도 돌려주고, `BoundMutation`에 선택 칸 `resendSafe?`가 생겼다(추가만). 결과 불명 뒤 재전송 버튼과 같은 입력 재제출 거절(아래 절 0929/03-03 행)이 키 유무 대신 "키가 있거나 `resendSafe`"를 본다. 그래서 IDEMPOTENT 쓰기도 다시 보낼 수 있다. 칸이 없는 손 정책과 NEVER는 전과 같다. 위 "먼저 할 일" 4단계 (1106/03-03) | `src/contracts/server-state.ts`, `src/presentation/adapters/query/application-query.ts`, `src/application/view-models/async-state.ts`, `docs/manual/` | `815ea58` | | [계약] **BREAKING** | `createBoundedPollCoordinator`와 `BoundedPollCoordinatorDependencies`에 타입 인자 `Operation extends BoundedPollOperation = BoundedPollOperation`이 생겼다. `operation`과 `execute`의 `input.operation`이 그 타입이라, 실행기 호출이 기능 descriptor의 입력·출력 타입으로 검사된다. 런타임 동작은 같다. realtime 설계 9.2절에 V3 실행기 결과 kind마다 poll 결과(kind, retryable, `retryAfterMs`)를 적은 표가 생겼다. 표대로 조합하면 401·403은 요청 한 번으로 lease를 끝낸다. 표는 조합 코드가 따를 규칙이고 강제하지 않는다. 위 "먼저 할 일" 6단계 (1106/04-02) | `src/adapters/realtime/polling/bounded-poll-coordinator.ts`, `src/application/policies/bounded-polling.ts`, `docs/architecture/realtime-events-web-push-and-bounded-polling.md` | `6f06e77` | @@ -75,7 +75,7 @@ - 일부: poll 조합 코드가 `input.operation`을 무시하고 다른 descriptor를 넘기는 것은 여전히 막지 않는다. 이제 `input.operation`이 descriptor 타입을 가져 그 길을 쓰기가 더 쉽다. 9.2절 표는 규칙이고, 템플릿은 poll `execute` 기본 구현을 주지 않는다 (1103/04-01, 1106/04-02). - 일부: reconnect `attempt` 안에서 연결을 만드는 조합 코드는 설정 오류가 여전히 서버 장애로 보인다. 규칙만 적었다 (1106/04-01). - 일부: 결과 불명 재전송이 rate limit에 막힌 동안 결과 불명 화면이 남고, 다시 보내기는 `Retry-After`(상한 5초)를 기다린다. 폼 밖에서 부른 같은 입력 재저장이 `NOT_APPLIED`로 끝나면 훅은 키를 지키지만 폼은 retry-later를 보인다 (1106/03-01). -- 일부: 기능 제거 드릴은 route ID나 URL만 적은 spec을 잡지 못하고, 다운스트림 spec이 다른 이유로 기능 ID를 한 이름으로 적으면 거짓 양성이 난다. 부분 문자열 검색의 거짓 양성과 dist 빌드 잔여 검사는 그대로다 (1106/16-01, 1105/16-04). +- 일부: 기능 제거 드릴은 route ID나 URL만 적은 spec과 한 단어 기능 ID만 적은 spec을 잡지 못하고, 다운스트림 spec이 다른 이유로 `-`가 든 기능 ID를 한 이름으로 적으면 거짓 양성이 난다. 부분 문자열 검색의 거짓 양성과 dist 빌드 잔여 검사는 그대로다 (1106/16-01, 1105/16-04). - 일부: `:has()`를 모르는 브라우저(Firefox 121 미만 등)는 전처럼 가림막 옆에 띠가 남는다. 오른쪽 drawer, RTL, Firefox, WebKit은 보지 않았다 (1106/08-03). - 일부: Cache Storage release marker 본문이 계속 읽히지 않으면 stage가 marker를 다시 쓰지 않는다. `replaceUnreadablePointer`는 active pointer만 푼다 (1105/02-02, 1106/02-01). - 일부: 초기 JS 예산의 폭과 되돌림 규칙은 문서에만 있다. 예산 값을 규칙 밖으로 바꿔도 실패하는 테스트는 없다 (1106/15-01). diff --git a/docs/manual/01-add-a-feature.md b/docs/manual/01-add-a-feature.md index cdb83b44..37b65111 100644 --- a/docs/manual/01-add-a-feature.md +++ b/docs/manual/01-add-a-feature.md @@ -660,11 +660,12 @@ corepack pnpm test:sample-removal -- --feature=invoice-feature ③ **잡는 검사 / 못 잡는 것** -- 남은 파일이 지운 기능을 가리키면 실패한다. `src`는 기능 ID나 폴더 이름을 담은 파일, `tests`는 이름에 기능 ID가 있거나 기능 폴더에서 import하는 파일, 그리고 본문에 기능 ID나 폴더 이름을 한 이름으로 적은 Playwright spec(`*.spec.ts`)이다. +- 남은 파일이 지운 기능을 가리키면 실패한다. `src`는 기능 ID나 폴더 이름을 담은 파일, `tests`는 이름에 기능 ID가 있거나 기능 폴더에서 import하는 파일, 그리고 본문에 `-`가 든 기능 ID나 폴더 이름을 한 이름으로 적은 Playwright spec(`*.spec.ts`)이다. - 메시지: ` removal failed:` 다음 줄 `fixture-id-residue: residue: ` - 템플릿 테스트가 예시 ID(`invoice-feature` 등)를 데이터로 쓰는 것은 잔여로 세지 않는다(1105/16-04). 그래서 매뉴얼 예시 이름으로 만든 기능도 이 단계를 통과한다. - - spec 본문은 이름 단위로 찾는다(1106/16-01). `test.describe("invoice-feature", …)`는 잔여이고, `product-feature`를 지울 때 `generate-product-feature-index.ts`처럼 더 긴 이름 안에 든 것은 잔여가 아니다. spec은 `test:all`(vitest)도 드릴의 다른 단계도 돌리지 않으므로 이 검사가 아니면 다음 CI의 브라우저 게이트에서야 실패한다. -- **못 잡음**: 기능을 가리키지 않는 폴더 밖 파일. 예: route ID나 URL만 적은 e2e spec, `artifacts/tests/a11y-manual/.md`. 기능 전용 spec은 [03 문서](03-outside-feature-folder.md)의 목록대로 손으로 지운다. vitest 테스트(`*.test.ts`) 안에서 기능 ID를 글자로만 적은 것도 잔여로 세지 않는다. 그 테스트가 지운 기능에 기대면 같은 드릴의 `test:all`이 실패한다. 드릴은 `src`와 `tests`만 찾고, a11y 기록은 남아도 검사가 실패하지 않는다. + - spec 본문은 이름 단위로 찾는다(1106/16-01). 적힌 그대로(대소문자 구분) 찾고, 앞뒤에 `[A-Za-z0-9_-]`가 붙으면 다른 이름이다. `test.describe("invoice-feature", …)`는 잔여이고, `product-feature`를 지울 때 `generate-product-feature-index.ts`처럼 더 긴 이름 안에 든 것은 잔여가 아니다. spec은 `test:all`(vitest)도 드릴의 다른 단계도 돌리지 않으므로 이 검사가 아니면 다음 CI의 브라우저 게이트에서야 실패한다. + - `-`가 없는 한 단어 ID·폴더 이름(`messages`, `status`)은 spec 본문에서 찾지 않는다. 템플릿 spec이 그 단어를 평범하게 쓰므로(`status: 200`, `getByRole("status")`) 찾으면 템플릿 spec이 잔여로 나온다. +- **못 잡음**: 기능을 가리키지 않는 폴더 밖 파일. 예: route ID나 URL만 적은 e2e spec, 한 단어 ID만 본문에 적은 spec, `artifacts/tests/a11y-manual/.md`. 기능 전용 spec은 [03 문서](03-outside-feature-folder.md)의 목록대로 손으로 지운다. vitest 테스트(`*.test.ts`) 안에서 기능 ID를 글자로만 적은 것도 잔여로 세지 않는다. 그 테스트가 지운 기능에 기대면 같은 드릴의 `test:all`이 실패한다. 드릴은 `src`와 `tests`만 찾고, a11y 기록은 남아도 검사가 실패하지 않는다. ④ **쓸 스킬**: `documentation-and-adrs`, `deprecation-and-migration` diff --git a/docs/manual/reference/errors.md b/docs/manual/reference/errors.md index 8eded627..0b7aa1e4 100644 --- a/docs/manual/reference/errors.md +++ b/docs/manual/reference/errors.md @@ -198,6 +198,6 @@ lint / check:architecture / check:i18n → FE-GATE-002, FE-GATE-010 | 메시지 | 원인 | 고칠 곳 | |---|---|---| -| ` removal failed:` 다음 `fixture-id-residue: residue: ` (`test:sample-removal`) | 기능을 지운 뒤에도 그 기능을 가리키는 파일이 남았다. `src`는 기능 ID나 폴더 이름을 담은 파일, `tests`는 이름이 기능 ID를 담거나 기능 폴더(`src/features//`, `tests/features//`)에서 import하는 파일, 본문에 기능 ID나 폴더 이름을 한 이름으로 적은 Playwright spec(`*.spec.ts`)이다 | 그 파일을 기능 폴더 안으로 옮기거나, 기능을 가리키지 않게 한다. 지운 기능 전용 spec이면 지운다. 목록에 템플릿 파일이 나오면 템플릿 결함이다. 그 파일을 고치지 말고 템플릿에 알린다 | +| ` removal failed:` 다음 `fixture-id-residue: residue: ` (`test:sample-removal`) | 기능을 지운 뒤에도 그 기능을 가리키는 파일이 남았다. `src`는 기능 ID나 폴더 이름을 담은 파일, `tests`는 이름이 기능 ID를 담거나 기능 폴더(`src/features//`, `tests/features//`)에서 import하는 파일, 본문에 `-`가 든 기능 ID나 폴더 이름을 적힌 그대로 한 이름으로 적은 Playwright spec(`*.spec.ts`)이다 | 그 파일을 기능 폴더 안으로 옮기거나, 기능을 가리키지 않게 한다. 지운 기능 전용 spec이면 지운다. 목록에 템플릿 파일이 나오면 템플릿 결함이다. 그 파일을 고치지 말고 템플릿에 알린다 | | `No installed feature declares FEATURE_MODULE_ID ""` | `--feature=`에 없는 기능 ID | 명령 인자 | | `feature scaffold failed:` 다음 `: ` (`test:feature-scaffold`) | 생성한 기능이 게이트 하나를 통과하지 못했다 | `scripts/create-feature.ts`의 템플릿. 제품 팀이 아니라 템플릿을 고칠 일이다 | diff --git a/scripts/lib/feature-residue.ts b/scripts/lib/feature-residue.ts index 757a4051..459a6262 100644 --- a/scripts/lib/feature-residue.ts +++ b/scripts/lib/feature-residue.ts @@ -22,10 +22,17 @@ import path from "node:path"; * `tests/`, vitest.config.ts), and no step of the drill runs a Playwright * spec. So a spec (`*.spec.ts`) that names the feature only in its text, * such as `test.describe("invoice-feature", ...)`, is residue: its text is - * searched for the ID or folder name as a whole kebab-case name. A longer - * name that contains it (`generate-product-feature-index.ts` for - * `product-feature`) does not count. A spec that names only the feature's - * routes or URLs is not found; 03's hand list removes the feature's specs. + * searched for the ID or folder name as written, case-sensitive, with no + * identifier character (`[A-Za-z0-9_-]`) on either side. A longer name + * that contains it (`generate-product-feature-index.ts` for + * `product-feature`, `KO_MESSAGES` for `messages`) does not count. A spec + * that names only the feature's routes or URLs is not found; 03's hand list + * removes the feature's specs. + * Diff review DR-02: only a name with a hyphen is searched. A one-word ID + * or folder (`status`, `reports`, `messages`) is an ordinary word in the + * template's own specs (`status: 200`, `getByRole("status")`, "reports" in + * a test title), and no text rule tells that from a reference, so a spec + * that names only a one-word ID is not found either. * * The reference sample keeps its own, wider pattern in * scripts/test-sample-removal.ts: the template owns all of its files. @@ -56,7 +63,13 @@ export async function productFeatureResidue( String.raw`(?:\bfrom\s*|\bimport\s*\(\s*|\bimport\s+|\bmock\s*\(\s*)["'][^"'\n]*/features/(?:${names})/`, "u", ); - const wholeName = new RegExp(`(? name.includes("-")) + .map(escapeRegExp); + const wholeName = + specNames.length === 0 + ? null + : new RegExp(`(? path.relative(root, file).split(path.sep).join("/"); @@ -70,7 +83,7 @@ export async function productFeatureResidue( if ( named.test(name) || imported.test(text) || - (playwrightSpec.test(name) && wholeName.test(text)) + (wholeName !== null && playwrightSpec.test(name) && wholeName.test(text)) ) { residue.push(name); } diff --git a/tests/unit/feature-residue.test.ts b/tests/unit/feature-residue.test.ts index 657a77d8..7b3f374c 100644 --- a/tests/unit/feature-residue.test.ts +++ b/tests/unit/feature-residue.test.ts @@ -1,4 +1,4 @@ -import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; +import { mkdir, mkdtemp, readdir, readFile, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; @@ -100,6 +100,39 @@ describe("product feature residue (1105/16-04)", () => { ).toEqual([]); }); + // 1106/16-01 (diff review DR-02). The spec search ignored case and took + // `_` as a boundary, so removing a feature named `messages` counted the + // template's accessibility spec (`KO_MESSAGES`), and `status` or `reports` + // counted a dozen template specs that use the word. + it("does not count the template's own specs for common feature IDs", async () => { + const specs: Record = {}; + for (const entry of await readdir("tests", { recursive: true })) { + const file = path.join("tests", entry).split(path.sep).join("/"); + if (/\.spec\.[cm]?[jt]sx?$/u.test(file)) specs[file] = await readFile(file, "utf8"); + } + expect(Object.keys(specs)).toContain("tests/e2e/accessibility.spec.ts"); + // A copy of the specs alone: `src` is searched by substring (1105/16-04). + const root = await fixture(specs); + + for (const id of ["product-feature", "messages", "status", "reports"]) { + expect(await productFeatureResidue(root, id, id), id).toEqual([]); + } + }); + + it("finds the name in a spec as written, and the folder name by the same rule", async () => { + const root = await fixture({ + "tests/e2e/checkout.spec.ts": `test.describe("${ID}", () => {});\n`, + "tests/e2e/documents.spec.ts": 'const FOLDER = "invoice-docs";\n', + "tests/e2e/title-case.spec.ts": 'test.describe("Invoice-Feature", () => {});\n', + "tests/e2e/longer-key.spec.ts": `const KEY = "${ID}_v2";\n`, + }); + + expect(await productFeatureResidue(root, ID, "invoice-docs")).toEqual([ + "tests/e2e/checkout.spec.ts", + "tests/e2e/documents.spec.ts", + ]); + }); + it("matches the folder name as well as the ID", async () => { const root = await fixture({ "src/contracts/leftover.ts": 'export const DIRECTORY = "invoices";\n',