@substrat-run/adapter-cloudflare 0.221.0 → 0.223.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.
Files changed (86) hide show
  1. package/dist/broker-telemetry.d.ts +2 -5
  2. package/dist/broker-telemetry.d.ts.map +1 -1
  3. package/dist/broker-telemetry.js +2 -5
  4. package/dist/broker-telemetry.js.map +1 -1
  5. package/dist/control-plane-do.d.ts +251 -67
  6. package/dist/control-plane-do.d.ts.map +1 -1
  7. package/dist/control-plane-do.js +666 -247
  8. package/dist/control-plane-do.js.map +1 -1
  9. package/dist/delivery-broker-do.d.ts +3 -2
  10. package/dist/delivery-broker-do.d.ts.map +1 -1
  11. package/dist/delivery-broker-do.js +10 -4
  12. package/dist/delivery-broker-do.js.map +1 -1
  13. package/dist/delivery-handoff.d.ts +17 -1
  14. package/dist/delivery-handoff.d.ts.map +1 -1
  15. package/dist/delivery-handoff.js +19 -5
  16. package/dist/delivery-handoff.js.map +1 -1
  17. package/dist/directory-cutover.d.ts +243 -0
  18. package/dist/directory-cutover.d.ts.map +1 -0
  19. package/dist/directory-cutover.js +604 -0
  20. package/dist/directory-cutover.js.map +1 -0
  21. package/dist/directory-mirror-apply.d.ts +19 -1
  22. package/dist/directory-mirror-apply.d.ts.map +1 -1
  23. package/dist/directory-mirror-apply.js +19 -3
  24. package/dist/directory-mirror-apply.js.map +1 -1
  25. package/dist/directory-mirror-backfill.d.ts +2 -0
  26. package/dist/directory-mirror-backfill.d.ts.map +1 -1
  27. package/dist/directory-mirror-backfill.js +6 -4
  28. package/dist/directory-mirror-backfill.js.map +1 -1
  29. package/dist/directory-mirror.d.ts +24 -0
  30. package/dist/directory-mirror.d.ts.map +1 -1
  31. package/dist/directory-mirror.js +16 -2
  32. package/dist/directory-mirror.js.map +1 -1
  33. package/dist/directory-objects.d.ts +40 -0
  34. package/dist/directory-objects.d.ts.map +1 -1
  35. package/dist/directory-objects.js +134 -2
  36. package/dist/directory-objects.js.map +1 -1
  37. package/dist/directory-placement.d.ts.map +1 -1
  38. package/dist/directory-placement.js +7 -1
  39. package/dist/directory-placement.js.map +1 -1
  40. package/dist/directory-split-inventory.d.ts +5 -3
  41. package/dist/directory-split-inventory.d.ts.map +1 -1
  42. package/dist/directory-split-inventory.js +12 -6
  43. package/dist/directory-split-inventory.js.map +1 -1
  44. package/dist/directory-tenant-orgs.d.ts +19 -0
  45. package/dist/directory-tenant-orgs.d.ts.map +1 -0
  46. package/dist/directory-tenant-orgs.js +33 -0
  47. package/dist/directory-tenant-orgs.js.map +1 -0
  48. package/dist/directory-tenant-roles.d.ts +35 -0
  49. package/dist/directory-tenant-roles.d.ts.map +1 -0
  50. package/dist/directory-tenant-roles.js +78 -0
  51. package/dist/directory-tenant-roles.js.map +1 -0
  52. package/dist/directory-tenant-tuples.d.ts +165 -0
  53. package/dist/directory-tenant-tuples.d.ts.map +1 -0
  54. package/dist/directory-tenant-tuples.js +197 -0
  55. package/dist/directory-tenant-tuples.js.map +1 -0
  56. package/dist/executor-route.d.ts +13 -0
  57. package/dist/executor-route.d.ts.map +1 -0
  58. package/dist/executor-route.js +12 -0
  59. package/dist/executor-route.js.map +1 -0
  60. package/dist/host.d.ts +76 -2
  61. package/dist/host.d.ts.map +1 -1
  62. package/dist/host.js +386 -67
  63. package/dist/host.js.map +1 -1
  64. package/dist/index.d.ts +2 -1
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +1 -0
  67. package/dist/index.js.map +1 -1
  68. package/dist/platform-sweeper-do.d.ts +1 -1
  69. package/dist/platform-sweeper-do.js +1 -1
  70. package/dist/scope-do.d.ts +11 -2
  71. package/dist/scope-do.d.ts.map +1 -1
  72. package/dist/scope-do.js +206 -58
  73. package/dist/scope-do.js.map +1 -1
  74. package/dist/scope-sweeper-do.d.ts +22 -0
  75. package/dist/scope-sweeper-do.d.ts.map +1 -1
  76. package/dist/scope-sweeper-do.js +74 -54
  77. package/dist/scope-sweeper-do.js.map +1 -1
  78. package/dist/scope-wake.d.ts +12 -1
  79. package/dist/scope-wake.d.ts.map +1 -1
  80. package/dist/scope-wake.js +14 -1
  81. package/dist/scope-wake.js.map +1 -1
  82. package/dist/tenant-due-work-do.d.ts +99 -0
  83. package/dist/tenant-due-work-do.d.ts.map +1 -0
  84. package/dist/tenant-due-work-do.js +149 -0
  85. package/dist/tenant-due-work-do.js.map +1 -0
  86. package/package.json +10 -10
@@ -12,9 +12,6 @@ import type { AnalyticsEngineDatasetLike } from './connector-calls.js';
12
12
  export declare function brokerTelemetryDataset(env: unknown): AnalyticsEngineDatasetLike | null;
13
13
  /** A sink writing every point and state report into `dataset`, in `BROKER_DATA_POINT_LAYOUT`. */
14
14
  export declare function analyticsBrokerSink(dataset: AnalyticsEngineDatasetLike): BrokerTelemetrySink;
15
- /** The broker object's (tenant, app) from its name, `brokerName(tenantId, app)`. */
16
- export declare function brokerIdsOf(name: string | undefined): {
17
- tenantId: string;
18
- app: string;
19
- };
15
+ /** The broker object's (tenant, app, environment) from its name: the kernel's `brokerIdsOf`. */
16
+ export { brokerIdsOf } from '@substrat-run/kernel';
20
17
  //# sourceMappingURL=broker-telemetry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"broker-telemetry.d.ts","sourceRoot":"","sources":["../src/broker-telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAA6C,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEvE,uGAAuG;AACvG,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,0BAA0B,GAAG,IAAI,CAKtF;AAED,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,mBAAmB,CAK5F;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAGvF"}
1
+ {"version":3,"file":"broker-telemetry.d.ts","sourceRoot":"","sources":["../src/broker-telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAA6C,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEvE,uGAAuG;AACvG,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,0BAA0B,GAAG,IAAI,CAKtF;AAED,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,mBAAmB,CAK5F;AAED,gGAAgG;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
@@ -21,9 +21,6 @@ export function analyticsBrokerSink(dataset) {
21
21
  state: (s) => dataset.writeDataPoint(brokerDataPoint(s)),
22
22
  };
23
23
  }
24
- /** The broker object's (tenant, app) from its name, `brokerName(tenantId, app)`. */
25
- export function brokerIdsOf(name) {
26
- const at = name?.indexOf('/') ?? -1;
27
- return at > 0 ? { tenantId: name.slice(0, at), app: name.slice(at + 1) } : { tenantId: name ?? '', app: '' };
28
- }
24
+ /** The broker object's (tenant, app, environment) from its name: the kernel's `brokerIdsOf`. */
25
+ export { brokerIdsOf } from '@substrat-run/kernel';
29
26
  //# sourceMappingURL=broker-telemetry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"broker-telemetry.js","sourceRoot":"","sources":["../src/broker-telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAA4B,MAAM,sBAAsB,CAAC;AAG3G,uGAAuG;AACvG,MAAM,UAAU,sBAAsB,CAAC,GAAY;IACjD,MAAM,EAAE,GAAI,GAAkD,EAAE,CAAC,wBAAwB,CAAC,CAAC;IAC3F,OAAO,EAAE,IAAI,OAAQ,EAAiC,CAAC,cAAc,KAAK,UAAU;QAClF,CAAC,CAAE,EAAiC;QACpC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,mBAAmB,CAAC,OAAmC;IACrE,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACxD,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;KACzD,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,WAAW,CAAC,IAAwB;IAClD,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACpC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,IAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AACjH,CAAC"}
1
+ {"version":3,"file":"broker-telemetry.js","sourceRoot":"","sources":["../src/broker-telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAA4B,MAAM,sBAAsB,CAAC;AAG3G,uGAAuG;AACvG,MAAM,UAAU,sBAAsB,CAAC,GAAY;IACjD,MAAM,EAAE,GAAI,GAAkD,EAAE,CAAC,wBAAwB,CAAC,CAAC;IAC3F,OAAO,EAAE,IAAI,OAAQ,EAAiC,CAAC,cAAc,KAAK,UAAU;QAClF,CAAC,CAAE,EAAiC;QACpC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,mBAAmB,CAAC,OAAmC;IACrE,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACxD,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;KACzD,CAAC;AACJ,CAAC;AAED,gGAAgG;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
@@ -8,10 +8,18 @@ import { type SupersedeMajor } from '@substrat-run/kernel';
8
8
  import { type RouteReadModelFlush, type RouteReadModelStatus } from './route-read-model-publisher.js';
9
9
  import { type PeerCallTargetRow } from './peer-call-target.js';
10
10
  import { type MirrorFlush, type MirrorStatus } from './directory-mirror.js';
11
+ export type { RoleRow } from './directory-tenant-roles.js';
11
12
  import { type BackfillLimits, type BackfillOwner, type BackfillStatus } from './directory-mirror-backfill.js';
12
13
  import type { MirrorBackfillPass } from './directory-mirror.js';
13
14
  import { type VerifyLimits, type VerifyOwner, type VerifyStatus } from './directory-mirror-verify.js';
14
- import type { AdminLogEntry, OnBehalfOf, DeclaredMigration, ListPage, OpsFailureEntry, SweepRunEntry, RoleDefinition, DirectoryCopyByReference, DirectoryDumpPage, ScopeDumpTable, ScopeStatus, ScopeStorageSample, RequestDay, RequestRollupDay, CostDay, MeterDay, MeterDayTake, StaleScope, StaleScopeTake, VerticalOwnerPeriod, Tenant, TenantId, AppEnvironment, EnvironmentServing, TenantStatus, PeerInstanceResolution, VerticalResolution, ErrorCode } from '@substrat-run/contracts';
15
+ import { type CutoverRow, type CutoverStatus } from './directory-cutover.js';
16
+ import { type MemberTupleRow } from './directory-tenant-tuples.js';
17
+ export type { MemberTupleRow } from './directory-tenant-tuples.js';
18
+ import { type OrgRow } from './directory-tenant-orgs.js';
19
+ export type { OrgRow } from './directory-tenant-orgs.js';
20
+ import { type RoleRow } from './directory-tenant-roles.js';
21
+ import type { AdminLogEntry, OnBehalfOf, DeclaredMigration, ListPage, OpsFailureEntry, SweepRunEntry, RoleDefinition, DirectoryCopyByReference, DirectoryDumpPage, ScopeDumpTable, ScopeId, ScopeStatus, ScopeStorageSample, RequestDay, RequestRollupDay, CostDay, MeterDay, MeterDayTake, StaleScope, StaleScopeTake, VerticalOwnerPeriod, Tenant, TenantId, AppEnvironment, EnvironmentServing, EnvironmentServeAcknowledgement, EnvironmentEffects, ConnectionReach, TenantStatus, PeerInstanceResolution, VerticalResolution, ErrorCode } from '@substrat-run/contracts';
22
+ import type { DependentErasure, OwedDependentErasure } from '@substrat-run/contracts';
15
23
  import type { AccessLogMethod, DeploymentWireAuth, FindingEntry, FindingFilter, FindingRuleEntry, FindingRuleInput, FindingStatusInput } from '@substrat-run/contracts';
16
24
  import type { ConnectLink, ConnectLinkConsume } from '@substrat-run/contracts';
17
25
  /**
@@ -80,14 +88,6 @@ export interface ConnectionGrantDoRow {
80
88
  granted_at: string;
81
89
  revoked_at: string | null;
82
90
  }
83
- export interface RoleRow {
84
- tenant_id: string;
85
- role_key: string;
86
- permissions: string;
87
- source: string;
88
- /** Absent on an older control plane's projection wire. */
89
- holder?: 'person' | 'system' | null;
90
- }
91
91
  /** The raw directory row; the coordinator maps it through the `scope` contract. */
92
92
  export interface ScopeRow {
93
93
  scope_id: string;
@@ -253,13 +253,6 @@ export interface ChannelHistoryRow {
253
253
  actor: string;
254
254
  at: string;
255
255
  }
256
- export interface OrgRow {
257
- org_id: string;
258
- tenant_id: string;
259
- slug: string;
260
- name: string;
261
- created_at: string;
262
- }
263
256
  export interface AccessLogRow {
264
257
  id: string;
265
258
  actor: string;
@@ -432,12 +425,6 @@ export interface DirectoryInventory {
432
425
  tenantsByStatus: Record<string, number>;
433
426
  }
434
427
  /** The shape the coordinator hands `recordAdmin`; before/after are arbitrary JSON. */
435
- /** One org membership as `listMembers` reads it (#2047: with its expiry). */
436
- export interface MemberTupleRow {
437
- subject: string;
438
- revoked_at: string | null;
439
- expires_at: string | null;
440
- }
441
428
  export interface AdminEntryInput {
442
429
  id: string;
443
430
  actor: string;
@@ -467,6 +454,12 @@ export interface LifecycleTargetRow {
467
454
  tenant_rev: number;
468
455
  /** #3119: the deployment serving the scope as the directory names it (`lifecycleDeployment`). */
469
456
  deployment: string;
457
+ /**
458
+ * K-69 (#3540): when a failed delivery to this scope may next be retried (#3119), or null when no
459
+ * delivery to it has failed since its last receipt. A scope with one is owed a retry, which a
460
+ * deployment may hand to the tenant's alarm.
461
+ */
462
+ retry_at: string | null;
470
463
  }
471
464
  /** #3119: the heal's wait after the second failure in a row against the same receipt and deployment,
472
465
  * doubling with each further one up to the cap. The first failure waits for nothing. */
@@ -519,7 +512,7 @@ export declare const BACKFILL_FAILURES_KEY = "versionMigrationsBackfillFailures"
519
512
  /** How long the backfill waits after its `failures`-th failure in a row: doubling, capped. */
520
513
  export declare function backfillBackoffMs(failures: number): number;
521
514
  /** The directory writes `ControlPlaneDO.reply` answers for (#113): each refuses with a typed throw. */
522
- export declare const REPLIED_METHODS: readonly ['createTenant', 'setTenantStatus', 'markScopeStoresFenced', 'reapTenant', 'setTenantName', 'putTenantStore', 'putBlobStore', 'provisionScope', 'createOrg', 'registerIdentityPool', 'linkIdentity', 'createFindingRule', 'insertVersion', 'verticalScopeStores', 'recordStoreDriverRelease', 'approveStoreDriverReleaseAndAudit', 'recordStoreDriverRevokeWalk', 'revokeStoreDriverReleaseAndAudit', 'storeDriverDeclarations', 'storeDriverRolloutPending', 'storeDriverRolloutWalked', 'holdStoreDriver', 'beginStoreDriverRollout', 'finishStoreDriverRollout', 'claimStoreDriverRebuild', 'advanceStoreDriverRebuild', 'updateVerticalListed', 'updateVerticalPublishRequest', 'updateVerticalInstallsBlocked', 'updateVerticalTenantProvisioner', 'updateVerticalEmailSender', 'updateVerticalTraceSampling', 'deleteVertical', 'admitVersion', 'rejectVersion', 'setVerticalServing', 'promoteChannel', 'defineRoleOrRefusal', 'assignTenantRole', 'writeTenantTuple', 'writeOrgTenantTuple', 'writeTenantSystemGrant', 'grantConnectionInDirectory', 'revokeConnectionGrantInDirectory', 'insertOrg', 'bindHostnameInDirectory', 'setHostnameStatus', 'setHostnameIssuance', 'deleteHostname', 'grantEntitlement', 'revokeEntitlement', 'putTenantStoreAndAudit', 'putBlobStoreAndAudit', 'recordStoreDriverReleaseAndAudit', 'beginStoreDriverRolloutAndAudit', 'finishStoreDriverRolloutAndAudit', 'importDumpAndAudit', 'stageRestorePage', 'commitStagedRestoreAndAudit', 'discardStagedRestore', 'registerIdentityPoolAndAudit', 'insertConnectionAndAudit', 'updateConnectionSecretAndAudit', 'revokeConnectionAndAudit', 'linkIdentityAndAudit', 'unlinkIdentityAndAudit', 'markAccessLogDrainedAndAudit', 'pruneAccessLogAndAudit', 'setDirectoryLakeCapture', 'ackDirectoryOutbox', 'advanceDirectoryLakeBackfill', 'pruneDirectoryLakeWindow', 'writeImpersonationAndAudit', 'endImpersonationAndAudit', 'setIssueStatusAndAudit', 'defineEnvironmentAndAudit', 'removeEnvironmentAndAudit', 'setEnvironmentServingAndAudit', 'claimEnvironmentServe'];
515
+ export declare const REPLIED_METHODS: readonly ['createTenant', 'setTenantStatus', 'markScopeStoresFenced', 'reapTenant', 'setTenantName', 'putTenantStore', 'putBlobStore', 'provisionScope', 'createOrg', 'registerIdentityPool', 'linkIdentity', 'createFindingRule', 'insertVersion', 'verticalScopeStores', 'recordStoreDriverRelease', 'approveStoreDriverReleaseAndAudit', 'recordStoreDriverRevokeWalk', 'revokeStoreDriverReleaseAndAudit', 'storeDriverDeclarations', 'storeDriverRolloutPending', 'storeDriverRolloutWalked', 'holdStoreDriver', 'beginStoreDriverRollout', 'finishStoreDriverRollout', 'claimStoreDriverRebuild', 'advanceStoreDriverRebuild', 'updateVerticalListed', 'updateVerticalPublishRequest', 'updateVerticalInstallsBlocked', 'updateVerticalTenantProvisioner', 'updateVerticalEmailSender', 'updateVerticalTraceSampling', 'deleteVertical', 'admitVersion', 'rejectVersion', 'setVerticalServing', 'promoteChannel', 'recordEarlierMajorPromote', 'setEarlierMajorServing', 'defineRoleOrRefusal', 'assignTenantRole', 'writeTenantTuple', 'writeOrgTenantTuple', 'writeTenantSystemGrant', 'grantConnectionInDirectory', 'revokeConnectionGrantInDirectory', 'insertOrg', 'bindHostnameInDirectory', 'setHostnameStatus', 'setHostnameIssuance', 'deleteHostname', 'grantEntitlement', 'revokeEntitlement', 'putTenantStoreAndAudit', 'putBlobStoreAndAudit', 'recordStoreDriverReleaseAndAudit', 'beginStoreDriverRolloutAndAudit', 'finishStoreDriverRolloutAndAudit', 'importDumpAndAudit', 'stageRestorePage', 'commitStagedRestoreAndAudit', 'discardStagedRestore', 'registerIdentityPoolAndAudit', 'insertConnectionAndAudit', 'updateConnectionSecretAndAudit', 'revokeConnectionAndAudit', 'linkIdentityAndAudit', 'unlinkIdentityAndAudit', 'markAccessLogDrainedAndAudit', 'pruneAccessLogAndAudit', 'setDirectoryLakeCapture', 'ackDirectoryOutbox', 'advanceDirectoryLakeBackfill', 'pruneDirectoryLakeWindow', 'writeImpersonationAndAudit', 'endImpersonationAndAudit', 'setIssueStatusAndAudit', 'defineEnvironmentAndAudit', 'removeEnvironmentAndAudit', 'setEnvironmentServingAndAudit', 'claimEnvironmentServe', 'setEnvironmentEffectsAndAudit'];
523
516
  export type RepliedMethod = (typeof REPLIED_METHODS)[number];
524
517
  /**
525
518
  * How long a stage holds off another restore's first page, counted from its last page. A restore
@@ -540,6 +533,10 @@ export declare class ControlPlaneDO extends DurableObject {
540
533
  private readonly kernelSql;
541
534
  /** Settles once the constructor's #1764 backfill check has run (awaited by the tests). */
542
535
  readonly backfillArmed: Promise<void>;
536
+ /** The pass recovers a handoff interrupted after the directory commit. */
537
+ private armTenantDueWork;
538
+ private autoReapAt;
539
+ private armSnapshotReap;
543
540
  constructor(ctx: DurableObjectState, env: unknown);
544
541
  /** Set where `DIRECTORY_MIRROR` is on and the two object namespaces are bound; null otherwise. */
545
542
  private readonly directoryMirror;
@@ -581,6 +578,35 @@ export declare class ControlPlaneDO extends DurableObject {
581
578
  }) | {
582
579
  enabled: false;
583
580
  };
581
+ /** Set where `DIRECTORY_CUTOVER` is on, or a tenant is not off yet; null otherwise. */
582
+ private readonly directoryCutover;
583
+ /** The cut-over's comparison age limit: the production default, other in a test directory. */
584
+ protected directoryCutoverOptions(): {
585
+ verifyMaxAgeMs?: number;
586
+ };
587
+ /**
588
+ * Flip a tenant's directory reads (and first writes) of the cut-over tables to its own object, or
589
+ * back. On is gated in code (`DirectoryCutover.refusal`): the dual-write on, the tenant's last
590
+ * comparison clean, nothing in flight. Off drains every write the object made first into this
591
+ * directory before reads return here. Staff only (the worker's route).
592
+ */
593
+ cutOverTenantDirectory(tenantId: string, to: 'on' | 'off', actor: string): Promise<{
594
+ row: CutoverRow;
595
+ } | {
596
+ refused: string;
597
+ }>;
598
+ /** Where each tenant's flag stands: a page after `after`, or the one `tenantId` names. */
599
+ directoryCutoverStatus(query?: {
600
+ tenantId?: string;
601
+ after?: string;
602
+ limit?: number;
603
+ }): CutoverStatus | {
604
+ enabled: false;
605
+ };
606
+ /** The alarm's cut-over pass, now (staff, and tests): drains, flips off it can complete, registry records. */
607
+ settleDirectoryCutover(): Promise<CutoverStatus | {
608
+ enabled: false;
609
+ }>;
584
610
  /** Set where a `ROUTES` KV namespace is bound; null otherwise, and the read model is off. */
585
611
  private routePublisher;
586
612
  /** #3494: the restore stage's cleanup in flight, which every stage door awaits (`dropRestoreStage`). */
@@ -937,7 +963,7 @@ export declare class ControlPlaneDO extends DurableObject {
937
963
  * previous status (for the audit before/after). Idempotent: set-to-empty DELETEs
938
964
  * plus the status flip converge on a re-run after a partial failure.
939
965
  */
940
- reapTenant(tenantId: string, audit?: AdminEntryInput): string;
966
+ reapTenant(tenantId: string, audit?: AdminEntryInput, deletingBy?: string): string;
941
967
  /**
942
968
  * Rename the DISPLAY name (never the slug); throw if absent; return the previous name. A rename
943
969
  * to the name it already has writes nothing, `audit` included; otherwise `audit`'s `before` is
@@ -1161,6 +1187,22 @@ export declare class ControlPlaneDO extends DurableObject {
1161
1187
  * types, which writes the row it always did (NULL) and judges no existing one.
1162
1188
  */
1163
1189
  scopeType?: string | null;
1190
+ /**
1191
+ * #2995 (K-64): the parent a `provision-child` names, as requested. Fixed when the row is first
1192
+ * written and never moved (`provisionedParent`, judged here against the row in the write's own
1193
+ * unit). For a new row the parent is judged again here too — of this tenant, `active`, no copy
1194
+ * and no child — so an archive of the parent cannot land between the host's check and this
1195
+ * write. The host has judged the types already. Absent: no parent named.
1196
+ */
1197
+ parentScopeId?: string;
1198
+ /**
1199
+ * #3625 (K-64): the host judged this provision an install (`claimsHome`): parentless, of type
1200
+ * `home`, primary, naming its app itself. Refused here, in the write's own unit, while the app has a
1201
+ * live home scope in the tenant, so two installs racing cannot both pass. Absent: not judged, as
1202
+ * every write was before it. #2993: `'sibling'`, a sibling of an app that declares scope types
1203
+ * (the host read the types), which claims the home as an install does and is refused in its own words.
1204
+ */
1205
+ claimsHome?: boolean | 'sibling';
1164
1206
  }, createdAt: string): boolean;
1165
1207
  /**
1166
1208
  * The scope's migration state, projected into the directory so the fleet
@@ -1181,13 +1223,15 @@ export declare class ControlPlaneDO extends DurableObject {
1181
1223
  tenantId?: string;
1182
1224
  status?: string[];
1183
1225
  vertical?: string;
1226
+ /** #2995: the children of this scope only. */
1227
+ parentScopeId?: string;
1184
1228
  } & ListPage): ScopeRow[];
1185
1229
  /**
1186
1230
  * #2993 part 4: the scope types other than `home` that the vertical's scopes hold, every tenant's
1187
1231
  * and every status but `reaped`, each once. What a promote judges the incoming version's declared
1188
1232
  * types against. A vertical none of whose scopes is typed answers `[]`.
1189
1233
  */
1190
- scopeTypesHeldBy(vertical: string): string[];
1234
+ scopeTypesHeldBy(vertical: string, servingRef?: string): string[];
1191
1235
  /** #2178: `PROVISIONED_VERSIONS_SQL` over the directory — one row per version, however many scopes. */
1192
1236
  provisionedVersionsOf(vertical: string, serving: ServingPointer | null, ownerTenant: string | null): InstallsReconciled[];
1193
1237
  /** Cross-checks the pair (K-3): a scope under a DIFFERENT tenant reads as absent. */
@@ -1247,13 +1291,43 @@ export declare class ControlPlaneDO extends DurableObject {
1247
1291
  code: ErrorCode;
1248
1292
  message: string;
1249
1293
  };
1294
+ /**
1295
+ * #2995 (K-64): archive a scope AND its children, in one unit, so a child never outlives its parent
1296
+ * by a crash between two writes. The parent is judged as `transitionScopeOrRefusal` judges it; each
1297
+ * child in `from` is archived with it, and a child already archived or reaped is left as it is. A
1298
+ * refused parent archives none. Answers the parent's previous state and each child's, for the
1299
+ * coordinator's audit rows and its lifecycle deliveries.
1300
+ */
1301
+ archiveScopeFamilyOrRefusal(tenantId: string, scopeId: string, from: string[], action: string): {
1302
+ ok: true;
1303
+ status: string;
1304
+ vertical: string | null;
1305
+ children: {
1306
+ scopeId: string;
1307
+ status: string;
1308
+ vertical: string | null;
1309
+ }[];
1310
+ } | {
1311
+ ok: false;
1312
+ code: ErrorCode;
1313
+ message: string;
1314
+ };
1315
+ /**
1316
+ * #2995: the ids of `parentScopeId`'s children in `tenantId` whose status is one of `statuses`, oldest
1317
+ * first. What a coordinator reaps before their parent: a child does not outlive it.
1318
+ */
1319
+ childScopeIds(tenantId: string, parentScopeId: string, statuses: string[]): string[];
1320
+ /** A transition's refusal, read in the same synchronous turn as the write that follows it. */
1321
+ private judgeTransition;
1322
+ /** The writes of one judged transition. Called inside the caller's transaction. */
1323
+ private applyTransition;
1250
1324
  /**
1251
1325
  * Kept for a coordinator from before #2447, which calls it and reads the previous role (for the
1252
1326
  * audit `before`) or null. The definition is judged as `defineRoleOrRefusal` judges it, and a
1253
1327
  * refusal is THROWN, so such a coordinator cannot read it as the previous role and audit a change
1254
1328
  * that never happened.
1255
1329
  */
1256
- defineRole(tenantId: string, role: RoleDefinition): RoleDefinition | null;
1330
+ defineRole(tenantId: string, role: RoleDefinition): RoleDefinition | null | Promise<RoleDefinition | null>;
1257
1331
  /**
1258
1332
  * INSERT OR REPLACE; answer the previous role (for the audit `before`) or null. Judged first, in
1259
1333
  * the same unit (#2447, `reservedRoleDefinitionRefusal`): against `reservation`, what the
@@ -1273,20 +1347,38 @@ export declare class ControlPlaneDO extends DurableObject {
1273
1347
  before: RoleDefinition | null;
1274
1348
  } | {
1275
1349
  refused: string;
1276
- };
1277
- private defineRoleIn;
1278
- /** Raw rows; the coordinator parses them through the `tenantRole` contract. */
1350
+ } | Promise<{
1351
+ before: RoleDefinition | null;
1352
+ } | {
1353
+ refused: string;
1354
+ }>;
1355
+ /** Raw rows; the coordinator parses them through the `tenantRole` contract. One cut-over tenant's are its object's (3e). */
1279
1356
  listRoles(filter: {
1280
1357
  tenantId?: string;
1281
1358
  source?: string;
1282
- } & ListPage): RoleRow[];
1283
- getRole(tenantId: string, key: string): RoleDefinition | undefined;
1359
+ } & ListPage): RoleRow[] | Promise<RoleRow[]>;
1360
+ /** A role as stored; a cut-over tenant's from its object (3e). The decisions in this object read `readRole` directly. */
1361
+ getRole(tenantId: string, key: string): RoleDefinition | undefined | Promise<RoleDefinition | undefined>;
1362
+ /** Whether the tenant's tuples and removal fences are read from, and first written to, its own object. */
1363
+ private tuplesCutOver;
1364
+ /** Whether the tenant's organizations are read from, and first written to, its own object (the third family). */
1365
+ private orgsCutOver;
1366
+ /** This directory as a `TupleStore`: its rows, its admin log, its orgs. */
1367
+ private tupleStore;
1368
+ /**
1369
+ * Run `fn` with no other call into this object between its first step and its end. For a cut-over
1370
+ * tenant's unit that reads what this directory still writes (a system switch, a connection) and
1371
+ * writes first in the tenant's object: the read, the object's write and the fallback are then one
1372
+ * step for every other call here, as the synchronous unit is for a tenant not cut over. A failure
1373
+ * is answered after the step, never thrown inside it (a throw there resets the object).
1374
+ */
1375
+ private exclusive;
1284
1376
  /**
1285
1377
  * A tenant tuple, upserted. With `audit` (#2526, `grant` at the tenant node, called through
1286
1378
  * `reply`), its admin row commits in the same transaction; without, as a coordinator from before
1287
- * #2526 calls it, and as this object's own units do, it is the bare write.
1379
+ * #2526 calls it, it is the bare write.
1288
1380
  */
1289
- writeTenantTuple(tenantId: string, subject: string, relation: string, object: string, expiresAt: string | null, audit?: AdminEntryInput): void;
1381
+ writeTenantTuple(tenantId: string, subject: string, relation: string, object: string, expiresAt: string | null, audit?: AdminEntryInput): void | Promise<void>;
1290
1382
  /**
1291
1383
  * #2526: `assignRole` at the tenant node — the role's reservation judged (`reserved`, what the
1292
1384
  * coordinator's modules reserve to a system principal: a role mixing them with other keys is
@@ -1295,19 +1387,25 @@ export declare class ControlPlaneDO extends DurableObject {
1295
1387
  */
1296
1388
  assignTenantRole(tenantId: string, principal: string, roleKey: string, reserved: readonly string[], audit: AdminEntryInput): {
1297
1389
  refused?: string;
1298
- };
1390
+ } | Promise<{
1391
+ refused?: string;
1392
+ }>;
1299
1393
  /**
1300
1394
  * #2526: a tenant tuple that names an org — `grantToOrg` at the tenant node, and `addMember` —
1301
- * with its admin row, in one unit, refused `not_found` when the org is not in the tenant.
1395
+ * with its admin row, in one unit, refused `not_found` when the org is not in the tenant. For a
1396
+ * cut-over tenant the org is asked here first: an org is never removed from a live tenant, so the
1397
+ * answer still holds when the object writes.
1302
1398
  */
1303
- writeOrgTenantTuple(tenantId: string, orgId: string, subject: string, relation: string, object: string, expiresAt: string | null, audit: AdminEntryInput): void;
1399
+ writeOrgTenantTuple(tenantId: string, orgId: string, subject: string, relation: string, object: string, expiresAt: string | null, audit: AdminEntryInput): void | Promise<void>;
1304
1400
  /**
1305
1401
  * #1743: a tenant-level `system:<module>` grant, refused while the record holds the module
1306
1402
  * off on any scope (`scopesSwitchedOffFor`). Synchronous, so the read and the write are one
1307
- * DO unit. Answers the switched-off scopes; non-empty means nothing was written. With `audit`
1308
- * (#2526, through `reply`), the row commits with the tuple, and a refusal records none.
1403
+ * DO unit; for a cut-over tenant, one exclusive step (`exclusive`), the switch read here and the
1404
+ * grant written first in the object. Answers the switched-off scopes; non-empty means nothing was
1405
+ * written. With `audit` (#2526, through `reply`), the row commits with the tuple, and a refusal
1406
+ * records none.
1309
1407
  */
1310
- writeTenantSystemGrant(tenantId: string, moduleId: string, relation: string, expiresAt: string | null, audit?: AdminEntryInput): string[];
1408
+ writeTenantSystemGrant(tenantId: string, moduleId: string, relation: string, expiresAt: string | null, audit?: AdminEntryInput): string[] | Promise<string[]>;
1311
1409
  /** The admin read: the bare hostname row, for the bind/status/unbind paths. */
1312
1410
  readHostname(hostname: string): HostnameRow | undefined;
1313
1411
  /**
@@ -1341,6 +1439,8 @@ export declare class ControlPlaneDO extends DurableObject {
1341
1439
  target_scope_id: string;
1342
1440
  invalidated: number;
1343
1441
  }[];
1442
+ /** #3625 (K-64): the home scope of (tenant, app, environment), or null (kernel `homeScopeIn`). */
1443
+ homeScopeOf(tenantId: TenantId, vertical: string, environment?: string): ScopeId | null;
1344
1444
  /** D-83 (#3530 step 3): the app's environments in the tenant, production first (kernel `environmentsOf`). */
1345
1445
  listEnvironments(tenantId: TenantId, vertical: string): AppEnvironment[];
1346
1446
  /**
@@ -1373,7 +1473,9 @@ export declare class ControlPlaneDO extends DurableObject {
1373
1473
  tenantId: TenantId;
1374
1474
  vertical: string;
1375
1475
  name: string;
1376
- }, next: EnvironmentServing, expected: EnvironmentServing | null, audit: AdminEntryInput, claim?: string): boolean;
1476
+ }, next: EnvironmentServing, expected: EnvironmentServing | null, audit: AdminEntryInput, claim?: string,
1477
+ /** #3638: what this serve acknowledges in this environment, judged and recorded here. */
1478
+ acknowledge?: EnvironmentServeAcknowledgement): boolean;
1377
1479
  /**
1378
1480
  * #3530 step 4: take an environment's serve lease (kernel `claimEnvironmentServeIn`), so its serves
1379
1481
  * run one at a time. Unaudited: it moves nothing a reader sees, and the serve it guards is audited.
@@ -1389,6 +1491,20 @@ export declare class ControlPlaneDO extends DurableObject {
1389
1491
  vertical: string;
1390
1492
  name: string;
1391
1493
  }, claim: string): void;
1494
+ /**
1495
+ * #3530 step 6: give a named environment connections of its own, or take that back (kernel
1496
+ * `setEnvironmentEffectsIn`), with its admin row in the same transaction. No row when nothing changed.
1497
+ */
1498
+ setEnvironmentEffectsAndAudit(input: {
1499
+ tenantId: TenantId;
1500
+ vertical: string;
1501
+ name: string;
1502
+ }, effects: EnvironmentEffects, audit: AdminEntryInput): {
1503
+ changed: boolean;
1504
+ before: EnvironmentEffects;
1505
+ };
1506
+ /** #3530 step 6: which connections the scope's effects may go through (kernel `connectionReachIn`). */
1507
+ connectionReach(tenantId: TenantId, scopeId: string): ConnectionReach;
1392
1508
  /** Directory write and endpoint checks share this DO's serialized unit. */
1393
1509
  setPeerBinding(tenantId: string, callerScopeId: string, vertical: string, targetScopeId: string | null): {
1394
1510
  ok: false;
@@ -1610,6 +1726,21 @@ export declare class ControlPlaneDO extends DurableObject {
1610
1726
  doClassesJson: string;
1611
1727
  migrationTag: string;
1612
1728
  }, audit?: AdminEntryInput, expected?: ServedFrom, supersede?: SupersedeMajor): boolean;
1729
+ /**
1730
+ * K-65 (#3539): record a release into an earlier major, served on its own script: only that major's
1731
+ * entry of `earlier_majors` moves, compare-and-set on `expected` (`releasedEarlierMajorJson`, which
1732
+ * refuses `precondition_failed`), and `audit`'s `before` is the entry this unit read.
1733
+ */
1734
+ setEarlierMajorServing(slug: string, major: number, s: {
1735
+ ref: string;
1736
+ versionId: string;
1737
+ doClasses: string[];
1738
+ migrationTag: string;
1739
+ }, expected: {
1740
+ versionId: string;
1741
+ doClasses: string[];
1742
+ migrationTag: string;
1743
+ }, audit: AdminEntryInput): boolean;
1613
1744
  /** #2351: the digest of the migrations read from a version's bundle, or `undefined` for no such version. */
1614
1745
  readMigrationsExtracted(id: string): {
1615
1746
  verticalSlug: string;
@@ -1694,6 +1825,21 @@ export declare class ControlPlaneDO extends DurableObject {
1694
1825
  writeImpersonationAndAudit(...args: Required<Parameters<ControlPlaneDO['writeImpersonation']>>): ReturnType<ControlPlaneDO['writeImpersonation']>;
1695
1826
  endImpersonationAndAudit(...args: Required<Parameters<ControlPlaneDO['endImpersonation']>>): ReturnType<ControlPlaneDO['endImpersonation']>;
1696
1827
  setIssueStatusAndAudit(...args: Required<Parameters<ControlPlaneDO['setIssueStatus']>>): ReturnType<ControlPlaneDO['setIssueStatus']>;
1828
+ /**
1829
+ * K-63 (#3624): what an erasure did at a master's dependents. An `erased` dependent leaves the
1830
+ * ledger, an `outstanding` one is kept with its next try; one admin row, in the same unit.
1831
+ */
1832
+ recordDependentErasures(tenantId: string, subjectId: string, outcomes: readonly DependentErasure[], audit: AdminEntryInput): void;
1833
+ /**
1834
+ * K-63 (#3624): hold each dependent as owed, before the master's erasure runs. The statements run
1835
+ * in one synchronous call, so the object commits them together. A row already owed is kept.
1836
+ */
1837
+ holdDependentErasures(tenantId: string, subjectId: string, dependents: readonly {
1838
+ vertical: string;
1839
+ scopeId: string;
1840
+ }[]): void;
1841
+ /** K-63 (#3624): the owed dependent erasures due at `now`, oldest due first. */
1842
+ dueDependentErasures(now: string, limit: number): OwedDependentErasure[];
1697
1843
  scopeErasureEpoch(tenantId: string, scopeId: string): number;
1698
1844
  /** The erasure claim (`SUBJECT_ERASURE_CLAIM_SQL`): false when the scope moved since the fence was read. */
1699
1845
  claimSubjectErasure(tenantId: string, scopeId: string, fence: SubjectErasureFence): boolean;
@@ -1714,14 +1860,28 @@ export declare class ControlPlaneDO extends DurableObject {
1714
1860
  leaseUntil: string;
1715
1861
  owner: string;
1716
1862
  limit: number;
1863
+ tenantId?: string;
1717
1864
  }): ScopeScriptCopyRow[];
1718
1865
  /** `HostAdmin.markScopeStoresFenced`: read and written in one synchronous step, so an unarchive is before or after. */
1719
- markScopeStoresFenced(tenantId: string, scopeId: string, whileTenantDeleting: boolean, audit?: AdminEntryInput): void;
1866
+ markScopeStoresFenced(tenantId: string, scopeId: string, whileTenantDeleting: boolean, audit?: AdminEntryInput, deadlines?: {
1867
+ archivedBy?: string;
1868
+ deletingBy?: string;
1869
+ }): void;
1720
1870
  scopeStoresFencedAt(tenantId: string, scopeId: string): string | null;
1721
1871
  /** #3314: `expiredBy` claims only while the expiry is set and due, in the claim's own write. */
1722
1872
  beginScopeScriptReap(tenantId: string, scopeId: string, expiredBy?: string): 'claimed' | 'pending' | 'missing' | 'not-due';
1723
1873
  settleScopeScriptCopy(tenantId: string, scopeId: string, scriptRef: string, moveId: string, state: string, loadStamp: string | null, revision: string | null, claimedBy?: string): boolean;
1724
1874
  touchScopeScriptCopy(tenantId: string, scopeId: string, scriptRef: string, moveId: string): void;
1875
+ nextScopeCopyDue(tenantId: string, now: string): string | null;
1876
+ listDueScopeCopyTenants(input: {
1877
+ after: string;
1878
+ by: string;
1879
+ now: string;
1880
+ limit: number;
1881
+ }): {
1882
+ tenantId: string;
1883
+ dueAt: string;
1884
+ }[];
1725
1885
  listScopeScriptCopies(filter: {
1726
1886
  tenantId?: string;
1727
1887
  scopeId?: string;
@@ -1773,22 +1933,29 @@ export declare class ControlPlaneDO extends DurableObject {
1773
1933
  * refuses on the listing it read itself first, so only a listing landing inside that window passes.
1774
1934
  */
1775
1935
  promoteChannel(from: string | null, history: ChannelHistoryRow, unlistedOnly: boolean, audit: AdminEntryInput, breakingWithinMajor?: string | null): boolean;
1936
+ /**
1937
+ * K-65 (#3539): the unit of a release into an earlier major, which moves no channel: its admin row
1938
+ * lands only while major `major`'s script still runs `from`, the version its gates were judged
1939
+ * against, with the listing and the admission read here as `promoteChannel` reads them for prod.
1940
+ * False, with nothing written, when that script moved.
1941
+ */
1942
+ recordEarlierMajorPromote(slug: string, major: number, from: string, versionId: string, unlistedOnly: boolean, audit: AdminEntryInput, breakingWithinMajor: string | null): boolean;
1776
1943
  listChannels(verticalSlug: string, page?: ListPage): ChannelRow[];
1777
1944
  insertChannelHistory(h: ChannelHistoryRow): void;
1778
1945
  listChannelHistory(verticalSlug: string, channel?: string, page?: ListPage): ChannelHistoryRow[];
1779
- readOrg(tenantId: string, orgId: string): OrgRow | undefined;
1946
+ readOrg(tenantId: string, orgId: string): OrgRow | undefined | Promise<OrgRow | undefined>;
1780
1947
  /** Returns false when the org already exists (idempotent); throws on slug collision. */
1781
- createOrg(orgId: string, tenantId: string, slug: string, name: string, createdAt: string): boolean;
1948
+ createOrg(orgId: string, tenantId: string, slug: string, name: string, createdAt: string): boolean | Promise<boolean>;
1782
1949
  /**
1783
1950
  * #2526: `createOrg` with its admin row, in one unit; an org that already exists writes nothing,
1784
1951
  * the row included. A new name rather than a trailing argument on `createOrg`, which an older
1785
1952
  * ControlPlaneDO already lists in `REPLIED_METHODS`: there the argument would be dropped and the
1786
1953
  * org created with no row, where an unknown method fails closed.
1787
1954
  */
1788
- insertOrg(orgId: string, tenantId: string, slug: string, name: string, createdAt: string, audit: AdminEntryInput): boolean;
1789
- listOrgs(tenantId: string): OrgRow[];
1790
- /** The tenant-level reads, synchronous, for a bound asked inside one of this object's units (#1184). */
1791
- private readonly directoryReader;
1955
+ insertOrg(orgId: string, tenantId: string, slug: string, name: string, createdAt: string, audit: AdminEntryInput): boolean | Promise<boolean>;
1956
+ /** A cut-over tenant's org, created first in its object; a slug's conflict is rethrown here with its code. */
1957
+ private createOrgFirst;
1958
+ listOrgs(tenantId: string): OrgRow[] | Promise<OrgRow[]>;
1792
1959
  /**
1793
1960
  * A membership change as ONE DO unit (#1184) — `HostAdmin.applyMembership`. Synchronous, so
1794
1961
  * no other request into this object runs between its reads and its writes: an add's removal
@@ -1801,41 +1968,41 @@ export declare class ControlPlaneDO extends DurableObject {
1801
1968
  * The org row's `before`/`after` are written here, since only the unit knows the expiry.
1802
1969
  * `reserved` (#2430) is what the coordinator's modules reserve to a system principal: an add of
1803
1970
  * a role carrying one is a person conferring it, refused in the unit (`reservedRoleRefusal`).
1971
+ * For a cut-over tenant (K-68 step 3e) the same unit runs in its object, whose tuples, fences and
1972
+ * roles are the ones written first; whether the org exists is asked here, where orgs are kept.
1804
1973
  */
1805
- applyMembership(change: MembershipChange, row: AdminEntryInput, orgRow?: AdminEntryInput, reserved?: readonly string[]): MembershipChangeResult;
1974
+ applyMembership(change: MembershipChange, row: AdminEntryInput, orgRow?: AdminEntryInput, reserved?: readonly string[]): MembershipChangeResult | Promise<MembershipChangeResult>;
1806
1975
  /**
1807
1976
  * A tenant-level removal as ONE DO unit (#1184) — `unassignRole` at the tenant node, and
1808
1977
  * `removeMember`: the tombstone, the principal's removal fence, and the audit row, which
1809
1978
  * K-21 writes only when something changed. The fence is raised either way: a removal of
1810
1979
  * someone whose add is still on its way takes nothing, and must still win. One method, so
1811
1980
  * no add can run between the revoke and the fence. Returns whether anything changed.
1812
- */
1813
- revokeAndFence(tenantId: string, principal: string, relation: string, object: string, row: AdminEntryInput): boolean;
1814
- /**
1815
- * `revokeAndFence`'s writes, for inside a transaction a caller already holds.
1816
1981
  *
1817
- * The time is minted HERE, in the unit, never taken from `row.at`: the coordinator mints its
1818
- * row before an awaited RPC, and a queue delay in between would age the fence by however
1819
- * long the call waited, which an add's cutoff would read as a removal from before its window
1820
- * (Codex round 3). The fence is compared with an add's `occurredAt`, stamped by the ScopeDO's
1821
- * clock. Both are this platform's own NTP-disciplined time, sub-second apart, which is far
1822
- * inside `MEMBERSHIP_REMOVAL_SKEW_MS`.
1823
- */
1824
- private revokeAndFenceIn;
1982
+ * The time is minted in the unit, never taken from `row.at`: the coordinator mints its row
1983
+ * before an awaited RPC, and a queue delay in between would age the fence by however long the
1984
+ * call waited, which an add's cutoff would read as a removal from before its window (Codex
1985
+ * round 3). The fence is compared with an add's `occurredAt`, stamped by the ScopeDO's clock.
1986
+ * Both are this platform's own NTP-disciplined time, sub-second apart, which is far inside
1987
+ * `MEMBERSHIP_REMOVAL_SKEW_MS`.
1988
+ */
1989
+ revokeAndFence(tenantId: string, principal: string, relation: string, object: string, row: AdminEntryInput): boolean | Promise<boolean>;
1825
1990
  /** Tombstone any tenant tuple by its exact (subject, relation, object). Returns
1826
- * whether a live row changed, so a repeat revoke is a silent no-op. */
1991
+ * whether a live row changed, so a repeat revoke is a silent no-op. A cut-over tenant's is
1992
+ * refused here (K-68 step 3e: its tuples are written in its object first). */
1827
1993
  revokeTenantTuple(tenantId: string, subject: string, relation: string, object: string, at: string): boolean;
1828
1994
  /** Members of an org. Live only unless `includeRevoked` — revoked rows are evidence. */
1829
- listMembers(tenantId: string, object: string, includeRevoked: boolean): MemberTupleRow[];
1830
- tenantTuples(tenantId: string, subject: string, relationPrefix: string): TupleRow[];
1995
+ listMembers(tenantId: string, object: string, includeRevoked: boolean): MemberTupleRow[] | Promise<MemberTupleRow[]>;
1996
+ tenantTuples(tenantId: string, subject: string, relationPrefix: string): TupleRow[] | Promise<TupleRow[]>;
1831
1997
  /**
1832
1998
  * ALL of a tenant's tenant-level tuples — the read behind scope-local projection
1833
1999
  * (docs/architecture/scope-local-permissions.md). Includes tombstoned rows so the
1834
2000
  * projection mirrors the directory exactly and the checker's own `live()` filter
1835
2001
  * drops them identically. Not on the request hot path — this runs on the admin
1836
- * write path, projecting into a tenant's scopes.
2002
+ * write path, projecting into a tenant's scopes. A cut-over tenant's are its object's, so a
2003
+ * revocation it made first is projected even while its fallback is still owed here.
1837
2004
  */
1838
- dumpTenantTuples(tenantId: string): TupleRow[];
2005
+ dumpTenantTuples(tenantId: string): TupleRow[] | Promise<TupleRow[]>;
1839
2006
  private readEntitlement;
1840
2007
  /**
1841
2008
  * Upsert; returns before/after for the host's audit row, `changed: false` when
@@ -2092,7 +2259,24 @@ export declare class ControlPlaneDO extends DurableObject {
2092
2259
  grantedAt: string;
2093
2260
  }, audit: AdminEntryInput): {
2094
2261
  vertical: string;
2095
- };
2262
+ } | Promise<{
2263
+ vertical: string;
2264
+ }>;
2265
+ /**
2266
+ * K-68 step 3e: a tenant-level connection grant of a cut-over tenant, as one exclusive step
2267
+ * (`exclusive`): the connection judged here as it stands, the tuple written first in the tenant's
2268
+ * object, and the record (`_substrat_connection_grants`, still this directory's) carried with it to
2269
+ * the fallback, which writes the record, the tuple and the admin row in one transaction. A revoke of
2270
+ * the connection can then land only after the grant, as it could in the synchronous unit; if the
2271
+ * fallback is applied later, `applyCarried` tombstones the record as that revoke's cascade would have.
2272
+ */
2273
+ private grantConnectionFirst;
2274
+ /**
2275
+ * K-68 step 3e: a write the directory still owns that rode a first write (`CarriedWrite`), in the
2276
+ * fallback's transaction. A connection revoked since the grant was judged tombstones the record at
2277
+ * its revoke time (#592's cascade): the grant came first, and the revoke took it.
2278
+ */
2279
+ private applyCarried;
2096
2280
  /**
2097
2281
  * #2732: `revokeFromConnection`'s directory half as one unit, after the scope's tuple was
2098
2282
  * delivered gone. The scope-level record is tombstoned (K-21), so the additive reconcile never
@@ -2141,7 +2325,7 @@ export declare class ControlPlaneDO extends DurableObject {
2141
2325
  * for — what the switch passes the scope as `tenantHeld`, so a subject whose only authority
2142
2326
  * there is a tenant tuple is still switchable. Read here, where the tenant tuples live.
2143
2327
  */
2144
- tenantHeldOf(kind: SwitchKind, tenantId: string, keys: readonly string[], now: string): string[];
2328
+ tenantHeldOf(kind: SwitchKind, tenantId: string, keys: readonly string[], now: string): string[] | Promise<string[]>;
2145
2329
  /** The fleet read. */
2146
2330
  listSystemSwitches(filter?: SystemSwitchRecordFilter): SystemSwitchRecordRow[];
2147
2331
  /** One scope's recorded positions of one kind, by subject — the status read's `recorded` join. */