Commit Graph
10 Commits
Author SHA1 Message Date
DongHyeonka de48db25d9 fix(router): context·feature 경계와 라우트 모듈 실패를 진단에 남긴다 (09-09)
문제: context gateway의 `ContextErrorBoundary`·`FeatureErrorBoundary`는
`onError`를 받지 않아 잡은 실패를 진단에 남기지 않고, 화면 지원 참조는
buildId뿐이다. 라우트 모듈이 청크 누락이 아닌 이유로 실패할 때(평가 중
throw, 15-01 뒤로는 기능 실행부 적재 실패)도 같은 화면만 그리고 기록이
없다. 안쪽 경계(`RenderErrorBoundary`) 밖에서 난 실패, 예를 들어 핸들의
route id가 레지스트리에 없거나 핸들에 라우트 codec이 없을 때는 사용자
신고로도 사건을 찾을 수 없다. 0929/08-05와 같은 결함이다.

고른 방법:
- `ScopedErrorBoundary`가 잡을 때 incident id를 만들어 `onError` 보고에
  넣고, 함수형 fallback에 같은 id를 넘긴다. 둘 다 추가 변경이다(기존
  ReactNode fallback과 `{scope, ownerId}`를 읽는 쪽은 그대로 동작).
- incident id 생성기를 `src/platform/errors/incident-id.ts`로 옮겨 두
  경계 계열이 같은 함수를 쓴다(platform은 presentation을 import할 수 없다).
- gateway가 두 경계에 `reportRenderFailure` 호출과
  `<buildId>:<incidentId>` 지원 참조를 넘긴다. context 경계는
  `component_boundary`를 "route"로 보고한다. 진단·텔레메트리 계약에
  context 값이 없고, 같은 gateway의 청크 복구 보고도 "route"를 쓴다.
- 비청크 적재 실패는 context 경계 안에서 다시 throw해 같은 보고 경로를
  탄다. route id는 URL의 등록 라우트, 없으면 context id다.

버린 대안:
- 세 곳을 presentation `RouteBoundary`로 바꾸기(0929/08-05 제안): 경계
  두 계열 통합(리팩토링 R4) 성격이고 context/feature 소유 범위 표시
  (`data-boundary`, testid)가 바뀐다.
- gateway가 URL마다 incident id를 하나 만들어 두 경계에 나눠 주기:
  두 경계가 같은 id를 공유해 사건 구분이 흐려진다.
- `component_boundary`에 "context" 추가: 진단·텔레메트리 계약과
  레지스트리 기준선을 바꾸는 일이라 이번 범위 밖이다.

위험·한계:
- `APP_SHELL`의 `errorElement`(0929/08-05가 함께 적은 곳)는 그대로
  buildId만 보이고 보고하지 않는다. React Router 오류 요소라 다른 방식
  (useRouteError + 마운트 시 보고)이 필요해 남겼다.
- 실패한 context 안에서 URL을 바꾸면 경계가 리셋되고 다시 throw해 방문마다
  한 번 보고한다.
- 화면 변화: context·feature 경계 실패 화면과 비청크 적재 실패 화면의
  지원 참조가 `build:incident` 형식이 된다. 시각 골든에는 없는 화면이다.
- 초기 JS +58 B gzip(202,748 → 202,806 B, 여유 1,994 B).

검증:
- RED: tests/component/context-boundary-diagnostics.test.tsx 3건(context
  경계: 미등록 핸들 id, feature 경계: codec 없는 핸들, 비청크 적재 실패)이
  모두 `Unable to find an element with the text: /^지원 참조:
  build-a:[0-9a-f]{8}$/`로 실패. 화면은 "지원 참조: build-a"였다.
- GREEN: 3건 통과. failure-boundary.test.tsx에 함수형 fallback이 보고한
  incident id를 받는지 1건 추가, `onError` 보고 기대값에 incidentId 추가.
- 회귀: tests/{architecture,platform,component,features,scripts,contract}
  95 files / 592 tests, tests/unit(pnpm을 띄우는 5개 제외) 164 files /
  1,929 tests 통과. tsc app·test 통과. 바꾼 파일 eslint 통과.
  check-architecture(shim), check-adapter-inventory, check-diagnostics,
  check-registries 통과.
2026-11-01 22:56:29 +09:00
DongHyeonka 582630062b test(scale): 극한 규모 테스트가 CPU와 무관한 비교만 단언한다 (0929/10-01)
문제
extreme-scale-registry.test.ts는 머지 게이트(FE-GATE-005 coverage, pr
scale tier)에서 돈다. 그런데 절대 시간 예산(100만 조회 1,500ms, 100k
조합·멤버십 3,000ms)을 단언한다. 1코어에서는 코드와 무관하게 떨어진다
(수정 전 9회 중 5회, 1,509~1,826ms). run-scale-profile.ts와
ungated-tests.json은 pr tier를 "CPU와 무관하다"고 설명하는데 이 파일만
어긋났다. 같은 이유로 진짜 회귀를 잡는지도 기계 속도에 달려 있었다.

고른 방법
- 조합: 이미 있던 10k -> 100k 증가 비율(30 미만)만 남긴다.
- 조회: 같은 100k 키로 만든 일반 객체 조회와 비교해 3배 미만인지 본다.
  조회 횟수는 1,000,000 -> 200,000(양쪽 합 400,000).
- 멤버십: 10k와 100k 선택·해석 비용을 repo의 assertLinearOrBetter(지수
  1.5 이하)로 본다.
- 측정: 비교하는 두 쪽을 번갈아 재고, 10k 쪽은 10번 반복해 일의 양을
  맞추고, 각자 가장 빠른 회차를 쓴다. 공유 코어에서 10ms 측정은 한
  scheduler slice 안에 끝나고 100ms 측정은 다른 프로세스 뒤에서 기다려
  성장이 실제보다 가팔라 보인다(일의 양을 맞추기 전 조합 비율 61 관측).
  가장 빠른 회차는 check:scale:baseline이 성장을 minMs로 읽는 것과 같다.
절대 시간은 기준 CPU에서만 비교하는 check:scale:baseline 몫으로 둔다.

버린 대안
- 예산을 올리기: 더 느린 러너에서 같은 문제가 다시 생긴다.
- 절대 예산을 nightly 전용 파일로 떼기: tier 설정·ungated 목록·문서를
  함께 고쳐야 하고, 머지 게이트 쪽에는 결국 이번 비교가 필요하다.
- 조회를 10k/100k 성장으로 보기: 감싸기(proxy)처럼 크기와 무관한 느려짐을
  못 잡는다. 선형 탐색은 어느 쪽이든 시간 초과로 드러난다.

위험·한계
- 비교도 실제 시계로 잰다. 바쁜 이웃 3개를 둔 1코어에서 관측한 최댓값은
  조합 비율 17(한도 30), 조회 비율 1.04(한도 3), 멤버십 지수 1.21(한도
  1.5)이다. 여유는 한도의 약 1.2~3배다.
- 크기와 무관한 작은 상수 배 느려짐(get trap이 있는 proxy 정도)은 조회
  비교가 잡지 못한다. 수정 전 절대 예산도 이 기계에서 잡지 못했다.

검증
- RED(수정 전, taskset -c 0): 대상 파일만 3회 중 1회, component·features·
  integration·platform/cardinality 3회 중 1회, 바쁜 이웃 1개를 더하면
  3회 중 3회 "expected 1509.6… to be less than 1500"
  (extreme-scale-registry.test.ts:78).
- 변이(기본 코어): 조합에 100번째마다 Object.keys -> "expected 145.5 to be
  less than 30". 조회에 20회 hasOwn get trap -> "expected 14.46 to be less
  than 3". 해석을 includes로 -> "super-linear growth: exponent 1.98".
- GREEN(taskset -c 0 + 같은 코어의 바쁜 이웃, --maxWorkers=4): 대상 6개
  파일 6회, component·features·integration·platform/cardinality 5회 모두
  통과. 이 파일만 바쁜 이웃 3개 옆에서 6회, coverage를 켜고 3회 통과.
- 실행 시간: 기본 코어에서 파일 1.76s -> 1.37s.
- 기본 코어: tests/features·platform·architecture·contract·runtime-schema
  60파일 403개 통과. tsc -p tsconfig.test.json, eslint 통과.

Refs: docs/reviews/2026-09-29-maturity-review/10-tests-fast-layers.md
2026-11-01 21:23:10 +09:00
DongHyeonkaandClaude Opus 5.5 20b68789a1 test(platform): expect a request id on untraced executions (03-03)
This test pinned the old behaviour where an untraced request sent no
x-correlation-id. 03-03 makes every logical execution send one; the test
still checks that no traceparent is added without opting in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:42:31 +09:00
DongHyeonkaandClaude Opus 5.5 991da882e2 test(platform): run platform tests on a test-only feature, not the sample (14-01)
Six platform tests imported or named the removable reference feature, so
FE-GATE-020 failed on typecheck, unit, coverage, home smoke and residue.
Router surfaces now install tests/helpers/fixture-feature.tsx by mocking
the generated indexes; the rest use neutral names or read the installed
modules. test:sample-removal passes 13/13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 21:18:39 +09:00
DongHyeonkaandClaude Opus 5.5 b2f37f05b0 fix(telemetry): evict buffered events only when that makes room (Q-6.9-11)
The buffer evicted lower-severity events one by one and only then found
the incoming event still did not fit, so both were lost (maxBytes 300,
info 50 + error 240, incoming warning 100: info evicted, warning
dropped). It now plans the evictions first (severity no higher than the
incoming one, lowest first, oldest first within a severity) and evicts
only if the plan frees enough room. The header comment now matches the
code: an event of the same severity is evicted, not only a lower one.

Verified: tests/platform/telemetry/telemetry-buffer.test.ts — the
review scenario RED before (info evicted), green after; same-severity
oldest-first eviction pinned. All gates PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:58:35 +09:00
DongHyeonkaandClaude Opus 5.5 911561985b fix(platform): let an interaction detach from its owner signal on completion (Q-6.9-7)
createExecutionContext forwarded an owner signal's abort and removed
that listener only when the interaction itself aborted. An interaction
that finished normally under a long-lived owner signal left its listener
and AbortController on the owner. ExecutionContext gains complete():
idempotent, detaches from the owner without aborting the interaction.
No caller passes an owner signal today, so this closes a latent leak.

Verified: new test in tests/platform/execution/execution-context.test.ts
(RED before: complete is not a function); all gates pass except the
known tests/unit/removal-fixture.test.ts (artifacts/ absent).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:58:35 +09:00
DongHyeonkaandClaude Opus 5.5 4e0745c569 fix(telemetry): redact credentials anywhere in a string, URL secrets and emails (R-9.3)
The value check was anchored with ^, so "request failed: Authorization:
Bearer abc" passed through, as did ?access_token=... in a URL and email
addresses. The key deny-list also missed pwd/pass/auth/otp/pin.

Changes in src/platform/telemetry/redact-telemetry.ts:
- Bearer/Basic credentials and JWTs are masked wherever they occur; only
  the match is replaced with [redacted], the rest of the message stays.
  A JWT cut short still matches.
- URL query/fragment parameters (?, &, #) are masked when the name is a
  secret key (isSecretTelemetryKey) or one of the URL-only names code,
  key, sig. Non-secret parameters (limit, cursor, state) are kept.
- Email addresses are masked, including one cut in half by truncation.
- Keys: pwd, pass, auth, otp, pin match as whole key tokens (camelCase,
  snake, kebab, PINCode split), so spinner/author/compass/isPinned are
  kept; passcode and passphrase are added as fragments.
- Strings are truncated before the patterns run, so the scan is bounded
  by maxStringLength. No regex lookbehind (Vite's default target includes
  Safari 16.0).
Public exports and signatures are unchanged.

Pinned first (passed before and after): "keeps legitimate telemetry values
and innocent keys untouched" (enum codes, ULID/UUID/hex ids, route ids,
numbers, booleans, BASIC_PLAN, react@19.1.0, a URL without secrets,
code=... in prose, keys spinner/author/code/key).

RED before fix:
- "redacts the short secret key %s as a whole key token" (11 cases, key
  kept)
- "redacts credentials in the middle of a string" (values unchanged)
- "masks secret URL query and fragment parameters" (tokens kept)
- "masks email addresses" (email kept)
- "does not leak a secret cut in half by truncation" (partial secrets kept)

Gates: check:architecture, check:types:app, check:types:test, lint,
test:component, check:release-coherence, test:platform pass. test:unit
passes except tests/unit/removal-fixture.test.ts, which needs generated
release evidence under artifacts/ that a fresh worktree does not have
(unrelated to this change).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:18:23 +09:00
DongHyeonkaandClaude Opus 5.5 6f2e97d482 fix(telemetry): deliver deduplicated occurrences to the collector (R-9.2)
With the default queueMicrotask scheduler the first event of a burst was
sent at once with occurrences=1, and every duplicate inside the 60s dedup
window only bumped counters.deduplicated, so 1000 identical errors reached
the collector as occurrences=1. An event dropped from the buffer also left
its fingerprint in the dedup table, suppressing that event for 60s.

Per D-6 the pipeline now holds duplicate counts per fingerprint. Held
counts are folded into a buffered item of the same fingerprint or ride as
summary items in the next batch; they get a batch of their own only on an
explicit flush() or when the dedup window closes (one window timer), so a
duplicate never triggers a send by itself. The held table is bounded by
maxFingerprints. A rejected or evicted event (new buffer onEvict hook) and
a sampled-out event forget their fingerprint (new
TelemetryDeduplicator.forget), so the next occurrence is admitted again
and a sampled-out event is never reported through a summary. Existing
signatures are unchanged; onEvict and forget are additive.

Test changes:
- tests/features/reference-feature/reference-telemetry.test.ts expected
  exactly one send for a 500-failure storm, which encoded the lost count;
  it now expects 2 sends whose occurrences sum to 500.
- telemetry-pipeline.test.ts:93 (auto flush off, 25 in one item) is kept
  as is and still passes.

RED before fix:
- "delivers every duplicate as occurrences with the default microtask
  scheduler" (sum was 1, expected 1000)
- "reports held duplicates when the dedup window closes without another
  flush" (no window timer armed)
- "does not let a rejected or evicted event suppress its fingerprint"
  (re-emitted event was deduplicated, not buffered)
- "never reports a sampled-out event through a duplicate summary"
  (sampledOut 1, expected 3)

Gates: check:architecture, check:types:app, check:types:test, lint,
test:component, check:release-coherence, test:platform pass; also
tests/scale/telemetry, tests/scale/session, tests/features/reference-feature
pass. test:unit passes except tests/unit/removal-fixture.test.ts, which
needs generated release evidence under artifacts/ that a fresh worktree
does not have (unrelated to this change).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:18:23 +09:00
DongHyeonkaandClaude Opus 5.5 0983742b6b fix(release): allow one boot reload per session regardless of mismatch key (R-9.1)
The reload-once marker only blocked a repeat of the same mismatch key. The
key is buildId:code:releaseId, so a load balancer alternating R10/R11
replicas produced a new key on every boot and each one reloaded again
(A->B->A->... looped). decide() now returns show-failure whenever a marker
younger than the TTL exists, whatever its key. markCoherentBoot() still
clears the marker and an expired marker still allows recovery.

The platform test "keeps a single bounded marker and scopes it to the
mismatch key" encoded the bug (R10->R11 then R11->R12 both reload-once);
it is rewritten to check only the bounded marker, and the key-independent
rule gets its own tests.

RED before fix:
- "allows one automatic reload per session within the TTL whatever the key"
  (A->B returned reload-once)
- "cannot loop when a load balancer alternates the mismatch key"
  (20 of 20 alternating boots reloaded)
- mixed-replica "cannot reload-loop when replicas alternate between two
  different mismatches" (runBootSession threw "reload loop")

Gates: check:architecture, check:types:app, check:types:test, lint,
test:component, check:release-coherence, test:platform pass. test:unit
passes except tests/unit/removal-fixture.test.ts, which needs generated
release evidence under artifacts/ that a fresh worktree does not have
(unrelated to this change).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:18:23 +09:00
donghyeon-ka 6f6c48ebb7 refactor: 도메인이 100개 1000개씩 늘어나도 유지보수 쉬운 구조로 변경 2026-09-24 00:42:21 +09:00