@substrat-run/adapter-cloudflare 0.217.0 → 0.219.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/dist/broker-lake.d.ts +19 -0
- package/dist/broker-lake.d.ts.map +1 -0
- package/dist/broker-lake.js +20 -0
- package/dist/broker-lake.js.map +1 -0
- package/dist/control-plane-do.d.ts +82 -5
- package/dist/control-plane-do.d.ts.map +1 -1
- package/dist/control-plane-do.js +276 -25
- package/dist/control-plane-do.js.map +1 -1
- package/dist/delivery-broker-do.d.ts +43 -6
- package/dist/delivery-broker-do.d.ts.map +1 -1
- package/dist/delivery-broker-do.js +85 -9
- package/dist/delivery-broker-do.js.map +1 -1
- package/dist/delivery-broker-platform.d.ts +52 -0
- package/dist/delivery-broker-platform.d.ts.map +1 -0
- package/dist/delivery-broker-platform.js +77 -0
- package/dist/delivery-broker-platform.js.map +1 -0
- package/dist/delivery-handoff.d.ts +22 -0
- package/dist/delivery-handoff.d.ts.map +1 -1
- package/dist/delivery-handoff.js +19 -0
- package/dist/delivery-handoff.js.map +1 -1
- package/dist/directory-restore-chunks.d.ts +16 -0
- package/dist/directory-restore-chunks.d.ts.map +1 -0
- package/dist/directory-restore-chunks.js +31 -0
- package/dist/directory-restore-chunks.js.map +1 -0
- package/dist/directory-split-inventory.d.ts +2 -2
- package/dist/directory-split-inventory.d.ts.map +1 -1
- package/dist/directory-split-inventory.js +5 -4
- package/dist/directory-split-inventory.js.map +1 -1
- package/dist/host.d.ts +7 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +44 -3
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/kick-coalescer-do.d.ts.map +1 -1
- package/dist/kick-coalescer-do.js +5 -4
- package/dist/kick-coalescer-do.js.map +1 -1
- package/dist/scope-do.d.ts +8 -1
- package/dist/scope-do.d.ts.map +1 -1
- package/dist/scope-do.js +154 -32
- package/dist/scope-do.js.map +1 -1
- package/dist/scope-wake.d.ts +5 -0
- package/dist/scope-wake.d.ts.map +1 -1
- package/dist/scope-wake.js +2 -1
- package/dist/scope-wake.js.map +1 -1
- package/dist/scope-work.d.ts +1 -1
- package/dist/scope-work.js +1 -1
- package/dist/scope-work.js.map +1 -1
- package/dist/sql.d.ts +2 -2
- package/dist/sql.d.ts.map +1 -1
- package/dist/sql.js +11 -10
- package/dist/sql.js.map +1 -1
- package/dist/supplied-delivery-broker.d.ts +35 -0
- package/dist/supplied-delivery-broker.d.ts.map +1 -0
- package/dist/supplied-delivery-broker.js +55 -0
- package/dist/supplied-delivery-broker.js.map +1 -0
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -30,7 +30,8 @@ export type { PlatformSweeperDoConfig, PlatformSweepOutcome } from './platform-s
|
|
|
30
30
|
export { defineCopyJobDO, type CopyJobDo, type CopyJobDoConfig, type CopyJobDoRecord, type CopyJobStep } from './copy-job-do.js';
|
|
31
31
|
export { defineScopeSweeperDO, SCOPE_SWEEPER_NAME } from './scope-sweeper-do.js';
|
|
32
32
|
export { defineDeliveryBrokerDO, type DeliveryBrokerDOClass, type DeliveryBrokerDeadLetterRpc, type DeliveryBrokerOptions, type DeliveryBrokerRelayRpc, type DeliveryBrokerRpc, type DeliveryBrokerSubscription, } from './delivery-broker-do.js';
|
|
33
|
-
export { DELIVERY_HANDOFF_KEY, type HandoffState } from './delivery-handoff.js';
|
|
33
|
+
export { DELIVERY_HANDOFF_KEY, DELIVERY_MODE_KEY, type DeliveryModeState, type HandoffState } from './delivery-handoff.js';
|
|
34
|
+
export { askControlPlaneToDrain, definePlatformDeliveryBrokerDO, registerPlatformDeliveryBroker, type PlatformBrokerEnv, type PlatformBrokerFactory, type ScopeDeliveryRpc, } from './delivery-broker-platform.js';
|
|
34
35
|
export type { ScopeSweeperDo, ScopeSweeperDoConfig, ScopeSweepHost, ScopeSweepOutcome, ScopeSweepReport, } from './scope-sweeper-do.js';
|
|
35
36
|
export { createD1TenantStores, d1TenantRelationalStore, tenantStoreDatabaseName, } from './d1.js';
|
|
36
37
|
export type { D1TenantStores, D1TenantStoresOptions } from './d1.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACrJ,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAE1F,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,6BAA6B,EAC7B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAC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,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EACL,oCAAoC,EACpC,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,9 @@ export { defineConnectionSweepDO, connectionSweepName, spreadOf as connectionSwe
|
|
|
31
31
|
export { defineCopyJobDO } from './copy-job-do.js';
|
|
32
32
|
export { defineScopeSweeperDO, SCOPE_SWEEPER_NAME } from './scope-sweeper-do.js';
|
|
33
33
|
export { defineDeliveryBrokerDO, } from './delivery-broker-do.js';
|
|
34
|
-
export { DELIVERY_HANDOFF_KEY } from './delivery-handoff.js';
|
|
34
|
+
export { DELIVERY_HANDOFF_KEY, DELIVERY_MODE_KEY } from './delivery-handoff.js';
|
|
35
|
+
// A5 (#3471): the broker the platform supplies to a pushed vertical, and what it reads.
|
|
36
|
+
export { askControlPlaneToDrain, definePlatformDeliveryBrokerDO, registerPlatformDeliveryBroker, } from './delivery-broker-platform.js';
|
|
35
37
|
export { createD1TenantStores, d1TenantRelationalStore, tenantStoreDatabaseName, } from './d1.js';
|
|
36
38
|
export { blobStoreBucketName, createR2BlobStores, r2TenantBlobStore, } from './r2.js';
|
|
37
39
|
export { createRouteResolver } from './route-resolver.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAYhD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,uGAAuG;AACvG,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EAC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AW,mBAAmB,CAAC,GAAG;IACtC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,GAAG;QAAE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAChH;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mGAAmG;IACnG,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;CACxC;AAED,oGAAoG;AACpG,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAE9E;AAuBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EACvC,MAAM,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAC/B,KAAK,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,GAAG,KAAK,aAAa,CAAC,GAAG,CAAC,GAAG,eAAe,CAoFjF"}
|
|
@@ -63,9 +63,10 @@ export function defineKickCoalescerDO(config) {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* The window's end: the trailing pass if a kick arrived that no pass has covered, and
|
|
66
|
-
* otherwise the end of this object. Its
|
|
67
|
-
* leaves nothing behind. That waits for the window's end, so a kick after
|
|
68
|
-
* at once without breaking the bound.
|
|
66
|
+
* otherwise the end of this object. Its state is deleted, so a producer that kicked once
|
|
67
|
+
* leaves nothing of the coalescer's behind. That waits for the window's end, so a kick after
|
|
68
|
+
* the delete may run at once without breaking the bound. Only its own key: a subclass that
|
|
69
|
+
* keeps something of its own across windows (#3461) keeps it.
|
|
69
70
|
*/
|
|
70
71
|
async alarm() {
|
|
71
72
|
const state = await this.ctx.storage.get('state');
|
|
@@ -81,7 +82,7 @@ export function defineKickCoalescerDO(config) {
|
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
84
|
await this.ctx.storage.deleteAlarm();
|
|
84
|
-
await this.ctx.storage.
|
|
85
|
+
await this.ctx.storage.delete('state');
|
|
85
86
|
}
|
|
86
87
|
async #pass(state) {
|
|
87
88
|
const startedAt = Date.now();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kick-coalescer-do.js","sourceRoot":"","sources":["../src/kick-coalescer-do.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AAiDnD,oGAAoG;AACpG,MAAM,UAAU,iBAAiB,CAAC,QAAkB,EAAE,OAAgB;IACpE,OAAO,GAAG,QAAQ,IAAI,OAAO,EAAE,CAAC;AAClC,CAAC;AAeD,6FAA6F;AAC7F,SAAS,UAAU,CAAC,KAAgB,EAAE,KAA+B;IACnE,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAgC;IAEhC,MAAM,QAAQ,GAAG,MAAM,CAAC,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ANGED
|
@@ -62,9 +62,16 @@ export interface ScopeDoEnv {
|
|
|
62
62
|
/**
|
|
63
63
|
* K-74: the app's delivery brokers (`defineDeliveryBrokerDO`), one per (tenant, app). Bound, every
|
|
64
64
|
* commit hands off the events the scope emitted and the intents it raised; unbound, nothing is
|
|
65
|
-
* handed off and delivery stays the control plane's drain.
|
|
65
|
+
* handed off and delivery stays the control plane's drain. A5 (#3471): the upload binds the
|
|
66
|
+
* platform's (`SubstratDeliveryBrokerDO`), and a scope hands off only while the control plane
|
|
67
|
+
* says its tenant is in shadow or live (`DELIVERY_MODE_KEY`), unless `SUBSTRAT_DELIVERY_HANDOFF`.
|
|
66
68
|
*/
|
|
67
69
|
SUBSTRAT_DELIVERY_BROKER?: DurableObjectNamespace;
|
|
70
|
+
/**
|
|
71
|
+
* A5: `always` hands off whatever the control plane says, owing every receiver, as A1–A4 did: for
|
|
72
|
+
* a test worker or a self-hosted script with no control plane. The uploader never sets it.
|
|
73
|
+
*/
|
|
74
|
+
SUBSTRAT_DELIVERY_HANDOFF?: string;
|
|
68
75
|
/**
|
|
69
76
|
* #3474: the Analytics Engine dataset the handoff and the broker write their points into
|
|
70
77
|
* (`BROKER_TELEMETRY_BINDING`). Unbound, nothing is written.
|
package/dist/scope-do.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-do.d.ts","sourceRoot":"","sources":["../src/scope-do.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EA0DL,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"scope-do.d.ts","sourceRoot":"","sources":["../src/scope-do.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EA0DL,KAAK,QAAQ,EAoBd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAiEL,KAAK,mBAAmB,EASxB,KAAK,SAAS,EA2Bd,K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gQD;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AAmBtD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CAOxD;AAED,gHAAgH;AAChH,OAAO,EAAE,kBAAkB,EAAE,CAAC;AA2B9B,wBAAgB,aAAa,CAC3B,OAAO,EAAE,kBAAkB,EAAE,EAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACzD;;;;GAIG;AACH,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,mBAAmB,CAAA;CAAO,GAClD,KAAK,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,UAAU,KAAK,aAAa,CAAC,UAAU,CAAC,CA4+S7E"}
|
package/dist/scope-do.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { REWIND_REFUSED } from './rewind-refusal.js';
|
|
2
2
|
import { SYSTEM_DOOR_MOVED } from './system-door.js';
|
|
3
3
|
import { DurableObject } from 'cloudflare:workers';
|
|
4
|
-
import { ATTACHMENT_ADDED, ATTACHMENT_REMOVED, CAPTURE_REFUSALS, attachmentRecord, domainEvent, domainEventInput, eventId, instant, objectRef, entityObjectRef, assertModuleEmittableType, assertKernelAuthoredType, toWireFailure, grantRefFromProof, principalId, principalBecomeCapabilityInput, principalBindLinkInput, scopeId as scopeIdOf, tenantId as tenantIdOf, platformRequestInput, platformRequestId, MAX_PENDING_PLATFORM_REQUESTS, MAX_PENDING_SWEEP_RUNS, SWEEP_RUNS_KIND, SCOPE_DUMP_PAGE_MAX_BYTES, SCOPE_TABLE_PAGE_MAX, SCOPE_QUERY_ROW_MAX, listLimitOf, pageOf, countedPageOf, requestFingerprint, substratError, errorCodeOf, assertReplayableDump, DUMP_OBJECTS_QUERY, dumpObjectsOf, replayDumpObjects, dumpObjectsAudit, REDRAIN_BATCH, } from '@substrat-run/contracts';
|
|
5
|
-
import { ulid, DO_SQL_LIMITS, unknownRoleError, createUlid, assertAllowed, ConnectionSealingKeyUnavailableError, noSealingKeyMessage, sealTo, assertReadOnlyQuery, refuseEntitlement, platformRequestHistoryQuery, platformRequestOf, PLATFORM_REQUEST_COLUMNS, PLATFORM_REQUEST_REDACTION_SQL, platformRequestRedactionParams, platformRequestRedactionQuery, intentPayloadCarriesSubject, redactSubjectJobRuns, eraseSubjectFromModules, readSubjectPage, moduleErasurePlan, redactSubjectScopeText, assertRowLimit, assertRowOffset, JOB_RUN_PATCH_SQL, JOB_RUN_CLAIM_SQL, JOB_RUN_RENEW_SQL, JOB_RUN_BEGIN_SQL, JOB_RUN_MISS_SQL, JOB_RUN_MISS_SETTLE_SQL, admissionMissOutcome, JOB_LEASE_EXPIRED_NOTE, JOB_STEP_RECORD_SQL, DELIVERY_ERROR_REDACTION_SQL, REDACTED_DELIVERY_NOTE, seatScopeTuple, delegatedRevokeSql, writeExplicitTupleIn, grantEntityShapeIn, grantEntityShapeOnceIn, topUpEntityGrantShapes, applyScopeRoleChange, changeScopeRole, revokeScopeRoles, scopeRoleHolders, assertModuleDeclared, noteDeclaredKeys, noteReservedKeys, SCOPE_SEATED_ROLES_SQL, inUnitRoleRefusal, loadedRoleSetRefusedRole, reservedRoleSetRefusedRole, reservedGrantRefusal, reservedRoleRefusal, reservedShapeRefusal, effectiveRoleGrantQuery, switchRecordedOff, switchSystemSchedules, peerGrantsStatus, systemGrantsStatus, systemScheduleState, systemSwitchedOff, OUTBOX_PRUNED_DDL, outboxSubscribersOf, pruneDrainedOutbox, denialListQuery, refusalListQuery, mapRefusalRow, denialSummaryQuery, denialTotalsQuery, DENIAL_WINDOW_QUERY, mapDenialRow, mapDenialSummaryBuckets, PermissionDenied, assertImpersonationAdmitted, assertImpersonationWrites, assertModuleEnqueueableKind, impersonationStampOf, createAtomic, NotSearchable, isSearchIndexTable, countDumpRows, planDumpSample, sampleFilters, sampleGraph, rowCountTable, searchIndexPlans, NotListable, listIndexPlans, moduleMigrations, REGISTERED_MIGRATIONS, registeredMigrationsOf, MIGRATION_DIGEST_FENCE_DDL, MIGRATION_DIGEST_MARK_LEGACY, assertJournalDumpCoherent, assertMigrationSql, migrationDivergence, migrationFailedError, migrationSetDivergence, migrationSteps, planMigrations, listQuery, cursorOf, searchLimit, searchMatchExpression, searchQuery, ATTACHMENT_TEXT_DDL, ATTACHMENT_BYTES_SQL, ATTACHMENT_CONDEMNED_DDL, ATTACHMENT_SWEEP_LICENCE_DDL, ATTACHMENT_SWEEP_LICENCE_TABLE, WIRE_NONCE_DDL, WIRE_NONCE_FULL, claimWireNonceIn, isWireNonceTable, isWireNonceWrite, clearOrphanSweepLicence, condemnLicensedOrphanAttachments, consumeOrphanSweepLicence, licensedOrphanIds, recordOrphanSweepLicence, refuseUnlicensedOrphanSweep, refuseCondemnedAttachment, refuseCondemnedInDump, rowlessAttachmentIds, attachmentRecordOfRow, enqueueAttachmentText, reconcileAttachmentText, queueAttachmentTextBackfill, startAttachmentTextBackfill, recordAttachmentText, searchAttachments, IDEMPOTENCY_DDL, REFUSALS_TABLE_DDL, REFUSALS_INDEX, refusalInsert, refusalOf, markGuardRefusal, REFUSALS_REBUILD, refusalsAdmitGuards, assertIdempotencyKey, assertPermissionKey, idempotencyLookupQuery, idempotencyPruneStatement, idempotencyRecordStatement, idempotencyOptedOutMessage, replayFor, entityVersionQuery, entityVersionOf, assertIfMatch, OUTBOX_ENTITY_INDEX, SCHEDULE_STATE_DDL, SCHEDULE_STATE_REBUILD, scheduleStateHasKind, VERTICAL_EVENTS_DDL, EXPORT_HOPS_SQL, emptyImportResult, IMPORT_CURSORS_SQL, IMPORT_CURSOR_OF_SQL, OUTBOX_MARK_SQL, exportedSinceQuery, emittedSinceQuery, emittedReportOf, EMITTED_REPORT_CAP, noteTransitionInto, withTransitions, IMPORT_CURSOR_ADVANCE_SQL, IMPORT_RECORD_SQL, moveImportCursor, CrossVerticalRegistry, exportReadPlan, exportReadQuery, planExportBatch, withheldNote, JOB_RUN_DDL, JOB_RUN_DUE_AT, jobRunListLimit, SYSTEM_DOOR_WAIT, ancestorsWithin, } from '@substrat-run/kernel';
|
|
4
|
+
import { ATTACHMENT_ADDED, ATTACHMENT_REMOVED, CAPTURE_REFUSALS, attachmentRecord, domainEvent, domainEventInput, eventId, instant, objectRef, entityObjectRef, assertModuleEmittableType, assertKernelAuthoredType, toWireFailure, grantRefFromProof, principalId, principalBecomeCapabilityInput, principalBindLinkInput, scopeId as scopeIdOf, tenantId as tenantIdOf, platformRequestInput, platformRequestId, MAX_PENDING_PLATFORM_REQUESTS, MAX_PENDING_SWEEP_RUNS, SWEEP_RUNS_KIND, SCOPE_DUMP_PAGE_MAX_BYTES, SCOPE_TABLE_PAGE_MAX, SCOPE_QUERY_ROW_MAX, listLimitOf, pageOf, countedPageOf, requestFingerprint, substratError, errorCodeOf, assertReplayableDump, DUMP_OBJECTS_QUERY, dumpObjectsOf, isRuntimeTable, replayDumpObjects, dumpObjectsAudit, REDRAIN_BATCH, } from '@substrat-run/contracts';
|
|
5
|
+
import { ulid, DO_SQL_LIMITS, unknownRoleError, createUlid, assertAllowed, ConnectionSealingKeyUnavailableError, noSealingKeyMessage, sealTo, assertReadOnlyQuery, refuseEntitlement, platformRequestHistoryQuery, platformRequestOf, PLATFORM_REQUEST_COLUMNS, PLATFORM_REQUEST_REDACTION_SQL, platformRequestRedactionParams, platformRequestRedactionQuery, intentPayloadCarriesSubject, redactSubjectJobRuns, eraseSubjectFromModules, readSubjectPage, moduleErasurePlan, redactSubjectScopeText, assertRowLimit, assertRowOffset, JOB_RUN_PATCH_SQL, JOB_RUN_CLAIM_SQL, JOB_RUN_RENEW_SQL, JOB_RUN_BEGIN_SQL, JOB_RUN_MISS_SQL, JOB_RUN_MISS_SETTLE_SQL, admissionMissOutcome, JOB_LEASE_EXPIRED_NOTE, JOB_STEP_RECORD_SQL, DELIVERY_ERROR_REDACTION_SQL, REDACTED_DELIVERY_NOTE, seatScopeTuple, delegatedRevokeSql, writeExplicitTupleIn, grantEntityShapeIn, grantEntityShapeOnceIn, topUpEntityGrantShapes, applyScopeRoleChange, changeScopeRole, revokeScopeRoles, scopeRoleHolders, assertModuleDeclared, noteDeclaredKeys, noteReservedKeys, SCOPE_SEATED_ROLES_SQL, inUnitRoleRefusal, loadedRoleSetRefusedRole, reservedRoleSetRefusedRole, reservedGrantRefusal, reservedRoleRefusal, reservedShapeRefusal, effectiveRoleGrantQuery, switchRecordedOff, switchSystemSchedules, peerGrantsStatus, systemGrantsStatus, systemScheduleState, systemSwitchedOff, OUTBOX_PRUNED_DDL, outboxSubscribersOf, pruneDrainedOutbox, denialListQuery, refusalListQuery, mapRefusalRow, denialSummaryQuery, denialTotalsQuery, DENIAL_WINDOW_QUERY, mapDenialRow, mapDenialSummaryBuckets, PermissionDenied, assertImpersonationAdmitted, assertImpersonationWrites, assertModuleEnqueueableKind, impersonationStampOf, createAtomic, NotSearchable, isSearchIndexTable, countDumpRows, planDumpSample, sampleFilters, sampleGraph, rowCountTable, searchIndexPlans, NotListable, listIndexPlans, moduleMigrations, REGISTERED_MIGRATIONS, registeredMigrationsOf, MIGRATION_DIGEST_FENCE_DDL, MIGRATION_DIGEST_MARK_LEGACY, assertJournalDumpCoherent, assertMigrationSql, migrationDivergence, migrationFailedError, migrationSetDivergence, migrationSteps, planMigrations, listQuery, cursorOf, searchLimit, searchMatchExpression, searchQuery, ATTACHMENT_TEXT_DDL, ATTACHMENT_BYTES_SQL, ATTACHMENT_CONDEMNED_DDL, ATTACHMENT_SWEEP_LICENCE_DDL, ATTACHMENT_SWEEP_LICENCE_TABLE, WIRE_NONCE_DDL, WIRE_NONCE_FULL, claimWireNonceIn, isWireNonceTable, isWireNonceWrite, clearOrphanSweepLicence, condemnLicensedOrphanAttachments, consumeOrphanSweepLicence, licensedOrphanIds, recordOrphanSweepLicence, refuseUnlicensedOrphanSweep, refuseCondemnedAttachment, refuseCondemnedInDump, rowlessAttachmentIds, attachmentRecordOfRow, enqueueAttachmentText, reconcileAttachmentText, queueAttachmentTextBackfill, startAttachmentTextBackfill, readAttachmentTextRecheckPage, requeueUnsupportedAttachmentText, startAttachmentTextRecheck, recordAttachmentText, searchAttachments, IDEMPOTENCY_DDL, REFUSALS_TABLE_DDL, REFUSALS_INDEX, refusalInsert, refusalOf, markGuardRefusal, REFUSALS_REBUILD, refusalsAdmitGuards, assertIdempotencyKey, assertPermissionKey, idempotencyLookupQuery, idempotencyPruneStatement, idempotencyRecordStatement, idempotencyOptedOutMessage, replayFor, entityVersionQuery, entityVersionOf, assertIfMatch, OUTBOX_ENTITY_INDEX, SCHEDULE_STATE_DDL, SCHEDULE_STATE_REBUILD, scheduleStateHasKind, VERTICAL_EVENTS_DDL, EXPORT_HOPS_SQL, emptyImportResult, IMPORT_CURSORS_SQL, IMPORT_CURSOR_OF_SQL, OUTBOX_MARK_SQL, exportedSinceQuery, emittedSinceQuery, emittedReportOf, EMITTED_REPORT_CAP, noteTransitionInto, withTransitions, IMPORT_CURSOR_ADVANCE_SQL, IMPORT_RECORD_SQL, moveImportCursor, CrossVerticalRegistry, exportReadPlan, exportReadQuery, planExportBatch, withheldNote, JOB_RUN_DDL, JOB_RUN_DUE_AT, jobRunListLimit, SYSTEM_DOOR_WAIT, ancestorsWithin, } from '@substrat-run/kernel';
|
|
6
6
|
import { isUpgradeRequest, readSubscription, LIVE_DECIDE_ATTEMPTS, LIVE_FANOUT_LIMIT, LIVE_PRINCIPAL_HEADER, LIVE_SCOPE_HEADER, LIVE_SUBSCRIBE_PATH, LIVE_TENANT_HEADER, LIVE_WITHIN_HEADER, LIVE_EXPIRES_HEADER, LIVE_CLOSE, LIVE_SOCKETS_PER_PRINCIPAL, decodeLiveWithin, liveInstant, liveRefusal, liveRefusalStatus, } from './live-reads.js';
|
|
7
7
|
import { replyOf } from './do-reply.js';
|
|
8
8
|
import { OperationQueue } from './serialization.js';
|
|
9
9
|
import { reconcileOnWake } from './reconcile-on-wake.js';
|
|
10
10
|
import { meterScopeWorkEntries, ScopeWorkMeter } from './scope-work.js';
|
|
11
|
-
import {
|
|
11
|
+
import { assertNoRuntimeStorage, doScopedSql, doBuiltColumnsOf, doRedactionSql, doSpineSql } from './sql.js';
|
|
12
12
|
import { actorOf, admitPeer, boundToPeerDeclarations, collectPeers, switchPeer, peerSubjectRef, subjectGrantState, assertNoSecret, CAPABILITY_DDL, UPLOAD_LINK_DDL, DOWNLOAD_LINK_DDL, createAttachmentVerbs, inspectUploadLink, resolveDownloadLink, redeemUploadLinkInTransaction, COPY_ORIGIN_DDL, ENTITY_STATE_MOVES_DDL, SWITCH_FENCES_DDL, TABLE_OWNERS_DDL, assertMigrationLeavesLedgerAlone, recordOwnershipSteps, runMigrationStatements, splitSqlStatements, executableSqlStatements, blankSqlComments, CAPABILITY_EXCHANGE_OPERATION, CAPABILITY_BECOME_MINT_OPERATION, becomeMintCheck, mintBecomeCapabilityAsPrincipal, CAPABILITY_BIND_MINT_OPERATION, bindLinkMintCheck, mintBindLinkAsPrincipal, revokeBecomeCapabilityAsPrincipal, readBecomeLinkStates, ENTITY_UNBIND_OPERATION, allowedFor, unbindEntityHolderBounded, capabilityAttachmentWriteRefused, createCapabilityVerbs, createEntityEdgeVerbs, createEntityStateVerbs, createTrashedReads, CONTINUATION_POSITION_CAP, visibleContinuation, searchStateWhere, uncheckedView, addStatePlans, addUpdatedStampPlans, watchUpdatedStamps, assertNoCallerPurge, isUnreachableParent, PURGE_BATCH, heldPurgePass, lifecycleRefusal, purgeHeldBy, assertPlatformRequestRoom, CONNECTOR_DISPATCH_REQUESTED_BY, MAX_PENDING_CONNECTOR_DISPATCHES, purgeDueOf, purgeOnlyKeysOf, runPurgePass, refuseTrashedTarget, assertBoundOperations, checkHeldOperationsOf, countChecks, noteUncheckedCompletion, registerTrashTargets, withheldKeysFor, capCoverage, delegationCeilingOf, delegationStampOf, outsideCeiling, parseScopeDelegation, statefulTablesOf, afterMigration, afterRuntimeDdl, derivesAnything, repairDerivedObjects, StateColumnLost, exchangeCapability, exchangeBecomeLinkById, guardSecrets, mintBecomeCapability, redactSecrets, redactSecretText, moduleLog, asyncInvocationId, asyncLinePass, resolveCapabilitySession, revokeCapabilityAsPlatform, readCapabilityPage, domainEventOf, facetEvents, readDeadLetters, readLifecycleFlow, readOperationSeries, readHistory, readInvocation, readUndrainedOutbox, walkEventCause, walkEventEffects, } from '@substrat-run/kernel';
|
|
13
13
|
import { assertSameAttachmentGate, attachmentGateOf, decideAttachmentRemove } from '@substrat-run/kernel';
|
|
14
14
|
import { COPY_RESTORE_FENCE_LAPSED, copyRestoreFenceLapsed, orphanSweepVersionRefusal } from '@substrat-run/kernel';
|
|
@@ -18,8 +18,10 @@ import { loadDropsRowsOf, SCOPE_COPY_LEASE_MS, ulidTime } from '@substrat-run/ke
|
|
|
18
18
|
import { handoffOutcome, reportHandoff, traceIdOf } from '@substrat-run/kernel';
|
|
19
19
|
import { currentTraceparent } from '@substrat-run/kernel/invocation-line';
|
|
20
20
|
import { analyticsBrokerSink, brokerTelemetryDataset } from './broker-telemetry.js';
|
|
21
|
-
import { DELIVERY_HANDOFF_KEY, HANDOFF_ROUNDS, handoffAfterFailure, handoffDue, handoffPending, mergeHandoff, sameMarks } from './delivery-handoff.js';
|
|
21
|
+
import { DELIVERY_HANDOFF_KEY, DELIVERY_MODE_KEY, HANDOFF_ROUNDS, deliveryModeAfter, handoffAfterFailure, handoffDue, handoffPending, mergeHandoff, sameMarks, } from './delivery-handoff.js';
|
|
22
|
+
import { registerPlatformDeliveryBroker } from './delivery-broker-platform.js';
|
|
22
23
|
import { advanceMarks, brokerName, handoffQueries, messagesOf } from '@substrat-run/kernel';
|
|
24
|
+
import { DELIVERY_HANDOFF_ENV, intentStateOf, intentStateQuery, witnessesOf, witnessQueries, } from '@substrat-run/kernel';
|
|
23
25
|
import { SCOPE_WAKE_KEY, keepRegisteredMeanwhile, kickControlPlane, runWake, wakeAfterCommit, wakeDueAt } from './scope-wake.js';
|
|
24
26
|
import { CARRIED_AWAY_KEY, COPY_MARK_CLEARED_KEY, KEPT_COPY_REFUSAL, KEPT_DIVERGENT_KEY, LOAD_STAMP_KEY, STORE_LOCAL_META_KEYS, WRITE_REVISION_KEY, carriedAwayDump, isCopyMarkInsert, isWriteStatement, assertSpineTablesBuilt, clearCopyMarker, dumpRowsInsert, isSpineTable, markCopyOrigin, repointScopeGrants, settleCopiedWork, emittedHere, IS_COPY_SQL, CLEAN_ROOM_COPY_SQL, isCopyLoad, isLifecycleWrite, readLifecycle, settleLifecycleAfterLoad, writeLifecycle, spineColumnAdditions } from '@substrat-run/kernel';
|
|
25
27
|
import { GRANT_CHILDREN_INDEX_DDL, SHAPE_MARKER_INDEX_DDL, grantedEntitiesForContext } from '@substrat-run/kernel';
|
|
@@ -926,6 +928,8 @@ options = {}) {
|
|
|
926
928
|
// import, rather than at the first scope it wakes.
|
|
927
929
|
for (const registration of modules)
|
|
928
930
|
assertModuleDeclared(options.permissions, registration.manifest.id);
|
|
931
|
+
// A5 (#3471): the broker the platform's supplied class forwards to is this kernel's.
|
|
932
|
+
registerPlatformDeliveryBroker();
|
|
929
933
|
// What the declared surface reserves holds in every instance too, whatever registers under its ids.
|
|
930
934
|
const declaredReserved = new Set();
|
|
931
935
|
const declaredListed = new Set();
|
|
@@ -1930,7 +1934,8 @@ options = {}) {
|
|
|
1930
1934
|
async pruneDrainedEvents(drainedBefore, limit, executors, due = true) {
|
|
1931
1935
|
// K-74: with a broker bound, only what it has acknowledged may go: the scope's own marks,
|
|
1932
1936
|
// which are only ever at or below what the broker holds, so the prune keeps more, never less.
|
|
1933
|
-
|
|
1937
|
+
// A5: only while this scope hands off at all; off, the broker holds nothing it still owes.
|
|
1938
|
+
const handedOffThrough = this.env.SUBSTRAT_DELIVERY_BROKER && (await this.handoffOptions()) !== null
|
|
1934
1939
|
? ((await this.ctx.storage.get(DELIVERY_HANDOFF_KEY))?.marks?.event ?? null)
|
|
1935
1940
|
: undefined;
|
|
1936
1941
|
return this.queue.enqueue(() => this.revision.transactionSync(() => pruneDrainedOutbox(this.switchSql(), {
|
|
@@ -2968,8 +2973,8 @@ options = {}) {
|
|
|
2968
2973
|
*
|
|
2969
2974
|
* The live reaper is this DO's only alarm use. A second one must share `alarm()` and
|
|
2970
2975
|
* this "earliest wins" rule, not call `setAlarm` on its own. The alarm makes workerd
|
|
2971
|
-
* keep a `_cf_METADATA` table in the scope's SQLite; every table walk here skips
|
|
2972
|
-
* `
|
|
2976
|
+
* keep a `_cf_METADATA` table in the scope's SQLite; every table walk here skips the
|
|
2977
|
+
* runtime's own tables (`isRuntimeTable`) for that reason (`exportDump`, `importDump`, `introspectTables`).
|
|
2973
2978
|
*/
|
|
2974
2979
|
async armLiveExpiry() {
|
|
2975
2980
|
let earliest;
|
|
@@ -3056,7 +3061,15 @@ options = {}) {
|
|
|
3056
3061
|
await this.ctx.storage.delete(SCOPE_WAKE_KEY);
|
|
3057
3062
|
return;
|
|
3058
3063
|
}
|
|
3059
|
-
|
|
3064
|
+
let answered;
|
|
3065
|
+
const ran = await runWake(state, Date.now(), () => this.wakeWork(), async (body) => {
|
|
3066
|
+
const answer = await kickControlPlane(transport, body);
|
|
3067
|
+
answered = answer?.broker;
|
|
3068
|
+
return answer;
|
|
3069
|
+
});
|
|
3070
|
+
// A5: the delivery mode the control plane holds for this tenant, on the same answer.
|
|
3071
|
+
if (answered)
|
|
3072
|
+
await this.applyDeliveryMode(state.tenantId, state.scopeId, answered);
|
|
3060
3073
|
// The object took other calls while the kick was out: keep what a commit stored meanwhile.
|
|
3061
3074
|
const next = keepRegisteredMeanwhile(state, ran, (await this.ctx.storage.get(SCOPE_WAKE_KEY)) ?? null);
|
|
3062
3075
|
if (!next) {
|
|
@@ -3091,10 +3104,16 @@ options = {}) {
|
|
|
3091
3104
|
* makes no progress, or that stops at its round limit with work left keeps it, on
|
|
3092
3105
|
* `HANDOFF_RETRY_MS`.
|
|
3093
3106
|
*/
|
|
3094
|
-
async handOffCommitted(tenantId, scopeId
|
|
3107
|
+
async handOffCommitted(tenantId, scopeId,
|
|
3108
|
+
/** #3474: the invocation whose commit this follows, and its trace: its own rows carry the trace. */
|
|
3109
|
+
commit) {
|
|
3095
3110
|
const broker = this.deliveryBroker(tenantId);
|
|
3096
3111
|
if (!broker)
|
|
3097
3112
|
return;
|
|
3113
|
+
// A5 (#3471): only while the tenant is in shadow or live, and under that mode.
|
|
3114
|
+
const options = await this.handoffOptions(tenantId, scopeId);
|
|
3115
|
+
if (options === null)
|
|
3116
|
+
return;
|
|
3098
3117
|
const ids = { tenantId, scopeId };
|
|
3099
3118
|
const stored = (await this.ctx.storage.get(DELIVERY_HANDOFF_KEY)) ?? null;
|
|
3100
3119
|
let marks = stored?.marks;
|
|
@@ -3107,8 +3126,15 @@ options = {}) {
|
|
|
3107
3126
|
// A backlog larger than one batch follows in the next round; bounded, so a commit never spins.
|
|
3108
3127
|
for (let round = 0; round < HANDOFF_ROUNDS; round++) {
|
|
3109
3128
|
inFlight = null;
|
|
3110
|
-
const sent = handoffQueries(marks).flatMap((q) => messagesOf(q.kind, this.sql.exec(q.sql, ...q.params).toArray(), ids));
|
|
3129
|
+
const sent = handoffQueries(marks).flatMap((q) => messagesOf(q.kind, this.sql.exec(q.sql, ...q.params).toArray(), ids, commit));
|
|
3111
3130
|
if (sent.length === 0) {
|
|
3131
|
+
// A5: a window's start the broker has not acknowledged goes on its own.
|
|
3132
|
+
if (options.start) {
|
|
3133
|
+
inFlight = { sent, startedAt: Date.now() };
|
|
3134
|
+
await broker.handOff([], options);
|
|
3135
|
+
inFlight = null;
|
|
3136
|
+
await this.startAcknowledged(options);
|
|
3137
|
+
}
|
|
3112
3138
|
drained = true;
|
|
3113
3139
|
break;
|
|
3114
3140
|
}
|
|
@@ -3118,7 +3144,11 @@ options = {}) {
|
|
|
3118
3144
|
await this.armAlarmBy(retry.due);
|
|
3119
3145
|
}
|
|
3120
3146
|
inFlight = { sent, startedAt: Date.now() };
|
|
3121
|
-
const answer = await broker.handOff(sent);
|
|
3147
|
+
const answer = await broker.handOff(sent, options);
|
|
3148
|
+
if (options.start) {
|
|
3149
|
+
await this.startAcknowledged(options);
|
|
3150
|
+
delete options.start;
|
|
3151
|
+
}
|
|
3122
3152
|
const next = advanceMarks(marks, sent, answer);
|
|
3123
3153
|
this.reportHandoffRound(tenantId, scopeId, inFlight, handoffOutcome(sent, answer));
|
|
3124
3154
|
inFlight = null;
|
|
@@ -3146,6 +3176,75 @@ options = {}) {
|
|
|
3146
3176
|
await this.armAlarmBy(next.due);
|
|
3147
3177
|
}
|
|
3148
3178
|
}
|
|
3179
|
+
/**
|
|
3180
|
+
* A5: what a handoff names, or null when this scope hands off nothing (its tenant is off).
|
|
3181
|
+
* `SUBSTRAT_DELIVERY_HANDOFF=always` hands off naming no mode, owing every receiver (A1–A4).
|
|
3182
|
+
*/
|
|
3183
|
+
async handoffOptions(tenantId, scopeId) {
|
|
3184
|
+
if (this.env.SUBSTRAT_DELIVERY_HANDOFF === 'always')
|
|
3185
|
+
return {};
|
|
3186
|
+
const state = (await this.ctx.storage.get(DELIVERY_MODE_KEY)) ?? null;
|
|
3187
|
+
if (!state)
|
|
3188
|
+
return null;
|
|
3189
|
+
return {
|
|
3190
|
+
mode: state.mode,
|
|
3191
|
+
...(state.startPending && tenantId && scopeId ? { start: { tenantId, scopeId, after: state.start } } : {}),
|
|
3192
|
+
};
|
|
3193
|
+
}
|
|
3194
|
+
/** A5: the broker took the window's start; stop sending it, unless the mode went on again meanwhile. */
|
|
3195
|
+
async startAcknowledged(options) {
|
|
3196
|
+
const state = (await this.ctx.storage.get(DELIVERY_MODE_KEY)) ?? null;
|
|
3197
|
+
if (!state?.startPending || !options.start || !sameMarks(state.start, options.start.after))
|
|
3198
|
+
return;
|
|
3199
|
+
const { startPending: _sent, ...rest } = state;
|
|
3200
|
+
await this.ctx.storage.put(DELIVERY_MODE_KEY, rest);
|
|
3201
|
+
}
|
|
3202
|
+
/** A5: what this scope holds now, past which a handoff seeded here starts. */
|
|
3203
|
+
handoffSeed() {
|
|
3204
|
+
const event = this.sql.exec(`SELECT id FROM _substrat_outbox WHERE ${emittedHere()} ORDER BY id DESC LIMIT 1`).toArray()[0];
|
|
3205
|
+
const intent = this.sql.exec(`SELECT id FROM _substrat_platform_requests WHERE ${emittedHere()} ORDER BY id DESC LIMIT 1`).toArray()[0];
|
|
3206
|
+
return { ...(event ? { event: event.id } : {}), ...(intent ? { intent: intent.id } : {}) };
|
|
3207
|
+
}
|
|
3208
|
+
/**
|
|
3209
|
+
* A5 (#3471): the delivery mode the control plane holds for this scope's tenant, as its wake's
|
|
3210
|
+
* answer carried it. Going on from off seeds the handoff at what the scope holds now: the drain
|
|
3211
|
+
* delivers everything committed before, and the broker sees only what follows. Off stops the
|
|
3212
|
+
* handoff; what the broker already holds stays with it, owed the receivers it was owed.
|
|
3213
|
+
*
|
|
3214
|
+
* Public for the platform and the suites; a caller in the script can only change which receivers
|
|
3215
|
+
* its own next messages are owed, never what the control plane lets the broker drive.
|
|
3216
|
+
*/
|
|
3217
|
+
async applyDeliveryMode(tenantId, scopeId, mode) {
|
|
3218
|
+
await this.ensureMigrations();
|
|
3219
|
+
const prior = (await this.ctx.storage.get(DELIVERY_MODE_KEY)) ?? null;
|
|
3220
|
+
const { next, seeded } = deliveryModeAfter(prior, mode, () => this.handoffSeed());
|
|
3221
|
+
if (next === prior)
|
|
3222
|
+
return;
|
|
3223
|
+
if (!next) {
|
|
3224
|
+
await this.ctx.storage.delete(DELIVERY_MODE_KEY);
|
|
3225
|
+
return;
|
|
3226
|
+
}
|
|
3227
|
+
if (seeded)
|
|
3228
|
+
await this.keepHandoff({ tenantId, scopeId, marks: seeded });
|
|
3229
|
+
await this.ctx.storage.put(DELIVERY_MODE_KEY, next);
|
|
3230
|
+
// The window's start reaches the broker with the next handoff; one now, so a quiet scope has one too.
|
|
3231
|
+
if (seeded)
|
|
3232
|
+
await this.handOffCommitted(tenantId, scopeId);
|
|
3233
|
+
}
|
|
3234
|
+
/**
|
|
3235
|
+
* A5: the drain's witness for the shadow comparison — this scope's own messages past `after`,
|
|
3236
|
+
* committed before `before`, with when the drain delivered each (`witnessQueries`). Reads only.
|
|
3237
|
+
*/
|
|
3238
|
+
async deliveryWitness(after, before, limit) {
|
|
3239
|
+
await this.ensureMigrations();
|
|
3240
|
+
return witnessQueries(after, before, Math.min(Math.max(1, limit), 1_000)).flatMap((q) => witnessesOf(q.kind, this.sql.exec(q.sql, ...q.params).toArray()));
|
|
3241
|
+
}
|
|
3242
|
+
/** A5: an intent's state, for the broker's live receiver. One primary-key read. */
|
|
3243
|
+
async intentDeliveryState(id) {
|
|
3244
|
+
await this.ensureMigrations();
|
|
3245
|
+
const q = intentStateQuery(id);
|
|
3246
|
+
return intentStateOf(this.sql.exec(q.sql, ...q.params).toArray());
|
|
3247
|
+
}
|
|
3149
3248
|
/** #3474: one point per handoff round, when the script binds `SUBSTRAT_BROKER_TELEMETRY`. */
|
|
3150
3249
|
reportHandoffRound(tenantId, scopeId, round, outcome) {
|
|
3151
3250
|
if (this.brokerSink === undefined) {
|
|
@@ -3302,8 +3401,8 @@ options = {}) {
|
|
|
3302
3401
|
await this.dispatch(tenantId, scopeId, invocationId);
|
|
3303
3402
|
// K-69: after the consumers, whose own emits and intents count too.
|
|
3304
3403
|
await this.noteScopeWake(tenantId, scopeId);
|
|
3305
|
-
// K-74: the same, for the delivery broker.
|
|
3306
|
-
await this.handOffCommitted(tenantId, scopeId);
|
|
3404
|
+
// K-74: the same, for the delivery broker. #3474: the rows this call wrote carry its trace.
|
|
3405
|
+
await this.handOffCommitted(tenantId, scopeId, { invocationId, traceId: traceIdOf(currentTraceparent()) });
|
|
3307
3406
|
if (liveSince === null)
|
|
3308
3407
|
return;
|
|
3309
3408
|
try {
|
|
@@ -4109,19 +4208,41 @@ options = {}) {
|
|
|
4109
4208
|
return this.queue.enqueue(async () => this.revision.transactionSync(() => recordAttachmentText(doSpineSql(this.sql), attachmentId, outcome, new Date().toISOString())));
|
|
4110
4209
|
}
|
|
4111
4210
|
/**
|
|
4112
|
-
* #1575: start the scope's
|
|
4113
|
-
*
|
|
4114
|
-
*
|
|
4211
|
+
* #1575: start the scope's kernel walks over its attachments — the one-shot backfill, and
|
|
4212
|
+
* the recheck for `extractorSet` when the host names one — unless each is marked or the
|
|
4213
|
+
* scope holds no attachments (both read before they write, so a marked scope writes
|
|
4214
|
+
* nothing — and moves no write revision — on every drive). The set is the host's: the DO
|
|
4215
|
+
* holds no extractors.
|
|
4216
|
+
*
|
|
4217
|
+
* One call for both, because the drive makes it for every scope on every pass: a second
|
|
4218
|
+
* call would be a second DO request per scope per sweep. The name predates the recheck and
|
|
4219
|
+
* stays, so a host and a DO a deploy has not yet brought level still talk: an older DO
|
|
4220
|
+
* ignores the argument, and an older host sends none, which starts no recheck.
|
|
4115
4221
|
*/
|
|
4116
|
-
async attachmentTextBackfillStart() {
|
|
4222
|
+
async attachmentTextBackfillStart(extractorSet) {
|
|
4117
4223
|
await this.ensureMigrations();
|
|
4118
|
-
await this.queue.enqueue(async () => this.revision.transactionSync(() =>
|
|
4224
|
+
await this.queue.enqueue(async () => this.revision.transactionSync(() => {
|
|
4225
|
+
const at = new Date().toISOString();
|
|
4226
|
+
startAttachmentTextBackfill(doSpineSql(this.sql), ulid(), at);
|
|
4227
|
+
if (typeof extractorSet === 'string')
|
|
4228
|
+
startAttachmentTextRecheck(doSpineSql(this.sql), extractorSet, ulid(), at);
|
|
4229
|
+
}));
|
|
4119
4230
|
}
|
|
4120
4231
|
/** #1575: one backfill batch, in one transaction (`queueAttachmentTextBackfill`). */
|
|
4121
4232
|
async attachmentTextBackfillBatch(after) {
|
|
4122
4233
|
await this.ensureMigrations();
|
|
4123
4234
|
return this.queue.enqueue(async () => this.revision.transactionSync(() => queueAttachmentTextBackfill(doSpineSql(this.sql), after, ulid, new Date().toISOString())));
|
|
4124
4235
|
}
|
|
4236
|
+
/** One page of the recheck's walk — a read; which rows an extractor reads is the host's call. */
|
|
4237
|
+
async attachmentTextRecheckPage(after) {
|
|
4238
|
+
await this.ensureMigrations();
|
|
4239
|
+
return this.queue.enqueue(async () => readAttachmentTextRecheckPage(doSpineSql(this.sql), after));
|
|
4240
|
+
}
|
|
4241
|
+
/** Re-queue these, each only while still `unsupported` with no live run, in one transaction (`requeueUnsupportedAttachmentText`). */
|
|
4242
|
+
async attachmentTextRequeueUnsupported(attachmentIds) {
|
|
4243
|
+
await this.ensureMigrations();
|
|
4244
|
+
return this.queue.enqueue(async () => this.revision.transactionSync(() => requeueUnsupportedAttachmentText(doSpineSql(this.sql), attachmentIds, ulid, new Date().toISOString())));
|
|
4245
|
+
}
|
|
4125
4246
|
// -- attachments through a capability (#1686) -------------------------------
|
|
4126
4247
|
// The coordinator hashed the session token; only the hash arrives. Each verb resolves it
|
|
4127
4248
|
// INSIDE the queue, as `invoke` does, so nothing can revoke between the resolution and
|
|
@@ -6015,11 +6136,15 @@ options = {}) {
|
|
|
6015
6136
|
// schema plus a bounded page, so nothing here can write the spine or inject.
|
|
6016
6137
|
// Authorization + the (tenantId, scopeId) K-3 cross-check happen on the
|
|
6017
6138
|
// coordinator BEFORE this RPC is reached (host.ts admin.listScopeTables).
|
|
6139
|
+
/** Every table in this scope's DB by name, without the runtime's own. */
|
|
6140
|
+
tableNames() {
|
|
6141
|
+
return this.sql.exec(`SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name`).toArray()
|
|
6142
|
+
.map((r) => r.name)
|
|
6143
|
+
.filter((name) => !isRuntimeTable(name));
|
|
6144
|
+
}
|
|
6018
6145
|
/** Every table in this scope's DB, with row counts; spine/internal tables flagged. */
|
|
6019
6146
|
introspectTables() {
|
|
6020
|
-
const names = this.
|
|
6021
|
-
.exec(`SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT GLOB '_cf_*' ORDER BY name`)
|
|
6022
|
-
.toArray().map((r) => r.name);
|
|
6147
|
+
const names = this.tableNames();
|
|
6023
6148
|
const known = new Set(names);
|
|
6024
6149
|
const count = (sql) => Number(this.sql.exec(sql).toArray()[0].c);
|
|
6025
6150
|
return names.map((name) => ({
|
|
@@ -6043,9 +6168,7 @@ options = {}) {
|
|
|
6043
6168
|
return replyOf(() => this.tablePage(table, limit, offset));
|
|
6044
6169
|
}
|
|
6045
6170
|
tablePage(table, limit, offset) {
|
|
6046
|
-
const known = new Set(this.
|
|
6047
|
-
.exec(`SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT GLOB '_cf_*'`)
|
|
6048
|
-
.toArray().map((r) => r.name));
|
|
6171
|
+
const known = new Set(this.tableNames());
|
|
6049
6172
|
if (!known.has(table))
|
|
6050
6173
|
throw substratError('not_found', `unknown table '${table}'`);
|
|
6051
6174
|
// The ceiling clamps; a bound SQLite would misread (NaN, non-finite, fractional,
|
|
@@ -6077,7 +6200,7 @@ options = {}) {
|
|
|
6077
6200
|
}
|
|
6078
6201
|
async readOnlyQuery(sql) {
|
|
6079
6202
|
const stmt = assertReadOnlyQuery(sql);
|
|
6080
|
-
|
|
6203
|
+
assertNoRuntimeStorage(stmt);
|
|
6081
6204
|
let result;
|
|
6082
6205
|
const rollback = new Error('read-only console rollback');
|
|
6083
6206
|
try {
|
|
@@ -6174,10 +6297,10 @@ options = {}) {
|
|
|
6174
6297
|
dumpTableDefs() {
|
|
6175
6298
|
return this.sql
|
|
6176
6299
|
.exec(`SELECT name, sql FROM sqlite_master
|
|
6177
|
-
WHERE type = 'table' AND name NOT GLOB 'sqlite_*'
|
|
6300
|
+
WHERE type = 'table' AND name NOT GLOB 'sqlite_*'
|
|
6178
6301
|
AND name NOT GLOB '${STAGE_GLOB}' AND name NOT GLOB '${CAPTURE_GLOB}' AND sql IS NOT NULL
|
|
6179
6302
|
ORDER BY name`)
|
|
6180
|
-
.toArray().filter(({ name }) => !isSearchIndexTable(name) && !isWireNonceTable(name));
|
|
6303
|
+
.toArray().filter(({ name }) => !isRuntimeTable(name) && !isSearchIndexTable(name) && !isWireNonceTable(name));
|
|
6181
6304
|
}
|
|
6182
6305
|
/**
|
|
6183
6306
|
* One page of `exportDumpStamped` (#2450): the tables in the same order, each table's rows in
|
|
@@ -6837,7 +6960,7 @@ options = {}) {
|
|
|
6837
6960
|
// The wire nonce store is this store's own (RFC wire-signing §4): never replayed, so a load
|
|
6838
6961
|
// starts it empty.
|
|
6839
6962
|
const replayable = tables
|
|
6840
|
-
.filter((t) => !isSearchIndexTable(t.name.toLowerCase()) && !isWireNonceTable(t.name))
|
|
6963
|
+
.filter((t) => !isRuntimeTable(t.name) && !isSearchIndexTable(t.name.toLowerCase()) && !isWireNonceTable(t.name))
|
|
6841
6964
|
.map((t) => (loadDropsRowsOf(t.name, destScopeId, sourceScopeId) ? { ...t, rows: () => [] } : t));
|
|
6842
6965
|
// The dump is untrusted input (#1143). `SqlStorage.exec` runs every statement
|
|
6843
6966
|
// in the string it is given, so a `ddl` with anything appended to its CREATE
|
|
@@ -6919,17 +7042,16 @@ options = {}) {
|
|
|
6919
7042
|
this.sql.exec('PRAGMA defer_foreign_keys = ON');
|
|
6920
7043
|
// Real tables only; `sqlite_*` internals are auto-managed and un-droppable.
|
|
6921
7044
|
const existing = this.sql
|
|
6922
|
-
// Nor workerd's own `_cf_*` (the live reaper's alarm keeps `_cf_METADATA`), which
|
|
6923
|
-
// it refuses to drop.
|
|
6924
7045
|
// Nor a staged load's own tables (#2450): this commit reads its rows from them below.
|
|
6925
|
-
.exec(`SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT GLOB 'sqlite_*'
|
|
7046
|
+
.exec(`SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT GLOB 'sqlite_*'
|
|
6926
7047
|
AND name NOT GLOB '${STAGE_GLOB}'`)
|
|
6927
7048
|
.toArray();
|
|
6928
7049
|
// Search index tables are left alone here and rebuilt below (#827): dropping a
|
|
6929
7050
|
// shadow table directly is an error, and `sqlite_master` order would reach one
|
|
6930
7051
|
// before its virtual table.
|
|
6931
7052
|
for (const { name } of existing) {
|
|
6932
|
-
|
|
7053
|
+
// The runtime's own (the live reaper's alarm keeps `_cf_METADATA`) it refuses to drop.
|
|
7054
|
+
if (isRuntimeTable(name) || isSearchIndexTable(name.toLowerCase()))
|
|
6933
7055
|
continue;
|
|
6934
7056
|
this.sql.exec(`DROP TABLE IF EXISTS "${name}"`);
|
|
6935
7057
|
}
|