Commit Graph
5 Commits
Author SHA1 Message Date
DongHyeonka ceaf316f65 test(setup): 시험 timeout을 모두 desktop 실측값으로 주고 손 숫자를 거절한다
frontend-quality-gates / merge / static checks (pull_request) Canceled after 0s
frontend-quality-gates / merge / tests (pull_request) Canceled after 0s
frontend-quality-gates / merge / browser tests (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Canceled after 0s
frontend-quality-gates / external-vulnerability-provider (pull_request) Canceled after 0s
frontend-quality-gates / external-provenance-provider (pull_request) Canceled after 0s
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Canceled after 0s
frontend-quality-gates / deploy-promoted-release (pull_request) Canceled after 0s
frontend-quality-gates / main / self-tests and removal drills (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Canceled after 0s
문제: 자식 프로세스 시험의 timeout은 `childProcessTimeout(<잰 ms>)`로
정한다(docs/work/reference/testing.md 2절). 그런데 기본값이 아니라서
`tests/setup.ts` 검사에 걸리지 않는 손 숫자가 남았다. 리뷰가 센 54곳 중
둘(`browser-soak.contract.test.ts`의 `evaluateSoak` 인자)은 timeout이 아니고,
AST로 다시 세면 80곳이다: 시험·describe·hook에 쓴 숫자, `VERIFY_TIMEOUT`·
`PROCESS_HEAVY_TIMEOUT_MS`(파일 넷에 따로)·`PROVIDER_BASE_FIXTURE_TIMEOUT_MS`
같은 상수, `PROCESS_WATCHDOG_MS * 3` 같은 식. taxonomy는 옛 상수를 예로
들었다. 실측으로 보면 손 숫자 하나가 모자랐다: system 시험의 provider 묶음
30초는 desktop 여섯 번 중 두 번 넘겼다.

고친 것:
- 80곳을 desktop에서 잰 가장 긴 실행으로 `childProcessTimeout(<ms>)`에
  넘긴다. coverage 묶음(maxWorkers=4)·test:unit 각 9회, integration 3회,
  scale(traffic·session·composition·global-local) 3회, 시스템 컨테이너의
  tests/system 6회, JSON reporter로 받았다. hook은 파일 시간에서 시험 합을
  뺀 값이다. 시간 초과로 끝난 실행은 그 시간을 하한으로 넣었다.
- 상수 사본은 지운다. 한 파일 안에서 여럿이 쓰는 값만
  `const X = childProcessTimeout(...)`로 둔다(`VERIFY_TIMEOUT`). guardian
  시험의 lease는 시험 timeout이 아니라 `childProcessTimeout(0)`(helper의 최소
  30초)로 둔다.
- `tests/unit/test-timeout-declarations.test.ts`가 tests/의 Vitest 파일을
  Babel로 읽어 시험·describe·hook의 timeout 인자가 helper 호출(또는 그것을
  담은 파일 상수)이 아니면 파일과 줄로 실패한다. 프로세스 안에서 도는 긴
  시험(scale tier)도 같은 helper를 쓴다.
- taxonomy 예시, testing.md 2절, `.claude/rules/tests.md` 9번, helper 머리
  주석을 같은 방법으로 맞춘다.

버린 대안:
- `tests/setup.ts` 검사를 「helper가 만든 값이 아닌 timeout」까지 넓히기.
  helper 값은 30초 단위 숫자라 손으로 쓴 60_000과 가릴 수 없고, hook과
  프로세스 안 시험은 보지 못한다.
- 프로세스 안 시험은 손 숫자 그대로 두기. 근거 없는 숫자가 남고 검사가
  예외를 가져야 한다.

위험·한계:
- 값이 커진 곳이 있다(15배 규칙): `manual-code-blocks` 300초 → 900초,
  provider 묶음 30초 → 480초 등. hang을 늦게 잡는다. 줄어든 곳도 있다
  (scale traffic 60초 → 30초 등, 잰 값의 15배 안).
- 측정은 desktop 부하 6~35에서 했다. runner가 더 느리면 다시 잰다.
- 검사 시험은 Vitest 파일 전부를 파싱해 coverage 묶음에서 최대 13.5초
  걸렸고, 그 값으로 자기 timeout을 준다. 이름 있는 함수를 콜백으로 넘긴
  시험(`it("x", run, 30_000)`)은 못 찾는다.
- 다운스트림: 손 숫자 timeout이 있는 제품 시험은 test:unit에서 이 검사에
  걸린다. 메시지가 helper를 알린다.

검증(desktop):
- RED: 검사 시험이 고치기 전 80곳을 파일·줄로 내고 실패. GREEN: 검사·
  child-process-timeout 6개 통과. check:types·eslint(바뀐 34파일) rc=0,
  verify:documentation PASS_SCOPED, 노트북 `scripts/verify.sh docs` OK.
- 측정 원자료: /tmp/claude-gates/w2fe2-t08m, -t08m2, -t08m3.
- 게이트 결과는 PR 본문에 적는다.

Refs: 1112/03-08
2026-11-13 06:47:02 +09:00
DongHyeonka 9f9e459c4d perf(build): 운영 빌드가 react-router의 운영 빌드를 싣는다
문제: react-router 7.18.1의 exports는 모든 조건에서
dist/development/*를 가리킨다. 그 파일은 ENABLE_DEV_WARNINGS = true라
운영 번들의 초기 청크에 라우터 개발 경고 문구("You rendered descendant
…")가 들어 있었다. 운영 콘솔에 개발 경고가 뜨고, 초기 JS가 약 600 B 크다.

고른 방법: vite build일 때만 react-router-dom이 import하는 두 진입점
(react-router, react-router/dom)을 같은 패키지의 dist/production 파일로
alias한다. 경로는 react-router-dom에서 react-router를 resolve한 개발
진입점 옆에서 찾고, 파일이 없으면 빌드를 멈춘다. 개발 서버와 테스트는
개발 빌드를 그대로 써서 경고를 받는다.
버린 대안: 고정 경로 alias(리뷰 실험). 업그레이드로 배치가 바뀌면
조용히 깨진다. react-router에 production 조건을 요청하기는 시점을 정할
수 없어 이 alias를 지울 조건으로만 적었다.

위험·한계: exports 밖 경로를 쓴다. 업그레이드 때 배치가 바뀌면 빌드가
실패한다(조용히 개발 빌드로 돌아가지 않는다). Firefox·WebKit e2e는
돌리지 않았다.

검증: tests/unit/build-environment-bundle.test.ts가 빌드한 JS에 개발
경고 문구가 없음을 본다(고치기 전 chunk-KS7C4IRE 1개에서 실패).
같은 빌드(local-build) 초기 JS 201,552 → 200,939 B(−613 B), 파일 25개.
라우터를 쓰는 e2e 5개 spec 14건(app-shell, reference-route,
reference-save, scroll-restoration, platform-overview, chromium) 통과.

Refs: docs/reviews/2026-11-03-maturity-review/15-performance.md 15-07
2026-11-04 20:25:48 +09:00
DongHyeonka af6d0a9f01 perf(build): react-dom을 자기 청크로 빼 build id만 바뀐 release의 캐시 손실을 줄인다
문제: build id는 부트 실패 화면이 보여 주므로 render-boot-failure 청크에
들어간다. react-dom과 scheduler(약 56 KB gzip)가 같은 청크에 있어서
build id만 다른 두 빌드에서 boot·index·render-boot-failure 세 파일의
이름이 바뀌었다. 합계 99,785 B로 초기 JS의 49.4%다. 해시 자산은 1년
immutable로 캐시되는데, 재방문 사용자는 코드가 같아도 release마다 이만큼
다시 받았다. 1101 O1이 같은 것을 재고 채택을 권했지만 결정 기록이 없었다.

고른 방법: codeSplitting.groups에 react-dom·scheduler 그룹을 더한다
(includeDependenciesRecursively: false라 라이브러리 모듈만 묶는다).
같은 비교에서 바뀐 초기 JS가 44,297 B(22.0%)로 준다. 초기 JS는
201,857 → 201,552 B, 초기 파일 수는 25개 그대로다(react-dom 진입
모듈 1.3 KB 청크가 합쳐졌다).
버린 대안: build id를 JS에 넣지 않고 release-manifest.json에서만 읽기.
boot까지 바뀌지 않아 더 줄지만, 부트 실패 화면이 build id를 보여 주는
계약을 바꿔야 한다.

위험·한계: boot(39 KB)는 build id로 설정을 대조하므로 계속 바뀐다.
그룹 정규식은 pnpm의 node_modules 배치를 가정한다. 배치가 바뀌어 그룹이
비면 새 테스트가 실패한다.

검증: tests/unit/build-environment-bundle.test.ts가 build id만 다른 두
빌드에서 react-dom이 든 청크의 이름이 같고 그 청크가
render-boot-failure가 아님을 본다(고치기 전 실패). 부트 실패 화면
e2e(tests/e2e/boot-module-failure.spec.ts, chromium) 통과.
feature-shape-growth·design-system-initial-chunk·bundle-classification
통과. 두 빌드 비교는 docs/operations/performance-evidence.md에 기록했다.

Refs: docs/reviews/2026-11-03-maturity-review/15-performance.md 15-06
2026-11-04 20:23:54 +09:00
DongHyeonka 51941a547b perf(build): 갤러리 전용 primitive를 초기 청크에서 뺀다 (1101/08-08)
문제
셸은 design-system/index.ts에서 Button·Drawer·Select를 import한다. 번들러는
배럴이 다시 내보내는 모듈을 side effect가 있다고 보고 모두 실행 순서대로
싣는다. 그래서 갤러리와 예제 화면만 쓰는 Tooltip·Menu·Toast·Tabs·Card·
Alert 등이 초기 청크(design-system-*.js)에 있다. 초기 JS는 203,818 B로
예산 204,800 B에서 982 B 남았다. 파일을 나눈 앞 커밋만으로는 바뀌지
않는다.

고른 방법
- vite.config.ts의 treeshake.moduleSideEffects 규칙으로
  src/presentation/design-system/ 아래 .ts·.tsx를 side effect 없음으로
  선언한다. 이 파일들은 컴포넌트·아이콘·토큰 목록 선언만 한다. CSS
  import는 bootstrap/main.tsx 한 곳뿐이고 이 범위 밖이다.
- 결정: 바이트를 줄인다. 예산이 걸린 지표는 바이트이고, 늘어나는 청크는
  진입 청크의 preload 목록(__vitePreload)으로 병렬로 받으므로 HTTP/2에서
  왕복이 늘지 않는다. 재검토 조건(HTTP/1.1 호스팅이면 청크 수가 비용)을
  설정 주석에 적었다.
- 새 테스트 tests/unit/design-system-initial-chunk.test.ts
  - 실제 vite build를 돌려 초기 청크에 lazy 화면 전용 클래스 13개가
    없는지 본다. 셸의 ui-drawer가 있는지를 같이 봐서 빈 결과로 통과하지
    않게 한다.
  - design-system 파일에 효과만을 위한 import(import "x")가 없는지 본다.
    선언 아래에서는 그런 import가 모듈과 함께 사라지기 때문이다.
- build-environment-bundle 테스트(13-06)는 design-system-* 청크 이름을
  찾았다. 그 청크가 없어져서, Button 코드(ui-button--pending)가 든 청크가
  build id를 바꿔도 같은지로 바꾼다. 두 build id로 빌드해 보면 바뀌는
  파일은 boot·index·render-boot-failure 셋뿐이다.
버린 대안
- 파일 분리만: 실측 효과 없음(203,824 B, 16개).
- manualChunks로 청크 이름을 고정: 제품이 primitive를 쓸 때마다 다시
  맞춰야 한다.
- 청크 수 줄이기: 15-01 청크 그룹과 같이 봤다. rolldown의 $initial 태그는
  main.tsx가 앱을 동적으로 import해서(09-03) 아무것도 잡지 않았다(25개,
  +16 B). 모듈 그래프로 boot 정적 closure를 만들면 배럴을 따라 갤러리
  primitive까지 잡혀 다시 초기 청크로 간다. 바이트 손해 없이 줄일 방법을
  찾지 못해 늘어난 수를 둔다.

위험·한계
- 초기 청크가 16개에서 25개로 는다(결정 당시 추정 21개보다 많다. 앞
  커밋의 파일 분리로 button·field·select가 따로 나온다). 전체(초기+lazy)
  gzip은 232,231 → 236,253 B로 4,022 B 는다. 첫 화면만 보는 사용자는
  2,718 B 덜 받고, 모든 화면을 도는 사용자는 청크 경계 비용만큼 더 받는다.
- 새 파일에 모듈 최상위 효과(전역 등록 등)를 넣으면 이 선언이 그 효과를
  지울 수 있다. 효과만을 위한 import는 테스트가 막지만, 최상위 문장은
  막지 않는다. 설정 주석에 적었다.
- lazy 청크 예산(청크당 122,880 B)에는 영향이 없다. 가장 큰 lazy 청크는
  8,431 B다.
- 화면 변화 없음: 같은 코드를 다른 청크에서 받는다.

검증
- RED(앞 커밋 상태): 새 테스트가 실패. 초기 청크에 ui-alert·ui-badge·
  ui-card·ui-data-table·ui-menu·ui-progress·ui-radio-group·ui-switch·
  ui-tabs·ui-toast·ui-tooltip 11개가 있었다.
- GREEN: design-system-initial-chunk·build-environment-bundle·
  design-system-contract·product-index-entrypoints·bundle-classification·
  sub-path-deployment·product-feature-selection-build 통과.
- 빌드(flock, build-frontend.ts): 초기 JS gzip 203,818 → 201,100 B
  (-2,718 B, 예산 여유 982 → 3,700 B), 초기 청크 16 → 25개, lazy 청크
  17 → 20개.
- node scripts/run-vitest.ts run tests/component: 35파일 228/228 통과.
- Chromium e2e(vite preview, 위 빌드): ui-gallery·design-system-
  interactions·app-shell·accessibility·platform-overview·reference-form·
  reference-route·reference-save·theme·typography·responsive·compact-
  smoke·i18n·scroll-restoration 55/55 통과.
- tsc(app·node·test), 바꾼 파일 eslint 통과.

Refs: docs/reviews/2026-11-01-maturity-review/08-presentation.md 08-08
2026-11-03 01:24:31 +09:00
DongHyeonkaandClaude Opus 5.5 2ec59ad9ee fix(build): read VITE_* values by key and refuse undeclared ones (13-06)
getBuildConfig defaulted to the whole import.meta.env, so Vite inlined every
loaded VITE_* value, read or not. Values are now read by key, a lint rule bans
whole-object references in src, and vite.config refuses VITE_* names missing
from ENV_REGISTRY. A build test pins the values that must stay in the bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:35:54 +09:00