Skip to content

TSK-009-05 TypeScript coverage 95 #328

@ClarusIubar

Description

@ClarusIubar

TSK-009-05 TypeScript coverage 95

Scope-ID: TSK-009-05
Issue: #328
Parent Issue: #323
Child Issue: #328
Branch: typescript-coverage-95
Status: in-progress
PR URL: TBD-TSK-009-05
Commit SHA: TBD-TSK-009-05
merge commit: TBD-TSK-009-05
CI evidence: TBD-TSK-009-05

Scope

React, Worker, scripts TypeScript 코드의 coverage gate를 statements, branches, functions, lines 각각 95% 이상으로 올리고, npm.cmd run test:coverage:ts가 95% threshold를 실제로 통과하도록 만든다.

이 child issue는 TypeScript coverage hard gate만 소유한다. Python coverage는 #329, QA Wiki traceability는 #330, 배포 확인과 UI/UX 기능 변경은 이 범위가 아니다.

Core Classification

Core: TSK-009-00
Parent Issue: #323
Rationale: UI/UX expectation tracking and 95% coverage gate parent 아래의 TypeScript coverage hard gate 실행 단위다.
Misroute blocked: Python coverage(#329), QA Wiki traceability(#330), UI/UX feature work, deployment debugging은 이 child issue 범위가 아니다.

문제 정의

Problem Why it matters
test:coverage:ts는 실행 통과 상태지만 95% 목표에는 미달 coverage gate가 품질 회귀를 막지 못함
Statements/lines가 약 90%, branches가 약 73% branch 경계와 예외 경로 테스트가 부족함
Functions가 95% 직전 일부 public boundary가 호출되지 않음

결정 사항

항목 결정
Branch typescript-coverage-95
API contract 변경 없음
DB schema 변경 없음
User-facing copy 변경 없음
Auth/OAuth path 변경 없음
Scope TypeScript tests/config coverage gate only

Out Of Scope

  • 사용자-facing copy 변경
  • API path, response shape, DB schema, OAuth 경로 변경
  • Python coverage 작업(TSK-009-06 FastAPI coverage 95 #329)
  • 배포 파이프라인 변경
  • coverage 달성을 위한 exclude 범위 확대
  • private implementation monkey patch 또는 import-only 테스트

Public Behavior And Interface / Data Flow Impact

Public behavior: npm.cmd run test:coverage:ts는 TypeScript coverage 네 지표가 모두 95% 이상일 때만 성공해야 한다.

Interface: Vitest coverage 설정과 test suite만 변경한다. production API/public response contract는 변경하지 않는다.

Data flow: Vitest coverage provider가 src, scripts, deploy/api-worker-shell production TypeScript를 측정하고 coverage summary를 출력한다.

Failure mode: 새 production TypeScript 코드가 coverage를 떨어뜨리면 coverage command가 실패해야 한다. coverage 달성을 위해 behavior 변경, API 변경, exclude 확대가 필요하면 중단한다.

Validation target: Statements >= 95%, Branches >= 95%, Functions >= 95%, Lines >= 95%.

Target Design

public tests and stable boundary tests
-> Vitest coverage provider
-> 95% threshold gate
-> CI/local failure on regression

Architecture Boundary Gate

Durability: durable

Architecture profile: Vitest config, public tests, script command boundary.

Responsibility map: coverage config는 threshold policy를 소유하고, 테스트 파일은 public behavior와 stable boundary를 검증한다.

Dependency direction: production code는 test helper에 의존하지 않는다. 테스트만 production public exports와 DOM/API/Worker/script boundary를 호출한다.

External dependency boundary: external network and browser APIs are mocked or isolated through existing test seams.

Validation seam: unit, integration, regression, e2e, and coverage tests use mocked DOM/API/Worker/script boundaries. Coverage is proven without live external services as the only proof.

Scope map: coverage 미달 보강은 TypeScript tests/config/scripts 범위에 한정한다.

Architecture risk: coverage 수치만 맞추기 위한 private implementation monkey patch나 무의미한 import-only 테스트를 금지한다.

Single-file exception: none expected.

Issue Structure

Parent issue:

Sub-issue:

현재 coverage snapshot

  • 기준 명령: npm.cmd run test:coverage:ts
  • Statements: 95.45% (5416/5674)
  • Branches: 85.63% (3332/3891)
  • Functions: 96.41% (1588/1647)
  • Lines: 95.60% (5005/5235)
  • Test files: 116 passed
  • Tests: 607 passed
  • 기준 commit: 9571ef5 test: raise TypeScript branch coverage

Refactor-First Coverage Checklist

  • Characterization tests: 과밀지점 리팩터링 전 public behavior를 먼저 고정하고 해당 단위 test green을 기록한다.
  • Hotspot refactor: reviews.ts review read flow의 반복 조립을 domain-local read context helper로 추출한다.
  • Hotspot refactor: useNaverFestivalMarkers의 marker lifecycle과 selection style update를 local planner/controller seam으로 분리한다.
  • Hotspot refactor: useAppReviewCrudActions의 API 이후 collection/cache/my-page 갱신을 pure helper로 분리한다.
  • Hotspot refactor: festival-domain read/import policy의 source 없음, empty items, stale cleanup, date/window branch를 service boundary로 고정한다.
  • Hotspot refactor: numeric-literal-audit와 event normalize script의 IO와 pure classification/compare logic을 분리한다.
  • Coverage fill: base-data-mappers, festival-series, simple mapper/component branch는 리팩터링 없이 테스트 추가로 처리한다.
  • Final hard gate: Vitest coverage threshold를 statements/branches/functions/lines 95로 설정하고 npm.cmd run test:coverage:ts가 실제 threshold 기준으로 통과하게 고정한다.

Coverage Slice Checklist

  • src/hooks coverage slice: app navigation, review/comment action, feedback/bootstrap effect, route query branch를 public hook/helper 기준으로 테스트하고 coverage summary를 기록한다.
  • src/components/naver-map coverage slice: marker sync, selection sync, viewport sync, overlay fallback을 SDK local mock boundary로 테스트하고 coverage summary를 기록한다.
  • src/api coverage slice: API core cache/error/body parsing, reviews client 실패/성공 branch, bootstrap/tourism edge response를 테스트하고 coverage summary를 기록한다.
  • Worker service coverage slice: auth/session/social-user, notification/review handlers, festival/tourism read-service/repository, route handler branch를 Request/Response boundary로 테스트하고 coverage summary를 기록한다.
  • Final hard gate slice: Vitest coverage threshold를 statements/branches/functions/lines 95로 설정하고 npm.cmd run test:coverage:ts가 실제 threshold 기준으로 통과하게 고정한다.

구현 순서

Order Issue Intent Completion evidence
1 #328 coverage summary에서 미달 파일과 branch를 선별 coverage output
2 #328 public behavior/stable boundary 테스트 추가 PR diff
3 #328 Vitest threshold 95% hard gate 설정 config diff
4 #328 로컬 검증과 PR/CI/merge 근거 기록 validation output, PR URL, CI URL, merge SHA

Behavior Preservation Rules

  • 리팩터링 전 characterization test를 먼저 추가한다.
  • 기존 public exports, hook return shape, Worker endpoint, response shape, API client behavior는 유지한다.
  • 사용자-facing copy, mojibake 문자열, DB schema, OAuth 경로, route path는 변경하지 않는다.
  • private 구현에 맞춘 monkey patch는 금지한다.
  • coverage exclude 확대, denominator 줄이기, import-only test는 금지한다.
  • 새 helper는 owner module 근처에 둔다. global barrel이나 중앙 type 덩어리로 회귀하지 않는다.

Test Gate

Coverage hard gate 변경이므로 최소 check:numeric-literals, lint, typecheck, test:unit, test:integration, test:regression, test:e2e, test:coverage:ts, build, git diff --check, UTF-8 integrity check가 필요하다.

Completion Evidence

Handoff Checklist

  • I am on the correct branch: typescript-coverage-95.
  • I have read the relevant repository instructions.
  • I know the parent issue and sub-issue.
  • I know what must not change.
  • I know the simplest acceptable implementation path.
  • I know which files or boundaries I must not touch.
  • I know what evidence is required before completion.
  • I will stop if the task crosses an out-of-scope boundary.

Canonical Skill / Policy Source

  • llm-code-generation-protocol
  • tdd
  • Repository AGENTS.md
  • Agent governance parent/child/checklist policy

Verification Contract

required commands: npm.cmd run check:numeric-literals; npm.cmd run lint; npm.cmd run typecheck; npm.cmd run test:unit; npm.cmd run test:integration; npm.cmd run test:regression; npm.cmd run test:e2e; npm.cmd run test:coverage:ts; npm.cmd run build; git diff --check; UTF-8 integrity check.

source-of-truth readback: #328 issue checklist, #323 parent checklist, PR diff/body, GitHub Actions checks, changed test/config readback, coverage summary readback.

required evidence: PR URL, main merge SHA, CI/CodeQL result links, local validation command results, coverage summary showing statements/branches/functions/lines >= 95%, UTF-8 readback result.

fail-closed failure modes: parent/child checklist missing; any coverage metric below 95%; threshold passes by widening exclude scope instead of adding meaningful tests; API/DB/OAuth contract change required; user-facing copy scope exceeded; UTF-8 or Markdown structure corruption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ciGitHub Actions, quality gates, and deployment workflow workarea:frontendReact UI, hooks, coordinator, and client service workpriority:highHigh priority workquality:solidSOLID principle hardeningtopic:architectureResponsibility boundaries, dependency flow, and module shapetype:childExecutable child issue under a parent roadmaptype:refactorRefactoring without product behavior changes

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions