@substrat-run/adapter-sqlite 0.140.0 → 0.141.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/index.d.ts CHANGED
@@ -430,6 +430,8 @@ export declare class SqliteScopeHost implements ScopeHost {
430
430
  * same as one that does not exist. Migrations are applied as on every door.
431
431
  */
432
432
  private openActiveScope;
433
+ /** The directory's current hold, read again when background work is about to run. */
434
+ private scopeWorkRefusal;
433
435
  /**
434
436
  * The exchange (#1672) — a secret traded for a session, or for the principal a `become`
435
437
  * capability yields. One serialized scope task and one transaction, so the use it takes
@@ -763,6 +765,13 @@ export declare class SqliteScopeHost implements ScopeHost {
763
765
  * directory. `PRAGMA table_info` is available in the pure adapter (the DO adapter
764
766
  * has to attempt-and-tolerate instead — see its `ensureDirectoryColumns`).
765
767
  */
768
+ /**
769
+ * Move a scope's binding or route (#1722), conditionally: on the binding the caller read, on
770
+ * the erasure epoch its carry read (a NULL epoch, from before the column, is 0) with no reap
771
+ * claimed, and on its copy move still owning a live lease. The move's confirmation commits in
772
+ * the same transaction as the row. False when any condition failed and nothing was written.
773
+ */
774
+ private moveScopeRow;
766
775
  private ensureColumn;
767
776
  /**
768
777
  * #1288: `_substrat_schedule_state`, rebuilt with `kind` in its key on a scope db
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAmBL,KAAK,eAAe,EAcpB,KAAK,WAAW,EAEhB,KAAK,YAAY,EAuBjB,KAAK,QAAQ,EACb,KAAK,YAAY,EAIjB,KAAK,cAAc,EA6CnB,KAAK,kBAAkB,EAQvB,KAAK,YAAY,EAOjB,KAAK,QAAQ,EAeb,KAAK,WAAW,EAIhB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAM1B,KAAK,wBAAwB,EAW7B,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,UAAU,E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uB;IAI/B;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAIjC;;;OAGG;IACH,OAAO,CAAC,cAAc;IAmBtB;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,iBAAiB;IA0BzB;;;;;;;OAOG;IACH,OAAO,CAAC,4BAA4B;IA4BpC;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,yBAAyB;IAWjC,OAAO,CAAC,sBAAsB;IAyI9B,OAAO,CAAC,SAAS;IAejB;;;;OAIG;IACH,qGAAqG;IACrG,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;IA6hBxB,oGAAoG;IACpG,OAAO,CAAC,YAAY;IAIpB;;;;;;OAMG;YACW,aAAa;YAqBb,sBAAsB;IAoFpC;;;;;;;;;OASG;IACH,OAAO,CAAC,oBAAoB;IAyB5B;;;;;OAKG;IACH;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,UAAU;IAKlB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,cAAc;IAKtB;;;;;OAKG;IACH,OAAO,CAAC,MAAM;IAuBd;;;OAGG;IACH,OAAO,CAAC,YAAY;IAUpB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAsG1B,OAAO,CAAC,OAAO;CAsChB"}
package/dist/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
2
2
  import { dirname, join } from 'node:path';
3
3
  import Database from 'better-sqlite3';
4
- import { accessLogEntry, adminLogEntry, delegatedReadParams, operationSeriesCount, opsFailureEntry, opsFailureFingerprint, issueEntry, FRESHNESS_HEARTBEAT_MINUTES, sweepRunEntry, modelUsageEntry, ATTACHMENT_ADDED, ATTACHMENT_REMOVED, attachmentRecord, createTenantInput, domainEvent, domainEventInput, exportReadInput, importBatch, importCursorMove, exportsOfManifestJson, importsOfManifestJson, entitlementGrant, entitlementGrantInput, eventId, meterReading, platformRequestInput, platformRequestId, MAX_PENDING_PLATFORM_REQUESTS, identityLink, identityPool, instant, connection, capabilityGrant, connectionGrant, connectionGrantRecord, connectionSecret, systemGrant, systemSwitch, systemSwitchRecord, peerSwitch, verticalCaller, verticalSlug as verticalSlugOf, subjectRef, requestFingerprint, createConnectionInput, connectLinkFilter, connectLinkKey, consumeConnectLinkInput, mintConnectLinkInput, projectedConnectionGrant, projectedConnectionKey, moduleManifest, createOrgInput, promotionAcknowledgement, bindAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, publishVersionInput, AUTO_ADMISSION_NOTE, routeTarget, ROUTE_SCOPE_HOSTNAMES_MAX, registerVerticalInput, vertical as verticalSchema, verticalChannel, verticalVersion, objectRef, entityObjectRef, assertModuleEmittableType, assertKernelAuthoredType, grantRefFromProof, org as orgSchema, orgMembership, principalId, resolvedIdentity, identityMembership, roleDefinition, scope as scopeSchema, tenant as tenantSchema, tenantRole, subjectShredReceipt, SCOPE_TABLE_PAGE_DEFAULT, SCOPE_TABLE_PAGE_MAX, SCOPE_QUERY_ROW_MAX, verticalServingState, callsOfManifestJson, outboundOfManifestJson, listLimitOf, pageOf, countedPageOf, SCOPE_GATE_REASONS, substratError, assertReplayableDump, delegatedReadRecord, ownerTransferAudit, memberChangeAudit, peerBindingAudit, copyMarkAudit, redrainEventsInput, REDRAIN_BATCH, } from '@substrat-run/contracts';
4
+ import { accessLogEntry, adminLogEntry, delegatedReadParams, operationSeriesCount, opsFailureEntry, opsFailureFingerprint, issueEntry, FRESHNESS_HEARTBEAT_MINUTES, sweepRunEntry, modelUsageEntry, ATTACHMENT_ADDED, ATTACHMENT_REMOVED, attachmentRecord, createTenantInput, domainEvent, domainEventInput, exportReadInput, importBatch, importCursorMove, exportsOfManifestJson, importsOfManifestJson, entitlementGrant, entitlementGrantInput, eventId, meterReading, platformRequestInput, platformRequestId, MAX_PENDING_PLATFORM_REQUESTS, identityLink, identityPool, instant, isSubstratError, connection, capabilityGrant, connectionGrant, connectionGrantRecord, connectionSecret, systemGrant, systemSwitch, systemSwitchRecord, peerSwitch, verticalCaller, verticalSlug as verticalSlugOf, subjectRef, requestFingerprint, createConnectionInput, connectLinkFilter, connectLinkKey, consumeConnectLinkInput, mintConnectLinkInput, projectedConnectionGrant, projectedConnectionKey, moduleManifest, createOrgInput, promotionAcknowledgement, bindAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, publishVersionInput, AUTO_ADMISSION_NOTE, routeTarget, ROUTE_SCOPE_HOSTNAMES_MAX, registerVerticalInput, vertical as verticalSchema, verticalChannel, verticalVersion, objectRef, entityObjectRef, assertModuleEmittableType, assertKernelAuthoredType, grantRefFromProof, org as orgSchema, orgMembership, principalId, resolvedIdentity, identityMembership, roleDefinition, scope as scopeSchema, tenant as tenantSchema, tenantRole, subjectShredReceipt, SCOPE_TABLE_PAGE_DEFAULT, SCOPE_TABLE_PAGE_MAX, SCOPE_QUERY_ROW_MAX, verticalServingState, callsOfManifestJson, outboundOfManifestJson, listLimitOf, pageOf, countedPageOf, SCOPE_GATE_REASONS, substratError, assertReplayableDump, delegatedReadRecord, ownerTransferAudit, memberChangeAudit, peerBindingAudit, copyMarkAudit, redrainEventsInput, REDRAIN_BATCH, } from '@substrat-run/contracts';
5
5
  import { actorOf, asPrincipal, assertAllowed, assertNoSecret, assertPermissionKey, CAPABILITY_DDL, COPY_ORIGIN_DDL, ENTITY_STATE_MOVES_DDL, CAPABILITY_EXCHANGE_OPERATION, capabilityAttachmentWriteRefused, capabilityTokenHash, createCapabilityVerbs, createEntityEdgeVerbs, createEntityStateVerbs, createTrashedReads, CONTINUATION_POSITION_CAP, visibleContinuation, searchStateWhere, uncheckedView, addStatePlans, entityStateMigrations, assertNoCallerPurge, isUnreachableParent, heldPurgePass, purgeDueOf, purgeHeldBy, lifecycleRefusal, purgeOnlyKeysOf, purgeReportOf, purgeStillDue, refuseTrashedTarget, registerTrashTargets, runPurgePass, withheldKeysFor, statefulTablesOf, afterMigration, afterRuntimeDdl, derivesAnything, repairDerivedObjects, StateColumnLost, exchangeCapability as exchangeCapabilitySecret, guardSecrets, mintBecomeCapability, plausibleSessionToken, readCapabilityPage, redactSecrets, redactSecretText, moduleLog, consoleLogSink, asyncInvocationId, asyncLinePass, consoleInvocationLineSink, resolveCapabilitySession, revokeCapabilityAsPlatform, assertReadOnlyQuery, attachmentBlobKey, attachmentSha256, entitlementDenial, requiredEntitlementFor, foldMeterReading, guardSpine, guardSqlLimits, DO_SQL_LIMITS, tooManyResultColumns, tooManyTableColumns, parseValidationRecords, resolveScopeRecord, ulid, ISSUE_RETENTION_DAYS, telemetryRetentionStatements, FINDINGS_DDL, CONNECT_LINKS_DDL, consumeConnectLinkRow, insertConnectLink, listConnectLinks as listConnectLinkRows, readConnectLink, restoreConnectLinkRow, revokeConnectLinkRow, createFindingRule, findingOfOpsFailure, findingOfSweepRun, pruneFindings, listFindingRules, listFindings, observeFinding, revokeFindingRule, setFindingStatus, assertRowLimit, assertRowOffset, OPS_FAILURE_RETENTION_DAYS, SWEEP_RUN_RETENTION_DAYS, SWEEP_RUNS_INTENT_INDEX, sweepRunsIntentHasKind, MODEL_USAGE_RETENTION_DAYS, foldModelUsage, backoffAt, platformRequestHistoryQuery, platformRequestOf, PLATFORM_REQUEST_COLUMNS, PLATFORM_REQUEST_REDACTION_SQL, platformRequestRedactionParams, platformRequestRedactionQuery, intentPayloadCarriesSubject, redactSubjectJobRuns, eraseSubjectFromModules, moduleRowsErased, moduleErasurePlan, redactSubjectScopeText, redactSubjectDirectoryText, ISSUE_EXEMPLAR_OWNER_BACKFILL_SQL, issueExemplarOwner, 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_STEP_RECORD_SQL, JOB_LEASE_EXPIRED_NOTE, assertLeaseMs, DELIVERY_ERROR_REDACTION_SQL, REDACTED_DELIVERY_NOTE, seatScopeTuple, applyScopeRoleChange, changeScopeRole, revokeScopeRoles, scopeRoleHolders, admitPeer, collectPeers, peerSeats, resolveVerticalInstanceFrom, resolvePeerInstanceFrom, peerGrantsStatus, systemGrantsStatus, systemScheduleState, systemSwitchedOff, systemSwitchedOffMessage, tenantSystemSwitchedOffMessage, PEER_SWITCHES_DDL, PEER_BINDINGS_DDL, SWITCH_OWED_DDL, SWITCH_FENCES_DDL, TABLE_OWNERS_DDL, assertMigrationLeavesLedgerAlone, recordOwnershipSteps, runMigrationStatements, executableSqlStatements, blankSqlComments, recordWriteSuperseded, switchFencesOf, switchSupersededMessage, SWITCH_KINDS, SYSTEM_SWITCHES_DDL, forgetSwitchesOf, listSystemSwitchRecords, moveSwitch, reassertActionOf, reassertEntry, reassertOffRow, recordSwitchedOff, recordSwitchedOn, restoreSwitchRecord, scopesSwitchedOffFor, switchActionOf, switchAuditSubject, recordAuditOutcome, auditWarningOf, switchNotFoundMessage, switchRecordsOf, switchedOffOf, switchesBackfillSqlOf, switchesTableExists, tenantHeldOf, tenantHoldsGrant, inUnitMovesToAudit, staleCarryRevertRow, staleCarryReverts, withRecorded, VERSION_MIGRATIONS_DDL, splitManifestMigrations, splitVersionMigrationsBatch, versionMigrationsOf, writeVersionMigrations, denialListQuery, refusalListQuery, mapRefusalRow, denialSummaryQuery, denialTotalsQuery, DENIAL_WINDOW_QUERY, mapDenialRow, mapDenialSummaryBuckets, IMPERSONATION_COLUMNS, IMPERSONATION_DDL, ImpersonationRefused, assertImpersonationWrites, assertModuleEnqueueableKind, assertSessionUsable, impersonationByIdQuery, impersonationListQuery, impersonationRowValues, impersonationStampOf, mapImpersonationRow, newImpersonationSession, resolveRetryPolicy, executorOutcomeOf, isDeliveryRefusal, refusalJournalText, membershipFencesBackfillSql, MEMBERSHIP_FENCES_DDL, membershipFencesTableExists, MEMBERSHIP_FENCE_SINCE_SQL, RAISE_MEMBERSHIP_FENCE_SQL, memberAddedAudit, orgChangeBound, tenantCoverage, isSecretBoxConfigured, unconfiguredSecretBox, createSubjectKeys, generateSealingKeyPair, noSealingKeyMessage, openSealed, sealTo, ConnectionSealingKeyUnavailableError, PermissionDenied, createAtomic, NotSearchable, NotListable, listIndexMigrations, listIndexPlans, listQuery, cursorOf, moduleMigrations, MIGRATION_DIGEST_FENCE_DDL, MIGRATION_DIGEST_MARK_LEGACY, assertJournalDumpCoherent, assertMigrationSql, migrationDivergence, migrationFailedError, migrationSteps, planMigrations, isSearchIndexTable, searchIndexMigrations, searchIndexPlans, searchLimit, searchMatchExpression, searchQuery, ATTACHMENT_TEXT_DDL, assertAttachmentExtractors, resolveAttachmentTextBounds, assertJobRegistrable, attachmentRecordOfRow, attachmentTextJob, enqueueAttachmentText, ATTACHMENT_TEXT_BACKFILL_JOB, ATTACHMENT_TEXT_JOB, kernelJobFor, queueAttachmentTextBackfill, startAttachmentTextBackfill, attachmentTextBackfillJob, reconcileAttachmentText, recordAttachmentText, searchAttachments, 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, emittedSinceQuery, emittedReportOf, EMITTED_REPORT_CAP, exportedSinceQuery, IMPORT_CURSOR_ADVANCE_SQL, IMPORT_RECORD_SQL, moveImportCursor, importCursorSourceOf, exportBreaksOf, exportBreakRefusal, bindExportBreaksOf, bindExportBreakRefusal, CrossVerticalRegistry, exportReadPlan, exportReadQuery, planExportBatch, withheldNote, JOB_RUN_DDL, JOB_RUN_DUE_AT, jobRunListLimit, jobRunOf, runDueJobRuns, startJobRun, IDEMPOTENCY_DDL, REFUSALS_TABLE_DDL, REFUSALS_INDEX, refusalInsert, refusalOf, markGuardRefusal, REFUSALS_REBUILD, refusalsAdmitGuards, assertIdempotencyKey, idempotencyLookupQuery, idempotencyPruneStatement, idempotencyRecordStatement, idempotencyOptedOutMessage, replayFor, globalFetch, createUlid, facetEvents, readHistory, walkEventCause, walkEventEffects, assertRedrainWindow, readInvocation, readDeadLetters, readLifecycleFlow, readOperationSeries, domainEventOf, readUndrainedOutbox, undrainedEventsOf, connectorCallRecord, noopConnectorCallRecorder, recordConnectorCall, settleConnectionUse, unknownRoleError, } from '@substrat-run/kernel';
6
6
  import { attributedView, delegatedRevokeSql, writeExplicitTupleIn, grantEntityShapeIn, shapeTopUpBatch, topUpEntityGrantShapes, settlePlatformRequestIn, } from '@substrat-run/kernel';
7
7
  import { ADMIN_LOG_INDEXES_SQL, SETTLE_INTENT_SQL, SETTLE_OUTCOME_SQL, settleOutcomeParamsOf, readAuditedOperations, unknownOutcomeOf, } from '@substrat-run/kernel';
8
8
  import { INERT_SCOPE_REASON, isPrimaryScopeRow } from '@substrat-run/kernel';
9
+ import { COPY_CLAIM_SQL, COPY_EXPIRED_SQL, COPY_MOVE_CONFIRM_SQL, COPY_MOVE_LIVE_PREDICATE, SCOPE_COPY_LEASE_MS, SCOPE_SCRIPT_COPY_COLUMNS, copyMoveConfirmParams, copyMoveLiveParams, scopeScriptCopyOf, } from '@substrat-run/kernel';
9
10
  import { GRANT_CHILDREN_INDEX_DDL, grantedEntitiesForContext } from '@substrat-run/kernel';
10
11
  import { LEGACY_SCOPE_ROWS_BACKFILL, assertSpineTablesBuilt, capabilitiesForLoad, dumpRowsInsert, isSpineTable, loadDirectoryDump, repointScopeGrants, settleCopiedWork, emittedHere, spineColumnAdditions } from '@substrat-run/kernel';
11
12
  import { ScopeActor } from './actor.js';
@@ -810,6 +811,10 @@ export class SqliteScopeHost {
810
811
  status TEXT NOT NULL DEFAULT 'active',
811
812
  schema_version TEXT NOT NULL DEFAULT '0',
812
813
  vertical_version_id TEXT,
814
+ erasure_epoch INTEGER,
815
+ -- #1722: set once a reap has started draining this scope's script copies, and never
816
+ -- cleared: only deleting the row ends it. While set, no copy move is recorded or bound.
817
+ reap_claimed_at TEXT,
813
818
  provisioned_version_id TEXT,
814
819
  -- Last FAILED migration attempt (§5.3). All null / 0 = healthy. Written on
815
820
  -- the failure path so a scope that fails closed stops rendering as active;
@@ -833,6 +838,24 @@ export class SqliteScopeHost {
833
838
  archived_at TEXT,
834
839
  created_at TEXT NOT NULL
835
840
  );
841
+ -- #1722: additive copy inventory; historical audit backfill is a separate act.
842
+ CREATE TABLE IF NOT EXISTS scope_script_copies (
843
+ tenant_id TEXT NOT NULL,
844
+ scope_id TEXT NOT NULL,
845
+ script_ref TEXT NOT NULL,
846
+ move_id TEXT NOT NULL,
847
+ state TEXT NOT NULL,
848
+ load_stamp TEXT,
849
+ revision TEXT,
850
+ last_attempt_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
851
+ -- 'source' | 'destination'. A pending entry belongs to its move until lease_until; a
852
+ -- sweep that claims it after that sets lease_owner (kernel scope-copy-ledger.ts).
853
+ role TEXT,
854
+ lease_until TEXT,
855
+ lease_owner TEXT,
856
+ PRIMARY KEY (tenant_id, scope_id, script_ref, move_id)
857
+ );
858
+ CREATE INDEX IF NOT EXISTS scope_script_copies_state ON scope_script_copies (state, scope_id);
836
859
  -- Private host state. Module SQL opens only the scope file, never this directory;
837
860
  -- neither table is included in directory exports or scope dumps (#2074).
838
861
  CREATE TABLE IF NOT EXISTS private_continuation_keys (
@@ -2113,7 +2136,7 @@ export class SqliteScopeHost {
2113
2136
  const actingAs = (operation) => authority.kind === 'capability-session'
2114
2137
  ? {
2115
2138
  kind: 'capability',
2116
- id: resolveCapabilitySession(spineSql(rt.db), authority.hash, this.clock(), operation),
2139
+ id: resolveCapabilitySession(spineSql(rt.db), authority.hash, this.clock(), operation, true),
2117
2140
  }
2118
2141
  : authority;
2119
2142
  const node = { tenantId: rt.tenantId, scopeId: rt.scopeId };
@@ -2688,14 +2711,14 @@ export class SqliteScopeHost {
2688
2711
  // Same lifecycle gates as the principal door, and reached the same way: a
2689
2712
  // suspended tenant refuses a support session exactly as it refuses a user.
2690
2713
  const scope = this.directory
2691
- .prepare('SELECT tenant_id, status FROM scopes WHERE scope_id = ?')
2714
+ .prepare('SELECT tenant_id FROM scopes WHERE scope_id = ?')
2692
2715
  .get(scopeId);
2693
2716
  if (!scope || scope.tenant_id !== tenantId) {
2694
2717
  throw substratError('not_found', `unknown scope for tenant: (${tenantId}, ${scopeId})`);
2695
2718
  }
2696
- if (scope.status !== 'active') {
2697
- throw substratError('conflict', `scope not active (status: ${scope.status}): ${scopeId}`, { reason: SCOPE_GATE_REASONS.notActive });
2698
- }
2719
+ const refusal = this.scopeWorkRefusal(tenantId, scopeId);
2720
+ if (refusal)
2721
+ throw substratError('conflict', refusal, { reason: SCOPE_GATE_REASONS.notActive });
2699
2722
  const rt = this.runtime(tenantId, scopeId);
2700
2723
  await this.applyPendingMigrations(rt);
2701
2724
  return this.buildStub(tenantId, scopeId, rt, asPrincipal(record.principal), options, record.id);
@@ -2717,14 +2740,14 @@ export class SqliteScopeHost {
2717
2740
  throw substratError('not_found', `module not registered on this host: ${moduleId}`);
2718
2741
  }
2719
2742
  const scope = this.directory
2720
- .prepare('SELECT tenant_id, status FROM scopes WHERE scope_id = ?')
2743
+ .prepare('SELECT tenant_id FROM scopes WHERE scope_id = ?')
2721
2744
  .get(scopeId);
2722
2745
  if (!scope || scope.tenant_id !== tenantId) {
2723
2746
  throw substratError('not_found', `unknown scope: ${scopeId}`);
2724
2747
  }
2725
- if (scope.status !== 'active') {
2726
- throw substratError('conflict', `scope not active (status: ${scope.status}): ${scopeId}`, { reason: SCOPE_GATE_REASONS.notActive });
2727
- }
2748
+ const refusal = this.scopeWorkRefusal(tenantId, scopeId);
2749
+ if (refusal)
2750
+ throw substratError('conflict', refusal, { reason: SCOPE_GATE_REASONS.notActive });
2728
2751
  const rt = this.runtime(tenantId, scopeId);
2729
2752
  await this.applyPendingMigrations(rt);
2730
2753
  return this.buildStub(tenantId, scopeId, rt, { kind: 'system', id: moduleId }, undefined, undefined, purge);
@@ -2989,6 +3012,20 @@ export class SqliteScopeHost {
2989
3012
  await this.applyPendingMigrations(rt);
2990
3013
  return rt;
2991
3014
  }
3015
+ /** The directory's current hold, read again when background work is about to run. */
3016
+ scopeWorkRefusal(tenantId, scopeId, allowProvisioning = false) {
3017
+ const row = this.directory
3018
+ .prepare(`SELECT s.status AS scope, t.status AS tenant
3019
+ FROM scopes s JOIN tenants t ON t.tenant_id = s.tenant_id
3020
+ WHERE s.scope_id = ? AND s.tenant_id = ?`)
3021
+ .get(scopeId, tenantId);
3022
+ if (!row)
3023
+ return `unknown scope for tenant: (${tenantId}, ${scopeId})`;
3024
+ // A connector can serve provisioning work; suspension still holds it.
3025
+ if (allowProvisioning && row.scope === 'provisioning' && row.tenant === 'active')
3026
+ return null;
3027
+ return lifecycleRefusal(row, { tenantId, scopeId });
3028
+ }
2992
3029
  /**
2993
3030
  * The exchange (#1672) — a secret traded for a session, or for the principal a `become`
2994
3031
  * capability yields. One serialized scope task and one transaction, so the use it takes
@@ -3185,10 +3222,7 @@ export class SqliteScopeHost {
3185
3222
  const report = { checks: [] };
3186
3223
  if (!this.modules.has(moduleId))
3187
3224
  return report;
3188
- const scope = this.directory
3189
- .prepare('SELECT status FROM scopes WHERE scope_id = ? AND tenant_id = ?')
3190
- .get(scopeId, tenantId);
3191
- if (!scope || scope.status !== 'active')
3225
+ if (this.scopeWorkRefusal(tenantId, scopeId))
3192
3226
  return report;
3193
3227
  const rt = this.runtime(tenantId, scopeId);
3194
3228
  await this.applyPendingMigrations(rt);
@@ -3265,10 +3299,7 @@ export class SqliteScopeHost {
3265
3299
  // not this driver's problem to raise — it simply has nothing due (the sweep
3266
3300
  // already enumerated `active` scopes; this guards a race where one archived
3267
3301
  // between enumeration and here).
3268
- const scope = this.directory
3269
- .prepare('SELECT status FROM scopes WHERE scope_id = ? AND tenant_id = ?')
3270
- .get(scopeId, tenantId);
3271
- if (!scope || scope.status !== 'active')
3302
+ if (this.scopeWorkRefusal(tenantId, scopeId))
3272
3303
  return report;
3273
3304
  const rt = this.runtime(tenantId, scopeId);
3274
3305
  await this.applyPendingMigrations(rt);
@@ -3361,6 +3392,14 @@ export class SqliteScopeHost {
3361
3392
  report.fired += 1;
3362
3393
  }
3363
3394
  catch (err) {
3395
+ // The system door can meet a suspension after the cadence gate. A refused
3396
+ // fire did not run, so leave its row due for the first live pass.
3397
+ if (isSubstratError(err) && err.code === 'conflict' && err.extensions.reason === SCOPE_GATE_REASONS.notActive) {
3398
+ report.lifecycleHeld = true;
3399
+ report.skipped += 1;
3400
+ report.runs.push({ operation: schedule.operation, outcome: 'skipped' });
3401
+ continue;
3402
+ }
3364
3403
  status = 'failed';
3365
3404
  failure = { error: err };
3366
3405
  report.failed += 1;
@@ -3924,6 +3963,12 @@ export class SqliteScopeHost {
3924
3963
  return report;
3925
3964
  }
3926
3965
  async dispatchExecutorsPass(rt, invocationId, report, lines, outcomes) {
3966
+ // A request that started while live may commit after a suspension. Its outbox
3967
+ // stays due without an attempt, just as a scheduled retry does.
3968
+ if (this.scopeWorkRefusal(rt.tenantId, rt.scopeId)) {
3969
+ report.lifecycleHeld = true;
3970
+ return;
3971
+ }
3927
3972
  const now = new Date().toISOString();
3928
3973
  const scope = this.executorScope(rt);
3929
3974
  // #2005: a non-primary scope (a fork, a snapshot, a preview of either kind) causes no
@@ -3947,6 +3992,10 @@ export class SqliteScopeHost {
3947
3992
  ORDER BY o.id`)
3948
3993
  .all(deliveryId, executor.eventType, now);
3949
3994
  for (const row of rows) {
3995
+ if (this.scopeWorkRefusal(rt.tenantId, rt.scopeId)) {
3996
+ report.lifecycleHeld = true;
3997
+ return;
3998
+ }
3950
3999
  report.attempted += 1;
3951
4000
  // #1901: this attempt's line. Its number is the one the journal records, which
3952
4001
  // `recordExecutorDelivery` answers — the Durable Object's RPC does the same.
@@ -4070,6 +4119,9 @@ export class SqliteScopeHost {
4070
4119
  return isPrimaryScopeRow(this.directory.prepare('SELECT kind, forked_from FROM scopes WHERE scope_id = ?').get(scopeId));
4071
4120
  }
4072
4121
  async drainDue(tenantId, scopeId) {
4122
+ if (this.scopeWorkRefusal(tenantId, scopeId)) {
4123
+ return { attempted: 0, delivered: 0, retrying: 0, deadLettered: 0, lifecycleHeld: true };
4124
+ }
4073
4125
  const rt = this.runtime(tenantId, scopeId);
4074
4126
  await this.applyPendingMigrations(rt);
4075
4127
  // #1525: null, and honestly so — a sweep is not a call. An attempt this pass makes
@@ -4254,13 +4306,11 @@ export class SqliteScopeHost {
4254
4306
  this.attachmentExtractors, this.attachmentTextBounds);
4255
4307
  }
4256
4308
  async startJobRun(tenantId, scopeId, input) {
4257
- const rt = this.runtime(tenantId, scopeId);
4258
- await this.applyPendingMigrations(rt);
4309
+ const rt = await this.openActiveScope(tenantId, scopeId);
4259
4310
  return jobRunOf(await startJobRun(this.jobStore(rt), input, ulid, this.clock));
4260
4311
  }
4261
4312
  async runDueJobs(tenantId, scopeId, options) {
4262
- const rt = this.runtime(tenantId, scopeId);
4263
- await this.applyPendingMigrations(rt);
4313
+ const rt = await this.openActiveScope(tenantId, scopeId);
4264
4314
  // #1575: the kernel's extraction jobs are this host's own, bound to this scope — no
4265
4315
  // deployment registers them, and none can shadow them. The backfill starts here, on
4266
4316
  // the drive, so a scope's first request never pays for attachments that predate it.
@@ -4292,6 +4342,9 @@ export class SqliteScopeHost {
4292
4342
  // directory, so a node control plane can drain routed intents exactly as the
4293
4343
  // Cloudflare one does; the context build is the same one `dispatchExecutors` hands
4294
4344
  // an in-process connector.
4345
+ const refusal = this.scopeWorkRefusal(tenantId, scopeId, true);
4346
+ if (refusal)
4347
+ throw substratError('conflict', refusal, { reason: SCOPE_GATE_REASONS.notActive });
4295
4348
  const rt = this.runtime(tenantId, scopeId);
4296
4349
  // `false`: this path deliberately does NOT enqueue, so nothing is held and
4297
4350
  // the connection's reads take an ordinary serialized turn. Built on a view bound to
@@ -6449,6 +6502,11 @@ export class SqliteScopeHost {
6449
6502
  if (opts?.expectedVersionId !== undefined && scope.vertical_version_id !== opts.expectedVersionId) {
6450
6503
  throw substratError('precondition_failed', 'scope binding changed; reload the scope and retry');
6451
6504
  }
6505
+ const epoch = this.directory.prepare('SELECT COALESCE(erasure_epoch, 0) AS erasure_epoch FROM scopes WHERE tenant_id = ? AND scope_id = ?')
6506
+ .get(tenantId, scopeId);
6507
+ if (opts?.expectedErasureEpoch !== undefined && epoch?.erasure_epoch !== opts.expectedErasureEpoch) {
6508
+ throw substratError('precondition_failed', 'scope erasure changed; reload the scope and retry');
6509
+ }
6452
6510
  const ack = bindAcknowledgement.parse(opts?.acknowledge ?? {});
6453
6511
  // #1756: an export an app in this tenant imports, dropped or re-versioned by what this
6454
6512
  // scope would run. Before the snapshot, so a refused bind leaves nothing behind.
@@ -6466,12 +6524,7 @@ export class SqliteScopeHost {
6466
6524
  await this.snapshotScope(actor, tenantId, scopeId);
6467
6525
  }
6468
6526
  }
6469
- const update = opts?.expectedVersionId === undefined
6470
- ? this.directory.prepare('UPDATE scopes SET vertical_version_id = ?, vertical = ? WHERE scope_id = ?')
6471
- .run(versionId, v.verticalSlug, scopeId)
6472
- : this.directory.prepare('UPDATE scopes SET vertical_version_id = ?, vertical = ? WHERE scope_id = ? AND vertical_version_id IS ?')
6473
- .run(versionId, v.verticalSlug, scopeId, opts.expectedVersionId);
6474
- if (update.changes === 0) {
6527
+ if (!this.moveScopeRow('vertical_version_id = ?, vertical = ?', [versionId, v.verticalSlug], tenantId, scopeId, opts)) {
6475
6528
  throw substratError('precondition_failed', 'scope binding changed; reload the scope and retry');
6476
6529
  }
6477
6530
  this.recordAdmin(actor, 'bindScopeVersion', { tenantId, scopeId }, null, {
@@ -6482,6 +6535,88 @@ export class SqliteScopeHost {
6482
6535
  ...(ack.exportBreak ? { acknowledged: ack } : {}),
6483
6536
  });
6484
6537
  },
6538
+ recordScopeScriptCopy: async (_actor, tenantId, scopeId, scriptRef, moveId, opts) => {
6539
+ if (!scriptRef || !moveId)
6540
+ throw substratError('conflict', 'copy script and move must name a real script');
6541
+ const result = this.directory.prepare(`INSERT INTO scope_script_copies (tenant_id, scope_id, script_ref, move_id, state, role, load_stamp, lease_until)
6542
+ SELECT tenant_id, scope_id, ?, ?, 'pending', ?, ?, ? FROM scopes
6543
+ WHERE tenant_id = ? AND scope_id = ? AND reap_claimed_at IS NULL
6544
+ ON CONFLICT (tenant_id, scope_id, script_ref, move_id) DO NOTHING`).run(scriptRef, moveId, opts?.role ?? null, opts?.loadStamp ?? null, new Date(Date.now() + (opts?.leaseMs ?? SCOPE_COPY_LEASE_MS)).toISOString(), tenantId, scopeId);
6545
+ if (result.changes > 0)
6546
+ return;
6547
+ const scope = this.directory.prepare('SELECT reap_claimed_at FROM scopes WHERE tenant_id = ? AND scope_id = ?')
6548
+ .get(tenantId, scopeId);
6549
+ if (!scope)
6550
+ throw substratError('not_found', `unknown scope ${scopeId} in tenant ${tenantId}`);
6551
+ if (scope.reap_claimed_at !== null)
6552
+ throw substratError('precondition_failed', `scope ${scopeId} is being reaped`);
6553
+ },
6554
+ claimExpiredScopeScriptCopies: async (_actor, input) => {
6555
+ const limit = assertRowLimit('limit', input.limit);
6556
+ return this.directory.transaction(() => {
6557
+ const due = this.directory.prepare(COPY_EXPIRED_SQL).all(input.now, limit);
6558
+ const claimed = [];
6559
+ for (const r of due) {
6560
+ if (this.directory.prepare(COPY_CLAIM_SQL).run(input.owner, input.leaseUntil, r.tenant_id, r.scope_id, r.script_ref, r.move_id, input.now).changes === 0)
6561
+ continue;
6562
+ claimed.push(this.directory.prepare(`SELECT ${SCOPE_SCRIPT_COPY_COLUMNS} FROM scope_script_copies
6563
+ WHERE tenant_id = ? AND scope_id = ? AND script_ref = ? AND move_id = ?`).get(r.tenant_id, r.scope_id, r.script_ref, r.move_id));
6564
+ }
6565
+ return claimed.map(scopeScriptCopyOf);
6566
+ })();
6567
+ },
6568
+ beginScopeScriptReap: async (_actor, tenantId, scopeId) => {
6569
+ const result = this.directory.prepare(`UPDATE scopes SET reap_claimed_at = strftime('%Y-%m-%dT%H:%M:%fZ','now')
6570
+ WHERE tenant_id = ? AND scope_id = ? AND reap_claimed_at IS NULL
6571
+ AND NOT EXISTS (SELECT 1 FROM scope_script_copies AS move
6572
+ WHERE move.tenant_id = scopes.tenant_id AND move.scope_id = scopes.scope_id
6573
+ AND move.state = 'pending')`).run(tenantId, scopeId);
6574
+ if (result.changes > 0)
6575
+ return;
6576
+ const scope = this.directory.prepare('SELECT reap_claimed_at FROM scopes WHERE tenant_id = ? AND scope_id = ?')
6577
+ .get(tenantId, scopeId);
6578
+ if (!scope)
6579
+ throw substratError('not_found', `unknown scope ${scopeId} in tenant ${tenantId}`);
6580
+ if (scope.reap_claimed_at !== null)
6581
+ return; // a reaper resumes its earlier claim
6582
+ throw substratError('precondition_failed', `scope ${scopeId} has a copy move in flight; retry reap after it settles`);
6583
+ },
6584
+ settleScopeScriptCopy: async (_actor, tenantId, scopeId, scriptRef, moveId, state, marker, opts) => this.directory.prepare(`UPDATE scope_script_copies SET state = ?, load_stamp = ?, revision = ?,
6585
+ last_attempt_at = strftime('%Y-%m-%dT%H:%M:%fZ','now')
6586
+ WHERE tenant_id = ? AND scope_id = ? AND script_ref = ? AND move_id = ?
6587
+ AND (state <> 'done' OR ? = 'done')
6588
+ ${opts?.claimedBy === undefined ? '' : "AND state = 'pending' AND lease_owner = ?"}`).run(state, marker?.loadStamp ?? null, marker?.revision ?? null, tenantId, scopeId, scriptRef, moveId, state, ...(opts?.claimedBy === undefined ? [] : [opts.claimedBy])).changes > 0,
6589
+ touchScopeScriptCopy: async (_actor, tenantId, scopeId, scriptRef, moveId) => {
6590
+ this.directory.prepare(`UPDATE scope_script_copies SET last_attempt_at = strftime('%Y-%m-%dT%H:%M:%fZ','now')
6591
+ WHERE tenant_id = ? AND scope_id = ? AND script_ref = ? AND move_id = ? AND state = 'eligible'`).run(tenantId, scopeId, scriptRef, moveId);
6592
+ },
6593
+ listScopeScriptCopies: async (_actor, filter) => {
6594
+ const where = [];
6595
+ const args = [];
6596
+ if (filter.tenantId) {
6597
+ where.push('tenant_id = ?');
6598
+ args.push(filter.tenantId);
6599
+ }
6600
+ if (filter.scopeId) {
6601
+ where.push('scope_id = ?');
6602
+ args.push(filter.scopeId);
6603
+ }
6604
+ if (filter.state) {
6605
+ where.push('state = ?');
6606
+ args.push(filter.state);
6607
+ }
6608
+ if (filter.after) {
6609
+ if (!filter.tenantId || !filter.scopeId)
6610
+ throw substratError('validation_failed', 'copy cursor requires tenant and scope');
6611
+ where.push('(script_ref > ? OR (script_ref = ? AND move_id > ?))');
6612
+ args.push(filter.after.scriptRef, filter.after.scriptRef, filter.after.moveId);
6613
+ }
6614
+ const limit = assertRowLimit('limit', filter.limit ?? 100);
6615
+ const order = filter.scopeId ? 'script_ref, move_id' : 'last_attempt_at, tenant_id, scope_id, script_ref';
6616
+ const rows = this.directory.prepare(`SELECT ${SCOPE_SCRIPT_COPY_COLUMNS} FROM scope_script_copies ${where.length ? `WHERE ${where.join(' AND ')}` : ''}
6617
+ ORDER BY ${order} LIMIT ?`).all(...args, limit);
6618
+ return rows.map(scopeScriptCopyOf);
6619
+ },
6485
6620
  /**
6486
6621
  * Record that this scope's provision has now run against `versionId` (#1172).
6487
6622
  * Written only after a provision or reconcile succeeded — a receipt, never a hope.
@@ -6559,9 +6694,9 @@ export class SqliteScopeHost {
6559
6694
  if (breaks.length > 0)
6560
6695
  throw substratError('precondition_failed', bindExportBreakRefusal(breaks));
6561
6696
  }
6562
- this.directory
6563
- .prepare('UPDATE scopes SET serving_ref = ? WHERE scope_id = ?')
6564
- .run(servingRef, scopeId);
6697
+ if (!this.moveScopeRow('serving_ref = ?', [servingRef], tenantId, scopeId, opts)) {
6698
+ throw substratError('precondition_failed', 'scope erasure or reap changed; reload and retry');
6699
+ }
6565
6700
  this.recordAdmin(actor, 'setScopeServingRef', { tenantId, scopeId }, { servingRef: scope.serving_ref }, { servingRef, ...(ack.exportBreak ? { acknowledged: ack } : {}) });
6566
6701
  },
6567
6702
  recordKeptCopyResolution: async (actor, tenantId, scopeId, r) => {
@@ -7517,6 +7652,31 @@ export class SqliteScopeHost {
7517
7652
  this.recordAccess(actor, 'shredSubject', { tenantId, scopeId }, { subjectId }, redacted.changes + intentsRedacted + jobRunsRedacted + idempotencyResults + moduleRowsErased(vertical));
7518
7653
  return receipt;
7519
7654
  },
7655
+ scopeErasureEpoch: async (_actor, tenantId, scopeId) => {
7656
+ // NULL on every row from before the column (#1722): the same 0 every CAS compares against.
7657
+ const row = this.directory.prepare('SELECT COALESCE(erasure_epoch, 0) AS erasure_epoch FROM scopes WHERE tenant_id = ? AND scope_id = ?')
7658
+ .get(tenantId, scopeId);
7659
+ if (!row)
7660
+ throw substratError('not_found', `unknown scope ${scopeId} in tenant ${tenantId}`);
7661
+ return row.erasure_epoch;
7662
+ },
7663
+ finalizeSubjectShred: async (actor, tenantId, scopeId, subjectId, redactions, expected) => {
7664
+ if (redactions.length === 0)
7665
+ throw substratError('conflict', 'subject erasure has no confirmed scope redaction');
7666
+ const claimed = this.directory.prepare(`UPDATE scopes SET erasure_epoch = COALESCE(erasure_epoch, 0) + 1
7667
+ WHERE tenant_id = ? AND scope_id = ? AND vertical_version_id IS ?
7668
+ AND serving_ref IS ? AND COALESCE(erasure_epoch, 0) = ?
7669
+ AND NOT EXISTS (SELECT 1 FROM scope_script_copies AS copy
7670
+ WHERE copy.tenant_id = scopes.tenant_id AND copy.scope_id = scopes.scope_id
7671
+ AND copy.state = 'pending')
7672
+ AND (SELECT COUNT(*) FROM scope_script_copies AS copy
7673
+ WHERE copy.tenant_id = scopes.tenant_id AND copy.scope_id = scopes.scope_id) = ?`).run(tenantId, scopeId, expected.versionId, expected.servingRef, expected.epoch, expected.copyCount);
7674
+ if (claimed.changes === 0)
7675
+ throw substratError('precondition_failed', 'scope route or copy inventory changed during subject erasure; retry after it settles');
7676
+ // The pure adapter has one co-located scope store. Its existing atomic shred is
7677
+ // the final local redaction and key destruction, after remote copies confirmed.
7678
+ return this.admin.shredSubject(actor, tenantId, scopeId, subjectId);
7679
+ },
7520
7680
  // -- impersonation (K-42, #868) ----------------------------------------
7521
7681
  beginImpersonation: async (actor, input) => {
7522
7682
  // Fail closed on the scope before minting anything, exactly as the
@@ -8581,6 +8741,27 @@ export class SqliteScopeHost {
8581
8741
  * directory. `PRAGMA table_info` is available in the pure adapter (the DO adapter
8582
8742
  * has to attempt-and-tolerate instead — see its `ensureDirectoryColumns`).
8583
8743
  */
8744
+ /**
8745
+ * Move a scope's binding or route (#1722), conditionally: on the binding the caller read, on
8746
+ * the erasure epoch its carry read (a NULL epoch, from before the column, is 0) with no reap
8747
+ * claimed, and on its copy move still owning a live lease. The move's confirmation commits in
8748
+ * the same transaction as the row. False when any condition failed and nothing was written.
8749
+ */
8750
+ moveScopeRow(set, setArgs, tenantId, scopeId, cond) {
8751
+ const now = new Date().toISOString();
8752
+ return this.directory.transaction(() => {
8753
+ const moved = this.directory.prepare(`UPDATE scopes SET ${set} WHERE scope_id = ?
8754
+ ${cond?.expectedVersionId === undefined ? '' : 'AND vertical_version_id IS ?'}
8755
+ ${cond?.expectedErasureEpoch === undefined ? '' : 'AND COALESCE(erasure_epoch, 0) = ? AND reap_claimed_at IS NULL'}
8756
+ ${cond?.confirmMove === undefined ? '' : COPY_MOVE_LIVE_PREDICATE}`).run(...setArgs, scopeId, ...(cond?.expectedVersionId === undefined ? [] : [cond.expectedVersionId]), ...(cond?.expectedErasureEpoch === undefined ? [] : [cond.expectedErasureEpoch]), ...(cond?.confirmMove === undefined ? [] : copyMoveLiveParams(cond.confirmMove, now)));
8757
+ if (moved.changes === 0)
8758
+ return false;
8759
+ if (cond?.confirmMove) {
8760
+ this.directory.prepare(COPY_MOVE_CONFIRM_SQL).run(...copyMoveConfirmParams(cond.confirmMove, tenantId, scopeId, now));
8761
+ }
8762
+ return true;
8763
+ })();
8764
+ }
8584
8765
  ensureColumn(db, table, column, ddl) {
8585
8766
  // Without case, as SQLite resolves a column name: a restore may have added this column
8586
8767
  // already, untyped and spelled as a newer kernel's dump spelled it (#1883).
@@ -8767,6 +8948,8 @@ export class SqliteScopeHost {
8767
8948
  // #1172: which version this scope's provision hook last ran against. Null on every
8768
8949
  // existing row, which reads as "unknown, reconcile once" rather than "up to date".
8769
8950
  this.ensureColumn(this.directory, 'scopes', 'provisioned_version_id', 'provisioned_version_id TEXT');
8951
+ this.ensureColumn(this.directory, 'scopes', 'erasure_epoch', 'erasure_epoch INTEGER');
8952
+ this.ensureColumn(this.directory, 'scopes', 'reap_claimed_at', 'reap_claimed_at TEXT');
8770
8953
  // §4.8's grace-window timestamp on tenants (mirrors scopes' archived_at).
8771
8954
  this.ensureColumn(this.directory, 'tenants', 'deleting_at', 'deleting_at TEXT');
8772
8955
  this.ensureColumn(this.directory, 'tenants', 'provisioned_by_tenant', 'provisioned_by_tenant TEXT REFERENCES tenants(tenant_id)');
@@ -9617,6 +9800,8 @@ export class SqliteScopeHost {
9617
9800
  // KERNEL_DDL is all IF NOT EXISTS, so a scope DB created before K-21 keeps the
9618
9801
  // old shape — ALTER the tombstone in.
9619
9802
  this.ensureColumn(db, '_substrat_tuples', 'revoked_at', 'revoked_at TEXT');
9803
+ // #2126: NULL keeps every existing capability's attachment behavior unchanged.
9804
+ this.ensureColumn(db, '_substrat_capabilities', 'attachments', 'attachments TEXT');
9620
9805
  db.exec(GRANT_CHILDREN_INDEX_DDL);
9621
9806
  // Executor retry state (#100), same reasoning: scopes provisioned before it
9622
9807
  // already have the table. Defaults read as "terminal", which is exactly right