@substrat-run/adapter-sqlite 0.124.0 → 0.126.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
@@ -263,7 +263,9 @@ export declare class SqliteScopeHost implements ScopeHost {
263
263
  importScope(actor: PlatformActorId, input: ProvisionScopeInput, dump: ScopeDump): Promise<void>;
264
264
  /** Drop-then-replay a dump into a scope's db, refreshing the migration frontier. */
265
265
  private loadDump;
266
- restoreScope(actor: PlatformActorId, tenantId: TenantId, scopeId: ScopeId, dump: ScopeDump): Promise<void>;
266
+ restoreScope(actor: PlatformActorId, tenantId: TenantId, scopeId: ScopeId, dump: ScopeDump, opts?: {
267
+ sourceScopeId?: ScopeId;
268
+ }): Promise<void>;
267
269
  snapshotScope(actor: PlatformActorId, tenantId: TenantId, scopeId: ScopeId, opts?: {
268
270
  kind?: string;
269
271
  expiresAt?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAeL,KAAK,eAAe,EAcpB,KAAK,WAAW,EAEhB,KAAK,YAAY,EAuBjB,KAAK,YAAY,EAIjB,KAAK,cAAc,EAqCnB,KAAK,kBAAkB,EAMvB,KAAK,YAAY,EAGjB,KAAK,QAAQ,EAeb,KAAK,WAAW,EAIhB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAI3B,KAAK,wBAAwB,EAW7B,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,WAAW,EAehB,KAAK,SAAS,EAEd,KAAK,OAAO,EAYZ,KAAK,sBAAsB,EAG3B,KAAK,QAAQ,EAGb,KAAK,iBAAiB,EAcvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAmBL,KAAK,aAAa,EAoBlB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAc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eAAe;IAiB7B,gFAAgF;IAChF,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,WAAW;IA2BnB,OAAO,CAAC,sBAAsB;IAe9B,4FAA4F;IAC5F,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,UAAU;IA2pIlB;;;;;;;;;OASG;IACH;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAOpB;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAc/B;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,iBAAiB;IA0BzB;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;IA2BpC;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,yBAAyB;IAWjC,OAAO,CAAC,sBAAsB;IAkI9B,OAAO,CAAC,SAAS;IAejB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;YAyfV,sBAAsB;IAsDpC;;;;;;;;;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;IAyE1B,OAAO,CAAC,OAAO;CA6ChB"}
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { existsSync, mkdirSync, readdirSync, readFileSync, 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, 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, projectedConnectionGrant, projectedConnectionKey, moduleManifest, createOrgInput, promotionAcknowledgement, bindAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, publishVersionInput, AUTO_ADMISSION_NOTE, routeTarget, registerVerticalInput, vertical as verticalSchema, verticalChannel, verticalVersion, objectRef, 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, substratError, assertReplayableDump, delegatedReadRecord, redrainEventsInput, REDRAIN_BATCH, } from '@substrat-run/contracts';
5
- import { actorOf, asPrincipal, assertAllowed, assertNoSecret, assertPermissionKey, CAPABILITY_DDL, CAPABILITY_EXCHANGE_OPERATION, capabilityAttachmentWriteRefused, capabilityTokenHash, createCapabilityVerbs, exchangeCapability as exchangeCapabilitySecret, guardSecrets, mintBecomeCapability, plausibleSessionToken, redactSecrets, redactSecretText, moduleLog, consoleLogSink, resolveCapabilitySession, revokeCapabilityAsPlatform, assertReadOnlyQuery, attachmentBlobKey, entitlementDenial, foldMeterReading, guardSpine, guardSqlLimits, DO_SQL_LIMITS, tooManyResultColumns, tooManyTableColumns, parseValidationRecords, resolveScopeRecord, ulid, ISSUE_RETENTION_DAYS, 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, JOB_RUN_PATCH_SQL, JOB_STEP_RECORD_SQL, DELIVERY_ERROR_REDACTION_SQL, REDACTED_DELIVERY_NOTE, seatScopeTuple, switchSystemSchedules, admitPeer, collectPeers, peerSeats, resolveVerticalInstanceFrom, switchPeer, peerGrantsStatus, systemGrantsStatus, systemScheduleState, systemSwitchedOff, systemSwitchedOffMessage, tenantSystemSwitchedOffMessage, SYSTEM_SWITCHES_BACKFILL_SQL, SYSTEM_SWITCHES_DDL, forgetSystemSwitchesOf, listSystemSwitchRecords, recordSystemSwitchedOff, recordSystemSwitchedOn, restoreSystemSwitchRecord, scopesSwitchedOffFor, switchedOffModulesOf, inUnitMovesToAudit, staleCarryRevertRow, staleCarryReverts, systemSwitchRecordsOf, systemSwitchesTableExists, withRecorded, VERSION_MIGRATIONS_DDL, splitManifestMigrations, splitVersionMigrationsBatch, versionMigrationsOf, writeVersionMigrations, denialListQuery, denialSummaryQuery, denialTotalsQuery, DENIAL_WINDOW_QUERY, mapDenialRow, mapDenialSummaryBuckets, IMPERSONATION_COLUMNS, IMPERSONATION_DDL, ImpersonationRefused, assertImpersonationWrites, assertModuleEnqueueableKind, assertSessionUsable, impersonationByIdQuery, impersonationListQuery, impersonationRowValues, impersonationStampOf, mapImpersonationRow, newImpersonationSession, resolveRetryPolicy, isSecretBoxConfigured, unconfiguredSecretBox, createSubjectKeys, generateSealingKeyPair, noSealingKeyMessage, openSealed, sealTo, ConnectionSealingKeyUnavailableError, PermissionDenied, createAtomic, NotSearchable, NotListable, listIndexMigrations, listIndexPlans, listQuery, cursorOf, moduleMigrations, isSearchIndexTable, searchIndexDdl, searchIndexMigrations, searchIndexPlans, searchLimit, searchMatchExpression, searchQuery, entityVersionQuery, entityVersionOf, assertIfMatch, OUTBOX_ENTITY_INDEX, SCHEDULE_STATE_DDL, SCHEDULE_STATE_REBUILD, scheduleStateHasKind, VERTICAL_EVENTS_DDL, EXPORT_HOPS_SQL, 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, jobRunListLimit, jobRunOf, runDueJobRuns, startJobRun, IDEMPOTENCY_DDL, assertIdempotencyKey, idempotencyLookupQuery, idempotencyPruneStatement, idempotencyRecordStatement, idempotencyOptedOutMessage, replayFor, globalFetch, createUlid, facetEvents, readHistory, walkEventCause, walkEventEffects, assertRedrainWindow, readInvocation, readDeadLetters, domainEventOf, readUndrainedOutbox, undrainedEventsOf, connectorCallRecord, noopConnectorCallRecorder, recordConnectorCall, settleConnectionUse, } from '@substrat-run/kernel';
4
+ import { accessLogEntry, adminLogEntry, delegatedReadParams, 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, projectedConnectionGrant, projectedConnectionKey, moduleManifest, createOrgInput, promotionAcknowledgement, bindAcknowledgement, bindHostnameInput, channelHistoryEntry, hostnameBinding, publishVersionInput, AUTO_ADMISSION_NOTE, routeTarget, 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, substratError, assertReplayableDump, delegatedReadRecord, redrainEventsInput, REDRAIN_BATCH, } from '@substrat-run/contracts';
5
+ import { actorOf, asPrincipal, assertAllowed, assertNoSecret, assertPermissionKey, CAPABILITY_DDL, CAPABILITY_EXCHANGE_OPERATION, capabilityAttachmentWriteRefused, capabilityTokenHash, createCapabilityVerbs, createEntityEdgeVerbs, exchangeCapability as exchangeCapabilitySecret, guardSecrets, mintBecomeCapability, plausibleSessionToken, redactSecrets, redactSecretText, moduleLog, consoleLogSink, resolveCapabilitySession, revokeCapabilityAsPlatform, assertReadOnlyQuery, attachmentBlobKey, entitlementDenial, foldMeterReading, guardSpine, guardSqlLimits, DO_SQL_LIMITS, tooManyResultColumns, tooManyTableColumns, parseValidationRecords, resolveScopeRecord, ulid, ISSUE_RETENTION_DAYS, 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, JOB_RUN_PATCH_SQL, JOB_STEP_RECORD_SQL, DELIVERY_ERROR_REDACTION_SQL, REDACTED_DELIVERY_NOTE, seatScopeTuple, switchSystemSchedules, admitPeer, collectPeers, peerSeats, resolveVerticalInstanceFrom, switchPeer, peerGrantsStatus, systemGrantsStatus, systemScheduleState, systemSwitchedOff, systemSwitchedOffMessage, tenantSystemSwitchedOffMessage, SYSTEM_SWITCHES_BACKFILL_SQL, SYSTEM_SWITCHES_DDL, forgetSystemSwitchesOf, listSystemSwitchRecords, recordSystemSwitchedOff, recordSystemSwitchedOn, restoreSystemSwitchRecord, scopesSwitchedOffFor, switchedOffModulesOf, inUnitMovesToAudit, staleCarryRevertRow, staleCarryReverts, systemSwitchRecordsOf, systemSwitchesTableExists, withRecorded, VERSION_MIGRATIONS_DDL, splitManifestMigrations, splitVersionMigrationsBatch, versionMigrationsOf, writeVersionMigrations, denialListQuery, denialSummaryQuery, denialTotalsQuery, DENIAL_WINDOW_QUERY, mapDenialRow, mapDenialSummaryBuckets, IMPERSONATION_COLUMNS, IMPERSONATION_DDL, ImpersonationRefused, assertImpersonationWrites, assertModuleEnqueueableKind, assertSessionUsable, impersonationByIdQuery, impersonationListQuery, impersonationRowValues, impersonationStampOf, mapImpersonationRow, newImpersonationSession, resolveRetryPolicy, isSecretBoxConfigured, unconfiguredSecretBox, createSubjectKeys, generateSealingKeyPair, noSealingKeyMessage, openSealed, sealTo, ConnectionSealingKeyUnavailableError, PermissionDenied, createAtomic, NotSearchable, NotListable, listIndexMigrations, listIndexPlans, listQuery, cursorOf, moduleMigrations, isSearchIndexTable, searchIndexDdl, searchIndexMigrations, searchIndexPlans, searchLimit, searchMatchExpression, searchQuery, entityVersionQuery, entityVersionOf, assertIfMatch, OUTBOX_ENTITY_INDEX, SCHEDULE_STATE_DDL, SCHEDULE_STATE_REBUILD, scheduleStateHasKind, VERTICAL_EVENTS_DDL, EXPORT_HOPS_SQL, 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, jobRunListLimit, jobRunOf, runDueJobRuns, startJobRun, IDEMPOTENCY_DDL, assertIdempotencyKey, idempotencyLookupQuery, idempotencyPruneStatement, idempotencyRecordStatement, idempotencyOptedOutMessage, replayFor, globalFetch, createUlid, facetEvents, readHistory, walkEventCause, walkEventEffects, assertRedrainWindow, readInvocation, readDeadLetters, domainEventOf, readUndrainedOutbox, undrainedEventsOf, connectorCallRecord, noopConnectorCallRecorder, recordConnectorCall, settleConnectionUse, } from '@substrat-run/kernel';
6
+ import { repointScopeGrants } from '@substrat-run/kernel';
6
7
  import { ScopeActor } from './actor.js';
7
8
  import { createTupleChecker } from './checker.js';
8
9
  /**
@@ -13,6 +14,19 @@ export function isStorageFault(err) {
13
14
  const code = err?.code;
14
15
  return typeof code === 'string' && /^SQLITE_(FULL|CORRUPT|IOERR|NOTADB)/.test(code);
15
16
  }
17
+ /**
18
+ * #1864: the kernel's own events (attachments, capability exchanges) written through the
19
+ * context an operation runs in, WITHOUT `ctx.emit`'s refusal of kernel-authored types. Keyed
20
+ * by the context object and never exported, so module code — which can reach `ctx` but not
21
+ * this map — cannot write one. Registered as each context is built.
22
+ */
23
+ const kernelEmitters = new WeakMap();
24
+ function kernelEmit(ctx, event) {
25
+ const write = kernelEmitters.get(ctx);
26
+ if (!write)
27
+ throw new Error('kernelEmit: not an operation context this host built');
28
+ write(event);
29
+ }
16
30
  /** The kernel's schedule-switch SQL (#1666), over one scope's database handle. */
17
31
  const switchSqlOf = (db) => ({
18
32
  all: (sql, ...params) => db.prepare(sql).all(...params),
@@ -1940,7 +1954,7 @@ export class SqliteScopeHost {
1940
1954
  visibility, created_by, created_at)
1941
1955
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
1942
1956
  .run(record.id, record.entity.entityType, record.entity.entityId, record.filename, record.contentType, record.size, record.sha256, record.visibility, record.createdBy, record.createdAt);
1943
- ctx.emit({
1957
+ kernelEmit(ctx, {
1944
1958
  type: ATTACHMENT_ADDED,
1945
1959
  schemaVersion: 1,
1946
1960
  entity: input.entity,
@@ -2010,7 +2024,7 @@ export class SqliteScopeHost {
2010
2024
  assertAllowed(await ctx.check(gate.write, { entityType: row.entity_type, entityId: row.entity_id }));
2011
2025
  rt.db.prepare('DELETE FROM _substrat_attachments WHERE id = ?').run(attachmentId);
2012
2026
  const record = rowToRecord(row);
2013
- ctx.emit({
2027
+ kernelEmit(ctx, {
2014
2028
  type: ATTACHMENT_REMOVED,
2015
2029
  schemaVersion: 1,
2016
2030
  entity: record.entity,
@@ -2038,12 +2052,16 @@ export class SqliteScopeHost {
2038
2052
  forkedFrom: input.forkedFrom ?? dump.scopeId,
2039
2053
  forkedAt: input.forkedAt ?? dump.capturedAt,
2040
2054
  });
2041
- await this.loadDump(input.tenantId, input.scopeId, dump.tables);
2055
+ // A fork: its callers (snapshotScope) hand it a dump the platform exported.
2056
+ await this.loadDump(input.tenantId, input.scopeId, { ...dump, exact: true });
2042
2057
  await this.admin.activateScope(actor, input.tenantId, input.scopeId);
2043
2058
  this.recordAdmin(actor, 'importScope', { tenantId: input.tenantId, scopeId: input.scopeId }, null, { sourceScopeId: dump.scopeId, tables: dump.tables.length, capturedAt: dump.capturedAt });
2044
2059
  }
2045
2060
  /** Drop-then-replay a dump into a scope's db, refreshing the migration frontier. */
2046
- async loadDump(tenantId, scopeId, tables,
2061
+ async loadDump(tenantId, scopeId,
2062
+ /** `scopeId` is the scope the dump was captured from: its node grants are re-pointed here.
2063
+ * `exact`: the platform exported it, so the re-point never falls back (`RepointSource`). */
2064
+ dump,
2047
2065
  /** Run inside the load's own transaction, after the replay (#1742) — the restore's re-assert
2048
2066
  * of the switch. It throws to roll the load back. */
2049
2067
  afterLoad) {
@@ -2125,10 +2143,10 @@ export class SqliteScopeHost {
2125
2143
  // one. Nothing errors — the rows insert fine — but the proof walk never matches them,
2126
2144
  // so `/me` reports a role while every `ctx.check` denies. Entity-level grants
2127
2145
  // (`object = customer:<id>`) are untouched: those ids travel with the dump.
2146
+ // Which rows move is `repointScopeGrants`'s (#1869): the dump's source scope, exactly.
2128
2147
  // `UPDATE OR REPLACE` because (subject, relation, object) is the primary key — a
2129
2148
  // rewritten row collapses onto an existing one rather than failing the restore.
2130
- db.prepare(`UPDATE OR REPLACE _substrat_tuples SET object = ?
2131
- WHERE object LIKE 'scope:%' AND object <> ?`).run(`scope:${scopeId}`, `scope:${scopeId}`);
2149
+ repointScopeGrants(switchSqlOf(db), scopeId, { scopeId: dump.scopeId, exact: dump.exact });
2132
2150
  // #1742: inside the replay's transaction, so a failure here rolls the whole load back and
2133
2151
  // the dump's grants never commit without the switch that should cover them.
2134
2152
  afterLoad?.(rt);
@@ -2137,7 +2155,7 @@ export class SqliteScopeHost {
2137
2155
  // load was a SAVEPOINT inside it, and that invoke's rollback undid the restore after
2138
2156
  // this verb had audited it.
2139
2157
  await rt.actor.turn(() => {
2140
- load(tables);
2158
+ load(dump.tables);
2141
2159
  // The frontier came in with the dump — refresh the cached applied-migration set so
2142
2160
  // a later bind/migrate builds on the loaded state, not the previous one.
2143
2161
  rt.appliedMigrations.clear();
@@ -2146,7 +2164,7 @@ export class SqliteScopeHost {
2146
2164
  }
2147
2165
  });
2148
2166
  }
2149
- async restoreScope(actor, tenantId, scopeId, dump) {
2167
+ async restoreScope(actor, tenantId, scopeId, dump, opts) {
2150
2168
  // Restore never creates a scope (that is importScope) — an unknown target fails closed.
2151
2169
  const existing = await this.admin.getScopeRecord(actor, tenantId, scopeId);
2152
2170
  if (!existing)
@@ -2156,7 +2174,9 @@ export class SqliteScopeHost {
2156
2174
  // provision's seat does — no schedule pass can run in between.
2157
2175
  // The re-assert's audit rows are written only once the load has committed.
2158
2176
  const rows = [];
2159
- await this.loadDump(tenantId, scopeId, dump.tables, (rt) => this.reassertSwitchesInTurn(rt, actor, tenantId, scopeId, undefined, (after) => rows.push(after)));
2177
+ // #1869: the re-point's source is the separate hint when given; the dump is otherwise as sent.
2178
+ const source = { tables: dump.tables, scopeId: opts?.sourceScopeId ?? dump.scopeId };
2179
+ await this.loadDump(tenantId, scopeId, source, (rt) => this.reassertSwitchesInTurn(rt, actor, tenantId, scopeId, undefined, (after) => rows.push(after)));
2160
2180
  for (const after of rows)
2161
2181
  this.recordAdmin(actor, 'reassertSystemSwitch', { tenantId, scopeId }, null, after);
2162
2182
  this.recordAdmin(actor, 'restoreScope', { tenantId, scopeId }, null, { sourceScopeId: dump.scopeId, tables: dump.tables.length, capturedAt: dump.capturedAt });
@@ -2643,7 +2663,7 @@ export class SqliteScopeHost {
2643
2663
  // Stamped `{ capability }` by the ordinary emit path, under the exchange's own
2644
2664
  // pseudo-operation name — the actor is the capability, as on every event it
2645
2665
  // goes on to cause.
2646
- emit: (capability, event) => this.operationContext(rt, { kind: 'capability', id: capability }, undefined, undefined, undefined, CAPABILITY_EXCHANGE_OPERATION, [], now).emit(event),
2666
+ emit: (capability, event) => kernelEmit(this.operationContext(rt, { kind: 'capability', id: capability }, undefined, undefined, undefined, CAPABILITY_EXCHANGE_OPERATION, [], now), event),
2647
2667
  }, secret, options?.mode);
2648
2668
  rt.db.exec('COMMIT');
2649
2669
  }
@@ -3584,16 +3604,17 @@ export class SqliteScopeHost {
3584
3604
  // a tenant-level grant (`grantToConnection` with `scopeId: null`) is enforced here
3585
3605
  // exactly as a scope-level one is. Reading only the scope's own table would answer
3586
3606
  // "not granted" where the checker answers allow — a read-back that disagrees with
3587
- // enforcement is worse than none, since it is the read an operator would trust.
3607
+ // enforcement is worse than none, since it is the read an operator would trust. GLOB,
3608
+ // not LIKE (#1869): case-sensitive, as the checker's match is.
3588
3609
  const rows = [
3589
3610
  ...this.readDb(rt)
3590
3611
  .prepare(`SELECT subject, relation, expires_at FROM _substrat_tuples
3591
- WHERE subject LIKE 'connection:%' AND relation LIKE 'granted:%'
3612
+ WHERE subject GLOB 'connection:*' AND relation GLOB 'granted:*'
3592
3613
  AND revoked_at IS NULL AND (expires_at IS NULL OR expires_at > ?)`)
3593
3614
  .all(now),
3594
3615
  ...this.directory
3595
3616
  .prepare(`SELECT subject, relation, expires_at FROM _substrat_tenant_tuples
3596
- WHERE tenant_id = ? AND subject LIKE 'connection:%' AND relation LIKE 'granted:%'
3617
+ WHERE tenant_id = ? AND subject GLOB 'connection:*' AND relation GLOB 'granted:*'
3597
3618
  AND revoked_at IS NULL AND (expires_at IS NULL OR expires_at > ?)`)
3598
3619
  .all(tenantId, now),
3599
3620
  ].sort((a, b) => a.subject.localeCompare(b.subject) || a.relation.localeCompare(b.relation));
@@ -4308,7 +4329,8 @@ export class SqliteScopeHost {
4308
4329
  };
4309
4330
  const writeGrant = (subject, permission, node, entity, expiresAt) => {
4310
4331
  if (entity) {
4311
- writeScopeTuple(node, subject, `granted:${permission}`, `${entity.entityType}:${entity.entityId}`, expiresAt);
4332
+ writeScopeTuple(node, subject, `granted:${permission}`, entityObjectRef(entity, 'HostAdmin'), // #1856: grant and grantToOrg both land here
4333
+ expiresAt);
4312
4334
  }
4313
4335
  else if (node.scopeId) {
4314
4336
  writeScopeTuple(node, subject, `granted:${permission}`, `scope:${node.scopeId}`, expiresAt);
@@ -7793,6 +7815,55 @@ export class SqliteScopeHost {
7793
7815
  scopeId: rt.scopeId,
7794
7816
  });
7795
7817
  };
7818
+ // ctx.emit's writer, and the kernel's own events' (#1864): one path to the outbox, with the
7819
+ // reserved-type refusal applied to module code only. Never handed to module code as-is.
7820
+ const writeEvent = (event, author) => {
7821
+ assertImpersonationWrites(impersonation, 'ctx.emit');
7822
+ const input = domainEventInput.parse(event);
7823
+ // #1864: a kernel-authored type is the kernel's to write — module code cannot forge one.
7824
+ if (author === 'module')
7825
+ assertModuleEmittableType(input.type);
7826
+ else
7827
+ assertKernelAuthoredType(input.type); // a new kernel event must join the reserved set
7828
+ // #1672: the COMPLETE parsed event — entity id, type and subject as well as payload.
7829
+ assertNoSecret('ctx.emit', input, minted);
7830
+ const full = domainEvent.parse({
7831
+ ...input,
7832
+ // #956: from the operation's instant, not the wall clock. `ORDER BY id`
7833
+ // is how the outbox and every timeline page, so an id whose timestamp
7834
+ // disagreed with its own `occurredAt` sorted the log by a clock nothing
7835
+ // else in the operation used.
7836
+ id: eventId.parse(rt.mintEventId(Date.parse(at))),
7837
+ occurredAt: at,
7838
+ tenantId: rt.tenantId,
7839
+ scopeId: rt.scopeId,
7840
+ actor: overrideActor ?? actorOf(subject),
7841
+ ...(passed.length ? { authorization: passed.map((p) => ({ ...p })) } : {}),
7842
+ ...(stamp ? { impersonation: stamp } : {}),
7843
+ // #1231: kernel-stamped like the two above — `domainEventInput.parse`
7844
+ // already stripped anything module code tried to smuggle under this key.
7845
+ ...(operation ? { operation } : {}),
7846
+ });
7847
+ rt.db
7848
+ .prepare(`INSERT INTO _substrat_outbox
7849
+ (id, type, schema_version, occurred_at, tenant_id, scope_id, actor,
7850
+ entity_type, entity_id, pii_class, subject_id, authorization,
7851
+ impersonation, operation, version, caused_by, invocation_id, payload)
7852
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
7853
+ .run(full.id, full.type, full.schemaVersion, full.occurredAt, full.tenantId, full.scopeId, JSON.stringify(full.actor), full.entity.entityType, full.entity.entityId, full.piiClass, full.subjectId ?? null, full.authorization ? JSON.stringify(full.authorization) : null, full.impersonation ? JSON.stringify(full.impersonation) : null, full.operation ?? null,
7854
+ // #1242: host configuration, not envelope data — the version is a fact
7855
+ // about the process, so it never rides `DomainEvent` for module code to
7856
+ // branch on; it exists for the observability joins the column serves.
7857
+ this.versionId,
7858
+ // #1237: whatever delivery is in flight FOR THIS SCOPE, if any — read off
7859
+ // the runtime, not the host, because the host serves every scope at once
7860
+ // and this context outlives an `await`. A fact about the surrounding
7861
+ // dispatch, never envelope data module code could set or branch on.
7862
+ rt.causedBy,
7863
+ // #1237: a fact about the surrounding CALL, like the version above — never
7864
+ // envelope data module code could set or branch on.
7865
+ rt.invocationId, full.payload === undefined ? null : JSON.stringify(full.payload));
7866
+ };
7796
7867
  const ctxRef = {
7797
7868
  tenantId: rt.tenantId,
7798
7869
  scopeId: rt.scopeId,
@@ -7813,48 +7884,7 @@ export class SqliteScopeHost {
7813
7884
  // log's text is not JSON.
7814
7885
  redact: (text) => redactSecretText(text, minted),
7815
7886
  }, this.logSink),
7816
- emit: (event) => {
7817
- assertImpersonationWrites(impersonation, 'ctx.emit');
7818
- const input = domainEventInput.parse(event);
7819
- // #1672: the COMPLETE parsed event — entity id, type and subject as well as payload.
7820
- assertNoSecret('ctx.emit', input, minted);
7821
- const full = domainEvent.parse({
7822
- ...input,
7823
- // #956: from the operation's instant, not the wall clock. `ORDER BY id`
7824
- // is how the outbox and every timeline page, so an id whose timestamp
7825
- // disagreed with its own `occurredAt` sorted the log by a clock nothing
7826
- // else in the operation used.
7827
- id: eventId.parse(rt.mintEventId(Date.parse(at))),
7828
- occurredAt: at,
7829
- tenantId: rt.tenantId,
7830
- scopeId: rt.scopeId,
7831
- actor: overrideActor ?? actorOf(subject),
7832
- ...(passed.length ? { authorization: passed.map((p) => ({ ...p })) } : {}),
7833
- ...(stamp ? { impersonation: stamp } : {}),
7834
- // #1231: kernel-stamped like the two above — `domainEventInput.parse`
7835
- // already stripped anything module code tried to smuggle under this key.
7836
- ...(operation ? { operation } : {}),
7837
- });
7838
- rt.db
7839
- .prepare(`INSERT INTO _substrat_outbox
7840
- (id, type, schema_version, occurred_at, tenant_id, scope_id, actor,
7841
- entity_type, entity_id, pii_class, subject_id, authorization,
7842
- impersonation, operation, version, caused_by, invocation_id, payload)
7843
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
7844
- .run(full.id, full.type, full.schemaVersion, full.occurredAt, full.tenantId, full.scopeId, JSON.stringify(full.actor), full.entity.entityType, full.entity.entityId, full.piiClass, full.subjectId ?? null, full.authorization ? JSON.stringify(full.authorization) : null, full.impersonation ? JSON.stringify(full.impersonation) : null, full.operation ?? null,
7845
- // #1242: host configuration, not envelope data — the version is a fact
7846
- // about the process, so it never rides `DomainEvent` for module code to
7847
- // branch on; it exists for the observability joins the column serves.
7848
- this.versionId,
7849
- // #1237: whatever delivery is in flight FOR THIS SCOPE, if any — read off
7850
- // the runtime, not the host, because the host serves every scope at once
7851
- // and this context outlives an `await`. A fact about the surrounding
7852
- // dispatch, never envelope data module code could set or branch on.
7853
- rt.causedBy,
7854
- // #1237: a fact about the surrounding CALL, like the version above — never
7855
- // envelope data module code could set or branch on.
7856
- rt.invocationId, full.payload === undefined ? null : JSON.stringify(full.payload));
7857
- },
7887
+ emit: (event) => writeEvent(event, 'module'),
7858
7888
  requestPlatform: (request) => {
7859
7889
  assertImpersonationWrites(impersonation, 'ctx.requestPlatform');
7860
7890
  const input = platformRequestInput.parse(request);
@@ -7963,6 +7993,7 @@ export class SqliteScopeHost {
7963
7993
  */
7964
7994
  grant: async (principal, permission, entity) => {
7965
7995
  assertImpersonationWrites(impersonation, 'ctx.grant');
7996
+ entityObjectRef(entity, 'ctx.grant'); // #1856: a tuple the walk can read back
7966
7997
  const held = await runCheck(permission, entity);
7967
7998
  if (!held.allowed) {
7968
7999
  throw new PermissionDenied(`cannot grant '${permission}' on ${entity.entityType}:${entity.entityId} — ` +
@@ -7973,7 +8004,11 @@ export class SqliteScopeHost {
7973
8004
  VALUES (?, ?, ?)`)
7974
8005
  .run(`principal:${principal}`, `granted:${permission}`, `${entity.entityType}:${entity.entityId}`);
7975
8006
  },
7976
- /** Withdraw a grant this caller could have made. Same guardrails, same reason. */
8007
+ /**
8008
+ * Withdraw a grant this caller could have made. Same guardrails, same reason — but NOT
8009
+ * the #1856 grammar check `grant` and `link` make: a revoke writes nothing the walk
8010
+ * must read back, and a grant stored before that check existed must stay removable.
8011
+ */
7977
8012
  revoke: async (principal, permission, entity) => {
7978
8013
  assertImpersonationWrites(impersonation, 'ctx.revoke');
7979
8014
  const held = await runCheck(permission, entity);
@@ -7996,23 +8031,19 @@ export class SqliteScopeHost {
7996
8031
  subject: overrideActor ? { kind: 'system', id: overrideActor.system } : subject,
7997
8032
  now: at,
7998
8033
  check: runCheck,
7999
- emit: (event) => ctxRef.emit(event),
8034
+ emit: (event) => writeEvent(event, 'kernel'),
8000
8035
  isOperation: (name) => this.operations.has(name),
8001
8036
  assertWrites: (verb) => assertImpersonationWrites(impersonation, verb),
8002
8037
  minted,
8003
8038
  }),
8004
- link: (child, parent) => {
8005
- assertImpersonationWrites(impersonation, 'ctx.link');
8006
- const allowed = relations.get(child.entityType);
8007
- if (!allowed?.has(parent.entityType)) {
8008
- throw new Error(`undeclared entity relation: ${child.entityType} → ${parent.entityType} ` +
8009
- `(declare it in a module manifest's entityRelations)`);
8010
- }
8011
- rt.db
8012
- .prepare(`INSERT OR IGNORE INTO _substrat_tuples (subject, relation, object)
8013
- VALUES (?, 'parent', ?)`)
8014
- .run(`${child.entityType}:${child.entityId}`, `${parent.entityType}:${parent.entityId}`);
8015
- },
8039
+ // K-16 / #1864: link and relink, written once in the kernel over the raw spine seam.
8040
+ ...createEntityEdgeVerbs({
8041
+ sql: spineSql(rt.db),
8042
+ relations,
8043
+ now: at,
8044
+ emit: (event) => writeEvent(event, 'kernel'),
8045
+ assertWrites: (verb) => assertImpersonationWrites(impersonation, verb),
8046
+ }),
8016
8047
  // #304: the request-time entitlement read. The pure adapter is single-process, so the
8017
8048
  // directory is local — no projection needed; it reads `_substrat_entitlements` straight,
8018
8049
  // with the same expiry-at-read filter as the gate (#33), and the SAME contract the DO
@@ -8062,6 +8093,7 @@ export class SqliteScopeHost {
8062
8093
  return sealTo({ keyId: key.keyId, publicKey: key.publicKey }, plaintext);
8063
8094
  },
8064
8095
  };
8096
+ kernelEmitters.set(ctxRef, (event) => writeEvent(event, 'kernel'));
8065
8097
  return ctxRef;
8066
8098
  }
8067
8099
  async applyPendingMigrations(rt) {