@ziffer-io/client 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -1
- package/dist/client.d.ts +317 -14
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +478 -40
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/retry.d.ts +201 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +240 -0
- package/dist/retry.js.map +1 -0
- package/package.json +4 -4
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAIH,8EAA8E;AAE9E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,0BAA0B,CAAC;AAEjE,qEAAqE;AACrE,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAE9C;;;;GAIG;AACH,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB,gEAAgE;AAChE,MAAM,UAAU,yBAAyB;IACvC,YAAY,GAAG,KAAK,CAAC;AACvB,CAAC;AAED,MAAM,WAAW,GAAG,wCAAwC,CAAC;AAE7D;;;;;GAKG;AACH,SAAS,aAAa,CAAC,KAAoB;IACzC,IAAI,KAAK,KAAK,IAAI,IAAI,YAAY,EAAE,CAAC;QACnC,OAAO;IACT,CAAC;IACD,MAAM,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IACpE,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,E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AAM,CAAC;YACP,OAAO;gBACL,IAAI,EAAE,QAAQ;gBACd,MAAM;gBACN,WAAW;gBACX,KAAK,EAAE,IAAI,iBAAiB,CAC1B,QAAQ,MAAM,8BAA8B,MAAM,IAAI,IAAI,EAAE,CAC7D;aACF,CAAC;QACJ,CAAC;QACD,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;YACX,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QACvC,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;YAC7B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;YACtF,CAAC;QACH,CAAC;QACD,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,MAAM;YACN,WAAW;YACX,KAAK,EAAE,IAAI,iBAAiB,CAAC,QAAQ,MAAM,SAAS,MAAM,IAAI,IAAI,iBAAiB,CAAC;SACrF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* assert the re-export is the SAME function object, so this cannot decay
|
|
16
16
|
* into a copy silently.
|
|
17
17
|
*/
|
|
18
|
-
export { API_KEY_EXPIRES_HEADER, API_KEY_EXPIRY_WARNING_DAYS, ApiRefusal, ERROR_ADMISSION_UNAVAILABLE, ERROR_API_KEY_UNKNOWN, ERROR_DECISION_UNKNOWN, ERROR_PROPOSAL_MALFORMED, ERROR_TENANT_MISMATCH, ResponseMalformed, WaitTimeout, ZifferClient, type Decision, type DecisionStatus, type WaitOptions, type WireProposal, type WireProposalPayload, } from './client.js';
|
|
18
|
+
export { API_KEY_EXPIRES_HEADER, API_KEY_EXPIRY_WARNING_DAYS, ApiRefusal, ERROR_ADMISSION_UNAVAILABLE, ERROR_API_KEY_UNKNOWN, ERROR_DECISION_UNKNOWN, ERROR_FEEDBACK_MALFORMED, ERROR_FEEDBACK_RATE_LIMITED, ERROR_FEEDBACK_TOO_LARGE, ERROR_FEEDBACK_UNAVAILABLE, ERROR_LIST_QUERY_MALFORMED, ERROR_PROPOSAL_MALFORMED, ERROR_TENANT_MISMATCH, ResponseMalformed, WaitTimeout, ZifferClient, type Decision, type DecisionListItem, type DecisionPage, type DecisionStatus, type RefusalCategory, type Feedback, type FeedbackStored, type FetchInit, type FetchLike, type Identity, type ListOptions, type ReceiptPresence, type RequestOptions, type WaitOptions, type WireProposal, type WireProposalPayload, type ZifferClientOptions, } from './client.js';
|
|
19
|
+
export { DeadlineExceeded, REQUEST_TIMEOUT_MS, RETRY_BUCKET_CAPACITY, type RetryCounters, } from './retry.js';
|
|
19
20
|
export { Refusal, verifyReceipt, type TrustAnchor, type Verified, type VerifyOptions, } from '@ziffer-io/verify';
|
|
20
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,UAAU,EACV,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,UAAU,EACV,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,aAAa,CAAC;AAQrB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AAOpB,OAAO,EACL,OAAO,EACP,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,GACnB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,14 @@
|
|
|
15
15
|
* assert the re-export is the SAME function object, so this cannot decay
|
|
16
16
|
* into a copy silently.
|
|
17
17
|
*/
|
|
18
|
-
export { API_KEY_EXPIRES_HEADER, API_KEY_EXPIRY_WARNING_DAYS, ApiRefusal, ERROR_ADMISSION_UNAVAILABLE, ERROR_API_KEY_UNKNOWN, ERROR_DECISION_UNKNOWN, ERROR_PROPOSAL_MALFORMED, ERROR_TENANT_MISMATCH, ResponseMalformed, WaitTimeout, ZifferClient, } from './client.js';
|
|
18
|
+
export { API_KEY_EXPIRES_HEADER, API_KEY_EXPIRY_WARNING_DAYS, ApiRefusal, ERROR_ADMISSION_UNAVAILABLE, ERROR_API_KEY_UNKNOWN, ERROR_DECISION_UNKNOWN, ERROR_FEEDBACK_MALFORMED, ERROR_FEEDBACK_RATE_LIMITED, ERROR_FEEDBACK_TOO_LARGE, ERROR_FEEDBACK_UNAVAILABLE, ERROR_LIST_QUERY_MALFORMED, ERROR_PROPOSAL_MALFORMED, ERROR_TENANT_MISMATCH, ResponseMalformed, WaitTimeout, ZifferClient, } from './client.js';
|
|
19
|
+
// The retry surface a caller can act on: the error a deadline produces, the
|
|
20
|
+
// counters to read, and the two numbers a runbook would quote. The rules
|
|
21
|
+
// themselves (the policy, the jitter, the header parser) stay inside the
|
|
22
|
+
// package — they are the client's behaviour, not an API to call, and
|
|
23
|
+
// exporting them would invite a second retry loop built out of this one's
|
|
24
|
+
// parts, which is the thing `packages/mcp` is careful not to have.
|
|
25
|
+
export { DeadlineExceeded, REQUEST_TIMEOUT_MS, RETRY_BUCKET_CAPACITY, } from './retry.js';
|
|
19
26
|
// The verify surface a receipt-holding caller needs, and ONLY that: the
|
|
20
27
|
// verifier itself, its refusal type, and the types its signature names.
|
|
21
28
|
// The rest of @ziffer-io/verify (canon, the strict Ed25519 predicate, suite
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,UAAU,EACV,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,UAAU,EACV,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,YAAY,GAkBb,MAAM,aAAa,CAAC;AAErB,4EAA4E;AAC5E,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,0EAA0E;AAC1E,mEAAmE;AACnE,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,GAEtB,MAAM,YAAY,CAAC;AAEpB,wEAAwE;AACxE,wEAAwE;AACxE,4EAA4E;AAC5E,4EAA4E;AAC5E,gEAAgE;AAChE,OAAO,EACL,OAAO,EACP,aAAa,GAId,MAAM,mBAAmB,CAAC"}
|
package/dist/retry.d.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The retry rules, in one place, for the one request path (ACP-355).
|
|
3
|
+
*
|
|
4
|
+
* A client that resends is a client that decides, on the customer's behalf,
|
|
5
|
+
* which failures are worth another try — and the wrong answer is expensive in
|
|
6
|
+
* both directions: a resend of something the gateway already accepted is a
|
|
7
|
+
* second hold on the same action, and a give-up on a degradation the gateway
|
|
8
|
+
* named is an outage the customer did not have. So the rules are written once,
|
|
9
|
+
* here, and the shared corpus `tools/fixtures/sdk-retry/cases.json` holds this
|
|
10
|
+
* SDK and the Python one to the same sleeps, the same counters and the same
|
|
11
|
+
* refusals. Two implementations of one rule are two rules unless something
|
|
12
|
+
* holds them to the same bytes.
|
|
13
|
+
*
|
|
14
|
+
* Nothing in this module talks to the network, reads a clock or draws a random
|
|
15
|
+
* number: it is handed `now`, the draw and the caller's deadline, and it
|
|
16
|
+
* returns what should happen next. That is what makes the corpus replayable —
|
|
17
|
+
* see `retry.test.ts`, where time advances only by sleeps.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* R1. The answers a resend can help with, as ONE list.
|
|
21
|
+
*
|
|
22
|
+
* `0` is not an HTTP status: it is this client's spelling of "no HTTP answer at
|
|
23
|
+
* all" — the connection was refused, DNS failed, or the round trip outlived
|
|
24
|
+
* {@link REQUEST_TIMEOUT_MS}. The request may or may not have reached the
|
|
25
|
+
* gateway, and that is precisely why it is retryable: the gateway keys a
|
|
26
|
+
* pending hold on the hash of the bytes it received (R7), so a resend of the
|
|
27
|
+
* SAME bytes lands on the same hold rather than opening a second one.
|
|
28
|
+
*
|
|
29
|
+
* **500 is deliberately not on this list.** ZIFFER names its own degradations
|
|
30
|
+
* 502 and 503, so a 500 is an unclassified server fault — something the
|
|
31
|
+
* gateway did not expect and did not classify — and a resend repeats it. Every
|
|
32
|
+
* other 4xx is absent for the plainer reason: the request was refused on its
|
|
33
|
+
* merits and the same bytes will be refused again.
|
|
34
|
+
*/
|
|
35
|
+
export declare const RETRYABLE_STATUSES: readonly number[];
|
|
36
|
+
/** R2. The first computed backoff window, doubled per computed retry. */
|
|
37
|
+
export declare const RETRY_BASE_MS = 500;
|
|
38
|
+
/**
|
|
39
|
+
* R2. The ceiling on the computed window. Unreachable today: R4 caps computed
|
|
40
|
+
* retries at four, so `k` never exceeds 3 and the largest window this client
|
|
41
|
+
* can produce is `500 * 2^3 = 4000` ms. It is written here rather than dropped
|
|
42
|
+
* because a bound that changes no outcome is documentation and not a control,
|
|
43
|
+
* and the next person to raise the cap needs to know which of the two it is.
|
|
44
|
+
*/
|
|
45
|
+
export declare const RETRY_MAX_BACKOFF_MS = 30000;
|
|
46
|
+
/** R4. At most five attempts in total when the caller gave no deadline; and,
|
|
47
|
+
* deadline or not, at most four of those may be computed retries. */
|
|
48
|
+
export declare const RETRY_MAX_ATTEMPTS = 5;
|
|
49
|
+
/** R6. The token bucket's capacity, and the level a fresh client starts at. */
|
|
50
|
+
export declare const RETRY_BUCKET_CAPACITY = 10;
|
|
51
|
+
/**
|
|
52
|
+
* R8. The timeout on ONE ROUND TRIP — send, and read the answer's body. It is
|
|
53
|
+
* not a budget for the call: a call that retries four times may take far
|
|
54
|
+
* longer than this and is not wrong for doing so. Waiting for a human to
|
|
55
|
+
* approve is not a round trip either; that is `ZifferClient.wait`, which polls.
|
|
56
|
+
*/
|
|
57
|
+
export declare const REQUEST_TIMEOUT_MS = 10000;
|
|
58
|
+
/** The header R3 reads. Lowercase because that is how `Headers.get` matches. */
|
|
59
|
+
export declare const RETRY_AFTER_HEADER = "retry-after";
|
|
60
|
+
/**
|
|
61
|
+
* R9. What the caller can read off the client instance: two counters and one
|
|
62
|
+
* gauge. Snake_case because these are the names R1..R10 gives them and the
|
|
63
|
+
* shared corpus pins them — a second spelling here would be a second name for
|
|
64
|
+
* one number, and the Python SDK's reader would be reading a different object.
|
|
65
|
+
*
|
|
66
|
+
* `retries_directed` and `retries_computed` are cumulative over the client's
|
|
67
|
+
* whole life; `retry_bucket_level` is a level, not a count, and moves both ways.
|
|
68
|
+
*/
|
|
69
|
+
export interface RetryCounters {
|
|
70
|
+
/** Retries the SERVER asked for, by sending `Retry-After` (R3). */
|
|
71
|
+
readonly retries_directed: number;
|
|
72
|
+
/** Retries this client decided on its own, with jittered backoff (R2). */
|
|
73
|
+
readonly retries_computed: number;
|
|
74
|
+
/** R6's bucket, 0..{@link RETRY_BUCKET_CAPACITY}. */
|
|
75
|
+
readonly retry_bucket_level: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* R5. The call's deadline arrived before the next sleep could be taken.
|
|
79
|
+
*
|
|
80
|
+
* Distinct from every other failure on purpose: it says the RETRY was
|
|
81
|
+
* abandoned, not that the gateway refused. It carries the last failure's name
|
|
82
|
+
* and status so the operator learns what was actually going wrong — a
|
|
83
|
+
* `DeadlineExceeded` that did not say "the last thing we saw was a 503" would
|
|
84
|
+
* send the reader looking at their own timeout instead of at the gateway.
|
|
85
|
+
*
|
|
86
|
+
* Thrown only when the caller gave a deadline. No deadline means no such
|
|
87
|
+
* check, and a directed sleep of an hour is then taken as directed.
|
|
88
|
+
*/
|
|
89
|
+
export declare class DeadlineExceeded extends Error {
|
|
90
|
+
/** The name of the last failure before the deadline — `ApiRefusal`,
|
|
91
|
+
* `ResponseMalformed`, `TimeoutError`, whatever the transport threw. */
|
|
92
|
+
readonly lastError: string;
|
|
93
|
+
/** The last failure's HTTP status; `0` when there was no HTTP answer. */
|
|
94
|
+
readonly status: number;
|
|
95
|
+
constructor(lastError: string, status: number);
|
|
96
|
+
}
|
|
97
|
+
/** R1. `status` is an HTTP status, or 0 for no HTTP answer at all. */
|
|
98
|
+
export declare function isRetryable(status: number): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* R2. Full jitter: `floor(u * min(30000, 500 * 2^k))`, `u` in [0,1).
|
|
101
|
+
*
|
|
102
|
+
* Full jitter and not "backoff plus a little noise", because the failure this
|
|
103
|
+
* defends against is a fleet of clients that all saw the same 503 and all come
|
|
104
|
+
* back at the same instant. Sleeping a uniform draw from the whole window is
|
|
105
|
+
* what spreads them; a narrow band around the window keeps the herd together.
|
|
106
|
+
* `floor` truncates and does not round.
|
|
107
|
+
*/
|
|
108
|
+
export declare function computedSleepMs(u: number, k: number): number;
|
|
109
|
+
/**
|
|
110
|
+
* R3. `Retry-After` as an INTEGER NUMBER OF SECONDS, or `null` for "no
|
|
111
|
+
* direction given".
|
|
112
|
+
*
|
|
113
|
+
* Integer seconds only. HTTP also permits an HTTP-date here, and `1.5`, `-1`
|
|
114
|
+
* and an empty value all exist in the wild; every one of them is read as
|
|
115
|
+
* ABSENT and the retry becomes a computed one. That is deliberate and it is
|
|
116
|
+
* the fail-safe direction: a misparsed date is a sleep of the wrong length
|
|
117
|
+
* (`Date.parse` of a malformed date yields NaN, and a NaN sleep is either
|
|
118
|
+
* instant or forever), while falling back to the computed path yields a sleep
|
|
119
|
+
* this client already knows how to bound. A value this client cannot read is
|
|
120
|
+
* not a direction it should follow.
|
|
121
|
+
*/
|
|
122
|
+
export declare function parseRetryAfterSeconds(raw: string | null): number | null;
|
|
123
|
+
/** What {@link RetryPolicy.decide} says to do next. */
|
|
124
|
+
export type RetryStep =
|
|
125
|
+
/** No retry. The caller throws the failure it already has, as it is. */
|
|
126
|
+
{
|
|
127
|
+
readonly kind: 'stop';
|
|
128
|
+
}
|
|
129
|
+
/** R5: a retry was due, but its sleep would cross the deadline. */
|
|
130
|
+
| {
|
|
131
|
+
readonly kind: 'deadline';
|
|
132
|
+
}
|
|
133
|
+
/** Sleep this long, then send the same bytes again. */
|
|
134
|
+
| {
|
|
135
|
+
readonly kind: 'sleep';
|
|
136
|
+
readonly ms: number;
|
|
137
|
+
readonly directed: boolean;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* The state of ONE call: attempts made, R2's `k`, and how many of this call's
|
|
141
|
+
* retries were computed.
|
|
142
|
+
*
|
|
143
|
+
* It is handed in rather than kept on the policy because one client may have
|
|
144
|
+
* two calls in flight — `propose` and a `wait` poll, say — and a `k` living on
|
|
145
|
+
* the client would be two calls sharing one backoff window, each doubling the
|
|
146
|
+
* other's. The bucket and the counters are per client (R6, R9); everything
|
|
147
|
+
* that resets per call is here.
|
|
148
|
+
*/
|
|
149
|
+
export interface CallState {
|
|
150
|
+
/** Round trips made so far in this call, including the one just answered. */
|
|
151
|
+
attempts: number;
|
|
152
|
+
/** R2's exponent. Advanced ONLY by a computed retry that actually happened. */
|
|
153
|
+
k: number;
|
|
154
|
+
/** R4's computed budget for this call. */
|
|
155
|
+
computed: number;
|
|
156
|
+
}
|
|
157
|
+
/** A fresh call's state. */
|
|
158
|
+
export declare function newCall(): CallState;
|
|
159
|
+
/**
|
|
160
|
+
* R1..R6 for one client instance: the token bucket, the two counters, and the
|
|
161
|
+
* decision.
|
|
162
|
+
*
|
|
163
|
+
* The bucket (R6) is the part that is easy to leave out and expensive to be
|
|
164
|
+
* without. Backoff alone still lets a client retry every call it makes, so a
|
|
165
|
+
* gateway that is down stays under the full retried load of every customer
|
|
166
|
+
* process at once. The bucket makes retrying a SHARED, exhaustible budget: ten
|
|
167
|
+
* computed retries, refilled one per successful call, so a client whose calls
|
|
168
|
+
* are all failing stops retrying and a client that is mostly healthy keeps its
|
|
169
|
+
* headroom. A directed retry spends nothing, because the server asked for it
|
|
170
|
+
* and it already knows its own load.
|
|
171
|
+
*/
|
|
172
|
+
export declare class RetryPolicy {
|
|
173
|
+
private bucket;
|
|
174
|
+
private directed;
|
|
175
|
+
private computed;
|
|
176
|
+
constructor(initialBucket?: number);
|
|
177
|
+
/** R9, as a plain object: a snapshot, not a live view. */
|
|
178
|
+
get counters(): RetryCounters;
|
|
179
|
+
/** R6: every successful call (2xx) adds one token, capped at capacity. */
|
|
180
|
+
refill(): void;
|
|
181
|
+
/**
|
|
182
|
+
* The whole of R1..R6 for one answer, in the order the corpus's README
|
|
183
|
+
* states: **R4, then R6, then R5**.
|
|
184
|
+
*
|
|
185
|
+
* That order is load-bearing. R5 runs last because it is a question about a
|
|
186
|
+
* SLEEP — if R4's cap or R6's empty bucket already said there is no retry,
|
|
187
|
+
* there is no sleep to measure and the caller gets the gateway's own last
|
|
188
|
+
* error rather than a `DeadlineExceeded` that names the wrong problem.
|
|
189
|
+
*
|
|
190
|
+
* Counters and the bucket move only on the branch that returns `sleep`: a
|
|
191
|
+
* retry that was computed and then refused by the deadline is not a retry,
|
|
192
|
+
* and counting it would inflate the only numbers an operator has. The draw
|
|
193
|
+
* IS consumed on that path, because it was drawn before the deadline
|
|
194
|
+
* refused it.
|
|
195
|
+
*
|
|
196
|
+
* `deadlineAtMs` is an absolute instant on the same clock as `nowMs`;
|
|
197
|
+
* `undefined` means the caller gave no deadline, and then R5 does not run.
|
|
198
|
+
*/
|
|
199
|
+
decide(status: number, retryAfterS: number | null, call: CallState, nowMs: number, deadlineAtMs: number | undefined, draw: () => number): RetryStep;
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;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nB,wEAAwE;AACtE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAC3B,mEAAmE;GACjE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE;AAC/B,uDAAuD;GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAKhF;;;;;;;;;GASG;AACH,MAAM,WAAW,SAAS;IACxB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,CAAC,EAAE,MAAM,CAAC;IACV,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,4BAA4B;AAC5B,wBAAgB,OAAO,IAAI,SAAS,CAEnC;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAK;gBAET,aAAa,GAAE,MAA8B;IAazD,0DAA0D;IAC1D,IAAI,QAAQ,IAAI,aAAa,CAM5B;IAED,0EAA0E;IAC1E,MAAM,IAAI,IAAI;IAId;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,IAAI,EAAE,MAAM,MAAM,GACjB,SAAS;CAoDb"}
|
package/dist/retry.js
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The retry rules, in one place, for the one request path (ACP-355).
|
|
3
|
+
*
|
|
4
|
+
* A client that resends is a client that decides, on the customer's behalf,
|
|
5
|
+
* which failures are worth another try — and the wrong answer is expensive in
|
|
6
|
+
* both directions: a resend of something the gateway already accepted is a
|
|
7
|
+
* second hold on the same action, and a give-up on a degradation the gateway
|
|
8
|
+
* named is an outage the customer did not have. So the rules are written once,
|
|
9
|
+
* here, and the shared corpus `tools/fixtures/sdk-retry/cases.json` holds this
|
|
10
|
+
* SDK and the Python one to the same sleeps, the same counters and the same
|
|
11
|
+
* refusals. Two implementations of one rule are two rules unless something
|
|
12
|
+
* holds them to the same bytes.
|
|
13
|
+
*
|
|
14
|
+
* Nothing in this module talks to the network, reads a clock or draws a random
|
|
15
|
+
* number: it is handed `now`, the draw and the caller's deadline, and it
|
|
16
|
+
* returns what should happen next. That is what makes the corpus replayable —
|
|
17
|
+
* see `retry.test.ts`, where time advances only by sleeps.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* R1. The answers a resend can help with, as ONE list.
|
|
21
|
+
*
|
|
22
|
+
* `0` is not an HTTP status: it is this client's spelling of "no HTTP answer at
|
|
23
|
+
* all" — the connection was refused, DNS failed, or the round trip outlived
|
|
24
|
+
* {@link REQUEST_TIMEOUT_MS}. The request may or may not have reached the
|
|
25
|
+
* gateway, and that is precisely why it is retryable: the gateway keys a
|
|
26
|
+
* pending hold on the hash of the bytes it received (R7), so a resend of the
|
|
27
|
+
* SAME bytes lands on the same hold rather than opening a second one.
|
|
28
|
+
*
|
|
29
|
+
* **500 is deliberately not on this list.** ZIFFER names its own degradations
|
|
30
|
+
* 502 and 503, so a 500 is an unclassified server fault — something the
|
|
31
|
+
* gateway did not expect and did not classify — and a resend repeats it. Every
|
|
32
|
+
* other 4xx is absent for the plainer reason: the request was refused on its
|
|
33
|
+
* merits and the same bytes will be refused again.
|
|
34
|
+
*/
|
|
35
|
+
export const RETRYABLE_STATUSES = [0, 429, 502, 503, 504];
|
|
36
|
+
/** R2. The first computed backoff window, doubled per computed retry. */
|
|
37
|
+
export const RETRY_BASE_MS = 500;
|
|
38
|
+
/**
|
|
39
|
+
* R2. The ceiling on the computed window. Unreachable today: R4 caps computed
|
|
40
|
+
* retries at four, so `k` never exceeds 3 and the largest window this client
|
|
41
|
+
* can produce is `500 * 2^3 = 4000` ms. It is written here rather than dropped
|
|
42
|
+
* because a bound that changes no outcome is documentation and not a control,
|
|
43
|
+
* and the next person to raise the cap needs to know which of the two it is.
|
|
44
|
+
*/
|
|
45
|
+
export const RETRY_MAX_BACKOFF_MS = 30_000;
|
|
46
|
+
/** R4. At most five attempts in total when the caller gave no deadline; and,
|
|
47
|
+
* deadline or not, at most four of those may be computed retries. */
|
|
48
|
+
export const RETRY_MAX_ATTEMPTS = 5;
|
|
49
|
+
/** R6. The token bucket's capacity, and the level a fresh client starts at. */
|
|
50
|
+
export const RETRY_BUCKET_CAPACITY = 10;
|
|
51
|
+
/**
|
|
52
|
+
* R8. The timeout on ONE ROUND TRIP — send, and read the answer's body. It is
|
|
53
|
+
* not a budget for the call: a call that retries four times may take far
|
|
54
|
+
* longer than this and is not wrong for doing so. Waiting for a human to
|
|
55
|
+
* approve is not a round trip either; that is `ZifferClient.wait`, which polls.
|
|
56
|
+
*/
|
|
57
|
+
export const REQUEST_TIMEOUT_MS = 10_000;
|
|
58
|
+
/** The header R3 reads. Lowercase because that is how `Headers.get` matches. */
|
|
59
|
+
export const RETRY_AFTER_HEADER = 'retry-after';
|
|
60
|
+
/**
|
|
61
|
+
* R5. The call's deadline arrived before the next sleep could be taken.
|
|
62
|
+
*
|
|
63
|
+
* Distinct from every other failure on purpose: it says the RETRY was
|
|
64
|
+
* abandoned, not that the gateway refused. It carries the last failure's name
|
|
65
|
+
* and status so the operator learns what was actually going wrong — a
|
|
66
|
+
* `DeadlineExceeded` that did not say "the last thing we saw was a 503" would
|
|
67
|
+
* send the reader looking at their own timeout instead of at the gateway.
|
|
68
|
+
*
|
|
69
|
+
* Thrown only when the caller gave a deadline. No deadline means no such
|
|
70
|
+
* check, and a directed sleep of an hour is then taken as directed.
|
|
71
|
+
*/
|
|
72
|
+
export class DeadlineExceeded extends Error {
|
|
73
|
+
/** The name of the last failure before the deadline — `ApiRefusal`,
|
|
74
|
+
* `ResponseMalformed`, `TimeoutError`, whatever the transport threw. */
|
|
75
|
+
lastError;
|
|
76
|
+
/** The last failure's HTTP status; `0` when there was no HTTP answer. */
|
|
77
|
+
status;
|
|
78
|
+
constructor(lastError, status) {
|
|
79
|
+
super(`the deadline passed before the next retry could be taken; the last failure was ` +
|
|
80
|
+
`${lastError}${status === 0 ? ' with no HTTP answer' : ` (HTTP ${status})`}`);
|
|
81
|
+
this.name = 'DeadlineExceeded';
|
|
82
|
+
this.lastError = lastError;
|
|
83
|
+
this.status = status;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** R1. `status` is an HTTP status, or 0 for no HTTP answer at all. */
|
|
87
|
+
export function isRetryable(status) {
|
|
88
|
+
return RETRYABLE_STATUSES.includes(status);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* R2. Full jitter: `floor(u * min(30000, 500 * 2^k))`, `u` in [0,1).
|
|
92
|
+
*
|
|
93
|
+
* Full jitter and not "backoff plus a little noise", because the failure this
|
|
94
|
+
* defends against is a fleet of clients that all saw the same 503 and all come
|
|
95
|
+
* back at the same instant. Sleeping a uniform draw from the whole window is
|
|
96
|
+
* what spreads them; a narrow band around the window keeps the herd together.
|
|
97
|
+
* `floor` truncates and does not round.
|
|
98
|
+
*/
|
|
99
|
+
export function computedSleepMs(u, k) {
|
|
100
|
+
return Math.floor(u * Math.min(RETRY_MAX_BACKOFF_MS, RETRY_BASE_MS * 2 ** k));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* R3. `Retry-After` as an INTEGER NUMBER OF SECONDS, or `null` for "no
|
|
104
|
+
* direction given".
|
|
105
|
+
*
|
|
106
|
+
* Integer seconds only. HTTP also permits an HTTP-date here, and `1.5`, `-1`
|
|
107
|
+
* and an empty value all exist in the wild; every one of them is read as
|
|
108
|
+
* ABSENT and the retry becomes a computed one. That is deliberate and it is
|
|
109
|
+
* the fail-safe direction: a misparsed date is a sleep of the wrong length
|
|
110
|
+
* (`Date.parse` of a malformed date yields NaN, and a NaN sleep is either
|
|
111
|
+
* instant or forever), while falling back to the computed path yields a sleep
|
|
112
|
+
* this client already knows how to bound. A value this client cannot read is
|
|
113
|
+
* not a direction it should follow.
|
|
114
|
+
*/
|
|
115
|
+
export function parseRetryAfterSeconds(raw) {
|
|
116
|
+
if (raw === null) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const text = raw.trim();
|
|
120
|
+
// Digits only: this refuses '', '1.5', '-1', '+1', '1e3' and every HTTP-date
|
|
121
|
+
// spelling, each of which becomes a computed retry.
|
|
122
|
+
if (!/^[0-9]+$/.test(text)) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const seconds = Number.parseInt(text, 10);
|
|
126
|
+
return Number.isSafeInteger(seconds) ? seconds : null;
|
|
127
|
+
}
|
|
128
|
+
const STOP = { kind: 'stop' };
|
|
129
|
+
const DEADLINE = { kind: 'deadline' };
|
|
130
|
+
/** A fresh call's state. */
|
|
131
|
+
export function newCall() {
|
|
132
|
+
return { attempts: 0, k: 0, computed: 0 };
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* R1..R6 for one client instance: the token bucket, the two counters, and the
|
|
136
|
+
* decision.
|
|
137
|
+
*
|
|
138
|
+
* The bucket (R6) is the part that is easy to leave out and expensive to be
|
|
139
|
+
* without. Backoff alone still lets a client retry every call it makes, so a
|
|
140
|
+
* gateway that is down stays under the full retried load of every customer
|
|
141
|
+
* process at once. The bucket makes retrying a SHARED, exhaustible budget: ten
|
|
142
|
+
* computed retries, refilled one per successful call, so a client whose calls
|
|
143
|
+
* are all failing stops retrying and a client that is mostly healthy keeps its
|
|
144
|
+
* headroom. A directed retry spends nothing, because the server asked for it
|
|
145
|
+
* and it already knows its own load.
|
|
146
|
+
*/
|
|
147
|
+
export class RetryPolicy {
|
|
148
|
+
bucket;
|
|
149
|
+
directed = 0;
|
|
150
|
+
computed = 0;
|
|
151
|
+
constructor(initialBucket = RETRY_BUCKET_CAPACITY) {
|
|
152
|
+
if (!Number.isInteger(initialBucket) ||
|
|
153
|
+
initialBucket < 0 ||
|
|
154
|
+
initialBucket > RETRY_BUCKET_CAPACITY) {
|
|
155
|
+
throw new TypeError(`RetryPolicy: the initial bucket must be an integer 0..${RETRY_BUCKET_CAPACITY}`);
|
|
156
|
+
}
|
|
157
|
+
this.bucket = initialBucket;
|
|
158
|
+
}
|
|
159
|
+
/** R9, as a plain object: a snapshot, not a live view. */
|
|
160
|
+
get counters() {
|
|
161
|
+
return {
|
|
162
|
+
retries_directed: this.directed,
|
|
163
|
+
retries_computed: this.computed,
|
|
164
|
+
retry_bucket_level: this.bucket,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/** R6: every successful call (2xx) adds one token, capped at capacity. */
|
|
168
|
+
refill() {
|
|
169
|
+
this.bucket = Math.min(RETRY_BUCKET_CAPACITY, this.bucket + 1);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The whole of R1..R6 for one answer, in the order the corpus's README
|
|
173
|
+
* states: **R4, then R6, then R5**.
|
|
174
|
+
*
|
|
175
|
+
* That order is load-bearing. R5 runs last because it is a question about a
|
|
176
|
+
* SLEEP — if R4's cap or R6's empty bucket already said there is no retry,
|
|
177
|
+
* there is no sleep to measure and the caller gets the gateway's own last
|
|
178
|
+
* error rather than a `DeadlineExceeded` that names the wrong problem.
|
|
179
|
+
*
|
|
180
|
+
* Counters and the bucket move only on the branch that returns `sleep`: a
|
|
181
|
+
* retry that was computed and then refused by the deadline is not a retry,
|
|
182
|
+
* and counting it would inflate the only numbers an operator has. The draw
|
|
183
|
+
* IS consumed on that path, because it was drawn before the deadline
|
|
184
|
+
* refused it.
|
|
185
|
+
*
|
|
186
|
+
* `deadlineAtMs` is an absolute instant on the same clock as `nowMs`;
|
|
187
|
+
* `undefined` means the caller gave no deadline, and then R5 does not run.
|
|
188
|
+
*/
|
|
189
|
+
decide(status, retryAfterS, call, nowMs, deadlineAtMs, draw) {
|
|
190
|
+
// R1, and it beats R3: a 500 carrying `Retry-After` is still not retried.
|
|
191
|
+
// The status decides; a header cannot promote an answer into the list.
|
|
192
|
+
if (!isRetryable(status)) {
|
|
193
|
+
return STOP;
|
|
194
|
+
}
|
|
195
|
+
// R4, half one: with NO deadline the cap counts attempts of either kind.
|
|
196
|
+
// Under a deadline the deadline is the bound on directed retries, because
|
|
197
|
+
// the server asking for a tenth try is the server telling us it is coming
|
|
198
|
+
// back — and the caller said how long it is prepared to wait.
|
|
199
|
+
if (deadlineAtMs === undefined && call.attempts >= RETRY_MAX_ATTEMPTS) {
|
|
200
|
+
return STOP;
|
|
201
|
+
}
|
|
202
|
+
let ms;
|
|
203
|
+
if (retryAfterS !== null) {
|
|
204
|
+
// R3: exactly N seconds. No jitter — the server already drew it, and a
|
|
205
|
+
// client adding its own would smear the window the server chose.
|
|
206
|
+
ms = retryAfterS * 1000;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
// R4, half two: the computed budget is four retries, deadline or not.
|
|
210
|
+
// A deadline buys patience with a server that is answering, not licence
|
|
211
|
+
// to hammer one that is not.
|
|
212
|
+
if (call.computed >= RETRY_MAX_ATTEMPTS - 1) {
|
|
213
|
+
return STOP;
|
|
214
|
+
}
|
|
215
|
+
// R6: an empty bucket means no computed retry, and the last error is
|
|
216
|
+
// raised exactly as it is.
|
|
217
|
+
if (this.bucket <= 0) {
|
|
218
|
+
return STOP;
|
|
219
|
+
}
|
|
220
|
+
ms = computedSleepMs(draw(), call.k);
|
|
221
|
+
}
|
|
222
|
+
// R5, strictly greater: a sleep that lands exactly on the deadline is taken.
|
|
223
|
+
if (deadlineAtMs !== undefined && nowMs + ms > deadlineAtMs) {
|
|
224
|
+
return DEADLINE;
|
|
225
|
+
}
|
|
226
|
+
if (retryAfterS !== null) {
|
|
227
|
+
// R3/R6: spends no token, and `k` does not advance — the server's
|
|
228
|
+
// direction is not evidence about how loaded WE think it is.
|
|
229
|
+
this.directed += 1;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
this.computed += 1;
|
|
233
|
+
this.bucket -= 1;
|
|
234
|
+
call.computed += 1;
|
|
235
|
+
call.k += 1;
|
|
236
|
+
}
|
|
237
|
+
return { kind: 'sleep', ms, directed: retryAfterS !== null };
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAE7E,yEAAyE;AACzE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE3C;qEACqE;AACrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAoBhD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC;4EACwE;IAC/D,SAAS,CAAS;IAC3B,yEAAyE;IAChE,MAAM,CAAS;IAExB,YAAY,SAAiB,EAAE,MAAc;QAC3C,KAAK,CACH,iFAAiF;YAC/E,GAAG,SAAS,GAAG,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,UAAU,MAAM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propose an action, wait for the decision, verify the receipt before you act",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ziffer",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"ziffer": {
|
|
43
|
-
"enginePin": "
|
|
43
|
+
"enginePin": "7fd84dbe1a430e6deea4b241ebe1ba641103ffbe"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@ziffer-io/types": "0.
|
|
47
|
-
"@ziffer-io/verify": "0.
|
|
46
|
+
"@ziffer-io/types": "0.2.0",
|
|
47
|
+
"@ziffer-io/verify": "0.2.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/node": "^22.15.0",
|