Commit Graph
8 Commits
Author SHA1 Message Date
DongHyeonka 313f9bac3e chore(recipes): 레시피 예산을 측정값 + 3%로 정하고 규칙을 적는다 (0929/05-04)
문제: 레시피 번들 예산을 수정마다 100 B씩 올려 왔다. 한도가 늘 직전
측정값이라 예산 초과가 "왜 커졌나"를 묻는 신호가 되지 못했다. 이번 수정
묶음 뒤 offline-indexeddb(37,327 > 36,900)와 realtime(40,902 > 40,900)이
넘었고, file-transfer는 여유가 47 B였다. remediation ledger는 예전 값
56,100을 적지 않아 check:remediation-ledger가 실패하고 있었다.

방법: 리뷰 결정(README 14절 0929/05-04)대로, 측정값 + 3%를 100 B 단위로
올린 값으로 한 번 정한다. 그 뒤 3% 안의 증가는 예산을 고치지 않고, 넘는
증가는 커밋 본문에 이유를 쓰고 같은 규칙으로 다시 정한다.
- file-transfer 56,053 → 57,800, offline-indexeddb 37,327 → 38,500,
  realtime 40,902 → 42,200, service-worker-pwa 9,716 → 10,100
- 규칙·이유·측정 표는 optional-adapter-recipes.md의 예산 절에 둔다.
  JSON은 주석을 받지 않아서다.
- realtime 문서 두 곳은 숫자 대신 정본 위치를 가리킨다. VD-10은 결정
  기록이라 그대로 둔다.
버린 대안: 수정마다 100 B 인상(지금 방식), 레시피 예산에서 kernel 제외
(kernel 증가를 놓친다).

위험: 3% 여유 안에서는 회귀가 조용히 쌓인다. 예산 값을 표와 JSON 두
곳에 적으므로, 다음 인상 때 표도 같이 고쳐야 한다(ledger는
check:remediation-ledger가 file-transfer 값을 대조한다).

검증: check:optional-recipes:source PASS(4 budgets), verify:documentation
PASS_SCOPED, check:remediation-ledger의 예산 실패 사라짐(TR-02~04 기존
3건은 그대로, 게이트 밖).
2026-11-03 07:00:41 +09:00
DongHyeonka e1a458081d refactor(recipes)!: runtime이 있는 port는 src port를 다시 내보낸다 (0929/05-03)
문제: `recipes/frontend-capabilities/`가 `src/application/ports/`와
같은 이름의 타입 34개를 따로 정의한다(`DurableObjectStorePort`,
`FilePickerPort`, `StorageDurabilityPort`, `TransferProgress`,
`PublicCacheInspection` 등). 7월 이후 runtime port가 바뀌어도(0929
05-01~05-14) recipe 복사본은 한 번도 따라오지 않았다. catalog는 이
복사본을 구현한 fake를 runtime의 fake로 안내해서, 그 fake로 쓴 테스트는
runtime에 없는 resume·quarantine을 전제했다.

고른 방법 (리뷰의 (c)):
- runtime이 있는 port와 그 표면의 타입은 recipe 정의를 지우고
  `src/application/ports`의 것을 같은 이름으로 다시 내보낸다. 옛 recipe
  port에만 쓰이던 `DurableObjectDataClass`, `DurableObjectIntegrity`,
  `DurableObjectRead`, `ObjectStoreRecoverySummary`도 지운다. src에 없는
  `DurableObjectId`·`ObjectGeneration` 브랜드와 `as*` 헬퍼는 남긴다(src
  port가 그대로 받는다).
- fake는 src port를 `implements`한다.
  - 파일 picker·content·preview·download fake와 storage durability fake:
    결과를 `BrowserDataResult`(`error`, 닫힌 코드, operation)로 바꿨다.
    `PROVIDER_UNAVAILABLE`은 src 코드 `UNAVAILABLE`이 된다.
  - `MemoryDurableObjectStore`: src OPFS port에 맞춰 다시 썼다. 생성자는
    scope·storagePolicy·maxObjectBytes를 받는다. 멈춘 put의 행은
    reconcile이 rollback만 한다(resume·quarantine 없음, runtime과 같다).
    LOGOUT·ACCOUNT_DELETION만 지원하고 나머지 reason은 `UNSUPPORTED`다.
  - 고칠 수 없는 fake: `MemoryStructuredOfflineStore`는
    `IndexedDbRepositoryPort`와 설계가 달라(배치 commit·idempotency 대
    CAS·lifecycle batch) catalog offline-indexeddb 행의 fake 칸에서 뺐다.
    recipe 전용 `StructuredOfflineStore`의 fake로는 남는다.
- recipe 전용 port 두 곳:
  - `PublicResponseCacheAdmin.inspect`는 runtime의 `PublicCacheInspection`
    모양으로 보고한다. `MemoryPublicResponseCache`가 그 모양을 만든다.
  - `FileTransferPort`(runtime 없음)의 progress는 `FileTransferProgress`로
    나눴다. `TransferProgress`라는 이름은 recipe barrel에서 src 타입으로
    계속 나간다. 일반 recipe인 `contracts.ts`가 선택형 runtime port를
    import하지 않게 하려는 것이다.
- 다시 갈라지지 않게 `optional-capability-contracts.test.ts`에 검사를
  더했다. recipes/가 src/application/ports/에 있는 이름으로 타입을
  정의하면 실패한다(다시 내보내기는 허용).
- runtime 제거 fixture(`test-browser-file-storage-runtime-removal.ts`)는
  이 runtime의 port를 다시 내보내는 recipe 두 파일과 그 테스트를 함께
  지우고, recipe barrel에서 두 export 줄을 먼저 뺀다.
버린 대안: 현상 유지(변경 누락 계속), 이름만 바꿔 `*Sketch`로 표시(중복
유지비가 남음), 두 벌을 비교하는 타입 테스트(두 벌을 계속 유지).

위험·한계:
- recipe에서 위 타입·fake를 쓰던 다운스트림은 컴파일 오류로 드러난다
  (조용히 깨지지 않는다). 같은 이름 타입의 모양, `MemoryDurableObjectStore`
  생성자·메서드, 파일 fake의 실패 결과(`failure` → `error`), 지운 타입
  4개가 바뀌었다. 두 제품 repo의 사용 여부는 확인하지 않았다.
- `MemoryDurableObjectStore`의 integrity digest는 runtime의 tree digest가
  아니다(주석에 적음). worker·Web Lock·authority·GC는 흉내내지 않는다.
- `test:browser-file-storage-removal`은 pnpm이 필요해 돌리지 못했다.
  barrel 줄 제거와 경로 추가는 코드로만 확인했다.

검증:
- RED: 새 검사를 수정 전 recipe 소스로 돌리면 실패한다.
  `expected [ 'LocalFileRef', …(33) ] to deeply equal []` (34개).
- GREEN: `node scripts/run-vitest.ts run tests/unit tests/recipes
  tests/contract` 180 files 2,548건 통과. `tsc` app·recipes·test·node
  통과, 바꾼 파일 eslint 통과, `check-registries` PASS(재승인 불필요),
  `verify-documentation-readiness` PASS_SCOPED.
  `check-optional-recipes`(source)는 0929/05-01의 offline-indexeddb 예산
  초과(37,327 > 36,900)만 실패하고 catalog·source 검사는 통과했다.
  이 커밋은 그 번들 크기를 바꾸지 않는다(recipes/는 sourceRoots 밖).

BREAKING CHANGE: recipes/frontend-capabilities의 browser-file·OPFS·
storage durability·public cache 타입 중 src/application/ports와 이름이
같은 것은 이제 그 src 타입이다. file·durability·OPFS fake는 src port를
구현하고 BrowserDataResult를 돌려준다(`result.failure.code` →
`result.error.code`). `MemoryDurableObjectStore`는 `{ scope, storagePolicy,
maxObjectBytes }`로 만든다. `FileTransferPort`의 progress 타입은
`FileTransferProgress`다. `DurableObjectDataClass`·`DurableObjectIntegrity`
·`DurableObjectRead`·`ObjectStoreRecoverySummary`는 없어졌다.
Refs: docs/reviews/2026-09-29-maturity-review/05-adapters-storage-kernel.md 05-03
2026-11-03 01:23:05 +09:00
DongHyeonka 37e5f9d682 test(e2e): SW spec이 이미 켠 worker와 생성된 사전 캐시 목록을 쓴다 (0929/11-03)
SW e2e는 템플릿의 `= null;` 줄만 바꿔 worker를 켰다. 제품이 이미 ACTIVE로
켠 트리에서는 2건이 실패하고 4건이 실행되지 않았다. 사전 캐시 목록도
템플릿 기준으로 고정돼 있어 해시 파일을 더하면 2건이 실패했다.

선택을 지금 값과 상관없이 고치되, 이미 ACTIVE면 제품의 handler를 그대로
두는 `turnOnServiceWorker` 하나로 모았다. 빌드가 만든 사전 캐시 목록을
`precached`로 돌려주고 spec이 그 목록과 비교한다. 같은 문제를 고친
0929/06-04(`96a4f68`)의 `selectActiveServiceWorker`는 ACTIVE 선택을
템플릿 값으로 덮어써 제품 handler가 빠지므로 이 함수로 바꿨고, 실패한
준비 단계에서 임시 복사본을 지우는 처리는 유지했다(두 브랜치 병합 때
오케스트레이터가 충돌을 풀었다).

위험: 테스트 도우미만 바뀐다. 0929/06-04 단위 테스트의 기대값이 "ACTIVE
선택도 템플릿 값으로 덮어쓴다"에서 "ACTIVE 선택은 그대로 둔다"로 바뀐다.
검증: ACTIVE 선택과 해시 파일 추가 트리 모두 6 passed(에이전트).
병합 뒤 service-worker-build-output 단위 테스트 5/5, SW e2e chromium·webkit
12/12, tsc(test), eslint 통과.
2026-11-01 23:20:28 +09:00
donghyeon-kaandClaude Opus 5.5 51685503d0 test(bootstrap): pin the composition's telemetry wiring for a failed Service Worker start (06-05)
Only the optional host was tested, so removing the composition line that hands
it the telemetry port kept every test green. The real composition with an
ACTIVE selection and a failing first install now must emit one event, and the
recipe doc names what the template still leaves unwired.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 14:05:59 +09:00
DongHyeonkaandClaude Opus 5.5 cd47516592 fix(bootstrap): report a Service Worker that did not start through telemetry (06-05)
An ACTIVE worker whose install failed left a trace only in health(), which
nothing reads. The optional host now emits service-worker.start.failed on the
application telemetry port, and the recipe doc lists what else to wire.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 00:26:54 +09:00
DongHyeonkaandClaude Opus 5.5 8a0e5f55bb test(security): smoke the build under the production CSP (13-08)
The declared CSP was never applied in a browser. A Playwright spec now serves
the build with config/hosting/security-headers.json and fails on any
securitypolicyviolation. It found one: zod's Function('') probe, listed in the
spec as a known violation until zod is configured jitless before first use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 23:10:59 +09:00
donghyeon-ka 6c52cdb916 feat: 기능 추가 과정중 2026-07-30 15:58:20 +09:00
donghyeon-ka 6c73b845bd feat: add optional frontend adapter recipes 2026-07-26 17:57:04 +09:00