Commit Graph
3 Commits
Author SHA1 Message Date
DongHyeonkaandClaude Opus 5.5 70158d17c1 fix(auth): report only a server 401 to the session owner (R-3.2)
V3 returned the same UNAUTHENTICATED outcome for "no credential, nothing
sent" and for a server 401, and the composition root called
onUnauthenticated() for both. With the demo owner that overwrote a
recovery-pending session with "unauthenticated", and the demo setState
notified even when the value did not change, which fed the scope-fence loop.

- V3: the server-401 UNAUTHENTICATED outcome now carries its response
  `metadata` (additive optional field). The pre-dispatch one does not.
- runtime-adapters: onUnauthenticated() only when metadata is present.
- demo session: setState is a no-op for the current value.

RED before fix: reference-runtime-composition.test.ts "does not report a
request refused before dispatch as a sign-out" (state became
"unauthenticated"), auth-session-adapter.test.ts "does not notify when the
demo state is set to its current value" (1 notification),
http-execution-v3.test.ts "tells a missing credential apart from a server
401" (no metadata). Pinned: "still signs out when the server answers 401".
Gates: check:architecture, check:types:app, check:types:test, lint,
test:component, test:integration, test:reference-feature, test:contract
pass. test:unit passes except removal-fixture.test.ts (needs generated
artifacts/ release evidence absent in a fresh worktree; unrelated).

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