- client: the final V2 classification step maps a 408/425 response with a
valid error envelope to SERVER_FAILURE (via gatewayFailureOr), keeping
the backend code and request/trace ids. contracts/errors.ts is unchanged.
- client: Retry-After is also parsed (kernel parser) on 503, so the retry
waits at least that long and the 30s ceiling applies. 502/504 keep the
local backoff.
RED (before the fix, 14 failing in tests/integration/http-client.test.ts):
- safe GET on a 408/425 error envelope: kind UNKNOWN_CLIENT_FAILURE,
fetched once (expected SERVER_FAILURE, 3 fetches, code UPSTREAM_BUSY)
- none/keyed command on a 408/425 error envelope: kind
UNKNOWN_CLIENT_FAILURE; keyed fetched once instead of 3 times
- 408/425 error envelope with Retry-After: 2: not retried
- 503 (gateway body and envelope) with Retry-After: 2: slept 125ms
instead of 2000ms
- 408/425 envelope and 503 with Retry-After: 31: retryAfterMs missing
Pins that passed before and after: a non-idempotent command is sent once
on 408/425/503 gateway bodies and on a 503 envelope; 502/504 ignore
Retry-After (125ms).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- retry-policy: a SERVER_FAILURE with status 408/425 follows the
502/503/504 rule (safe or keyed only; never idempotency "none" or
retry "never"). Retry-After is honored and its 30s ceiling applies to
any failure that carries it, not only RATE_LIMITED.
- client: Retry-After is parsed by platform/retry-after.ts for
408/425/429, on every failure path (gateway bodies included).
The local parseRetryAfterHeader is removed.
RED (before the fix, 15 failing):
- 408/425 gateway body on a safe GET: expected 3 fetches, got 1
- keyed command on 408/425: expected 3 fetches, got 1
- 408/425 with Retry-After: 2: expected ok after a 2000ms wait, got the
first failure
- 408/425 with Retry-After: 31: retryAfterMs missing on the failure
- 429 Retry-After "1.5": slept 1500ms instead of the 125ms backoff;
"Thursday, 01-Jan-70 00:00:05 GMT": slept 5000ms; "1e3", "0x10",
"-1", "2099-01-01T00:00:00Z": accepted by the old parser, so the
request was not retried with the 125ms backoff
- unit shouldRetry(safe, SERVER_FAILURE 408): false
Non-idempotent command on 408/425 stays 1 fetch (pinned, passed before
and after).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
V2 checked the content type and decoded the body before looking at the
status. An nginx 502 with an HTML page became CONTENT_TYPE_MISMATCH and
an empty or broken 503/504 JSON body became MALFORMED_JSON: both
non-retryable and shown as a contract breach. For a 5xx/408/425 status
these branches, and the invalid-envelope branch, now return
SERVER_FAILURE with the httpStatus, the same R-3.3 rule V3 uses.
Retry follows V2's existing SERVER_FAILURE rule in retry-policy.ts, so
502/503/504 retry and 408/425/500 do not; SERVER_FAILURE was already in
retryKinds, so retry-policy.ts is unchanged.
The existing "non-JSON response" test used a 502 and pinned the old
CONTENT_TYPE_MISMATCH classification; it now uses a 200, which still
covers the non-JSON rejection and body redaction.
Verified: four new http-client cases (502 HTML, 503 empty JSON, 504
broken JSON, 408 text) failed RED with CONTENT_TYPE_MISMATCH /
MALFORMED_JSON and now pass with the expected fetch counts. All lane
gates pass except the known removal-fixture test; test:reference-feature
timed out once under load and passed on rerun.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The V2 client only attempted 401 session recovery while the physical
attempt count was under maxRetryAttempts + 1. With MAX_RETRY_ATTEMPTS=0,
or when a 503 retry had already used the budget, a recoverable 401 went
straight to onUnauthenticated() and logged the user out. Recovery is
already bounded to one replay by recoveryUsed and by the deadline, so
the budget check is removed.
The comments in runtime-adapters.ts and adapters/http/index.ts said V2
works as a rollback path for V3 once its four slots are injected. That
is wrong: V2 validates the {success,data,meta} envelope and V3 the bare
DTO, so the same backend fails every V2 response with
ENVELOPE_MISMATCH. The comments and the client.ts ledger row in
docs/reviews/adapters/01-network-and-state.md now say a rollback also
needs a V2-envelope server. No docs/architecture page made the claim.
V2 code is kept.
Verified: two new auth-recovery cases (retries disabled; 503 then 401)
failed RED with ok:false and now recover. All lane gates pass except
the known removal-fixture test; verify:documentation passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shared credential admission (V2 and V3) only rejected CR/LF. A token
with NUL, a non-Latin-1 character or another control character passed,
then Fetch rejected it after V3 had marked the attempt dispatched: a query
burned its retry budget and a command ended MAYBE_APPLIED with
NETWORK_FAILURE. The external session adapter also merged header names
that differ only in case, silently keeping the last value.
- admitCredentialHeaders: the value must match [\x20-\x7E\xA0-\xFF]+ (a
ByteString without C0/C1 controls); the size limit is now the string
length, which is the wire byte count for a ByteString. Failure stays
CREDENTIAL_HEADER_VALUE_INVALID, i.e. AUTH_INTEGRATION_FAILURE before
dispatch.
- checkFinalInvariants: builds `new Headers(headers)` first; any value
Fetch would reject fails as HEADER_VALUE_INVALID (new additive member of
FinalInvariantFailure) with zero fetch calls.
- validateCredentialPatch: rejects case-only duplicate header names.
RED before fix: http-execution-v3-live-authority.test.ts "rejects a NUL /
non-Latin-1 credential value before dispatch" (got TRANSPORT_FAILURE, fetch
called), http-contract-bridge.test.ts "rejects a NUL/non-Latin-1/tab/DEL/C1
control value ..." and "fails before dispatch when Fetch would reject a
header value", auth-session-adapter.test.ts "rejects credential headers
that differ only in case instead of merging them". Pinned: "admits an
ordinary bearer token", CR/LF rejection, existing "Bearer ok"/"Bearer
token" integration paths.
Gates: check:architecture, check:types:app, check:types:test, lint,
test:component, test:integration, test:contract, test:platform,
test:reference-feature 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>
FE-GATE-020 proves a capability can be removed by rebuilding the whole project
without it. The fixture it built could not get that far, and the failures all
came from the fixture rather than from anything about removability.
It was not a repository. The supply-chain inventory is defined as the tracked
file set, so it asks `git ls-files` what the project contains; with no
repository to ask, generation failed and took every provider suite down with
it. It is now initialised on preparation and committed after the removal — not
before, or the index would still list the files the removal deleted.
It had no `.gitignore`, so once it did have a repository, every generated
artifact and every linked module landed in the index and the inventory refused
the fixture for tracked and generated paths colliding. It carries the ignore
rules now, and therefore records the same tracked set as the repository it was
copied from.
Each removal script kept its own copy-target list and they had drifted: the
reference-feature fixture omitted `playwright.capabilities.config.ts`, which the
inventory requires. There is one list now. It also gained the install and
workspace identity — `.npmrc`, the lockfile, the workspace file — without which
the fixture is a different project, and the release evidence a candidate is
assembled from, without which no candidate can be built at all.
A tracked root the removal deletes is no longer required of the result: the
optional-recipe fixture deletes `recipes/`, and the inventory policy demanded
it back. Roots that are gone are pruned from the fixture's policy.
Two smaller causes. A platform integration file asserted the reference feature's
own route ids, so removing the feature left it importing a deleted module —
typecheck, the test run, coverage and the residue scan all failed on that one
misplaced assertion, which now lives in the feature's test tree. And the
canonical exact-count authority was re-imposed on a contract the fixture
deliberately reduces, failing the fixture for the reduction it exists to prove;
`CI_CONTRACT_MODE` already marked those runs and is now honoured by default.
The reference-feature fixture goes from failing before its first assertion to
1,612 passing with one failure, and that one is the live process-tree
observation test already red on the main tree.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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>
Four fixtures linked the installed dependencies into a throwaway root with a
single directory symlink at <fixture>/node_modules, then ran pnpm inside that
root. pnpm does not recognise the modules directory it finds there and purges
it; with CI=true it does so without a prompt. The purge followed the symlink and
deleted the repository's own node_modules mid-run, so a test suite uninstalled
the workspace it was running in. That is what produced the cascading,
file-unrelated failures a full test:unit run reported, and it happened twice
while running the suites for the adapter re-review.
scripts/lib/fixture-node-modules.ts replaces all four sites: node_modules is a
real directory whose entries are individual symlinks, so a recursive delete
unlinks the fixture's own links instead of walking through one link into the
shared tree. Resolution is unchanged.
tests/unit/fixture-node-modules.test.ts performs the exact recursive delete pnpm
performs and asserts the source tree survives, and check:adapter-inventory now
fails on any reintroduction of the directory-symlink form — verified by putting
the old line back and watching the gate reject it.
A full tests/unit + tests/integration run now leaves the dependencies intact.
removal-fixture, supply-chain and security-followup-archive, the three suites
that had to be excluded before, pass in that run.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
LEG-01. AuthSessionPort.recover now takes the request's lifetime context, and
the raw recovery helper returns data only. The sign-out notification moved to
the site that adopts the result, so a recovery that answers after the deadline
or a caller abort is observed and discarded instead of logging the user out of
a request nobody is waiting on.
LEG-02. The V2 client shares V3's credential admission validator instead of
checking the allowed set alone. A bearer profile whose patch omits, empties,
duplicates or corrupts Authorization now fails closed with zero fetches rather
than dispatching an anonymous request under an authenticated profile.
OPT-NET-01. A cursor loader rejection is re-thrown exactly as it is with no
signal at all. Only a signal that has actually aborted classifies the outcome
as PAGINATION_ABORTED, so a real upstream failure stops being filed as a user
cancellation.
OPT-NET-02. defineMutationIntent and the V3 admission site now share the single
isValidIdempotencyKey authority, closing the drift that let a control character
through intent definition.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
LIVE-01. A credential collaborator that returns UNAVAILABLE, throws, rejects
or answers off-contract is an outage of the auth integration, not evidence
about the user's session. Each of those now closes as AUTH_INTEGRATION_FAILURE
with zero fetches, so the composition root's logout path stays reserved for a
genuinely absent session. The synchronous and asynchronous failure sites share
one classifier.
LIVE-02 / LIVE-03. Object.freeze(new Map(...)) freezes the wrapper, not the
backing store, so an exported registry could still be cleared or replaced after
composition. Both the installed REST auth profile registry and the composed
HTTP/event lookups are now read facades over private stores, and every composed
row is an exact own-data snapshot that rejects accessors, inherited and
symbol-keyed fields.
LIVE-04. The total deadline now bounds the physical waits rather than being
checked between them: dispatch and response admission race the attempt signal,
the bounded reader takes that signal, and an abandoned operation is still
observed once so a late native rejection cannot surface unhandled. A body that
completes after the deadline or the caller owns the execution is no longer
admitted; a stale generation keeps its more specific SCOPE_FENCED verdict.
LIVE-05. DEADLINE is no longer treated as a caller-owned cancellation, so a
timeout reaches api.request.failed exactly once while caller, route, scope and
shutdown aborts stay excluded.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
N-06: export one idempotency-key authority from mutation-intent.ts and use it
in the V2 client. A caller-supplied key is validated before credentials, timers
and fetch, and an invalid value is rejected as VALIDATION_REJECTED /
IDEMPOTENCY_KEY_INVALID rather than trimmed, regenerated or dropped, so a keyed
command can no longer replay while sending no key.
N-07: bound the legacy credential wait by the existing attempt controller,
which already carries the total deadline and the caller signal, so a
non-cooperative owner cannot hold the request open and no extra timer is
introduced. The owner receives the operation context, and the failure follows
ownership: deadline to REQUEST_TIMEOUT, caller to REQUEST_ABORTED, and only a
genuine rejection to AUTH_INTEGRATION_FAILURE. None of these paths fetch.
N-08: readBoundedJson delegates to the common bounded reader, so cancel and
releaseLock throws stay isolated inside the closed result, and the V2
content-type mismatch now cancels the response body.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>
Install the REST auth profile registry once at composition and make it the
single transport authority for V3. Contract composition now rejects an
unregistered authProfileId, so the executor never resolves a profile at
runtime.
The credential collaborator contributes proof headers only: Fetch credentials
come from the resolved profile, transport-owned and forbidden headers are
rejected, headers outside the profile's allowed set are rejected, and a missing
required header fails closed as AUTH_INTEGRATION_FAILURE with zero fetch calls.
The final invariant re-proves credentials mode and the exact header sets.
Demo mode satisfies the strict bearer profile with a fixed non-secret marker
instead of weakening REFERENCE_EXTERNAL_BEARER. Credential owners now receive
the operation lifetime through AuthOperationContext.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>