@substrat-run/adapter-cloudflare 0.113.0 → 0.116.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 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAaL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EA2CpB,KAAK,sBAAsB,EAI3B,KAAK,YAAY,EAEjB,KAAK,QAAQ,EAQb,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAEpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,IAAI,EAET,KAAK,gBAAgB,EAOrB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAKd,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAI1B,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,WAAW,EAQhB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAExB,KAAK,cAAc,EAGnB,KAAK,SAAS,EACd,KAAK,cAAc,EAGnB,KAAK,OAAO,EAIZ,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAE3B,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEnB,KAAK,QAAQ,EAGb,KAAK,iBAAiB,EAIvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAYL,KAAK,gBAAgB,EAOrB,KAAK,uBAAuB,EAE5B,KAAK,gBAAgB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AE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,aAAa,EACzB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAQf;CACF"}
package/dist/host.js CHANGED
@@ -1,6 +1,7 @@
1
- import { fromWireFailure, accessLogEntry, adminLogEntry, opsFailureEntry, opsFailureFingerprint, issueEntry, sweepRunEntry, FRESHNESS_HEARTBEAT_MINUTES, sweepRunsPayload, modelUsageEntry, attachmentRecord, createTenantInput, identityLink, identityPool, createOrgInput, promotionAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, publishVersionInput, AUTO_ADMISSION_NOTE, registerVerticalInput, vertical as verticalSchema, verticalServingState, verticalChannel, verticalVersion, connection, capabilityGrant, connectionGrant, connectionGrantRecord, connectionSecret, systemGrant, entitlementGrant, entitlementGrantInput, instant, meterReading, subjectRef, createConnectionInput, projectedConnectionGrant, projectedConnectionKey, moduleManifest, org as orgSchema, orgMembership, resolvedIdentity, roleDefinition, scope as scopeSchema, tenant as tenantSchema, tenantRole, delegatedReadRecord, subjectShredReceipt, platformRequest, connectorDispatchKind, outboundOfManifestJson, substratError, redrainEventsInput, } from '@substrat-run/contracts';
1
+ import { fromWireFailure, accessLogEntry, adminLogEntry, opsFailureEntry, opsFailureFingerprint, issueEntry, sweepRunEntry, FRESHNESS_HEARTBEAT_MINUTES, sweepRunsPayload, modelUsageEntry, attachmentRecord, createTenantInput, identityLink, identityPool, createOrgInput, promotionAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, publishVersionInput, AUTO_ADMISSION_NOTE, registerVerticalInput, vertical as verticalSchema, verticalServingState, verticalChannel, verticalVersion, connection, capabilityGrant, connectionGrant, connectionGrantRecord, connectionSecret, systemGrant, entitlementGrant, entitlementGrantInput, instant, meterReading, subjectRef, createConnectionInput, projectedConnectionGrant, projectedConnectionKey, moduleManifest, org as orgSchema, orgMembership, resolvedIdentity, identityMembership, roleDefinition, scope as scopeSchema, tenant as tenantSchema, tenantRole, delegatedReadRecord, subjectShredReceipt, platformRequest, connectorDispatchKind, outboundOfManifestJson, substratError, redrainEventsInput, } from '@substrat-run/contracts';
2
2
  import { normalizeHostname, toRouteTarget } from './route-resolver.js';
3
- import { attachmentBlobKey, entitlementDenial, foldMeterReading, parseValidationRecords, resolveScopeRecord, ulid, foldModelUsage, backoffAt, resolveRetryPolicy, isSecretBoxConfigured, unconfiguredSecretBox, createSubjectKeys, generateSealingKeyPair, openSealed, ImpersonationRefused, assertSessionUsable, impersonationRowValues, mapImpersonationRow, newImpersonationSession, globalFetch, assertRedrainWindow, } from '@substrat-run/kernel';
3
+ import { attachmentBlobKey, entitlementDenial, foldMeterReading, parseValidationRecords, resolveScopeRecord, ulid, foldModelUsage, backoffAt, resolveRetryPolicy, isSecretBoxConfigured, unconfiguredSecretBox, createSubjectKeys, generateSealingKeyPair, openSealed, ImpersonationRefused, assertSessionUsable, impersonationRowValues, mapImpersonationRow, newImpersonationSession, jobRunOf, runDueJobRuns, startJobRun, globalFetch, assertRedrainWindow, } from '@substrat-run/kernel';
4
+ import { isOrangeToOrange, isUpgradeRequest, LIVE_MODE_HEADER, LIVE_PRINCIPAL_HEADER, LIVE_SCOPE_HEADER, LIVE_SUBSCRIBE_PATH, LIVE_TENANT_HEADER, } from './live-reads.js';
4
5
  import { tenantStoreDatabaseName } from './d1.js';
5
6
  import { blobStoreBucketName, r2TenantBlobStore } from './r2.js';
6
7
  /** DO row → contract shape. Never reads the secrets table — that is the split. */
@@ -99,6 +100,14 @@ export class CloudflareScopeHost {
99
100
  /** Worker-side attachment-bucket resolver (#473); undefined ⇒ attachments() refuses. */
100
101
  attachmentBuckets;
101
102
  executors = new Map();
103
+ /**
104
+ * `<moduleId>/<job>` → the pass body and its default step policy (#1577). Host
105
+ * code like `executors`, and keyed the way a run row is: the coalescing key's
106
+ * first two thirds, so a run read off the DO finds its handler by the columns it
107
+ * already carries. The HANDLER stays on the coordinator — it holds credentials
108
+ * and calls the internet, which is why the DO never sees it.
109
+ */
110
+ jobs = new Map();
102
111
  /**
103
112
  * The event currently being effected, stamped onto admin rows the executor writes.
104
113
  * Ambient rather than threaded through every HostAdmin signature: set and cleared
@@ -245,7 +254,16 @@ export class CloudflareScopeHost {
245
254
  * delivery cannot wedge the ones behind it. At-least-once still requires
246
255
  * idempotent handlers.
247
256
  */
248
- async drainExecutors(tenantId, scopeId) {
257
+ async drainExecutors(tenantId, scopeId,
258
+ /**
259
+ * #1525: the call this drain pass is running in, or null.
260
+ *
261
+ * The coordinator is the ONLY side that knows. Executors run here, not in the DO,
262
+ * so by the time the journal RPC arrives the DO's queued body has returned and its
263
+ * own `invocationId` field reads null — an ambient read there would record "no
264
+ * call" for every attempt an operation's own tail made.
265
+ */
266
+ invocationId) {
249
267
  const report = {
250
268
  attempted: 0,
251
269
  delivered: 0,
@@ -272,17 +290,17 @@ export class CloudflareScopeHost {
272
290
  // the authority this host lacks. The intent row carries the retry
273
291
  // state from here on; the handler's own idempotency ledger absorbs
274
292
  // the at-least-once residue, as it already must in-process.
275
- await stub.routeExecutorEventToPlatform(event.id, deliveryId, connectorDispatchKind(executor.provider), JSON.stringify({ executorId: id, event }), JSON.stringify({ system: 'connector-dispatch' }));
293
+ await stub.routeExecutorEventToPlatform(event.id, deliveryId, connectorDispatchKind(executor.provider), JSON.stringify({ executorId: id, event }), JSON.stringify({ system: 'connector-dispatch' }), invocationId);
276
294
  report.routedToPlatform += 1;
277
295
  }
278
296
  else if (executor.kind === 'connector') {
279
297
  await executor.handler(await this.connectorContext(tenantId, scopeId, executor.timeoutMs, event.id), event);
280
- await stub.recordExecutorAttempt(event.id, deliveryId, null, null);
298
+ await stub.recordExecutorAttempt(event.id, deliveryId, null, null, invocationId);
281
299
  report.delivered += 1;
282
300
  }
283
301
  else {
284
302
  await executor.handler(this.admin, event);
285
- await stub.recordExecutorAttempt(event.id, deliveryId, null, null);
303
+ await stub.recordExecutorAttempt(event.id, deliveryId, null, null, invocationId);
286
304
  report.delivered += 1;
287
305
  }
288
306
  }
@@ -293,7 +311,7 @@ export class CloudflareScopeHost {
293
311
  const prior = await stub.executorAttempts(event.id, deliveryId);
294
312
  const attempts = prior + 1;
295
313
  const exhausted = attempts >= executor.retry.maxAttempts;
296
- await stub.recordExecutorAttempt(event.id, deliveryId, message, exhausted ? null : backoffAt(attempts, executor.retry, new Date()));
314
+ await stub.recordExecutorAttempt(event.id, deliveryId, message, exhausted ? null : backoffAt(attempts, executor.retry, new Date()), invocationId);
297
315
  if (exhausted)
298
316
  report.deadLettered += 1;
299
317
  else
@@ -311,7 +329,65 @@ export class CloudflareScopeHost {
311
329
  // does not get its effects driven either.
312
330
  await this.cp.validateScopeAccess(tenantId, scopeId);
313
331
  await this.migrateAndRecord(scopeId);
314
- return this.drainExecutors(tenantId, scopeId);
332
+ // #1525: null, and honestly so — a sweep is not a call. An attempt this pass makes
333
+ // records no invocation, which is what distinguishes it from the first attempt the
334
+ // emitting operation's own tail made.
335
+ return this.drainExecutors(tenantId, scopeId, null);
336
+ }
337
+ registerJob(moduleId, name, handler, retry) {
338
+ const key = `${moduleId}/${name}`;
339
+ if (this.jobs.has(key))
340
+ throw new Error(`job '${key}' is already registered`);
341
+ this.jobs.set(key, { handler, retry });
342
+ }
343
+ /**
344
+ * D-14's DURABLE driver: the run store is RPC to the scope DO, and nothing else.
345
+ *
346
+ * The pass engine stays on the coordinator — it is the same kernel code the pure
347
+ * adapter runs, so the two drivers cannot disagree about when a step is skipped or
348
+ * when a run fails. What crosses into the DO is a row read and a row write, which
349
+ * is also the only part that has to be durable.
350
+ *
351
+ * Every step costs a round trip, deliberately. Batching a pass's steps into one
352
+ * write at the end would be cheaper and would lose exactly the work an eviction
353
+ * mid-pass is supposed to keep — and a DO is evicted and revived constantly.
354
+ */
355
+ jobStore(scopeId) {
356
+ const stub = this.scopeStub(scopeId);
357
+ return {
358
+ startOrJoin: (key, row) => stub.jobRunStartOrJoin(key.moduleId, key.job, key.instance, row),
359
+ get: (id) => stub.jobRunById(id),
360
+ due: (now, limit, afterId) => stub.jobRunsDue(now, limit, afterId),
361
+ list: (filter) => stub.jobRunList(filter),
362
+ patch: (id, patch) => stub.jobRunPatch(id, patch),
363
+ commitPass: (id, patch) => stub.jobCommitPass(id, patch),
364
+ step: (runId, name) => stub.jobStepRow(runId, name),
365
+ recordStep: (runId, name, result, attempts, lastError, at) => stub.jobStepRecord(runId, name, result, attempts, lastError, at),
366
+ };
367
+ }
368
+ async startJobRun(tenantId, scopeId, input) {
369
+ await this.cp.validateScopeAccess(tenantId, scopeId);
370
+ await this.migrateAndRecord(scopeId);
371
+ return jobRunOf(await startJobRun(this.jobStore(scopeId), input, ulid, () => new Date().toISOString()));
372
+ }
373
+ async runDueJobs(tenantId, scopeId, options) {
374
+ // Same lifecycle gate as `drainDue`: a suspended scope's runs wait rather than
375
+ // advance, and an archived one's never move again.
376
+ await this.cp.validateScopeAccess(tenantId, scopeId);
377
+ await this.migrateAndRecord(scopeId);
378
+ return runDueJobRuns({
379
+ store: this.jobStore(scopeId),
380
+ handlerFor: (run) => this.jobs.get(`${run.module_id}/${run.job}`),
381
+ now: () => new Date().toISOString(),
382
+ openScope: (run) => this.getSystemScope(run.module_id, tenantId, scopeId),
383
+ maxPasses: options?.maxPasses,
384
+ limit: options?.limit,
385
+ });
386
+ }
387
+ async jobRuns(tenantId, scopeId, filter) {
388
+ await this.cp.validateScopeAccess(tenantId, scopeId);
389
+ await this.migrateAndRecord(scopeId);
390
+ return (await this.jobStore(scopeId).list(filter ?? {})).map(jobRunOf);
315
391
  }
316
392
  async dispatchConnector(tenantId, scopeId, handler, event, options) {
317
393
  // The platform half of a routed delivery (#574 phase 3). The same lifecycle gate as
@@ -512,6 +588,10 @@ export class CloudflareScopeHost {
512
588
  async invocationEventsLocal(scopeId, input) {
513
589
  return this.scopeStub(scopeId).invocationEvents(input);
514
590
  }
591
+ /** Every delivery that gave up (#1525) on this host's own scope — the vertical-host read. */
592
+ async deadLettersLocal(scopeId, input) {
593
+ return this.scopeStub(scopeId).deadLetters(input);
594
+ }
515
595
  /** One event's causal chain (#1237) on this host's own scope — the vertical-host read. */
516
596
  async eventCauseLocal(scopeId, input) {
517
597
  return this.scopeStub(scopeId).eventCause(input);
@@ -548,6 +628,16 @@ export class CloudflareScopeHost {
548
628
  async redrainEventsLocal(scopeId, drainedBefore) {
549
629
  return this.scopeStub(scopeId).redrainEvents(drainedBefore);
550
630
  }
631
+ /**
632
+ * How many rows that reopen would touch, in this host's own scope (#1545) — the
633
+ * read-only half a dry run asks for. A separate method rather than a flag on the one
634
+ * above: the two return the same shape, so a lost argument would turn a count into a
635
+ * reopen silently, and a name cannot be lost that way. No audit, like the reopen: the
636
+ * platform's `redrainEvents` is the door, and a count egresses nothing to record.
637
+ */
638
+ async redrainCountLocal(scopeId, drainedBefore) {
639
+ return this.scopeStub(scopeId).redrainCount(drainedBefore);
640
+ }
551
641
  /**
552
642
  * The PITR bookmarks one scope recorded before its migration passes (#286) — the
553
643
  * rewind points a backout UI offers. Behind the vertical's platform-gated
@@ -1192,7 +1282,8 @@ export class CloudflareScopeHost {
1192
1282
  const heartbeatDue = p.stateAt === null || now - Date.parse(p.stateAt) > FRESHNESS_HEARTBEAT_MINUTES * 60_000;
1193
1283
  if (!changed && !heartbeatDue)
1194
1284
  continue;
1195
- await stub.recordScheduleRun(`freshness:${eventType}`, nowIso, outcome);
1285
+ // #1288: 'freshness', said rather than inferred from the key's prefix.
1286
+ await stub.recordScheduleRun(`freshness:${eventType}`, nowIso, outcome, 'freshness');
1196
1287
  report.checks.push({ eventType, outcome, observedAt: p.observedAt, withinHours });
1197
1288
  }
1198
1289
  return report;
@@ -1242,7 +1333,9 @@ export class CloudflareScopeHost {
1242
1333
  error: err instanceof Error ? err.message : String(err),
1243
1334
  });
1244
1335
  }
1245
- await stub.recordScheduleRun(schedule.operation, new Date(now).toISOString(), status);
1336
+ // #1288: 'schedule', whatever this operation happens to be called — including
1337
+ // `freshness:<something>`, which is exactly the row the evaluator no longer eats.
1338
+ await stub.recordScheduleRun(schedule.operation, new Date(now).toISOString(), status, 'schedule');
1246
1339
  report.runs.push({ operation: schedule.operation, outcome: status === 'ok' ? 'ok' : 'failed' });
1247
1340
  }
1248
1341
  return report;
@@ -1333,7 +1426,9 @@ export class CloudflareScopeHost {
1333
1426
  // Whatever the outbox already held is the drain sweep's own backstop.
1334
1427
  const drained = session?.mode === 'read-only'
1335
1428
  ? { attempted: 0, delivered: 0, retrying: 0, deadLettered: 0, routedToPlatform: 0 }
1336
- : await this.drainExecutors(tenantId, scopeId);
1429
+ // #1525: this drain is part of the call that emitted the events — the
1430
+ // coordinator's half of the post-commit tail the DO ran the consumers in.
1431
+ : await this.drainExecutors(tenantId, scopeId, invokeOptions?.invocationId ?? null);
1337
1432
  // #458: the operation committed having enqueued platform intents — tell the
1338
1433
  // caller's harness so it can flag the response for the router kick (#381).
1339
1434
  // Routed connector deliveries (#574 phase 3) count too: the inline drain just
@@ -1777,7 +1872,7 @@ export class CloudflareScopeHost {
1777
1872
  const parsed = publishVersionInput.parse(input);
1778
1873
  const owning = await this.cp.readVertical(parsed.verticalSlug);
1779
1874
  if (!owning) {
1780
- throw new Error(`unknown vertical '${parsed.verticalSlug}'`);
1875
+ throw substratError('not_found', `unknown vertical '${parsed.verticalSlug}'`);
1781
1876
  }
1782
1877
  // Lands PENDING — a push is not a deploy — except for a PRIVATE vertical
1783
1878
  // (tenant-owned, not listed), whose blast radius is its own tenant: there the
@@ -1816,7 +1911,7 @@ export class CloudflareScopeHost {
1816
1911
  setVerticalListed: async (actor, slug, listed) => {
1817
1912
  const existing = await this.cp.readVertical(slug);
1818
1913
  if (!existing)
1819
- throw new Error(`unknown vertical '${slug}'`);
1914
+ throw substratError('not_found', `unknown vertical '${slug}'`);
1820
1915
  // Listing is the moment other tenants start trusting this code, so the
1821
1916
  // version they would install must carry a real staff vouch — an auto-admitted
1822
1917
  // prod version has never been read by anyone but its author.
@@ -1834,35 +1929,35 @@ export class CloudflareScopeHost {
1834
1929
  requestPublish: async (actor, slug) => {
1835
1930
  const existing = await this.cp.readVertical(slug);
1836
1931
  if (!existing)
1837
- throw new Error(`unknown vertical '${slug}'`);
1932
+ throw substratError('not_found', `unknown vertical '${slug}'`);
1838
1933
  await this.cp.updateVerticalPublishRequest(slug, new Date().toISOString());
1839
1934
  await this.recordAdmin(actor, 'requestPublish', { tenantId: null }, null, { slug });
1840
1935
  },
1841
1936
  setVerticalInstallsBlocked: async (actor, slug, blocked) => {
1842
1937
  const existing = await this.cp.readVertical(slug);
1843
1938
  if (!existing)
1844
- throw new Error(`unknown vertical '${slug}'`);
1939
+ throw substratError('not_found', `unknown vertical '${slug}'`);
1845
1940
  await this.cp.updateVerticalInstallsBlocked(slug, blocked ? 1 : 0);
1846
1941
  await this.recordAdmin(actor, 'setVerticalInstallsBlocked', { tenantId: null }, { installsBlocked: !!existing.installs_blocked }, { installsBlocked: blocked });
1847
1942
  },
1848
1943
  setVerticalTenantProvisioner: async (actor, slug, granted) => {
1849
1944
  const existing = await this.cp.readVertical(slug);
1850
1945
  if (!existing)
1851
- throw new Error(`unknown vertical '${slug}'`);
1946
+ throw substratError('not_found', `unknown vertical '${slug}'`);
1852
1947
  await this.cp.updateVerticalTenantProvisioner(slug, granted ? 1 : 0);
1853
1948
  await this.recordAdmin(actor, 'setVerticalTenantProvisioner', { tenantId: null }, { tenantProvisioner: !!existing.tenant_provisioner }, { tenantProvisioner: granted });
1854
1949
  },
1855
1950
  setVerticalEmailSender: async (actor, slug, granted) => {
1856
1951
  const existing = await this.cp.readVertical(slug);
1857
1952
  if (!existing)
1858
- throw new Error(`unknown vertical '${slug}'`);
1953
+ throw substratError('not_found', `unknown vertical '${slug}'`);
1859
1954
  await this.cp.updateVerticalEmailSender(slug, granted ? 1 : 0);
1860
1955
  await this.recordAdmin(actor, 'setVerticalEmailSender', { tenantId: null }, { emailSender: !!existing.email_sender }, { emailSender: granted });
1861
1956
  },
1862
1957
  deleteVertical: async (actor, slug) => {
1863
1958
  const existing = await this.cp.readVertical(slug);
1864
1959
  if (!existing)
1865
- throw new Error(`unknown vertical '${slug}'`);
1960
+ throw substratError('not_found', `unknown vertical '${slug}'`);
1866
1961
  // Refuse while any restorable scope is bound: a deleted registry row would strand
1867
1962
  // those scopes' version pins and routing. An `archived` scope (a deleted app) still
1868
1963
  // blocks — unarchive can bring it back — but the refusal names reap/restore, not
@@ -1871,10 +1966,10 @@ export class CloudflareScopeHost {
1871
1966
  // for the cleanup script (#248).
1872
1967
  const bound = await this.cp.countScopesForVertical(slug);
1873
1968
  if (bound.live > 0) {
1874
- throw new Error(`vertical '${slug}' still backs ${bound.live} scope(s) — delete or rebind them first`);
1969
+ throw substratError('conflict', `vertical '${slug}' still backs ${bound.live} scope(s) — delete or rebind them first`);
1875
1970
  }
1876
1971
  if (bound.archived > 0) {
1877
- throw new Error(`vertical '${slug}' still backs ${bound.archived} archived scope(s) — reap or restore them first`);
1972
+ throw substratError('conflict', `vertical '${slug}' still backs ${bound.archived} archived scope(s) — reap or restore them first`);
1878
1973
  }
1879
1974
  await this.cp.deleteVertical(slug);
1880
1975
  await this.recordAdmin(actor, 'deleteVertical', { tenantId: null }, { slug, source: existing.source, ownerTenant: existing.owner_tenant }, null);
@@ -1882,7 +1977,7 @@ export class CloudflareScopeHost {
1882
1977
  admitVersion: async (actor, versionId) => {
1883
1978
  const v = await this.cp.readVersion(versionId);
1884
1979
  if (!v)
1885
- throw new Error(`unknown version ${versionId}`);
1980
+ throw substratError('not_found', `unknown version ${versionId}`);
1886
1981
  if (v.admission === 'admitted') {
1887
1982
  // Idempotent — except an AUTO-admitted version, which this upgrades to a
1888
1983
  // manual vouch by clearing the note (what the publish seam requires).
@@ -1893,7 +1988,7 @@ export class CloudflareScopeHost {
1893
1988
  return;
1894
1989
  }
1895
1990
  if (v.admission === 'rejected') {
1896
- throw new Error(`version ${versionId} was rejected — publish a new one`);
1991
+ throw substratError('conflict', `version ${versionId} was rejected — publish a new one`);
1897
1992
  }
1898
1993
  await this.cp.setAdmission(versionId, 'admitted', null);
1899
1994
  await this.recordAdmin(actor, 'admitVersion', { tenantId: null }, { admission: v.admission }, { admission: 'admitted' });
@@ -1901,7 +1996,7 @@ export class CloudflareScopeHost {
1901
1996
  rejectVersion: async (actor, versionId, note) => {
1902
1997
  const v = await this.cp.readVersion(versionId);
1903
1998
  if (!v)
1904
- throw new Error(`unknown version ${versionId}`);
1999
+ throw substratError('not_found', `unknown version ${versionId}`);
1905
2000
  if (v.admission === 'admitted') {
1906
2001
  throw new Error(`version ${versionId} is already admitted — it may be bound`);
1907
2002
  }
@@ -1913,7 +2008,7 @@ export class CloudflareScopeHost {
1913
2008
  promoteVersion: async (actor, verticalSlug, channel, versionId, acknowledge) => {
1914
2009
  const incoming = await this.cp.readVersion(versionId);
1915
2010
  if (!incoming)
1916
- throw new Error(`unknown version ${versionId}`);
2011
+ throw substratError('not_found', `unknown version ${versionId}`);
1917
2012
  if (incoming.vertical_slug !== verticalSlug) {
1918
2013
  throw new Error(`version ${versionId} belongs to '${incoming.vertical_slug}'`);
1919
2014
  }
@@ -2018,7 +2113,7 @@ export class CloudflareScopeHost {
2018
2113
  bindScopeVersion: async (actor, tenantId, scopeId, versionId, opts) => {
2019
2114
  const v = await this.cp.readVersion(versionId);
2020
2115
  if (!v)
2021
- throw new Error(`unknown version ${versionId}`);
2116
+ throw substratError('not_found', `unknown version ${versionId}`);
2022
2117
  const scope = await this.cp.getScopeRecord(tenantId, scopeId);
2023
2118
  if (!scope)
2024
2119
  throw new Error(`unknown scope ${scopeId} in tenant ${tenantId}`);
@@ -2064,7 +2159,7 @@ export class CloudflareScopeHost {
2064
2159
  verticalServing: async (actor, verticalSlug) => {
2065
2160
  const r = await this.cp.readVertical(verticalSlug);
2066
2161
  if (!r)
2067
- throw new Error(`unknown vertical '${verticalSlug}'`);
2162
+ throw substratError('not_found', `unknown vertical '${verticalSlug}'`);
2068
2163
  await this.recordAccess(actor, 'verticalServing', {}, { verticalSlug }, r.serving_ref ? 1 : 0);
2069
2164
  if (!r.serving_ref || !r.serving_version_id || !r.serving_migration_tag)
2070
2165
  return null;
@@ -2079,7 +2174,7 @@ export class CloudflareScopeHost {
2079
2174
  const parsed = verticalServingState.parse(state);
2080
2175
  const r = await this.cp.readVertical(verticalSlug);
2081
2176
  if (!r)
2082
- throw new Error(`unknown vertical '${verticalSlug}'`);
2177
+ throw substratError('not_found', `unknown vertical '${verticalSlug}'`);
2083
2178
  await this.cp.setVerticalServing(verticalSlug, {
2084
2179
  ref: parsed.ref,
2085
2180
  versionId: parsed.versionId,
@@ -2093,7 +2188,7 @@ export class CloudflareScopeHost {
2093
2188
  versionManifest: async (actor, verticalSlug, versionId) => {
2094
2189
  const v = await this.cp.readVersion(versionId);
2095
2190
  if (!v || v.vertical_slug !== verticalSlug) {
2096
- throw new Error(`unknown version ${versionId} for vertical '${verticalSlug}'`);
2191
+ throw substratError('not_found', `unknown version ${versionId} for vertical '${verticalSlug}'`);
2097
2192
  }
2098
2193
  await this.recordAccess(actor, 'versionManifest', {}, { verticalSlug, versionId }, v.manifest_json ? 1 : 0);
2099
2194
  return v.manifest_json;
@@ -2338,11 +2433,39 @@ export class CloudflareScopeHost {
2338
2433
  // The same refusal the stamp carries: a reaped scope's storage is gone, and
2339
2434
  // addressing its DO would construct an empty one and report nothing reopened.
2340
2435
  const record = await this.scopeRecordForRead(tenantId, scopeId);
2341
- const { drainedBefore } = redrainEventsInput.parse(input);
2436
+ const { drainedBefore, countOnly } = redrainEventsInput.parse(input);
2342
2437
  // The window rule at the HostAdmin boundary, not only at the control-plane door:
2343
2438
  // this verb is public, so an in-process caller reaches it without that route. Host
2344
2439
  // code, so the real clock is the right one to read (the DO host injects none).
2440
+ // Applied to a count too: a future instant is as meaningless to count as it is
2441
+ // dangerous to reopen, and one answer from this verb should not be reachable
2442
+ // through a door the other is refused at.
2345
2443
  assertRedrainWindow(drainedBefore, new Date().toISOString());
2444
+ // A COUNT reopens nothing, so it writes no receipt (#1545). Both rows below exist
2445
+ // for a second egress of a tenant's payloads: the intent because a reopen that
2446
+ // crashed before its outcome row would otherwise leave no trace, the outcome
2447
+ // because something moved. A count moves nothing and egresses nothing, and an
2448
+ // admin row saying a redrain was intended on a scope where none was is a false
2449
+ // statement about a tenant's data — the opposite of what the log is for.
2450
+ //
2451
+ // It IS a read, though, and K-24 admits no curated subset: every `HostAdmin` read
2452
+ // records actor, method, target and result count in the access log, so "who counted
2453
+ // every tenant's outbox" has an answer. The count itself is the result count — the
2454
+ // read returns one row, and the number in it is the fact worth having. The row lands
2455
+ // on THIS host whichever branch answered, like the drain's read.
2456
+ if (countOnly) {
2457
+ const redrainable = this.eventDrainDelegation && record.vertical
2458
+ ? await this.eventDrainDelegation.redrain({
2459
+ tenantId,
2460
+ scopeId,
2461
+ vertical: record.vertical,
2462
+ drainedBefore,
2463
+ countOnly: true,
2464
+ })
2465
+ : await this.scopeStub(scopeId).redrainCount(drainedBefore);
2466
+ await this.recordAccess(actor, 'redrainEvents', { tenantId, scopeId }, { drainedBefore, countOnly: true }, redrainable);
2467
+ return redrainable;
2468
+ }
2346
2469
  // Audit FIRST, on `rewindScope`'s rule (K-33), because this has the same shape: the
2347
2470
  // mutation commits in a DO and the row is a separate write afterwards, so a failure
2348
2471
  // between them left a reopen that had happened with no receipt — and the retry could
@@ -2406,6 +2529,13 @@ export class CloudflareScopeHost {
2406
2529
  await this.recordAccess(actor, 'invocationEvents', { tenantId, scopeId }, { invocationId: input.invocationId }, read.events.length);
2407
2530
  return read;
2408
2531
  },
2532
+ deadLetters: async (actor, tenantId, scopeId, input) => {
2533
+ // K-3 cross-check on the directory BEFORE the scope DO, like every read here.
2534
+ await this.scopeRecordForRead(tenantId, scopeId);
2535
+ const page = await this.scopeStub(scopeId).deadLetters(input);
2536
+ await this.recordAccess(actor, 'deadLetters', { tenantId, scopeId }, null, page.entries.length);
2537
+ return page;
2538
+ },
2409
2539
  readScopeTable: async (actor, tenantId, scopeId, input) => {
2410
2540
  await this.scopeRecordForRead(tenantId, scopeId);
2411
2541
  const page = await this.scopeStub(scopeId).introspectTable(input.table, input.limit, input.offset);
@@ -2716,6 +2846,23 @@ export class CloudflareScopeHost {
2716
2846
  await this.recordAccess(actor, 'listIdentityTenants', {}, { provider }, tenants.length);
2717
2847
  return tenants;
2718
2848
  },
2849
+ listIdentityMemberships: async (actor, provider, externalId) => {
2850
+ // ONE round trip: the pool check, the join and the K-24 row all happen inside
2851
+ // the directory's own call. The id and timestamp are minted here, as
2852
+ // `recordAccess` mints them, so the log row is shaped exactly like its siblings.
2853
+ const { topology, memberships } = await this.cp.identityMemberships(provider, externalId, {
2854
+ id: ulid(),
2855
+ actor,
2856
+ at: new Date().toISOString(),
2857
+ });
2858
+ if (topology === null)
2859
+ throw new Error(`identity pool '${provider}' is not registered`);
2860
+ if (topology !== 'central') {
2861
+ throw new Error(`identity pool '${provider}' is tenant-bound — enumerating tenants is only ` +
2862
+ `meaningful on a central pool, where the same externalId is the same person`);
2863
+ }
2864
+ return memberships.map((m) => identityMembership.parse(m));
2865
+ },
2719
2866
  listIdentityLinks: async (actor, tenantId) => {
2720
2867
  const rows = await this.cp.dumpTenantIdentities(tenantId);
2721
2868
  const links = rows.map((r) => identityLink.parse({
@@ -3298,6 +3445,104 @@ export class CloudflareScopeHost {
3298
3445
  // via newUniqueId (K-7) and stores the mapping in the directory — deferred.
3299
3446
  return this.scopeNs.get(this.scopeNs.idFromName(scopeId));
3300
3447
  }
3448
+ // -- live reads (#938): the door ------------------------------------------
3449
+ // The coordinator's half of the live-read path. It decides two things and no more:
3450
+ // whether this CONNECTION can carry a push at all, and who is asking. What a
3451
+ // subscriber may then be told is decided in the scope DO, per event, per frame.
3452
+ /**
3453
+ * Subscribe a principal to this scope's changes — `ScopeHost.liveReads`.
3454
+ *
3455
+ * Present on this host and declared `never` on `SqliteScopeHost`: a live read needs
3456
+ * something that outlives a request and can be woken when an event lands, and on
3457
+ * Cloudflare that is the scope's own Durable Object. The seam's full reasoning is on
3458
+ * the contract (`ScopeHost.liveReads`), beside the `clock?: never` precedent it
3459
+ * mirrors.
3460
+ *
3461
+ * **Two kinds of refusal, and they are deliberately different shapes.** A request
3462
+ * that cannot carry a socket is answered with a `Response` (426, 501) — that is a
3463
+ * fact about the connection, addressed to the client. A scope that must not be
3464
+ * reached at all THROWS, exactly as `getScope` and the attachment door do, because
3465
+ * it is the same refusal an ordinary read of that scope would get and it should not
3466
+ * arrive as a different class of answer just because the caller asked for a socket.
3467
+ */
3468
+ liveReads = {
3469
+ subscribe: async ({ tenantId, scopeId, principal, request }) => {
3470
+ if (!isUpgradeRequest(request)) {
3471
+ return new Response('live reads are a WebSocket surface', {
3472
+ status: 426,
3473
+ headers: { [LIVE_MODE_HEADER]: 'not-an-upgrade' },
3474
+ });
3475
+ }
3476
+ /**
3477
+ * The orange-to-orange refusal (#938).
3478
+ *
3479
+ * Cloudflare does not carry WebSockets across an O2O hop — the customer's own
3480
+ * proxied zone in front of ours — so an upgrade offered here would fail
3481
+ * somewhere the vertical cannot see, and the client would be left holding a
3482
+ * socket that never delivers. Refused at the door instead, with a reason the
3483
+ * client can read, so the fallback to polling is a thing it KNOWS it is doing
3484
+ * rather than a silence it has to infer.
3485
+ *
3486
+ * Per request, never per hostname: whether a tenant is O2O is decided by the
3487
+ * tenant's own DNS, which is theirs to change without telling us. Anything
3488
+ * cached would be a fact with an invisible expiry date; this header is correct
3489
+ * on the request after they change it.
3490
+ *
3491
+ * 501, not 426: 426 means "upgrade and try again", and trying again is exactly
3492
+ * what will not work. This connection cannot carry the thing that was asked for.
3493
+ */
3494
+ if (isOrangeToOrange(request)) {
3495
+ return new Response('live reads are not available over this connection — the request arrived ' +
3496
+ 'through a proxied customer zone, which does not carry WebSockets. Poll instead.', { status: 501, headers: { [LIVE_MODE_HEADER]: 'poll' } });
3497
+ }
3498
+ /**
3499
+ * The same fail-closed lifecycle gate + lazy migration every other door takes
3500
+ * (`getScope`, `attachments`; control-plane.md §4.1/§4.2, K-3).
3501
+ *
3502
+ * A subscription is a new way INTO a scope, and the permission filter downstream
3503
+ * answers a different question: it decides what a subscriber may see, not whether
3504
+ * this scope should be reachable at all. Without this, an unknown, cross-tenant,
3505
+ * suspended or archiving scope could still be addressed and handed a 101 — a
3506
+ * scope that refuses every ordinary read while quietly holding an open socket.
3507
+ *
3508
+ * Costs a CP-less vertical nothing: `validateScopeAccess` is a **no-op** on the
3509
+ * null control plane (the router already gated lifecycle and tenancy from the
3510
+ * shared directory), so this is the hosted-vertical shape unchanged.
3511
+ *
3512
+ * `migrateAndRecord`, not the DO's own `ensureMigrations`: the DO migrates
3513
+ * itself when the socket opens either way, but only this reports the applied
3514
+ * count to the directory — so a scope whose first contact after a deploy is a
3515
+ * subscription does not go dark in the migration fleet view.
3516
+ */
3517
+ await this.cp.validateScopeAccess(tenantId, scopeId);
3518
+ await this.migrateAndRecord(scopeId);
3519
+ // Asserted, not carried through from the client: the principal is the
3520
+ // vertical's own resolution of its session, and the tenant and scope are the
3521
+ // node the router resolved. Every inbound copy is replaced, for the reason the
3522
+ // router strips `x-substrat-*` before setting its own.
3523
+ const headers = new Headers(request.headers);
3524
+ headers.set(LIVE_PRINCIPAL_HEADER, principal);
3525
+ headers.set(LIVE_TENANT_HEADER, tenantId);
3526
+ headers.set(LIVE_SCOPE_HEADER, scopeId);
3527
+ const forwarded = new Request(new URL(LIVE_SUBSCRIBE_PATH, 'https://scope.substrat.internal'),
3528
+ // `new Request(url, { …, headers })` rather than `new Request(request, …)`:
3529
+ // the DO is addressed by its own path, not the client's, and the upgrade
3530
+ // headers that matter travel in `headers` above. Verified in workerd — a
3531
+ // reconstructed request keeps `Upgrade`, `Connection` and the
3532
+ // `Sec-WebSocket-*` pair, which is what makes the router's own
3533
+ // strip-and-assert safe on this path too.
3534
+ { method: 'GET', headers });
3535
+ // Through `scopeStub`, deliberately, rather than a second `idFromName` here:
3536
+ // that method's own comment says the id derivation is milestone-one and that
3537
+ // production will mint per-jurisdiction ids from the directory. A copy of the
3538
+ // derivation would keep compiling on the day it changes and address a DIFFERENT
3539
+ // object — a subscriber watching an empty scope while its writes land elsewhere.
3540
+ // `ScopeStubRpc` describes the RPC methods and not `fetch`, which every stub has;
3541
+ // the cast widens the view of one object, it does not mint a second one.
3542
+ const stub = this.scopeStub(scopeId);
3543
+ return stub.fetch(forwarded);
3544
+ },
3545
+ };
3301
3546
  // -- scope-local projection (docs/architecture/scope-local-permissions.md, Phase 2) --
3302
3547
  // The write side of the local reader (Phase 1): after any tenant-level change,
3303
3548
  // the coordinator PROJECTS the tenant's current roles + tenant-level tuples into