From d68e25a2ad5e8482a97b07dbc9f9e33ce0af3016 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 26 Sep 2026 00:28:02 +0900 Subject: [PATCH] test(coverage): ratchet live retry, contract bridge and IndexedDB modules (10-04) The policy guarded legacy retry-policy.ts but not the live V3 retry and contract path rules, and the strategy doc claimed 19 modules at 90% targets. The doc now states the enforced ratchet. The below-threshold fixture used the pre-counter summary shape and failed with a TypeError instead of the 'Risk coverage failed:' diagnostic the negative gate expects. Co-Authored-By: Claude Opus 5.5 --- config/testing/risk-coverage.json | 35 ++++++++++++++++++- .../frontend-platform-testing-strategy.md | 31 +++++++++++++--- tests/fixtures/coverage/below-threshold.json | 16 ++++----- 3 files changed, 68 insertions(+), 14 deletions(-) diff --git a/config/testing/risk-coverage.json b/config/testing/risk-coverage.json index f3b5eb7b..3095ac12 100644 --- a/config/testing/risk-coverage.json +++ b/config/testing/risk-coverage.json @@ -178,6 +178,36 @@ "functions": 90, "branches": 80 } + }, + { + "path": "src/adapters/http/http-contract-bridge.ts", + "owner": "http-runtime", + "minimum": { + "lines": 85, + "statements": 79, + "functions": 100, + "branches": 73 + } + }, + { + "path": "src/adapters/http/http-retry-lifecycle.ts", + "owner": "http-runtime", + "minimum": { + "lines": 100, + "statements": 100, + "functions": 100, + "branches": 100 + } + }, + { + "path": "src/adapters/storage/indexeddb/indexeddb-runtime.ts", + "owner": "storage-runtime", + "minimum": { + "lines": 79, + "statements": 76, + "functions": 73, + "branches": 72 + } } ], "highRiskPaths": [ @@ -197,7 +227,10 @@ "src/bootstrap/read-bounded-boot-json.ts", "src/contracts/diagnostics.ts", "src/features/reference-feature/adapters/reference-http-gateway.ts", - "src/presentation/adapters/query/application-query.ts" + "src/presentation/adapters/query/application-query.ts", + "src/adapters/http/http-contract-bridge.ts", + "src/adapters/http/http-retry-lifecycle.ts", + "src/adapters/storage/indexeddb/indexeddb-runtime.ts" ], "waivers": [] } diff --git a/docs/testing/frontend-platform-testing-strategy.md b/docs/testing/frontend-platform-testing-strategy.md index 3e6f9fc5..4ddbfd4a 100644 --- a/docs/testing/frontend-platform-testing-strategy.md +++ b/docs/testing/frontend-platform-testing-strategy.md @@ -153,11 +153,25 @@ Chromium, Firefox, WebKit과 compact project로 실행한다. 빠른 Vite 개발 #### 위험 기반 coverage -V8 text/JSON/LCOV를 생성하고 전체 기준과 retry/storage/telemetry/application -composition/compatibility/performance/promotion/chunk/diagnostics/reference HTTP -operation/query-mutation/registry compatibility 19개 high-risk module에 80개 -scoped threshold를 적용한다. critical module 누락 또는 threshold 미달 fixture는 -merge gate를 실패시킨다. +V8 text/JSON/LCOV를 생성하고 `config/testing/risk-coverage.json`의 하한을 +적용한다. 하한은 전체 평균 4개(`summary`: lines 75, statements 73, functions 80, +branches 68)와 `criticalModules` 20개의 모듈별 하한 80개(모듈마다 4개)다. +`check-risk-coverage.ts`는 두 종류를 합쳐 "84 thresholds"로 보고한다. 모듈은 +HTTP 실행(`http-execution-v3.ts`, live 재시도 규칙 `http-retry-lifecycle.ts`, +계약 경로 규칙 `http-contract-bridge.ts`, legacy V2 `retry-policy.ts`, 요청 조립, +bounded body/JSON), server-state scope, Service Worker lifecycle, 저장소 +(`browser-storage-adapter.ts`, `indexeddb-runtime.ts`), telemetry, application +조립, compatibility, chunk recovery, release manifest, boot JSON, diagnostics, +reference HTTP gateway, application query다. 모듈별 하한은 목표치가 아니라 +등록할 때 측정값 근처로 둔 ratchet이다(되돌아가지 못하게 막는 하한). 새로 +넣은 세 모듈은 2026-09-26 측정값을 내림한 값이다. +critical module 누락 또는 threshold 미달 fixture는 merge gate를 실패시킨다. + +realtime(`src/adapters/realtime/`)과 Web Push(`src/adapters/web-push/`)는 +`test:realtime-removal`이 통째로 지우는 선택 runtime이라 +(`scripts/test-realtime-runtime-removal.ts`의 `runtimePaths`) 모듈별 하한에 넣지 +않는다. 넣으면 그 runtime을 지운 다운스트림의 coverage gate가 없는 파일 때문에 +실패한다. 두 영역은 전체 평균 하한만 받는다. Repository inventory의 정적 provenance는 runtime 실행 가능 여부가 아니라 현재 Vitest/V8 producer가 file counter를 생성하는 문장의 존재 여부를 나타낸다. 따라서 @@ -951,6 +965,13 @@ fixture로 확인한다. ### 14.2 위험별 목표 +아래 표는 올려 갈 **목표**다. 지금 gate가 막는 값은 이 표가 아니라 +`config/testing/risk-coverage.json`의 현재값 ratchet이다(2.3절 "위험 기반 +coverage"). 예를 들어 `service-worker-lifecycle.ts`의 branch 하한은 43, +`http-execution-v3.ts`는 52로 표의 목표보다 낮다. 테스트를 보강해 측정값이 +오르면 그 모듈의 하한을 새 측정값으로 올린다. 하한을 내리는 변경은 이유를 +커밋 메시지에 적는다. + | 영역 | Line/statement 참고 | Branch 우선 목표 | | --- | --- | --- | | registry/codec/schema | 95~100% | 100%에 가깝게 | diff --git a/tests/fixtures/coverage/below-threshold.json b/tests/fixtures/coverage/below-threshold.json index 1df4f7e2..0e973e44 100644 --- a/tests/fixtures/coverage/below-threshold.json +++ b/tests/fixtures/coverage/below-threshold.json @@ -1,14 +1,14 @@ { "total": { - "lines": { "pct": 0 }, - "statements": { "pct": 0 }, - "functions": { "pct": 0 }, - "branches": { "pct": 0 } + "lines": { "total": 10, "covered": 0, "skipped": 0, "pct": 0 }, + "statements": { "total": 10, "covered": 0, "skipped": 0, "pct": 0 }, + "functions": { "total": 2, "covered": 0, "skipped": 0, "pct": 0 }, + "branches": { "total": 4, "covered": 0, "skipped": 0, "pct": 0 } }, "src/adapters/http/http-execution-v3.ts": { - "lines": { "pct": 0 }, - "statements": { "pct": 0 }, - "functions": { "pct": 0 }, - "branches": { "pct": 0 } + "lines": { "total": 10, "covered": 0, "skipped": 0, "pct": 0 }, + "statements": { "total": 10, "covered": 0, "skipped": 0, "pct": 0 }, + "functions": { "total": 2, "covered": 0, "skipped": 0, "pct": 0 }, + "branches": { "total": 4, "covered": 0, "skipped": 0, "pct": 0 } } }