@cotal-ai/core 0.12.0 → 0.13.1
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/dist/acls.d.ts +31 -7
- package/dist/acls.d.ts.map +1 -1
- package/dist/acls.js +105 -17
- package/dist/acls.js.map +1 -1
- package/dist/agent-file.js +1 -1
- package/dist/agent-file.js.map +1 -1
- package/dist/auth-provider.d.ts +8 -0
- package/dist/auth-provider.d.ts.map +1 -1
- package/dist/auth-provider.js.map +1 -1
- package/dist/backup.d.ts.map +1 -1
- package/dist/backup.js +6 -4
- package/dist/backup.js.map +1 -1
- package/dist/broker-floor.d.ts +34 -0
- package/dist/broker-floor.d.ts.map +1 -0
- package/dist/broker-floor.js +39 -0
- package/dist/broker-floor.js.map +1 -0
- package/dist/canonical.d.ts +24 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +159 -0
- package/dist/canonical.js.map +1 -0
- package/dist/connector.d.ts +4 -0
- package/dist/connector.d.ts.map +1 -1
- package/dist/endpoint-action.d.ts +424 -0
- package/dist/endpoint-action.d.ts.map +1 -0
- package/dist/endpoint-action.js +910 -0
- package/dist/endpoint-action.js.map +1 -0
- package/dist/endpoint-binding.d.ts +344 -0
- package/dist/endpoint-binding.d.ts.map +1 -0
- package/dist/endpoint-binding.js +753 -0
- package/dist/endpoint-binding.js.map +1 -0
- package/dist/endpoint-checkpoint.d.ts +292 -0
- package/dist/endpoint-checkpoint.d.ts.map +1 -0
- package/dist/endpoint-checkpoint.js +818 -0
- package/dist/endpoint-checkpoint.js.map +1 -0
- package/dist/endpoint-cluster.d.ts +95 -0
- package/dist/endpoint-cluster.d.ts.map +1 -0
- package/dist/endpoint-cluster.js +194 -0
- package/dist/endpoint-cluster.js.map +1 -0
- package/dist/endpoint-contract-store.d.ts +90 -0
- package/dist/endpoint-contract-store.d.ts.map +1 -0
- package/dist/endpoint-contract-store.js +348 -0
- package/dist/endpoint-contract-store.js.map +1 -0
- package/dist/endpoint-envelope.d.ts +165 -0
- package/dist/endpoint-envelope.d.ts.map +1 -0
- package/dist/endpoint-envelope.js +346 -0
- package/dist/endpoint-envelope.js.map +1 -0
- package/dist/endpoint-grants.d.ts +123 -0
- package/dist/endpoint-grants.d.ts.map +1 -0
- package/dist/endpoint-grants.js +215 -0
- package/dist/endpoint-grants.js.map +1 -0
- package/dist/endpoint-guard.d.ts +222 -0
- package/dist/endpoint-guard.d.ts.map +1 -0
- package/dist/endpoint-guard.js +468 -0
- package/dist/endpoint-guard.js.map +1 -0
- package/dist/endpoint-handle.d.ts +176 -0
- package/dist/endpoint-handle.d.ts.map +1 -0
- package/dist/endpoint-handle.js +608 -0
- package/dist/endpoint-handle.js.map +1 -0
- package/dist/endpoint-journal.d.ts +225 -0
- package/dist/endpoint-journal.d.ts.map +1 -0
- package/dist/endpoint-journal.js +431 -0
- package/dist/endpoint-journal.js.map +1 -0
- package/dist/endpoint-receipt.d.ts +225 -0
- package/dist/endpoint-receipt.d.ts.map +1 -0
- package/dist/endpoint-receipt.js +417 -0
- package/dist/endpoint-receipt.js.map +1 -0
- package/dist/endpoint-records.d.ts +243 -0
- package/dist/endpoint-records.d.ts.map +1 -0
- package/dist/endpoint-records.js +591 -0
- package/dist/endpoint-records.js.map +1 -0
- package/dist/endpoint-serve.d.ts +176 -0
- package/dist/endpoint-serve.d.ts.map +1 -0
- package/dist/endpoint-serve.js +446 -0
- package/dist/endpoint-serve.js.map +1 -0
- package/dist/endpoint-service.d.ts +518 -0
- package/dist/endpoint-service.d.ts.map +1 -0
- package/dist/endpoint-service.js +973 -0
- package/dist/endpoint-service.js.map +1 -0
- package/dist/endpoint-session.d.ts +398 -0
- package/dist/endpoint-session.d.ts.map +1 -0
- package/dist/endpoint-session.js +834 -0
- package/dist/endpoint-session.js.map +1 -0
- package/dist/endpoint-signing.d.ts +105 -0
- package/dist/endpoint-signing.d.ts.map +1 -0
- package/dist/endpoint-signing.js +190 -0
- package/dist/endpoint-signing.js.map +1 -0
- package/dist/endpoint-subjects.d.ts +222 -0
- package/dist/endpoint-subjects.d.ts.map +1 -0
- package/dist/endpoint-subjects.js +381 -0
- package/dist/endpoint-subjects.js.map +1 -0
- package/dist/endpoint-supervisor.d.ts +19 -0
- package/dist/endpoint-supervisor.d.ts.map +1 -0
- package/dist/endpoint-supervisor.js +12 -0
- package/dist/endpoint-supervisor.js.map +1 -0
- package/dist/endpoint-traits.d.ts +225 -0
- package/dist/endpoint-traits.d.ts.map +1 -0
- package/dist/endpoint-traits.js +469 -0
- package/dist/endpoint-traits.js.map +1 -0
- package/dist/endpoint-verbs.d.ts +277 -0
- package/dist/endpoint-verbs.d.ts.map +1 -0
- package/dist/endpoint-verbs.js +576 -0
- package/dist/endpoint-verbs.js.map +1 -0
- package/dist/endpoint-virtual.d.ts +308 -0
- package/dist/endpoint-virtual.d.ts.map +1 -0
- package/dist/endpoint-virtual.js +440 -0
- package/dist/endpoint-virtual.js.map +1 -0
- package/dist/endpoint-work.d.ts +304 -0
- package/dist/endpoint-work.d.ts.map +1 -0
- package/dist/endpoint-work.js +728 -0
- package/dist/endpoint-work.js.map +1 -0
- package/dist/endpoint.d.ts +66 -22
- package/dist/endpoint.d.ts.map +1 -1
- package/dist/endpoint.js +289 -89
- package/dist/endpoint.js.map +1 -1
- package/dist/evict.d.ts +95 -32
- package/dist/evict.d.ts.map +1 -1
- package/dist/evict.js +193 -3
- package/dist/evict.js.map +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/dist/lease.d.ts +4 -0
- package/dist/lease.d.ts.map +1 -1
- package/dist/lease.js.map +1 -1
- package/dist/members.d.ts +4 -4
- package/dist/members.d.ts.map +1 -1
- package/dist/members.js +12 -12
- package/dist/members.js.map +1 -1
- package/dist/provision.d.ts +70 -18
- package/dist/provision.d.ts.map +1 -1
- package/dist/provision.js +194 -33
- package/dist/provision.js.map +1 -1
- package/dist/safe-pattern.d.ts +33 -0
- package/dist/safe-pattern.d.ts.map +1 -0
- package/dist/safe-pattern.js +486 -0
- package/dist/safe-pattern.js.map +1 -0
- package/dist/schema-profile.d.ts +93 -0
- package/dist/schema-profile.d.ts.map +1 -0
- package/dist/schema-profile.js +284 -0
- package/dist/schema-profile.js.map +1 -0
- package/dist/streams.d.ts +13 -8
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +35 -18
- package/dist/streams.js.map +1 -1
- package/dist/subjects.d.ts +100 -40
- package/dist/subjects.d.ts.map +1 -1
- package/dist/subjects.js +136 -60
- package/dist/subjects.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { EpEnvelopeError } from "./endpoint-envelope.js";
|
|
2
|
+
import { epwStreamName, poolDurable, canonConsumerConfig, epjStreamName, canonDurable } from "./endpoint-binding.js";
|
|
3
|
+
import { AckPolicy, jetstreamManager } from "@nats-io/jetstream";
|
|
4
|
+
import { reconcileWorkItem, assertWorkPoolContext, } from "./endpoint-work.js";
|
|
5
|
+
import { mintSupervisorWrite } from "./endpoint-supervisor.js";
|
|
6
|
+
import { writeServiceStatus, parseServiceStatus, parseServiceSpec, parseActivationPolicy, SERVICE_ESCALATED, SERVICE_EXITED, SERVICE_RESTART_HISTORY_FIELD, SERVICE_RETIRED_MARK_FIELD, } from "./endpoint-service.js";
|
|
7
|
+
import { RECORD_KINDS, recordSpecKey, recordStatusKey, updateRecordEntry, readRecordLeader } from "./endpoint-records.js";
|
|
8
|
+
import { assertLifecycleToken, endpointToken, assertPoolToken } from "./endpoint-subjects.js";
|
|
9
|
+
import { spacePrefix, assertInboxConnId } from "./subjects.js";
|
|
10
|
+
function invalid(what) {
|
|
11
|
+
throw new EpEnvelopeError("contract-invalid", `${what} (SPEC 13.6 virtual)`);
|
|
12
|
+
}
|
|
13
|
+
const uint = (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0;
|
|
14
|
+
const isRec = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
15
|
+
const ACTIVATOR_CONTEXTS = new WeakSet();
|
|
16
|
+
export async function activatorContext(nc, space) {
|
|
17
|
+
spacePrefix(space); // boundary guard: usable space token, throws otherwise
|
|
18
|
+
const ctx = Object.freeze({ jsm: await jetstreamManager(nc, { checkAPI: false }), space });
|
|
19
|
+
ACTIVATOR_CONTEXTS.add(ctx);
|
|
20
|
+
return ctx;
|
|
21
|
+
}
|
|
22
|
+
/** The activator principal's COMPLETE broker authority (§13.6/§13.9): the exact per-pool
|
|
23
|
+
* Consumer INFO PUBLISH row plus — since Consumer INFO is a request/reply call — the
|
|
24
|
+
* CONNECTION-SCOPED reply inbox SUBSCRIBE row `_INBOX_<connId>.>` (never account-wide
|
|
25
|
+
* `_INBOX.>`, which is cross-connection reply-read authority). The start is a mediated,
|
|
26
|
+
* target-bound seam (off-broker or its own ep rail), so it contributes no row here; NOTHING
|
|
27
|
+
* else — no MSG.NEXT/ACK, no EPW STREAM.MSG.GET, no consumer create/update/delete, no EPW
|
|
28
|
+
* publish. The credential's OWN lifetime/renewal/lifecycle-UID binding rides the production
|
|
29
|
+
* activator provisioning (the named manager-wiring slice); this is the confined subject set.
|
|
30
|
+
* `connId` is the connection's validated inbox nonce (the same `_INBOX_<connId>` prefix the
|
|
31
|
+
* connection sets); omit it to get the publish half alone. */
|
|
32
|
+
export function activatorGrants(space, endpoint, pool, connId) {
|
|
33
|
+
const publish = [`$JS.API.CONSUMER.INFO.${epwStreamName(space)}.${poolDurable(endpoint, pool)}`];
|
|
34
|
+
const subscribe = connId !== undefined ? [`_INBOX_${assertInboxConnId(connId)}.>`] : [];
|
|
35
|
+
return { publish, subscribe };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Read the pool's occupancy FRESH from the exact per-pool Consumer INFO (request/reply
|
|
39
|
+
* snapshot; leader-routed like every JS API call). FAIL CLOSED, never fabricated — and every
|
|
40
|
+
* EDITABLE knob the count depends on is re-proved at EVERY read, because a post-create
|
|
41
|
+
* consumer edit must not silently falsify the fence:
|
|
42
|
+
* - a missing or unreadable consumer is `unavailable` (an admission fence cannot treat
|
|
43
|
+
* ignorance as an empty pool);
|
|
44
|
+
* - a reported `max_deliver` other than -1 (unlimited) is `failed-precondition`
|
|
45
|
+
* ({@link poolConsumerConfig} pins -1 at create; MaxDeliver is editable after);
|
|
46
|
+
* - a `filter_subject` that is not EXACTLY the pool's derived filter — or any multi-filter
|
|
47
|
+
* (`filter_subjects`) shape — is `failed-precondition`: FilterSubject is editable, and a
|
|
48
|
+
* narrowed/foreign filter reads 0 while stored work remains;
|
|
49
|
+
* - a non-explicit ack policy is `failed-precondition` (without an ack barrier,
|
|
50
|
+
* `num_ack_pending` does not mean "work still owned").
|
|
51
|
+
* Accepts the branded {@link WorkPoolContext} (admission path) or the narrow branded
|
|
52
|
+
* {@link ActivatorContext} (the watch loop); a hand-assembled context is refused.
|
|
53
|
+
*/
|
|
54
|
+
export async function readPoolOccupancy(ctx, endpoint, pool) {
|
|
55
|
+
if (!ACTIVATOR_CONTEXTS.has(ctx))
|
|
56
|
+
assertWorkPoolContext(ctx);
|
|
57
|
+
const stream = epwStreamName(ctx.space);
|
|
58
|
+
const durable = poolDurable(endpoint, pool);
|
|
59
|
+
let info;
|
|
60
|
+
try {
|
|
61
|
+
info = await ctx.jsm.consumers.info(stream, durable);
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
throw new EpEnvelopeError("unavailable", `the pool occupancy read failed for ${stream}/${durable}; an admission fence fails closed, never open (SPEC 13.6): ${e?.message ?? String(e)}`);
|
|
65
|
+
}
|
|
66
|
+
if (info.config.max_deliver !== -1)
|
|
67
|
+
throw new EpEnvelopeError("failed-precondition", `pool consumer ${durable} reports max_deliver ${String(info.config.max_deliver)}, not -1 (unlimited); a finite delivery ceiling strands exhausted items outside num_pending and num_ack_pending, so the occupancy sum would be a lie; repin the consumer (SPEC 13.6)`);
|
|
68
|
+
const expectedFilter = `${spacePrefix(ctx.space)}.epw.${endpointToken(endpoint)}.${assertPoolToken(pool)}.>`;
|
|
69
|
+
if (info.config.filter_subjects !== undefined)
|
|
70
|
+
throw new EpEnvelopeError("failed-precondition", `pool consumer ${durable} reports a multi-filter (filter_subjects); the §13.6 count is defined over exactly ONE pool filter; repin the consumer (SPEC 13.9)`);
|
|
71
|
+
if (info.config.filter_subject !== expectedFilter)
|
|
72
|
+
throw new EpEnvelopeError("failed-precondition", `pool consumer ${durable} reports filter "${String(info.config.filter_subject)}", not the pool's own "${expectedFilter}"; FilterSubject is editable post-create and a narrowed/foreign filter undercounts stored work; repin the consumer (SPEC 13.6/13.9)`);
|
|
73
|
+
if (info.config.ack_policy !== AckPolicy.Explicit)
|
|
74
|
+
throw new EpEnvelopeError("failed-precondition", `pool consumer ${durable} reports ack_policy "${String(info.config.ack_policy)}", not explicit; without the ack barrier num_ack_pending does not mean owned work (SPEC 13.9)`);
|
|
75
|
+
if (info.config.deliver_subject !== undefined)
|
|
76
|
+
throw new EpEnvelopeError("failed-precondition", `pool consumer ${durable} is a PUSH consumer (deliver_subject set); the §13.6 pool is pull-only, a delete/recreate must not substitute a push shape; repin the consumer (SPEC 13.9)`);
|
|
77
|
+
if (!uint(info.num_pending) || !uint(info.num_ack_pending) || !Number.isSafeInteger(info.num_pending + info.num_ack_pending))
|
|
78
|
+
throw new EpEnvelopeError("internal", `pool consumer ${durable} reported non-safe-integer counters (num_pending ${String(info.num_pending)}, num_ack_pending ${String(info.num_ack_pending)})`);
|
|
79
|
+
return { pending: info.num_pending, ackPending: info.num_ack_pending, occupancy: info.num_pending + info.num_ack_pending };
|
|
80
|
+
}
|
|
81
|
+
// ---- the serial admission durable --------------------------------------------------------------
|
|
82
|
+
/**
|
|
83
|
+
* The VIRTUAL endpoint's canonicalizer durable: {@link canonConsumerConfig} with
|
|
84
|
+
* `max_ack_pending` PINNED to 1 (not an option — the pin is the point). One submission is in
|
|
85
|
+
* the admission path at a time, so the count → decide → enqueue sequence is SERIAL and two
|
|
86
|
+
* concurrent submissions cannot both observe the same free slot. Pool-worker execution
|
|
87
|
+
* concurrency is untouched: occupancy already counts every worker's `num_ack_pending`, and the
|
|
88
|
+
* worker durable keeps its own knobs. Because MaxAckPending is EDITABLE post-create,
|
|
89
|
+
* {@link admitVirtualWork} re-proves the live pin at every admission — creation intent alone
|
|
90
|
+
* is not the invariant.
|
|
91
|
+
*/
|
|
92
|
+
export function virtualAdmissionConsumerConfig(space, endpoint, opts = {}) {
|
|
93
|
+
return canonConsumerConfig(space, endpoint, { ackWaitMs: opts.ackWaitMs, maxAckPending: 1 });
|
|
94
|
+
}
|
|
95
|
+
// ---- the registered activation policy (bound to the svc registration, never caller-supplied) ---
|
|
96
|
+
/**
|
|
97
|
+
* Read the endpoint's REGISTERED §13.6 activation policy from its `svc.<endpoint>.<instanceId>`
|
|
98
|
+
* spec — the ONE authority for capacity and the restart knobs, so no decision or supervision
|
|
99
|
+
* seam trusts a caller-supplied policy. The read is fail-closed: a missing registration is
|
|
100
|
+
* `failed-precondition` (there is no policy to admit or supervise under), and a registration
|
|
101
|
+
* without an `activation` block means the endpoint is not virtual, so a virtual decision over
|
|
102
|
+
* it refuses. `readSpec` MUST be LEADER-SERVED (the policy read gates escalation/retirement and
|
|
103
|
+
* capacity, so it is FENCING by use; a follower Direct Get could read a stale wider policy) and
|
|
104
|
+
* returns the spec value plus its store revision, so a decision can carry the revision and
|
|
105
|
+
* RE-PROVE it after its later awaits (a re-registration must not narrow the policy mid-flight).
|
|
106
|
+
*/
|
|
107
|
+
async function readRegisteredActivation(readSpec, endpoint, instanceId) {
|
|
108
|
+
const iId = assertLifecycleToken(instanceId, "instanceId");
|
|
109
|
+
const entry = await readSpec();
|
|
110
|
+
if (entry === undefined)
|
|
111
|
+
throw new EpEnvelopeError("failed-precondition", `endpoint "${endpoint}/${iId}" has no registered svc spec; a virtual decision has no policy to bind to (SPEC 13.6)`);
|
|
112
|
+
const spec = parseServiceSpec(entry.value, { endpoint });
|
|
113
|
+
if (spec.activation === undefined)
|
|
114
|
+
throw new EpEnvelopeError("failed-precondition", `endpoint "${endpoint}/${iId}" is registered without an activation policy (not a virtual endpoint); no on-demand admission or restart supervision applies (SPEC 13.6)`);
|
|
115
|
+
return { policy: parseActivationPolicy(spec.activation), revision: entry.revision };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The §13.6 admission fence, in the canonicalizer's decide path (admission BEFORE decision):
|
|
119
|
+
* 1. RE-PROVE the serial pin LIVE: the canonicalizer durable must report
|
|
120
|
+
* `max_ack_pending === 1` and its exact EPJ filter (both editable post-create); a drifted
|
|
121
|
+
* admission durable means the serial invariant is GONE — refuse, never decide;
|
|
122
|
+
* 2. RECONCILE the caller's outstanding acceptances (`reconcileWorkItem` per item, the §13.6
|
|
123
|
+
* predicate): an accepted item with no terminal, no settled lease, and no live pool entry
|
|
124
|
+
* is re-enqueued NOW, so repaired work is inside the count new work competes under;
|
|
125
|
+
* 3. read occupancy FRESH ({@link readPoolOccupancy}, fail-closed against every editable knob);
|
|
126
|
+
* 4. verdict: `occupancy < policy.capacity` (the REGISTERED activation policy, closed schema).
|
|
127
|
+
* Infrastructure failures THROW (`unavailable`/`failed-precondition`); only a genuine
|
|
128
|
+
* over-capacity state returns `admitted: false`.
|
|
129
|
+
*/
|
|
130
|
+
export async function admitVirtualWork(ctx, args) {
|
|
131
|
+
assertWorkPoolContext(ctx);
|
|
132
|
+
if (!Number.isSafeInteger(args.now))
|
|
133
|
+
invalid(`now ${String(args.now)} is not an integer`);
|
|
134
|
+
// The capacity is bound to the REGISTERED policy, read leader-served (the admission fence is
|
|
135
|
+
// a decision gate): a caller cannot pass a wider capacity than the endpoint registered.
|
|
136
|
+
const specKey = recordSpecKey(RECORD_KINDS.svc, [args.endpoint, args.instanceId]);
|
|
137
|
+
const readPolicy = () => readRegisteredActivation(() => readRecordLeader(ctx.jsm, ctx.space, specKey), args.endpoint, args.instanceId);
|
|
138
|
+
const { policy, revision: policyRevision } = await readPolicy();
|
|
139
|
+
// (1) The serial pin is proved LIVE at every admission, not assumed from creation.
|
|
140
|
+
const admissionDurable = canonDurable(args.endpoint);
|
|
141
|
+
let admissionInfo;
|
|
142
|
+
try {
|
|
143
|
+
admissionInfo = await ctx.jsm.consumers.info(epjStreamName(ctx.space), admissionDurable);
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
throw new EpEnvelopeError("unavailable", `the admission-durable read failed for ${admissionDurable}; the serial pin cannot be assumed, admission fails closed (SPEC 13.6): ${e?.message ?? String(e)}`);
|
|
147
|
+
}
|
|
148
|
+
if (admissionInfo.config.max_ack_pending !== 1)
|
|
149
|
+
throw new EpEnvelopeError("failed-precondition", `admission durable ${admissionDurable} reports max_ack_pending ${String(admissionInfo.config.max_ack_pending)}, not 1; MaxAckPending is editable post-create and without the pin two submissions can observe the same free slot; repin the consumer (SPEC 13.6)`);
|
|
150
|
+
// Re-prove the load-bearing shape too (defense against a delete/recreate substituting a
|
|
151
|
+
// semantically different consumer that keeps the same max_ack_pending/filter): the serial
|
|
152
|
+
// pin only serializes when ack is Explicit and delivery is pull (no deliver_subject).
|
|
153
|
+
if (admissionInfo.config.ack_policy !== AckPolicy.Explicit)
|
|
154
|
+
throw new EpEnvelopeError("failed-precondition", `admission durable ${admissionDurable} reports ack_policy "${String(admissionInfo.config.ack_policy)}", not explicit; max_ack_pending only serializes an ack-barriered consumer (SPEC 13.9)`);
|
|
155
|
+
if (admissionInfo.config.deliver_subject !== undefined)
|
|
156
|
+
throw new EpEnvelopeError("failed-precondition", `admission durable ${admissionDurable} is a PUSH consumer (deliver_subject set); the canonicalizer is pull-only, a push shape does not serialize the decision path (SPEC 13.9)`);
|
|
157
|
+
const expectedAdmissionFilter = `${spacePrefix(ctx.space)}.epj.${endpointToken(args.endpoint)}.>`;
|
|
158
|
+
if (admissionInfo.config.filter_subjects !== undefined || admissionInfo.config.filter_subject !== expectedAdmissionFilter)
|
|
159
|
+
throw new EpEnvelopeError("failed-precondition", `admission durable ${admissionDurable} reports filter "${String(admissionInfo.config.filter_subject)}", not the endpoint's own "${expectedAdmissionFilter}"; a drifted admission filter serializes the wrong stream; repin the consumer (SPEC 13.9)`);
|
|
160
|
+
// (2) Repair BEFORE counting.
|
|
161
|
+
let repaired = 0;
|
|
162
|
+
for (const o of args.outstanding ?? []) {
|
|
163
|
+
const verdict = await reconcileWorkItem(ctx, { ref: o.ref, itemBytes: o.itemBytes, workExpiry: o.workExpiry, now: args.now });
|
|
164
|
+
if (verdict.state === "re-enqueued")
|
|
165
|
+
repaired++;
|
|
166
|
+
}
|
|
167
|
+
// (3) occupancy
|
|
168
|
+
const occupancy = await readPoolOccupancy(ctx, args.endpoint, args.pool);
|
|
169
|
+
// (4) RE-PROVE the policy revision after every await above: a re-registration that NARROWED
|
|
170
|
+
// capacity mid-flight must not let this decision admit under the stale wider policy. The
|
|
171
|
+
// decision binds the re-proven policy (§13.6); the caller carries `policyRevision` into the
|
|
172
|
+
// acceptance commit so the accept CAS (after this helper returns) fences on the same coordinate.
|
|
173
|
+
const fresh = await readPolicy();
|
|
174
|
+
if (fresh.revision !== policyRevision)
|
|
175
|
+
throw new EpEnvelopeError("conflict", `endpoint "${args.endpoint}/${args.instanceId}" re-registered during admission (policy revision ${policyRevision} → ${fresh.revision}); the decision refuses rather than admit under a stale policy (SPEC 13.6)`);
|
|
176
|
+
return { admitted: occupancy.occupancy < fresh.policy.capacity, occupancy, capacity: fresh.policy.capacity, repaired, policyRevision: fresh.revision };
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Watch one pool by BOUNDED POLLING of its exact Consumer INFO and start the instance through
|
|
180
|
+
* the bound seam when there is work and no live instance. See the module header for the
|
|
181
|
+
* authority profile this loop is confined to. One start is in flight at a time (the guard is
|
|
182
|
+
* local dedupe, not the correctness fence — registration owns that); polls stay serial with the
|
|
183
|
+
* tick chain, so a slow INFO read never stacks requests.
|
|
184
|
+
*/
|
|
185
|
+
export function startVirtualActivator(opts) {
|
|
186
|
+
if (!ACTIVATOR_CONTEXTS.has(opts.ctx))
|
|
187
|
+
throw new EpEnvelopeError("failed-precondition", `the activator context was not constructed by activatorContext(); a hand-assembled resource bundle never authorizes (SPEC 13.4)`);
|
|
188
|
+
const pollMs = opts.pollMs ?? 500;
|
|
189
|
+
const maxPollMs = opts.maxPollMs ?? 5000;
|
|
190
|
+
if (!Number.isSafeInteger(pollMs) || pollMs <= 0)
|
|
191
|
+
invalid(`pollMs ${String(opts.pollMs)} is not a positive integer`);
|
|
192
|
+
if (!Number.isSafeInteger(maxPollMs) || maxPollMs < pollMs)
|
|
193
|
+
invalid(`maxPollMs ${String(opts.maxPollMs)} is not a FINITE integer >= pollMs ${pollMs}; the backoff ceiling bounds the activation delay`);
|
|
194
|
+
if (typeof opts.onError !== "function")
|
|
195
|
+
invalid("onError is required; an unobserved activator failure is a silent liveness hole");
|
|
196
|
+
const setTimeoutFn = opts.setTimeoutFn ?? ((fn, ms) => setTimeout(fn, ms));
|
|
197
|
+
const clearTimeoutFn = opts.clearTimeoutFn ?? ((h) => clearTimeout(h));
|
|
198
|
+
let stopped = false;
|
|
199
|
+
let timer;
|
|
200
|
+
let startInFlight = false;
|
|
201
|
+
let delay = pollMs;
|
|
202
|
+
let polls = 0, starts = 0, infoErrors = 0, startErrors = 0, lastOccupancy = 0;
|
|
203
|
+
const schedule = () => {
|
|
204
|
+
if (stopped)
|
|
205
|
+
return;
|
|
206
|
+
timer = setTimeoutFn(() => { void tick(); }, delay);
|
|
207
|
+
timer.unref?.();
|
|
208
|
+
};
|
|
209
|
+
const tick = async () => {
|
|
210
|
+
if (stopped)
|
|
211
|
+
return;
|
|
212
|
+
polls++;
|
|
213
|
+
let occ;
|
|
214
|
+
try {
|
|
215
|
+
occ = await readPoolOccupancy(opts.ctx, opts.endpoint, opts.pool);
|
|
216
|
+
}
|
|
217
|
+
catch (e) {
|
|
218
|
+
if (stopped)
|
|
219
|
+
return; // stop() during the INFO: report nothing, schedule nothing
|
|
220
|
+
infoErrors++;
|
|
221
|
+
opts.onError("info", e);
|
|
222
|
+
delay = Math.min(maxPollMs, delay * 2);
|
|
223
|
+
schedule();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (stopped)
|
|
227
|
+
return; // stop() during the INFO: a not-yet-started activation never begins
|
|
228
|
+
lastOccupancy = occ.occupancy;
|
|
229
|
+
if (occ.occupancy > 0) {
|
|
230
|
+
delay = pollMs; // work present: poll at base rate
|
|
231
|
+
if (!startInFlight) {
|
|
232
|
+
startInFlight = true;
|
|
233
|
+
// Deliberately NOT awaited by the tick chain: a slow or wedged start must not stop the
|
|
234
|
+
// polling that makes the wedge observable. The flag dedupes; errors surface via onError.
|
|
235
|
+
void (async () => {
|
|
236
|
+
let begun = false;
|
|
237
|
+
try {
|
|
238
|
+
const live = await opts.isLive();
|
|
239
|
+
if (stopped)
|
|
240
|
+
return; // stop() during the liveness read: do not begin
|
|
241
|
+
if (!live) {
|
|
242
|
+
starts++;
|
|
243
|
+
begun = true;
|
|
244
|
+
await opts.startInstance();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
catch (e) {
|
|
248
|
+
// A pre-start failure (a rejecting isLive) AFTER stop is SILENT: no start began, so
|
|
249
|
+
// it is not a real activation fault, only a race the stop won. A failure once the
|
|
250
|
+
// start actually BEGAN is always reported (the started work's result matters).
|
|
251
|
+
if (!begun && stopped)
|
|
252
|
+
return;
|
|
253
|
+
startErrors++;
|
|
254
|
+
opts.onError("start", e);
|
|
255
|
+
}
|
|
256
|
+
finally {
|
|
257
|
+
startInFlight = false;
|
|
258
|
+
}
|
|
259
|
+
})();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
delay = Math.min(maxPollMs, delay * 2); // quiet: back off toward the finite ceiling
|
|
264
|
+
}
|
|
265
|
+
schedule();
|
|
266
|
+
};
|
|
267
|
+
schedule();
|
|
268
|
+
return {
|
|
269
|
+
stop() {
|
|
270
|
+
stopped = true;
|
|
271
|
+
if (timer)
|
|
272
|
+
clearTimeoutFn(timer);
|
|
273
|
+
},
|
|
274
|
+
stats: () => ({ polls, starts, infoErrors, startErrors, lastOccupancy }),
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
// ---- restart-intensity supervision -------------------------------------------------------------
|
|
278
|
+
/** §13.6 defaults: more than 3 restarts within 60s escalates. */
|
|
279
|
+
export const RESTART_MAX_DEFAULT = 3;
|
|
280
|
+
export const RESTART_WINDOW_MS_DEFAULT = 60_000;
|
|
281
|
+
/** The SUPERVISOR-OWNED status field carrying the durable restart history: entries are
|
|
282
|
+
* `{ t, epoch }`, one per DYING PROCESS EPOCH (a real restart advances the epoch, so a
|
|
283
|
+
* replayed note is an idempotent no-op). The field is defined by the service module because
|
|
284
|
+
* {@link writeServiceStatus} carries it forward through instance-side writes. */
|
|
285
|
+
export const RESTART_HISTORY_FIELD = SERVICE_RESTART_HISTORY_FIELD;
|
|
286
|
+
/** The reconciler's durable retirement-complete mark (see {@link reconcileEscalation}). */
|
|
287
|
+
export const RETIRED_MARK_FIELD = SERVICE_RETIRED_MARK_FIELD;
|
|
288
|
+
const td = new TextDecoder();
|
|
289
|
+
function parseHistory(raw, what) {
|
|
290
|
+
if (raw === undefined)
|
|
291
|
+
return [];
|
|
292
|
+
if (!Array.isArray(raw) || !raw.every((e) => isRec(e) && uint(e.t) && uint(e.epoch)))
|
|
293
|
+
throw new EpEnvelopeError("internal", `the stored restart history for ${what} is garbled; a mediated-writer record that does not validate is a writer bug (SPEC 13.3)`);
|
|
294
|
+
return raw;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Note one restart of a virtual instance, DURABLY and CAS-fenced (§13.6 supervision):
|
|
298
|
+
* - the restart history rides the instance's `svc….status` record and is SUPERVISOR-OWNED
|
|
299
|
+
* ({@link writeServiceStatus} carries it forward through every unpinned instance write, so
|
|
300
|
+
* a successor's ordinary `ready` convergence cannot reset or forge it);
|
|
301
|
+
* - the write is pinned to the revision THIS call read (`expectedStatusRevision`), so two
|
|
302
|
+
* concurrent notes can never merge-lose a restart (one loses `conflict` and retries);
|
|
303
|
+
* - each entry is BOUND to the dying process epoch: a note whose epoch is already recorded is
|
|
304
|
+
* an idempotent NO-OP (`duplicate: true`) — one physical restart counts once, however many
|
|
305
|
+
* times its notification is retried or duplicated;
|
|
306
|
+
* - a CLOCK REGRESSION (`now` before the newest recorded restart) REFUSES
|
|
307
|
+
* (`failed-precondition`): a rolled-back supervisor clock must not amnesty durable history;
|
|
308
|
+
* - a stored {@link SERVICE_ESCALATED} state REFUSES (`failed-precondition`): the instance
|
|
309
|
+
* has stopped restarting, terminally — {@link reconcileEscalation} is the retirement retry;
|
|
310
|
+
* - more than `maxRestarts` entries within `restartWindowMs` (the pruned history plus this
|
|
311
|
+
* note) ESCALATES: the status commits {@link SERVICE_ESCALATED} first (irreversible at the
|
|
312
|
+
* writer), then the caller's D13 retire seam runs (`retireLifecycle`, the §13.1 terminal
|
|
313
|
+
* barrier, MUST be idempotent). A retire failure is `unavailable` with the escalated status
|
|
314
|
+
* already durable — honest halves; {@link reconcileEscalation} retries until it completes.
|
|
315
|
+
* A non-escalating note records {@link SERVICE_EXITED} (the instance just died; its successor
|
|
316
|
+
* writes `ready` itself when it registers) with the pruned history plus this note.
|
|
317
|
+
*/
|
|
318
|
+
export async function noteInstanceRestart(kv, args) {
|
|
319
|
+
if (!uint(args.now))
|
|
320
|
+
invalid(`now ${String(args.now)} is not an unsigned integer`);
|
|
321
|
+
if (!uint(args.epoch))
|
|
322
|
+
invalid(`epoch ${String(args.epoch)} is not an unsigned integer`);
|
|
323
|
+
if (typeof args.retireLifecycle !== "function")
|
|
324
|
+
invalid("retireLifecycle is required; escalation without terminal retirement is a half-fence");
|
|
325
|
+
if (typeof args.readSpecLeader !== "function")
|
|
326
|
+
invalid("readSpecLeader is required; the restart-intensity policy is FENCING and must be read leader-served, never a follower KV get (SPEC 13.6/13.9)");
|
|
327
|
+
const iId = assertLifecycleToken(args.instanceId, "instanceId");
|
|
328
|
+
const what = `"${args.endpoint}/${args.instanceId}"`;
|
|
329
|
+
// The restart-intensity thresholds are bound to the REGISTERED activation policy, read
|
|
330
|
+
// LEADER-SERVED (fencing by use), never caller-supplied and never follower-stale: a supervisor
|
|
331
|
+
// cannot loosen the window to suppress an escalation, and a stale wider window cannot either.
|
|
332
|
+
const { policy } = await readRegisteredActivation(args.readSpecLeader, args.endpoint, iId);
|
|
333
|
+
const maxRestarts = policy.maxRestarts ?? RESTART_MAX_DEFAULT;
|
|
334
|
+
const windowMs = policy.restartWindowMs ?? RESTART_WINDOW_MS_DEFAULT;
|
|
335
|
+
const key = recordStatusKey(RECORD_KINDS.svc, [args.endpoint, iId]);
|
|
336
|
+
const stored = await kv.get(key);
|
|
337
|
+
let prior;
|
|
338
|
+
let expectedStatusRevision = 0;
|
|
339
|
+
if (stored && stored.operation === "PUT") {
|
|
340
|
+
prior = parseServiceStatus(JSON.parse(td.decode(stored.value)));
|
|
341
|
+
expectedStatusRevision = stored.revision;
|
|
342
|
+
}
|
|
343
|
+
else if (stored && stored.operation !== "PUT") {
|
|
344
|
+
throw new EpEnvelopeError("failed-precondition", `the status for ${what} carries a ${stored.operation} marker; supervising over a deletion would resurrect authoritative state (SPEC 13.12)`);
|
|
345
|
+
}
|
|
346
|
+
if (prior?.state === SERVICE_ESCALATED)
|
|
347
|
+
throw new EpEnvelopeError("failed-precondition", `${what} is escalated; the instance has stopped restarting and its lifecycle retires terminally (SPEC 13.6; reconcileEscalation is the retirement retry), a further restart note never applies`);
|
|
348
|
+
const history = parseHistory(prior?.[RESTART_HISTORY_FIELD], what);
|
|
349
|
+
// CLOCK REGRESSION is checked BEFORE the duplicate short-circuit: a rolled-back supervision
|
|
350
|
+
// clock must fail loud on EVERY note, including a replay, rather than silently returning a
|
|
351
|
+
// stale window count computed against the bad clock (SPEC 13.6).
|
|
352
|
+
const newest = history.reduce((m, e) => Math.max(m, e.t), 0);
|
|
353
|
+
if (args.now < newest)
|
|
354
|
+
throw new EpEnvelopeError("failed-precondition", `${what}: the supervision clock ${args.now} is BEHIND the newest recorded restart ${newest}; a clock regression must not amnesty durable history (SPEC 13.6); restore the clock or reconcile manually`);
|
|
355
|
+
if (history.some((e) => e.epoch === args.epoch)) {
|
|
356
|
+
// The SAME dying epoch is already recorded: this note is a replay/duplicate of a restart
|
|
357
|
+
// already counted — idempotent no-op (a real restart advances the epoch).
|
|
358
|
+
const inWindow = history.filter((e) => args.now - e.t < windowMs).length;
|
|
359
|
+
return { escalated: false, restartsInWindow: inWindow, duplicate: true };
|
|
360
|
+
}
|
|
361
|
+
const pruned = history.filter((e) => args.now - e.t < windowMs);
|
|
362
|
+
pruned.push({ t: args.now, epoch: args.epoch });
|
|
363
|
+
const escalated = pruned.length > maxRestarts;
|
|
364
|
+
const status = {
|
|
365
|
+
epoch: args.epoch,
|
|
366
|
+
state: escalated ? SERVICE_ESCALATED : SERVICE_EXITED,
|
|
367
|
+
observedSpecRevision: prior?.observedSpecRevision ?? 0,
|
|
368
|
+
[RESTART_HISTORY_FIELD]: pruned,
|
|
369
|
+
};
|
|
370
|
+
const committedRevision = await writeServiceStatus(kv, {
|
|
371
|
+
endpoint: args.endpoint,
|
|
372
|
+
instanceId: iId,
|
|
373
|
+
epoch: args.epoch,
|
|
374
|
+
status,
|
|
375
|
+
readProcessEpoch: args.readProcessEpoch,
|
|
376
|
+
expectedStatusRevision,
|
|
377
|
+
supervisor: mintSupervisorWrite(), // the package-private authority to originate the history + escalation
|
|
378
|
+
});
|
|
379
|
+
if (escalated) {
|
|
380
|
+
try {
|
|
381
|
+
await args.retireLifecycle();
|
|
382
|
+
}
|
|
383
|
+
catch (e) {
|
|
384
|
+
throw new EpEnvelopeError("unavailable", `${what} escalated durably (the status stands and blocks restarts) but the lifecycle retire seam failed; reconcileEscalation retries it, nothing un-escalates (SPEC 13.6/13.1): ${e?.message ?? String(e)}`);
|
|
385
|
+
}
|
|
386
|
+
// Best-effort retirement-complete mark (the ONE touch an escalated row admits, pinned).
|
|
387
|
+
// A failure here is harmless: reconcileEscalation re-invokes the idempotent retire seam
|
|
388
|
+
// and writes the mark on its own pass.
|
|
389
|
+
try {
|
|
390
|
+
await updateRecordEntry(kv, key, { ...status, [RETIRED_MARK_FIELD]: args.now }, committedRevision);
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
/* reconciler backstop */
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return { escalated, restartsInWindow: pruned.length, duplicate: false };
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* The escalation RETIREMENT reconciler (§13.6: "the lifecycle retires terminally" must survive
|
|
400
|
+
* a crash or a failed retire between the escalation CAS and the barrier): acts on an
|
|
401
|
+
* already-escalated status row, re-invokes the caller's IDEMPOTENT retire seam until it
|
|
402
|
+
* succeeds, and then durably marks completion (a revision-pinned direct update — the one touch
|
|
403
|
+
* an escalated row admits; {@link writeServiceStatus} refuses everything else). Run it on
|
|
404
|
+
* supervisor startup and whenever {@link noteInstanceRestart} refuses on an escalated row.
|
|
405
|
+
* Returns what it found and whether THIS pass did the retirement.
|
|
406
|
+
*/
|
|
407
|
+
export async function reconcileEscalation(kv, args) {
|
|
408
|
+
if (typeof args.retireLifecycle !== "function")
|
|
409
|
+
invalid("retireLifecycle is required");
|
|
410
|
+
if (!uint(args.now))
|
|
411
|
+
invalid(`now ${String(args.now)} is not an unsigned integer`);
|
|
412
|
+
const iId = assertLifecycleToken(args.instanceId, "instanceId");
|
|
413
|
+
const key = recordStatusKey(RECORD_KINDS.svc, [args.endpoint, iId]);
|
|
414
|
+
const stored = await kv.get(key);
|
|
415
|
+
if (!stored)
|
|
416
|
+
return { escalated: false, retired: false, acted: false }; // TRUE absence: never escalated
|
|
417
|
+
// A DEL/PURGE marker is CORRUPTION, not clean absence: reconciling over it could let an
|
|
418
|
+
// escalated identity's retirement silently never run. Fail closed (§13.12 retention floor).
|
|
419
|
+
if (stored.operation !== "PUT")
|
|
420
|
+
throw new EpEnvelopeError("failed-precondition", `the status for "${args.endpoint}/${args.instanceId}" carries a ${stored.operation} marker; a deletion is never clean absence, an escalated identity must not skip retirement (SPEC 13.12)`);
|
|
421
|
+
const status = parseServiceStatus(JSON.parse(td.decode(stored.value)));
|
|
422
|
+
if (status.state !== SERVICE_ESCALATED)
|
|
423
|
+
return { escalated: false, retired: false, acted: false };
|
|
424
|
+
if (status[RETIRED_MARK_FIELD] !== undefined)
|
|
425
|
+
return { escalated: true, retired: true, acted: false };
|
|
426
|
+
try {
|
|
427
|
+
await args.retireLifecycle();
|
|
428
|
+
}
|
|
429
|
+
catch (e) {
|
|
430
|
+
throw new EpEnvelopeError("unavailable", `the retirement of escalated "${args.endpoint}/${args.instanceId}" failed again; the escalation stands and this reconciler retries (SPEC 13.6/13.1): ${e?.message ?? String(e)}`);
|
|
431
|
+
}
|
|
432
|
+
try {
|
|
433
|
+
await updateRecordEntry(kv, key, { ...status, [RETIRED_MARK_FIELD]: args.now }, stored.revision);
|
|
434
|
+
}
|
|
435
|
+
catch (e) {
|
|
436
|
+
throw new EpEnvelopeError("conflict", `the retirement of "${args.endpoint}/${args.instanceId}" completed but its mark lost a CAS (a concurrent reconciler passed); re-run to converge: ${e?.message ?? String(e)}`);
|
|
437
|
+
}
|
|
438
|
+
return { escalated: true, retired: true, acted: true };
|
|
439
|
+
}
|
|
440
|
+
//# sourceMappingURL=endpoint-virtual.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-virtual.js","sourceRoot":"","sources":["../src/endpoint-virtual.ts"],"names":[],"mappings":"AA+DA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,mBAAmB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAA8C,MAAM,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