@serve.zone/interfaces 32.97.0 → 32.98.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.
@@ -1,4 +1,5 @@
1
1
  import type { IIdentityCredential } from './user.js';
2
+ import { validateControllerPeerSet, type IControllerPeerSet } from './controller.js';
2
3
  import { isSha256Digest } from './immutableimage.js';
3
4
  import type {
4
5
  IRuntimeAssignmentObservation, IRuntimeAssignmentReference, IRuntimeAssignment,
@@ -75,6 +76,24 @@ export interface IRegisterPalletRuntimeSessionRequest {
75
76
  export interface IRegisterPalletRuntimeSessionResponse {
76
77
  session: IRuntimeSessionBinding;
77
78
  protocol: IProtocolOffer;
79
+ /**
80
+ * The controller's current peer set (`validateControllerPeerSet`, Linus rulings 252 point 9 and
81
+ * 253 point 5), as the relay registration and Spark heartbeat answers carry it. From the Pallet
82
+ * release that admits it, Pallet judges it by `judgeControllerPeerSet` against the peer set it
83
+ * stores on disk. It travels beside the binding, never in it: the binding is compared whole, so
84
+ * a peer set in it would change every session. A local controller states none.
85
+ *
86
+ * This answer is read exactly (`snapshotRegisterPalletRuntimeSessionResponse`) at two hops: by
87
+ * the relay that carries it and again by the node. Pallet 37.0.1 and coreflow 33.5.1 refuse an
88
+ * answer carrying the member, and the failure ends the node's session. So from the Cloudly
89
+ * release that sends it, Cloudly's sender gates it per session, in code, on the existing
90
+ * `IProtocolOffer.interfacesVersion` of the node (its `registerPalletRuntimeSession` request)
91
+ * and of the carrying relay (its `registerClusterRelay` request), stating the member only when
92
+ * both name 32.98.0 or later. No other member states support. The relay registration answer's
93
+ * own `controller` needs no gate: coreflow reads that answer field by field and ignores the
94
+ * member.
95
+ */
96
+ controller?: IControllerPeerSet;
78
97
  }
79
98
 
80
99
  export interface IApplyRuntimeAssignmentRequest {
@@ -305,8 +324,16 @@ export const snapshotRegisterPalletRuntimeSessionRequest = (
305
324
  export const snapshotRegisterPalletRuntimeSessionResponse = (
306
325
  valueArg: unknown,
307
326
  ): IRegisterPalletRuntimeSessionResponse => safe(() => {
308
- const value = record(capture(valueArg), ['session', 'protocol']);
309
- return { session: session(value.session), protocol: readProtocolOffer(value) };
327
+ const value = record(capture(valueArg), ['session', 'protocol'], ['controller']);
328
+ const response: IRegisterPalletRuntimeSessionResponse = {
329
+ session: session(value.session), protocol: readProtocolOffer(value),
330
+ };
331
+ if (Object.hasOwn(value, 'controller')) {
332
+ requireValue(validateControllerPeerSet(value.controller).length === 0);
333
+ // `capture` already made an inert copy; the peer set's own validator judged it exactly.
334
+ response.controller = value.controller as IControllerPeerSet;
335
+ }
336
+ return response;
310
337
  });
311
338
 
312
339
  export const snapshotApplyRuntimeAssignmentRequest = (
@@ -17,6 +17,7 @@ import type {
17
17
  TCoreMailSha256,
18
18
  TCoreMailWorkloadOperation,
19
19
  } from '../data/coremail.js';
20
+ import type { IControllerPeerSet } from '../data/controller.js';
20
21
  import type { IMailConnectionInfo } from '../data/mail.js';
21
22
  import type { IWorkloadReplicaIdentity } from '../data/workloadreplicaidentity.js';
22
23
 
@@ -182,6 +183,26 @@ export interface IReq_CoreMailAuthenticateControl extends plugins.typedrequestIn
182
183
  credentialId: string;
183
184
  credentialVersion: number;
184
185
  credentialSecret: string;
186
+ /**
187
+ * The controller's current peer set (Linus rulings 250 W1, 252 point 9 and 253): the one
188
+ * controller contract, read by `data.validateControllerPeerSet` and admitted by
189
+ * `data.judgeControllerPeerSet` against the peer set CoreMail stored, exactly as a gateway, a
190
+ * relay and a node admit it. CoreMail stores the peer set and never dials an origin in it.
191
+ *
192
+ * CoreMail judges it only after the credential verified. A credential failure still closes the
193
+ * socket with 4401 unanswered. The two controller refusals, `controller-mismatch` and
194
+ * `controller-epoch-older`, are answered as `ICoreMailErrorData` codes (`retryable: false`),
195
+ * and then the session is closed. A peer set at a higher epoch is stored durably beside
196
+ * CoreMail's applied state before anything is admitted at that epoch, and CoreMail closes its
197
+ * control sessions of a lower epoch.
198
+ *
199
+ * Optional on the wire until the next major, where it becomes required. A CoreMail without the
200
+ * check ignores it. A CoreMail with the check stores the first peer set stated after the
201
+ * credential verified, and accepts a session without one only while it has stored none, so the
202
+ * check stays inert until the controller states itself; from then on a session without it is
203
+ * refused `controller-epoch-older`.
204
+ */
205
+ controller?: IControllerPeerSet;
185
206
  };
186
207
  response: {
187
208
  authenticated: true;
@@ -192,6 +213,16 @@ export interface IReq_CoreMailAuthenticateControl extends plugins.typedrequestIn
192
213
  * `ICoreMailReplicaIdentity` from an earlier CoreMail (`normalizeCoreMailReplicaIdentity`).
193
214
  */
194
215
  replica: IWorkloadReplicaIdentity | ICoreMailReplicaIdentity;
216
+ /**
217
+ * The `configEpoch` of the desired state CoreMail has applied when the session opens, `0` when
218
+ * it has applied none (`data.normalizeCoreMailControlAppliedConfigEpoch`): never an error. It is
219
+ * the `expectedAppliedConfigEpoch` the controller's next preparation states, and the controller
220
+ * reserves above the greater of it and its own reserved epoch (Linus ruling 250 W2).
221
+ *
222
+ * Absent from a CoreMail built before this member. A reader that needs it reads its absence as
223
+ * "not stated" and never as `0`: assuming `0` is the restart lock-out ruling 250 W2 removes.
224
+ */
225
+ appliedConfigEpoch?: number;
195
226
  };
196
227
  }
197
228