Commit Graph
22 Commits
Author SHA1 Message Date
DongHyeonka 37a850040d test(http): deadline 분류 시험이 대기 지점에서 가짜 시계로 deadline을 낸다
문제: 「times out at the <phase> wait when the deadline fires」가 실제
시계로 30ms deadline을 잡는다. 전송 실패(transport backoff)나 503
(retry backoff)을 처리하는 시점에 이미 30ms가 지났으면 실행기는
backoff할 시간이 없다고 보고 그 실패로 끝낸다(`remaining() > 0`이
거짓). 그래서 기대한 TIMEOUT 대신 NETWORK_FAILURE·503 결과가 나온다.
desktop 부하 31에서 한 번 떨어졌다(PR #19 W2-FE 기록 F).

고른 방법: deadline 경우만 가짜 시계(`vi.useFakeTimers`)로 돌고, 그
대기에 닿은 것을 확인한 뒤 30ms를 진행한다. 시험이 보려는 것(대기
중에 deadline이 나면 DEADLINE·TIMEOUT)을 그대로 보고 기계 속도에는
기대지 않는다. 두 backoff 단계는 답하기 전에 실제 시간 40ms를 멈춘다
(`Atomics.wait`). 실제 시계로 되돌리면 이 시험이 매번 실패한다.
- 버린 대안: deadline을 늘리기. 경쟁이 남고 규칙 밖이다.
- 버린 대안: `vi.waitFor`로 기다리기. 가짜 시계에서는 확인할 때마다
  시계를 진행해 대기에 닿기 전에 deadline이 날 수 있다.

위험·한계: 실행기 동작은 바꾸지 않았다. deadline이 이미 지난 뒤
도착한 전송 실패를 NETWORK_FAILURE로 보고하는 것이 맞는지는 이
커밋이 정하지 않는다.

검증(desktop): 시험 파일 72개 3회 연속 통과. 변이: 가짜 시계를 빼고
실제 30ms deadline에 같은 40ms 멈춤을 두면 transport backoff·retry
backoff 둘이 매번 실패(나머지 넷 통과). eslint·check:types rc=0.
로그 /tmp/claude-gates/w2fe2-http1·2/.
2026-11-12 22:26:17 +09:00
DongHyeonka c842bac0d5 test(http): 오래된 scope의 성공 응답을 버리는 마지막 검사를 고정한다
문제
§10.8의 마지막 검사(src/adapters/http/http-execution-v3.ts:1493-1499,
검증을 통과한 성공 응답이라도 scope가 이미 현재가 아니면 SCOPE_FENCED)
를 false로 바꿔도 네 라운드째 모든 테스트가 통과한다(변이 L01). 지금
scope fence 테스트는 scope signal도 abort해서, abort 경로가 먼저
답하고 이 검사까지 오지 않는다.

고른 방법과 버린 대안
- tests/unit/http-execution-v3.test.ts에 경우 둘(조회·명령)을 더한다.
  fetch 안에서 scope의 isCurrent만 false로 바꾸고 signal은 abort하지
  않는다. JSON 성공 경로에서 dispatch 뒤 scope를 보는 곳은 이 검사
  하나라서, 검사를 지우면 SUCCESS가 나와 테스트가 실패한다.
- 기대값: CONTRACT_VIOLATION/SCOPE_FENCED, 조회는 NOT_APPLICABLE,
  명령은 MAYBE_APPLIED(보냈으니 적용됐을 수 있다).
- 기존 abort 테스트를 바꾸는 안은 버렸다. 그 테스트는 abort가 먼저
  이기는 경로를 지킨다.

위험·한계
- 테스트만 더했다. 실행기 코드는 그대로다.

검증
- desktop batch에서 확인:
  node scripts/run-vitest.ts run tests/unit/http-execution-v3.test.ts
- 변이 L01(:1494 조건을 false로)을 넣으면 "discards a valid read/command
  success that arrives after its scope stopped being current" 2건이
  실패해야 한다.

Refs: 0929/10-04
2026-11-06 01:05:22 +09:00
DongHyeonka dae44f5cf4 test(http): interaction signal listener 정리도 고정한다
문제
실행기는 호출자·interaction·scope 세 signal에 abort listener를 달고
끝날 때 셋을 모두 지운다(src/adapters/http/http-execution-v3.ts:662-664).
listener 정리 테스트는 호출자와 scope signal만 감시해서, interaction
signal 쪽 제거 줄(:663)을 지운 변이 R2b가 107파일 995개를 모두
통과했다. 한 interaction 안에서 요청을 여러 번 보내면 요청마다
listener 하나(lifetime controller를 잡은 closure)가 interaction
마감까지 남는다.

고른 방법과 버린 대안
- 같은 테스트(tests/unit/http-execution-v3.test.ts)에
  createExecutionContext로 만든 interaction을 넘기고, 그
  cancellation.signal도 감시 목록에 넣는다.
- 끝나는 경우에 "interaction cancel"을 더한다. interaction 취소는
  호출자 abort와 같은 forwarder를 타지만 listener를 단 signal이 달라서
  따로 본다.
- 별도 테스트를 새로 만드는 안은 버렸다. 세 signal은 같은 정리 함수가
  지우므로 한 테스트에서 함께 보는 편이 규칙과 맞다.

위험·한계
- 테스트만 바꿨다. 실행기 코드는 그대로다. 실제 누수량은 재지 않는다.

검증
- desktop batch에서 확인:
  node scripts/run-vitest.ts run tests/unit/http-execution-v3.test.ts
- 변이 R2b(:663 제거)를 넣으면 세 경우 모두 "removes the listeners it
  added to the caller, interaction and scope signals after …"가
  실패해야 한다.

Refs: 1105/10-02
2026-11-05 21:58:39 +09:00
DongHyeonka a6b85e878c test(http): MAX_RETRY_ATTEMPTS 전달과 signal listener 정리를 고정한다
문제
V2를 지울 때(048f490) 같이 지운 테스트 둘이 V3 동작도 지키고 있었다.
- 운영 설정 MAX_RETRY_ATTEMPTS가 실행기에 닿는지. V3는
  runtime-adapters.ts에서 넘긴다. 값을 상수 2로 바꾼 변이 H53이 15파일
  143건을 통과했다. 장애 때 재시도를 끄는 손잡이가 조용히 사라질 수 있다
  (REQUEST_TIMEOUT_MS는 실제로 한 번 그렇게 버려졌다).
- 호출자·scope signal에 단 abort listener를 지우는지. 호출자 쪽 제거를 지운
  H56은 머지 게이트 테스트를 모두 통과했고, scope 쪽(H57)은 nightly
  tier의 long-session 테스트 하나만 잡았다.

고른 방법
- tests/features/reference-feature/reference-runtime-composition.test.ts:
  실제 createRuntimeAdapters에 MAX_RETRY_ATTEMPTS 0·1을 주고, 재시도
  예산 2인 참조 목록 조회가 503에 1회·2회 나가는지 센다(Math.random 0으로
  backoff 대기 없음). 설치된 기능의 HTTP가 있어야 조립 루트 경로를 탈 수
  있어 참조 기능 테스트에 두었다. test:reference-feature는 머지 게이트다.
- tests/unit/http-execution-v3.test.ts: 응답으로 끝날 때와 호출자 abort로
  끝날 때, 호출자·scope signal에 더한 abort listener가 같은 함수로 모두
  지워지는지 센다.

위험·한계
- ①은 참조 기능에 기댄다. 샘플을 지운 제품에서는 이 테스트도 같이
  빠진다. 조립 루트를 기능 없이 부를 수단이 없어서다.
- 10-04 ③(realtime snapshot의 GET 조건)은 다른 작업 몫이다.

검증
- 변이 H53·H56·H57을 하나씩 넣으면 새 테스트가 실패하고, 되돌리면 통과한다.
- 두 파일 76건 통과. check:types:test, eslint 통과.

Refs: docs/reviews/2026-11-03-maturity-review/10-tests-fast-layers.md 10-04
2026-11-04 20:57:17 +09:00
DongHyeonkaandClaude Opus 5.5 f0a6495989 fix(http): never let request id generation block a V3 request (03-03)
crypto.randomUUID exists only in secure contexts. If it throws, the request
now goes out without x-correlation-id instead of ending as a runtime failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:56:22 +09:00
DongHyeonkaandClaude Opus 5.5 e62b020ad6 test(http): cover KEYED retries with budget left through the V3 executor (10-03)
Every KEYED fixture had retryBudget 0, so passing "SAFE" instead of the
contract's retry semantics (M1b) survived. Two executor tests now pin that a
KEYED send retries only before dispatch, with the same key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:41:36 +09:00
DongHyeonkaandClaude Opus 5.5 c5da3cf001 fix(http): send a request id and carry the server correlation id to failures (03-03)
V3 read the response x-correlation-id and dropped it, and untraced requests
sent no id, so a support reference could not be matched to a server log.
Each logical execution now sends one x-correlation-id; failures carry the
echoed value as requestId and diagnostics record it as correlation_id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:27:42 +09:00
DongHyeonkaandClaude Opus 5.5 2afee67150 fix(http): let the package classify command 401/403/429 and keep re-login first (03-02)
These statuses skipped the package classifier and always became
MAYBE_APPLIED, so an expired session ended in "contact support" or the
unknown-result screen. The descriptor gains optional classifyStatus, the
reference create declares NOT_APPLIED, and AUTH_REQUIRED keeps reauth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:16:25 +09:00
DongHyeonkaandClaude Opus 5.5 c7052ef09a fix(http): join a retried command's effect and never replay MAYBE_APPLIED (Q-6.3-7)
A retried command reported only its last attempt's effect. An IDEMPOTENT
command whose first attempt was lost (network error or 429) and whose
retry got a NOT_APPLIED problem ended as "not applied, retry", although
the first attempt may have applied. A 5xx with an HTML or empty body is
MAYBE_APPLIED for a command, yet the executor still replayed it.

The executor now records what each retried attempt settled on and joins
it into the final outcome's effect. An admission whose own certainty is
MAYBE_APPLIED (or APPLIED_CONFIRMED) is not retried; a 429 still is,
because its admission reason is RATE_LIMITED rather than an effect
verdict. The logical accumulator is not reused because it is raised at
dispatch and cannot tell a rejected attempt from a lost one.

Verified: three new tests (lost response then 400, 429 then 400, 504
empty body) failed RED with NOT_APPLIED / a second attempt and now pass.
All lane gates pass except the known removal-fixture test; two component
tests timed out once under load and passed on rerun.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:41:45 +09:00
DongHyeonkaandClaude Opus 5.5 4c7737361a fix(http): classify every terminal wait through terminalOutcomeFor (Q-6.3-6)
The executor decided the terminal outcome of an ended wait in six places
(credentials, lease, dispatch, transport backoff, admission, retry
backoff). The two backoff copies only checked the caller, so a scope
fence during a retry sleep ended as TRANSPORT_FAILURE{TIMEOUT} and the
user saw "timed out, retry" after logging out.

All six sites now call one terminalOutcomeFor(phase) helper: the caller
cancels, the deadline times out, a scope fence during a wait is
ABORTED_BY_SCOPE and during admission stays the SCOPE_FENCED violation.

Verified: a new owner x phase table in http-execution-v3.test.ts pins
the 16 existing combinations and failed RED only for the two backoff
scope-fence cases (TIMEOUT instead of ABORTED_BY_SCOPE). All lane gates
pass except the known removal-fixture test (missing artifacts/).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 13:41:45 +09:00
DongHyeonkaandClaude Opus 5.5 861edd4fe5 fix(http): keep status of a 5xx without a usable problem body (R-3.3)
A gateway 502/503/504 (or 408/425) with an HTML, empty or broken body
ended as CONTRACT_VIOLATION without response metadata, so httpStatus and
http_status_group were lost, and the feature binding turned it into a
non-retryable "contact support" failure. Request-side violations
(FINAL_REQUEST_INVARIANT_FAILED, MISSING/UNEXPECTED_IDEMPOTENCY_KEY) fell
through to ENVELOPE_MISMATCH, a server-response error.

- V3: violations raised while admitting an error-status response now carry
  the response `metadata` (additive optional field on CONTRACT_VIOLATION).
  The observation status reads `metadata` from any outcome that has it, so
  telemetry keeps http_status_group (this also gives a server 401 "4xx").
- Binding: a violation whose status is 5xx/408/425 becomes SERVER_FAILURE
  with httpStatus (retryable, action "retry" unless the effect is uncertain).
  Other violations keep their kind and now include httpStatus when known.
  Request-side violations map to VALIDATION_REJECTED.

RED before fix: http-execution-v3.test.ts "ends a 502/503/504/408 response
as a retryable server failure with its status" (observation status
undefined, binding kind CONTENT_TYPE_MISMATCH/SCHEMA_MISMATCH/...),
feature-http-binding.test.ts "does not report the request-side violation
... as a server envelope mismatch" (got ENVELOPE_MISMATCH).
Gates: check:architecture, check:types:app, check:types:test, lint,
test:component, test:integration, test:contract, test:platform,
test:reference-feature pass (reference-page "mounts list and detail keys"
timed out once under load avg ~50 and passed on rerun). 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 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 dfb7734674 fix: run the provider sandbox and admit a release to a named environment
The provider sandbox never ran. bubblewrap 0.9.0 stops parsing an `--args`
file at the first non-option and never hands the remainder back, so the
command written into that file was silently dropped: bwrap printed its usage
text, exited 1, and the provider produced no evidence at all. The options
still travel in the args file — that is what keeps host paths and credentials
out of `/proc/<pid>/cmdline` — but the command now rides on real argv, and
`encodeProviderBwrapInput` refuses a `--` so the drop cannot come back.

The scope wrapper then could not exit. It read the supervisor's liveness pipe
through `fs`, which runs a blocking `read(2)` on a threadpool thread; the
supervisor holds that pipe open for the scope's whole life, so the read never
returned and closing the descriptor did not interrupt it. Once bubblewrap
finished the wrapper deadlocked in `process.exit`, the scope outlived the
provider, and a completed run was reported as a timeout kill. The channel is
now read through the event loop, so teardown is observable and terminal.

Creation modes were left to the ambient umask. `mkdir(mode)` and `open(mode)`
are requests the kernel subtracts the umask from, so a runner exporting a
restrictive umask produced directories it could not enter and handed `tar` a
file it could not re-open. Private modes are pinned instead of inherited.

Promotion cleanup deleted before it checked. Removals run through a pinned
descriptor, so a leaf substituted after validation had this promotion's exact
five destroyed first and the substitution reported afterwards, leaving a
half-emptied directory a retry could not tell from a completed one. The name
is re-bound to the inode before anything is removed, so the failure is total.

Separately, release coherence proved the artifacts agreed with each other but
never that they belonged where they were going: a build whose runtime document
said `APP_ENV: local`, `AUTH_MODE: demo` and a loopback API is coherent with
itself and passed every gate. `public/` is copied verbatim into `dist/`, so
that local document shipped with every build regardless of what the build was
for. Runtime configuration now comes from a declared profile, and FE-GATE-027
refuses to admit an artifact to an environment it does not match — including
refusing an undeclared destination, so nothing is admitted by omission.

`REQUEST_TIMEOUT_MS` and `VITE_ROUTER_BASE_PATH` were validated and then
dropped: the V3 executor ran every operation on its contract's own deadline,
and Vite emitted root-absolute assets for a sub-path deployment. The timeout is
now a ceiling that may tighten a contract but never loosen one, and one base
path feeds the router, the Service Worker scope and the asset base together.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 16:38:19 +09:00
DongHyeonkaandClaude Opus 5 df18349682 fix: validate the snapshot that installs, not the object that was shown
Three trust boundaries checked a caller's object and then read it again to
use it. Between those two reads an accessor or a Proxy can answer
differently, so the value that passed validation and the value that was
installed were not the same value.

A credential owner's answer was read field by field outside the auth
boundary: a throwing `kind` getter escaped into the transport catch and an
auth outage reached operators as `NETWORK_FAILURE`. Contract composition
validated a contribution and then copied it, so a policy that answered
10,000 to the ceiling check and 999,999 to the copy installed the second
value. The cursor runtime validated its profile once and re-read it on
every page, so raising `maxPages` after construction widened a cap that
had already been checked.

`src/contracts/exact-snapshot.ts` is the one descriptor-based decoder they
now share: every property is read exactly once, an accessor, a symbol, an
inherited or non-enumerable field and a throwing trap all resolve to a
typed failure, and validation runs on the owned copy.

Separately, the `responseBody: NONE` probe awaited a bare `read()`. The
deadline produced a bounded public result while the raw reader kept its
lease, so the body stayed locked and the outer compensator could not
cancel it. The probe now takes the operation lifetime and owns the cancel
and the lock release itself.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 01:25:12 +09:00
DongHyeonkaandClaude Opus 5 e06e4377ca fix: preserve command effect certainty across retries
Separate per-attempt physical state from the logical execution history. The
executor now keeps one monotonic certainty accumulator joined through
joinMutationEffectCertainty, records MAYBE_APPLIED at dispatch, and reads the
accumulator from every retry-loop fence, final-invariant, cancellation and
timeout return.

A retry-time scope fence landing between the loop-entry check and the
pre-dispatch invariant can no longer downgrade an already dispatched command to
NOT_STARTED.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 23:01:48 +09:00
DongHyeonkaandClaude Opus 5 67cc5b6d2c fix: restore V3 HTTP observability
Project one typed HttpExecutionObservation per logical V3 execution through a
closed composition-root projector: only registered diagnostic context keys and
bucketed values reach the sinks, and terminal non-abort failures now emit
exactly one api.request.failed telemetry event. Caller cancellation and scope
fencing record a diagnostic but never a failure event.

routeId becomes a required input at the installed operation-executor boundary
so the feature gateway's low-cardinality route identity survives to the sink.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 22:42:51 +09:00
DongHyeonka abdd90ad5d test: execute the HTTP scenario catalog 2026-08-02 11:17:28 +09:00
DongHyeonka 15645541b7 fix: reject credential idempotency headers 2026-08-02 01:33:07 +09:00
DongHyeonka fa2f699125 fix: reject invalid keyed mutation intents 2026-08-02 01:21:50 +09:00
DongHyeonka cbcc7b5ed7 fix: preserve logical mutation intent 2026-08-02 01:07:19 +09:00
DongHyeonka 0eb23875cb fix: harden invalidation registry governance 2026-08-01 23:59:11 +09:00
DongHyeonka c6da03369c refactor: 리펙토링 2026-08-01 19:39:59 +09:00