@procedures/peer 0.13.1 → 0.14.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/CHANGELOG.md +47 -0
- package/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/host/faces.d.ts +2 -0
- package/dist/host/faces.d.ts.map +1 -1
- package/dist/host/faces.js +16 -2
- package/dist/host/faces.js.map +1 -1
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +74 -4
- package/dist/host/index.js.map +1 -1
- package/dist/host/tracking.d.ts +4 -1
- package/dist/host/tracking.d.ts.map +1 -1
- package/dist/host/tracking.js +14 -5
- package/dist/host/tracking.js.map +1 -1
- package/package.json +5 -3
- package/src/host/faces.ts +17 -2
- package/src/host/index.ts +88 -4
- package/src/host/tracking.ts +16 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @procedures/peer
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 217a90f: From 0.14.0, a call that the shutdown cuts ends with `UNAVAILABLE` and `retryable: false` when the call can have had its effect. Before, it ended with `INTERNAL_ERROR` (server stack CLI-48). This is true before and after the first item. This change is a break of the server stack, thus it is its own MINOR (decision D13). No 0.13 release marks the old code as deprecated, because no host relies on it.
|
|
8
|
+
|
|
9
|
+
The error registry gives `INTERNAL_ERROR` to a bug of the server, with the severity `CRITICAL`. A cut is not a bug: the server stopped. Thus an alert on `INTERNAL_ERROR` does not fire at each deploy that cuts a write. The code tells why the call ended, and the flag `retryable` tells if a retry is safe.
|
|
10
|
+
|
|
11
|
+
The behavior that changes:
|
|
12
|
+
|
|
13
|
+
- `createProcedureHost()` of `@procedures/peer`: each cut has the code `UNAVAILABLE`. This is the same on HTTP, WebSocket and MCP.
|
|
14
|
+
- A cut after the first item ends the stream in-band. A cut before the first item is the answer of the call. Before, a cut of a call that can have had its effect had the code `INTERNAL_ERROR` in the two cases.
|
|
15
|
+
- The flag `retryable` of a cut comes from the operation of the call. It is false for a call that can have had its effect (the operation `once`), and true for a repeatable call.
|
|
16
|
+
- `procedureHandler()` of `@procedures/client`: a handler error with `retryable: false` gets the HTTP status 500, not 503. A 503 invites a retry at the HTTP level (decision D3). Thus a cut before the first item of a call that can have had its effect is 500 with `UNAVAILABLE`, with no `Retry-After`. A retryable cut stays 503.
|
|
17
|
+
- `ProcedureServer` of `@procedures/client`: a handler error without a retryable flag gets the flag of its code in `ERROR_CODES`. Before, it got false. Thus `UNAVAILABLE` without a flag is retryable, and it keeps the HTTP status 503.
|
|
18
|
+
- The close of each face and of each listener of the host first waits until each answer that a face ended has gone out. It waits for the event `finish` of each ended response, and for the write callback of each upgraded socket. Thus the close of the transports does not lose the answer of a call that the deadline of the drain cuts. An open stream that is not ended does not hold the close.
|
|
19
|
+
- The WebSocket face keeps its connections open after the cooperative abort of the drain, until each cut call ends in-band. Before, the connections closed at the abort, and a cut call lost its end.
|
|
20
|
+
- `@procedures/mcp-server`: the error result of a failed stream has `_meta` with `code` and `retryable`. The error result of a failed call also has `retryable` in `_meta`. These fields are new.
|
|
21
|
+
|
|
22
|
+
The behavior that does not change:
|
|
23
|
+
|
|
24
|
+
- A real failure of a handler keeps its own code, for example `INTERNAL_ERROR` or `HANDLER_ERROR`.
|
|
25
|
+
- A refusal at the stop of the intake stays `UNAVAILABLE`, 503 and retryable.
|
|
26
|
+
- The retry middleware reads the flag `retryable`, not the code. Thus it does not retry a cut of a call that can have had its effect.
|
|
27
|
+
|
|
28
|
+
Migration steps:
|
|
29
|
+
|
|
30
|
+
- A caller that finds a cut by the code `INTERNAL_ERROR`: look for `UNAVAILABLE` in its place. Do not retry the call when `retryable` is false.
|
|
31
|
+
- A handler that throws `UNAVAILABLE` with `retryable: false`: its HTTP status is 500 in place of 503. Without the flag, the error is retryable and gets 503. A retry middleware then sends the call again, so give `retryable: false` when the call can have had its effect.
|
|
32
|
+
- The site: no change is necessary. Its code does not read the code of a cut, or the HTTP status 503.
|
|
33
|
+
- MiniMongo: no change is necessary. Its code does not read `INTERNAL_ERROR`, `UNAVAILABLE` or the severity of an error.
|
|
34
|
+
- The procedures host of Graph (GRAPH-11): no change is necessary. Its code does not read `INTERNAL_ERROR`. Its error "the server has no AGENT_TOKEN" is `UNAVAILABLE` with `retryable: false`, so its HTTP status is 500 in place of 503. No code of Graph reads that status.
|
|
35
|
+
- jarvis: no change is necessary. Its drain test already expects `UNAVAILABLE` with `retryable: false` for a cut procedure call (S6 A12). Its code reads only `NOT_FOUND` and `FORBIDDEN`.
|
|
36
|
+
- The `mark` CLI and `procedure-server`: no change is necessary. The lifecycle test of CI-2 expects `UNAVAILABLE` for the cut of `lifecycle.ticksOnce`.
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [217a90f]
|
|
41
|
+
- @procedures/client@0.14.0
|
|
42
|
+
|
|
43
|
+
## 0.13.2
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [3a235b9]
|
|
48
|
+
- @procedures/client@0.13.2
|
|
49
|
+
|
|
3
50
|
## 0.13.1
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -141,7 +141,7 @@ await svc.run();
|
|
|
141
141
|
- **The listeners.** The faces of a listener mount on its mount list, so they share one port. Without `listen`, the app mounts `host.handler` and `host.upgrade` on its own listener.
|
|
142
142
|
- **The request tracking.** Each call goes through `life.request`, with the route `<face> <procedure>`. The function of the pattern gives the idempotency of each call: a repeatable procedure, a keyed call, or a call that runs one time (decision D3).
|
|
143
143
|
- **The readiness of the calls.** The option `controller.requires` names the dependencies of the service that each call needs. While a check of one of them fails readiness, the service refuses each call with `UNAVAILABLE` (CLI-45).
|
|
144
|
-
- **The streams.** Each call is a stream, and a unary call is a stream of one (decision D4). A stream stays in flight until its end. A cut after the first item ends the stream with an error line.
|
|
144
|
+
- **The streams.** Each call is a stream, and a unary call is a stream of one (decision D4). A stream stays in flight until its end. A cut after the first item ends the stream with an error line. Each cut has the code `UNAVAILABLE`, and its flag `retryable` tells if a retry is safe (CLI-48). Before the first item, the HTTP face answers 503 for a retryable cut and 500 for another cut.
|
|
145
145
|
- **The collections.** The option `collections` gives the storages. The host serves `collections.<name>.*` for each one.
|
|
146
146
|
- **The expose rule.** The rule of the policy applies to each procedure that the host serves, also to the collection procedures (CLI-47). A host with an expose rule must list the collection procedures that it serves, for example `collections.notes.*`. An `exclude` hides one of them, for example `collections.notes.clear`. The option `expose` of the host wins over the rule of the policy, for the server and for each face.
|
|
147
147
|
- **Always on.** `host.health`, `host.info`, `host.metrics` and `events.subscribe` stay on, whatever the expose rule says. The host pins them with `registerProcedures(procedures, { alwaysOn: true })`. The topic rule is the expose rule of `events.subscribe`.
|