Repository navigation
Release 1.0.0-alpha.11: no resend after a timeout or of any write; SERVER_TIMEOUT; explain says what is known - #67
Merged
Conversation
…from a failed read; 1.0.0-alpha.11 A timeout ends the client's wait and does not stop the work on the server, so a request that timed out (TIMEOUT, a 408, a 504) is no longer sent again, a read included: a slow query was being run twice. A lost connection, a 429 and other 5xx are resent once as before. Every ApiError the client lets out says what was asked (method, path, idempotent). explain uses it: a write that got no answer is 'the change may or may not have been made', never 'try again', and Explanation gains retrySafe. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…esent A server-side SQL execution timeout, as an instance answers it, arrives as an error document (a SqlException beginning "Execution Timeout Expired", a Win32Exception "The wait operation timed out"), not as a 408. It surfaced as a bare "Server Error" and a read was sent again. apiErrorFromResponse now codes it SERVER_TIMEOUT by the exception's type and the start of its message, whatever the status; the resend rule leaves it alone; explain says to ask for less, with retrySafe false; a 400 carrying it is not re-coded as a rejected query; the conformance suite checks a refusal's code. Unit-tested with the document as sent, through query.v1, api/asset and rest-1. Not provoked live. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
…outcome is unknown Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
retrySafe false covered a write whose fate is unknown and a read that will fail the same way, which call for opposite actions. The fact is now a field: unknown (a write with no confirmation), notApplied (the server refused before doing the work; one failed command of a batch), null (a read, or nothing known of the request). Replaces the previous commit's advice to derive it from request.idempotent, which was wrong for a write the server refused. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
A second send of a guarded batch harms no data (it matches nothing), but "matched nothing" is how a conflict reads. When the first send landed and only its answer was lost, the resend told the caller that someone else changed the asset and nothing was applied, about its own change. No write is marked idempotent now. A guarded write with no confirmation rejects like any write and is explained as an unconfirmed change with outcome "unknown"; the caller reads the asset again and decides. SendOptions.idempotent is removed from assetApi.send. Proved live: the second send lists no asset and reports no failure. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
… the unauthorized hook The premise of retry-write has been checked once (a missing and an invalid session on api/asset: a 401 before any command ran); the doc comment, spec 000, example 09 and the changelog say that and its limits. The removal of SendOptions.idempotent is its own Breaking entry. The conformance suite gains a 401 with an empty body; batch.run with a guard is tested to send once when its answer is lost. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking
1. A request that timed out is no longer sent again, a read included.
Since alpha.5 an idempotent request (a GET, a query.v1 read) that timed out was sent once more, about 150 ms later. A timeout ends the client's wait; it does not stop the work on the server. So a slow query was run twice, possibly while the first was still running, and the caller waited two timeouts.
TIMEOUT), the server (a 408), a gateway in front of it (a 504), or the server's own SQL execution timeout (SERVER_TIMEOUT, below).NETWORK_ERROR), a 429, any other 5xx.client.pagesandclient.allstop at the first timeout.resendable()insrc/core/retry.ts.2. A guarded write is no longer sent again automatically.
Since alpha.5 a guarded batch with no creates (
client.sendGuarded,batch.runwithguard: true) was marked idempotent and resent once after a lost connection or a 5xx. A second send harms no data: it matches nothing, because the first advanced the Moment. But "matched nothing" is how a conflict is reported. So when the first send had landed and only its answer was lost, the caller was told that someone else changed the asset and nothing was applied, about its own change.explaingives the unconfirmed-change sentence withoutcome: "unknown".retryableis false for a guarded write, so "retry" does not resend it after a 401 and "retry-write" does.retryable: falsedoes not mean it cannot be resumed after signing in again; the hook's doc comment says so.3.
SendOptions.idempotentis removed from/wire'sassetApi.send. Nothing can be marked safe to resend any more. A caller deletes the option; one that guarded a batch itself and relied on the resend catches the error, reads the assets again and decides.Changed
client.explainno longer tells a person to try again after a write that got no answer. For everytransienterror it said "Agility could not be reached, or is busy. The same request may work in a moment." For a write whose fate is unknown, that is how a duplicate gets made.retrySafeoutcomefalse"unknown"SERVER_TIMEOUT)falsenulltruenulltruenulltrue"notApplied"for a write,nullfor a readnullnullWhat is known about
"retry-write"(no behaviour change). The hook's answer that resends a write rests on the consumer's assertion that a refusal means nothing ran. That has now been checked once, by a browser-app consumer, on one product release: an api/asset create sent with no session, and one with an invalid session, were each answered 401 with an empty body before any command ran, and nothing was created. Not checked: a session that was valid and has expired, a 403, rest-1. The doc comment, spec 000 and example 09 say this in place of "cannot be verified".Added
SERVER_TIMEOUT: a server-side SQL execution timeout, as an instance answers it. The server gives up on a request that takes longer than it allows and answers an error document, not a 408:exceptionsholding aSqlExceptionwhose message begins "Execution Timeout Expired" and aWin32Exception"The wait operation timed out". It used to surface as a bare "Server Error", and a read was sent again.apiErrorFromResponsenow recognises it by the exception's type and the start of its message, whatever the status:code: "SERVER_TIMEOUT",kind: "transient", the exception's words as the message, the whole document indetails. Never resent; a 400 carrying it is not re-coded as a rejected query.transportConformancechecks that a refused response carries the codeapiErrorFromResponsegives it, with that document as one case, and gains a 401 with an empty body (kindauthfrom the status alone). Only refused responses are compared; a transport that builds refusals withapiErrorFromResponsepasses unchanged.Explanation.retrySafe(boolean | null): may the same request be sent again as it is? Nothing more than that.Explanation.outcome("unknown" | "notApplied" | null): is it known whether the change was made?"unknown": a write with no confirmation (no answer, a timeout of the client's or the server's, a cancelled wait, a 5xx, an unreadable answer)."notApplied": the server answered a refusal before doing the work (a 4xx or a 429 in answer to a write, a conflict), and each failed command when a batch's failures are explained. For a batch it speaks of that command alone; the others are in the Outcome.null: a read, or an error that does not say what was asked.ApiError.request:{ method, path, idempotent }, stamped by the client on every error it lets out, with any transport. Never the body or the headers (a test asserts the keys). An error from a/wireor/servicesfunction used on a transport no client wrapped has no stamp.Things a reviewer should know
retrySafe: falsecovers a write whose fate is unknown and a read that will fail the same way again, which call for opposite actions (look before acting; do not look, ask for less). An earlier commit on this branch told consumers to derive the difference fromrequest.idempotent; that was wrong (a refused write is also not idempotent, and its outcome is known) and is replaced byoutcome.retrySafeisfalsefor a read withSERVER_TIMEOUT. Repeating it harms no data, but a consumer that shows a retry button whenretrySafeis true would invite running the same costly query again. A judgement call.TIMEOUTandSERVER_TIMEOUTarekind: "transient". The kind says what the failure is; the resend rule is narrower than the kind.SERVER_TIMEOUTwas not provoked live: that would mean running a query that costly on a shared instance. Not confirmed, and the changelog says so: the HTTP status it arrives with (so the body decides); whether api/asset reports it in thisexceptionsshape or in its ownExceptionslist of strings (both are recognised); that rest-1 uses the same shape for it.timeoutMsandretriesdoc comments, the guard's doc comment, the README, example 09 and the changelog agree with it.Verification
At the head commit (b04afa3):
npm run verify: 267 unit tests in 33 files, all passing.retries: 3; a 408 and a 504 once; a lost connection and a 502 twice;allstops at the first timeout.sendGuardedandbatch.runwithguard: true, each over a transport that fails the send with a 502 or a lost connection,retries: 3: sent once, markedidempotent: false, explained withoutcome: "unknown".SERVER_TIMEOUT: the error document exactly as an instance sent it, throughclient.query(query.v1),client.queryPage(api/asset),client.deleted(rest-1) and a write, at statuses 500 and 400, each sent once. Controls that get no code: anotherSqlException, another server error, the same words inside a 400's message, a plain-text body.outcome: each case above, including 400, 401, 403, 404, 413, 429 and 408 in answer to a write, a conflict, a read, an unstamped error and one failed command.After merge
Tag
v1.0.0-alpha.11to stage the publish.🤖 Generated with Claude Code
https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm