@substrat-run/adapter-sqlite 0.132.1 → 0.134.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 +16 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +148 -57
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BlobStoreHandle, type ImportBatch, type ImportResult, type Coverage, type PeerCoverage, type VerticalCaller, type CapabilityExchange, type ConnectionId, type ModuleId, type DomainEvent, type PlatformRequestId, type PlatformRequest, type PlatformRequestFilter, type PlatformRequestStatus, type PlatformRequestFailure, type ProjectedConnectionGrant, type PermissionKey, type PlatformActorId, type OnBehalfOf, type PrincipalId, type ScopeDump, type ScopeId, type ImpersonationSessionId, type TenantId, type TenantStoreHandle } from '@substrat-run/contracts';
|
|
2
|
-
import { type ModuleLogSink, type FreshnessReport, type FreshnessRegistration, type BlobStoreProvisionInput, type ScopeAttachments, type ExecutorDeadLetter, type ExecutorDrainReport, type MigrateScopeOutcome, type MigrationFrontier, type ExecutorHandler, type ExecutorRetryPolicy, type ConnectorHandler, type ConnectorOptions, type Clock, type FetchLike, type SecretBox, type HostAdmin, type ModuleRegistration, type OperationHandler, type PermissionChecker, type ProvisionScopeInput, type ScheduleRegistration, type ScheduleRunReport, type ScopeHost, type ScopeStub, type ScopeStubOptions, type TenantRelationalStore, type TenantStoreProvisionInput, type JobDriveReport, type JobHandler, type JobRun, type JobRunFilter, type StartJobRunInput, type ConnectorCallRecorder } from '@substrat-run/kernel';
|
|
2
|
+
import { type ModuleLogSink, type FreshnessReport, type FreshnessRegistration, type BlobStoreProvisionInput, type ScopeAttachments, type ExecutorDeadLetter, type ExecutorDrainReport, type MigrateScopeOutcome, type MigrationFrontier, type ExecutorHandler, type ExecutorRetryPolicy, type ConnectorHandler, type ConnectorOptions, type Clock, type FetchLike, type SecretBox, type HostAdmin, type ModuleRegistration, type OperationHandler, type PermissionChecker, type ProvisionScopeInput, type ScheduleRegistration, type ScheduleRunReport, type ScopeHost, type ScopeStub, type ScopeStubOptions, type TenantRelationalStore, type TenantStoreProvisionInput, type AttachmentExtractor, type JobDriveReport, type JobHandler, type JobRun, type JobRunFilter, type StartJobRunInput, type ConnectorCallRecorder } from '@substrat-run/kernel';
|
|
3
3
|
/**
|
|
4
4
|
* A fault in the database itself (full, corrupt, I/O), as opposed to one statement failing.
|
|
5
5
|
* The #1764 backfill logs and opens past a failed batch, but never past one of these.
|
|
@@ -16,6 +16,13 @@ export declare function isStorageFault(err: unknown): boolean;
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const DO_SCOPE_ONLY_SPINE_TABLES: ReadonlySet<string>;
|
|
18
18
|
export interface SqliteScopeHostOptions {
|
|
19
|
+
/**
|
|
20
|
+
* The parsers attachment text is extracted with (#1575, K-43) — `defaultAttachmentExtractors()`
|
|
21
|
+
* from `@substrat-run/attachment-extractors`, or a list of the deployment's own. The kernel
|
|
22
|
+
* and this adapter parse no file format; omitted, every upload records `unsupported`, with
|
|
23
|
+
* that reason, which is a valid configuration rather than a broken one.
|
|
24
|
+
*/
|
|
25
|
+
attachmentExtractors?: readonly AttachmentExtractor[];
|
|
19
26
|
/** Directory holding one SQLite file per scope plus the directory database. */
|
|
20
27
|
dir: string;
|
|
21
28
|
/** Defaults to the built-in tuple checker (deny-by-default on empty tuples). */
|
|
@@ -178,6 +185,8 @@ export declare class SqliteScopeHost implements ScopeHost {
|
|
|
178
185
|
private readonly onBehalfOf;
|
|
179
186
|
private readonly systemPrincipal;
|
|
180
187
|
private readonly secretBox;
|
|
188
|
+
/** The parsers attachment text is extracted with (K-43); the host's own, never imported here. */
|
|
189
|
+
private readonly attachmentExtractors;
|
|
181
190
|
private readonly fetchImpl;
|
|
182
191
|
private readonly connectorCalls;
|
|
183
192
|
private readonly clock;
|
|
@@ -523,6 +532,12 @@ export declare class SqliteScopeHost implements ScopeHost {
|
|
|
523
532
|
* no path by which this can deadlock against itself.
|
|
524
533
|
*/
|
|
525
534
|
private jobStore;
|
|
535
|
+
/**
|
|
536
|
+
* The extraction job's adapter half (#1575): the record and the bytes with no permission
|
|
537
|
+
* gate — extraction is the kernel's own derivation, and the person-facing gate is at
|
|
538
|
+
* search — and the outcome written in a turn of its own, like every job store write.
|
|
539
|
+
*/
|
|
540
|
+
private attachmentTextHandler;
|
|
526
541
|
startJobRun(tenantId: TenantId, scopeId: ScopeId, input: StartJobRunInput): Promise<JobRun>;
|
|
527
542
|
runDueJobs(tenantId: TenantId, scopeId: ScopeId, options?: {
|
|
528
543
|
maxPasses?: number;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,QAAQ,EACb,KAAK,YAAY,EAIjB,KAAK,cAAc,EAwCnB,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,UAAU,EACf,KAAK,WAAW,EAehB,KAAK,SAAS,EAEd,KAAK,OAAO,EAYZ,KAAK,sBAAsB,EAG3B,KAAK,QAAQ,EAGb,KAAK,iBAAiB,EAevB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAoBL,KAAK,aAAa,EAoBlB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAc1B,KAAK,uBAAuB,EAG5B,KAAK,gBAAgB,EAGrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,mBAA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CAAC,SAAS;IAejB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;YA4eV,sBAAsB;IAkEpC;;;;;;;;;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;IAgF1B,OAAO,CAAC,OAAO;CA6ChB"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync
|
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import Database from 'better-sqlite3';
|
|
4
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, ownerTransferAudit, 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, REFUSALS_DDL, refusalInsert, refusedTransitionOf, assertIdempotencyKey, idempotencyLookupQuery, idempotencyPruneStatement, idempotencyRecordStatement, idempotencyOptedOutMessage, replayFor, globalFetch, createUlid, facetEvents, readHistory, walkEventCause, walkEventEffects, assertRedrainWindow, readInvocation, readDeadLetters, readLifecycleFlow, domainEventOf, readUndrainedOutbox, undrainedEventsOf, connectorCallRecord, noopConnectorCallRecorder, recordConnectorCall, settleConnectionUse, unknownRoleError, } from '@substrat-run/kernel';
|
|
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, attachmentSha256, entitlementDenial, foldMeterReading, guardSpine, guardSqlLimits, DO_SQL_LIMITS, tooManyResultColumns, tooManyTableColumns, parseValidationRecords, resolveScopeRecord, ulid, ISSUE_RETENTION_DAYS, telemetryRetentionStatements, 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, redactSubjectScopeText, redactSubjectDirectoryText, ISSUE_EXEMPLAR_OWNER_BACKFILL_SQL, issueExemplarOwner, 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, ATTACHMENT_TEXT_DDL, assertAttachmentExtractors, assertJobRegistrable, attachmentRecordOfRow, attachmentTextJob, enqueueAttachmentText, isAttachmentTextRun, reconcileAttachmentText, recordAttachmentText, searchAttachments, 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, REFUSALS_DDL, refusalInsert, refusedTransitionOf, assertIdempotencyKey, idempotencyLookupQuery, idempotencyPruneStatement, idempotencyRecordStatement, idempotencyOptedOutMessage, replayFor, globalFetch, createUlid, facetEvents, readHistory, walkEventCause, walkEventEffects, assertRedrainWindow, readInvocation, readDeadLetters, readLifecycleFlow, domainEventOf, readUndrainedOutbox, undrainedEventsOf, connectorCallRecord, noopConnectorCallRecorder, recordConnectorCall, settleConnectionUse, unknownRoleError, } from '@substrat-run/kernel';
|
|
6
6
|
import { attributedHost } from '@substrat-run/kernel';
|
|
7
7
|
import { LEGACY_SCOPE_ROWS_BACKFILL, assertNoSpineReference, assertSpineTablesBuilt, dumpRowsInsert, isSpineTable, loadDirectoryDump, repointScopeGrants, spineColumnAdditions } from '@substrat-run/kernel';
|
|
8
8
|
import { ScopeActor } from './actor.js';
|
|
@@ -295,6 +295,9 @@ const KERNEL_DDL = `
|
|
|
295
295
|
);
|
|
296
296
|
CREATE INDEX IF NOT EXISTS _substrat_attachments_entity
|
|
297
297
|
ON _substrat_attachments (entity_type, entity_id);
|
|
298
|
+
-- #1575: attachment text and its FTS5 index, shared from @substrat-run/kernel. After
|
|
299
|
+
-- _substrat_attachments, whose delete trigger it adds.
|
|
300
|
+
${ATTACHMENT_TEXT_DDL}
|
|
298
301
|
-- #901: an entity's version is the ULID of the last event about it, so
|
|
299
302
|
-- MAX(id) per (entity_type, entity_id) is the read. The id column sits last so
|
|
300
303
|
-- SQLite walks to the end of the matched range instead of aggregating over it.
|
|
@@ -366,7 +369,7 @@ function keysetTail(where, params, key, page, defaultOrder = 'asc') {
|
|
|
366
369
|
let tail = ` ORDER BY ${key} ${order}`;
|
|
367
370
|
if (page?.limit !== undefined) {
|
|
368
371
|
tail += ' LIMIT ?';
|
|
369
|
-
params.push(page.limit);
|
|
372
|
+
params.push(assertRowLimit('limit', page.limit));
|
|
370
373
|
}
|
|
371
374
|
return tail;
|
|
372
375
|
}
|
|
@@ -560,6 +563,8 @@ export class SqliteScopeHost {
|
|
|
560
563
|
onBehalfOf = null;
|
|
561
564
|
systemPrincipal = principalId.parse(ulid());
|
|
562
565
|
secretBox;
|
|
566
|
+
/** The parsers attachment text is extracted with (K-43); the host's own, never imported here. */
|
|
567
|
+
attachmentExtractors;
|
|
563
568
|
fetchImpl;
|
|
564
569
|
connectorCalls;
|
|
565
570
|
clock;
|
|
@@ -573,6 +578,8 @@ export class SqliteScopeHost {
|
|
|
573
578
|
// process-wide `ulid()` that every other id here still uses.
|
|
574
579
|
constructor(options) {
|
|
575
580
|
this.secretBox = options.secretBox ?? unconfiguredSecretBox;
|
|
581
|
+
assertAttachmentExtractors(options.attachmentExtractors ?? []);
|
|
582
|
+
this.attachmentExtractors = options.attachmentExtractors ?? [];
|
|
576
583
|
this.fetchImpl = options.fetch ?? globalFetch;
|
|
577
584
|
this.connectorCalls = options.connectorCalls ?? noopConnectorCallRecorder;
|
|
578
585
|
this.clock = options.clock ?? (() => instant.parse(new Date().toISOString()));
|
|
@@ -1113,6 +1120,12 @@ export class SqliteScopeHost {
|
|
|
1113
1120
|
first_seen TEXT NOT NULL,
|
|
1114
1121
|
last_seen TEXT NOT NULL,
|
|
1115
1122
|
last_message TEXT NOT NULL,
|
|
1123
|
+
-- #1632: whose ops failure last_message was copied from, written in the same
|
|
1124
|
+
-- statement as the message: last_owner_kind is 'tenant' (last_tenant_id names it) or
|
|
1125
|
+
-- 'platform' (the platform's own row; last_tenant_id NULL). NULL kind = unknown, an
|
|
1126
|
+
-- issue from before the columns that no retained row attributes.
|
|
1127
|
+
last_tenant_id TEXT,
|
|
1128
|
+
last_owner_kind TEXT,
|
|
1116
1129
|
last_vertical TEXT,
|
|
1117
1130
|
last_version TEXT,
|
|
1118
1131
|
resolved_version TEXT,
|
|
@@ -1919,21 +1932,6 @@ export class SqliteScopeHost {
|
|
|
1919
1932
|
}
|
|
1920
1933
|
return gate;
|
|
1921
1934
|
};
|
|
1922
|
-
const rowToRecord = (row) => attachmentRecord.parse({
|
|
1923
|
-
id: row.id,
|
|
1924
|
-
entity: { entityType: row.entity_type, entityId: row.entity_id },
|
|
1925
|
-
filename: row.filename,
|
|
1926
|
-
contentType: row.content_type,
|
|
1927
|
-
size: row.size,
|
|
1928
|
-
sha256: row.sha256,
|
|
1929
|
-
visibility: row.visibility,
|
|
1930
|
-
createdBy: row.created_by,
|
|
1931
|
-
createdAt: row.created_at,
|
|
1932
|
-
});
|
|
1933
|
-
const sha256Hex = async (body) => {
|
|
1934
|
-
const digest = await globalThis.crypto.subtle.digest('SHA-256', body);
|
|
1935
|
-
return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, '0')).join('');
|
|
1936
|
-
};
|
|
1937
1935
|
// One attachment mutation/read = one serialized scope task, transactional exactly
|
|
1938
1936
|
// like an operation invoke (including K-35 denial recording and prompt dispatch of
|
|
1939
1937
|
// the events it emitted).
|
|
@@ -2011,7 +2009,7 @@ export class SqliteScopeHost {
|
|
|
2011
2009
|
filename: input.filename,
|
|
2012
2010
|
contentType: input.contentType,
|
|
2013
2011
|
size: input.body.byteLength,
|
|
2014
|
-
sha256: await
|
|
2012
|
+
sha256: await attachmentSha256(input.body),
|
|
2015
2013
|
visibility: input.visibility,
|
|
2016
2014
|
createdBy: creator.id,
|
|
2017
2015
|
createdAt: new Date().toISOString(),
|
|
@@ -2036,6 +2034,9 @@ export class SqliteScopeHost {
|
|
|
2036
2034
|
piiClass: 'none',
|
|
2037
2035
|
payload: { attachment: record },
|
|
2038
2036
|
});
|
|
2037
|
+
// #1575: queue its text extraction in the same transaction — a `pending` row
|
|
2038
|
+
// and a job run. Nothing is extracted here, so nothing here can fail the upload.
|
|
2039
|
+
enqueueAttachmentText(spineSql(rt.db), record.id, ulid(), this.clock());
|
|
2039
2040
|
return record;
|
|
2040
2041
|
});
|
|
2041
2042
|
}
|
|
@@ -2054,7 +2055,7 @@ export class SqliteScopeHost {
|
|
|
2054
2055
|
.prepare(`SELECT * FROM _substrat_attachments WHERE entity_type = ? AND entity_id = ?
|
|
2055
2056
|
ORDER BY id DESC`)
|
|
2056
2057
|
.all(entity.entityType, entity.entityId);
|
|
2057
|
-
return rows.map(
|
|
2058
|
+
return rows.map(attachmentRecordOfRow);
|
|
2058
2059
|
}),
|
|
2059
2060
|
open: async (attachmentId) => {
|
|
2060
2061
|
const record = await guarded('attachments.open', async (ctx) => {
|
|
@@ -2065,11 +2066,11 @@ export class SqliteScopeHost {
|
|
|
2065
2066
|
return null;
|
|
2066
2067
|
if (opts.admitByEvent !== undefined) {
|
|
2067
2068
|
admitByDelivery(rt, opts.admitByEvent, row);
|
|
2068
|
-
return
|
|
2069
|
+
return attachmentRecordOfRow(row);
|
|
2069
2070
|
}
|
|
2070
2071
|
const gate = targetGate(row.entity_type);
|
|
2071
2072
|
assertAllowed(await ctx.check(gate.read, { entityType: row.entity_type, entityId: row.entity_id }));
|
|
2072
|
-
return
|
|
2073
|
+
return attachmentRecordOfRow(row);
|
|
2073
2074
|
});
|
|
2074
2075
|
if (!record)
|
|
2075
2076
|
return null;
|
|
@@ -2078,7 +2079,7 @@ export class SqliteScopeHost {
|
|
|
2078
2079
|
throw new Error(`attachment ${record.id}: bytes missing from the blob store — the metadata row ` +
|
|
2079
2080
|
`survived something the object did not (rewind/reap); see the #473 integrity notes`);
|
|
2080
2081
|
}
|
|
2081
|
-
if ((await
|
|
2082
|
+
if ((await attachmentSha256(obj.body)) !== record.sha256) {
|
|
2082
2083
|
throw new Error(`attachment ${record.id}: bytes do not match the recorded sha256`);
|
|
2083
2084
|
}
|
|
2084
2085
|
return { record, body: obj.body, contentType: obj.contentType ?? record.contentType };
|
|
@@ -2098,7 +2099,7 @@ export class SqliteScopeHost {
|
|
|
2098
2099
|
const gate = targetGate(row.entity_type);
|
|
2099
2100
|
assertAllowed(await ctx.check(gate.write, { entityType: row.entity_type, entityId: row.entity_id }));
|
|
2100
2101
|
rt.db.prepare('DELETE FROM _substrat_attachments WHERE id = ?').run(attachmentId);
|
|
2101
|
-
const record =
|
|
2102
|
+
const record = attachmentRecordOfRow(row);
|
|
2102
2103
|
kernelEmit(ctx, {
|
|
2103
2104
|
type: ATTACHMENT_REMOVED,
|
|
2104
2105
|
schemaVersion: 1,
|
|
@@ -2114,6 +2115,18 @@ export class SqliteScopeHost {
|
|
|
2114
2115
|
await store.delete(attachmentBlobKey(rt.scopeId, removed.id)).catch(() => { });
|
|
2115
2116
|
return removed;
|
|
2116
2117
|
},
|
|
2118
|
+
// #1575: extracted text, gated per hit by the check `open` makes, before the limit.
|
|
2119
|
+
search: async (term, options) => {
|
|
2120
|
+
if (opts.admitByEvent !== undefined) {
|
|
2121
|
+
// The delivery-admitted surface reads the ONE attachment its delivery names; a
|
|
2122
|
+
// search would reach past it. Nothing builds this surface for anything but `open`.
|
|
2123
|
+
throw new Error('attachments.search is not available on a delivery-scoped surface');
|
|
2124
|
+
}
|
|
2125
|
+
// The term is judged before the turn: a refusal costs no queue slot.
|
|
2126
|
+
searchMatchExpression(term, 'prefix');
|
|
2127
|
+
// Authorized first, as this surface's subject, then matched over readable owners only.
|
|
2128
|
+
return guarded('attachments.search', (ctx) => searchAttachments(spineSql(rt.db), { targets: this.attachmentTargets, check: (permission, entity) => ctx.check(permission, entity) }, term, searchLimit(options?.limit)));
|
|
2129
|
+
},
|
|
2117
2130
|
};
|
|
2118
2131
|
}
|
|
2119
2132
|
async importScope(actor, input, dump) {
|
|
@@ -2224,6 +2237,10 @@ export class SqliteScopeHost {
|
|
|
2224
2237
|
if (present.has(plan.table))
|
|
2225
2238
|
db.exec(searchIndexDdl(plan));
|
|
2226
2239
|
}
|
|
2240
|
+
// #1575: attachment text is not in a dump, so a load left it as it was. Drop the
|
|
2241
|
+
// text of attachments the dump did not bring back, and queue extraction for those
|
|
2242
|
+
// it brought back without text — the bytes decide what that run finds.
|
|
2243
|
+
reconcileAttachmentText(spineSql(db), ulid, this.clock());
|
|
2227
2244
|
// Re-point scope-level grants at the scope they now live in. They are written as
|
|
2228
2245
|
// `object = scope:<scopeId>`, so a fork, a restore into a different scope, or #286's
|
|
2229
2246
|
// migration onto a stable script name all land rows naming a scope that is not this
|
|
@@ -3571,6 +3588,8 @@ export class SqliteScopeHost {
|
|
|
3571
3588
|
return rt.actor.enqueue(() => this.dispatchExecutors(rt, null));
|
|
3572
3589
|
}
|
|
3573
3590
|
registerJob(moduleId, name, handler, retry) {
|
|
3591
|
+
// #1575: the kernel's own jobs are dispatched before this registry is read.
|
|
3592
|
+
assertJobRegistrable(moduleId, name);
|
|
3574
3593
|
const key = `${moduleId}/${name}`;
|
|
3575
3594
|
if (this.jobs.has(key))
|
|
3576
3595
|
throw new Error(`job '${key}' is already registered`);
|
|
@@ -3605,8 +3624,8 @@ export class SqliteScopeHost {
|
|
|
3605
3624
|
ORDER BY id DESC LIMIT 1`);
|
|
3606
3625
|
const insertRun = db.prepare(`INSERT INTO _substrat_job_runs
|
|
3607
3626
|
(id, module_id, job, instance, payload, status, cursor, counters, attempts,
|
|
3608
|
-
last_error, started_at, updated_at, next_attempt_at, ended_at)
|
|
3609
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
3627
|
+
last_error, started_at, updated_at, next_attempt_at, ended_at, subject_id)
|
|
3628
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
3610
3629
|
// A compare-and-set on `running` (#1632): a pass that outlived an erasure must not
|
|
3611
3630
|
// write its cursor back over the redaction. The kernel's statement, so both adapters
|
|
3612
3631
|
// hold the same line.
|
|
@@ -3620,7 +3639,7 @@ export class SqliteScopeHost {
|
|
|
3620
3639
|
const live = row(findLive.get(key.moduleId, key.job, key.instance));
|
|
3621
3640
|
if (live)
|
|
3622
3641
|
return live;
|
|
3623
|
-
insertRun.run(r.id, r.module_id, r.job, r.instance, r.payload, r.status, r.cursor, r.counters, r.attempts, r.last_error, r.started_at, r.updated_at, r.next_attempt_at, r.ended_at);
|
|
3642
|
+
insertRun.run(r.id, r.module_id, r.job, r.instance, r.payload, r.status, r.cursor, r.counters, r.attempts, r.last_error, r.started_at, r.updated_at, r.next_attempt_at, r.ended_at, r.subject_id ?? null);
|
|
3624
3643
|
return r;
|
|
3625
3644
|
});
|
|
3626
3645
|
const commitPassTx = db.transaction((id, p) => {
|
|
@@ -3674,6 +3693,27 @@ export class SqliteScopeHost {
|
|
|
3674
3693
|
}),
|
|
3675
3694
|
};
|
|
3676
3695
|
}
|
|
3696
|
+
/**
|
|
3697
|
+
* The extraction job's adapter half (#1575): the record and the bytes with no permission
|
|
3698
|
+
* gate — extraction is the kernel's own derivation, and the person-facing gate is at
|
|
3699
|
+
* search — and the outcome written in a turn of its own, like every job store write.
|
|
3700
|
+
*/
|
|
3701
|
+
attachmentTextHandler(rt) {
|
|
3702
|
+
return attachmentTextJob({
|
|
3703
|
+
record: (attachmentId) => rt.actor.enqueue(() => {
|
|
3704
|
+
const row = rt.db.prepare('SELECT * FROM _substrat_attachments WHERE id = ?').get(attachmentId);
|
|
3705
|
+
return row ? attachmentRecordOfRow(row) : null;
|
|
3706
|
+
}),
|
|
3707
|
+
bytes: async (record) => {
|
|
3708
|
+
const scope = this.directory.prepare('SELECT vertical FROM scopes WHERE scope_id = ?').get(rt.scopeId);
|
|
3709
|
+
const store = this.attachmentStore(rt.tenantId, scope?.vertical ?? null);
|
|
3710
|
+
return (await store.get(attachmentBlobKey(rt.scopeId, record.id)))?.body ?? null;
|
|
3711
|
+
},
|
|
3712
|
+
write: (attachmentId, outcome) => rt.actor.enqueue(() => recordAttachmentText(spineSql(rt.db), attachmentId, outcome, this.clock())),
|
|
3713
|
+
},
|
|
3714
|
+
// K-43: the host's parsers, handed in — this adapter imports none.
|
|
3715
|
+
this.attachmentExtractors);
|
|
3716
|
+
}
|
|
3677
3717
|
async startJobRun(tenantId, scopeId, input) {
|
|
3678
3718
|
const rt = this.runtime(tenantId, scopeId);
|
|
3679
3719
|
await this.applyPendingMigrations(rt);
|
|
@@ -3682,9 +3722,12 @@ export class SqliteScopeHost {
|
|
|
3682
3722
|
async runDueJobs(tenantId, scopeId, options) {
|
|
3683
3723
|
const rt = this.runtime(tenantId, scopeId);
|
|
3684
3724
|
await this.applyPendingMigrations(rt);
|
|
3725
|
+
// #1575: the kernel's extraction job is this host's own, bound to this scope — no
|
|
3726
|
+
// deployment registers it, and none can shadow it.
|
|
3727
|
+
const attachmentText = { handler: this.attachmentTextHandler(rt) };
|
|
3685
3728
|
return runDueJobRuns({
|
|
3686
3729
|
store: this.jobStore(rt),
|
|
3687
|
-
handlerFor: (run) => this.jobs.get(`${run.module_id}/${run.job}`),
|
|
3730
|
+
handlerFor: (run) => isAttachmentTextRun(run) ? attachmentText : this.jobs.get(`${run.module_id}/${run.job}`),
|
|
3688
3731
|
now: this.clock,
|
|
3689
3732
|
openScope: (run) => this.getSystemScope(run.module_id, tenantId, scopeId),
|
|
3690
3733
|
maxPasses: options?.maxPasses,
|
|
@@ -4060,7 +4103,7 @@ export class SqliteScopeHost {
|
|
|
4060
4103
|
` ORDER BY id ${order}`;
|
|
4061
4104
|
if (filter?.limit !== undefined) {
|
|
4062
4105
|
sql += ' LIMIT ?';
|
|
4063
|
-
params.push(filter.limit);
|
|
4106
|
+
params.push(assertRowLimit('limit', filter.limit));
|
|
4064
4107
|
}
|
|
4065
4108
|
const rows = this.directory.prepare(sql).all(...params);
|
|
4066
4109
|
return rows.map((r) => modelUsageEntryOf(r));
|
|
@@ -4415,7 +4458,7 @@ export class SqliteScopeHost {
|
|
|
4415
4458
|
// private vertical self-admit, and what lets a LISTED vertical's builder keep
|
|
4416
4459
|
// previewing their own new code (issue #509 ask (d)).
|
|
4417
4460
|
if (v.admission !== 'admitted' && scope.kind !== 'preview') {
|
|
4418
|
-
throw
|
|
4461
|
+
throw substratError('conflict', `version ${versionId} is ${v.admission}, not admitted — it cannot be bound to a scope`);
|
|
4419
4462
|
}
|
|
4420
4463
|
return { v, scope };
|
|
4421
4464
|
};
|
|
@@ -4828,7 +4871,7 @@ export class SqliteScopeHost {
|
|
|
4828
4871
|
` ORDER BY tenant_id ${order}, role_key ${order}`;
|
|
4829
4872
|
if (filter?.limit !== undefined) {
|
|
4830
4873
|
sql += ' LIMIT ?';
|
|
4831
|
-
params.push(filter.limit);
|
|
4874
|
+
params.push(assertRowLimit('limit', filter.limit));
|
|
4832
4875
|
}
|
|
4833
4876
|
const rows = this.directory.prepare(sql).all(...params);
|
|
4834
4877
|
// Parsed, not cast: `permissions` is a JSON blob in a TEXT column, so the
|
|
@@ -5287,7 +5330,7 @@ export class SqliteScopeHost {
|
|
|
5287
5330
|
return;
|
|
5288
5331
|
}
|
|
5289
5332
|
if (existing.ownerTenant !== parsed.ownerTenant) {
|
|
5290
|
-
throw
|
|
5333
|
+
throw substratError('conflict', `vertical '${parsed.slug}' is owned by ${existing.ownerTenant ?? 'the platform'}, not ${parsed.ownerTenant ?? 'the platform'}`);
|
|
5291
5334
|
}
|
|
5292
5335
|
throw new Error(`vertical '${parsed.slug}' is already registered as ${existing.source}`);
|
|
5293
5336
|
}
|
|
@@ -5368,7 +5411,7 @@ export class SqliteScopeHost {
|
|
|
5368
5411
|
.get(slug);
|
|
5369
5412
|
const prodVersion = prod ? readVersion(prod.version_id) : undefined;
|
|
5370
5413
|
if (prodVersion?.admissionNote === AUTO_ADMISSION_NOTE) {
|
|
5371
|
-
throw
|
|
5414
|
+
throw substratError('conflict', `vertical '${slug}' prod version ${prodVersion.id} is auto-admitted (private self-serve) — ` +
|
|
5372
5415
|
`a staff admit must vouch for it before listing`);
|
|
5373
5416
|
}
|
|
5374
5417
|
}
|
|
@@ -5510,7 +5553,7 @@ export class SqliteScopeHost {
|
|
|
5510
5553
|
throw new Error(`version ${versionId} belongs to '${incoming.verticalSlug}'`);
|
|
5511
5554
|
}
|
|
5512
5555
|
if (incoming.admission !== 'admitted') {
|
|
5513
|
-
throw
|
|
5556
|
+
throw substratError('conflict', `version ${versionId} is ${incoming.admission}, not admitted — it cannot be promoted`);
|
|
5514
5557
|
}
|
|
5515
5558
|
const current = this.directory
|
|
5516
5559
|
.prepare('SELECT version_id FROM vertical_channels WHERE vertical_slug = ? AND channel = ?')
|
|
@@ -5646,6 +5689,9 @@ export class SqliteScopeHost {
|
|
|
5646
5689
|
},
|
|
5647
5690
|
bindScopeVersion: async (actor, tenantId, scopeId, versionId, opts) => {
|
|
5648
5691
|
const { v, scope } = bindTarget(tenantId, scopeId, versionId);
|
|
5692
|
+
if (opts?.expectedVersionId !== undefined && scope.vertical_version_id !== opts.expectedVersionId) {
|
|
5693
|
+
throw substratError('precondition_failed', 'scope binding changed; reload the scope and retry');
|
|
5694
|
+
}
|
|
5649
5695
|
const ack = bindAcknowledgement.parse(opts?.acknowledge ?? {});
|
|
5650
5696
|
// #1756: an export an app in this tenant imports, dropped or re-versioned by what this
|
|
5651
5697
|
// scope would run. Before the snapshot, so a refused bind leaves nothing behind.
|
|
@@ -5663,13 +5709,19 @@ export class SqliteScopeHost {
|
|
|
5663
5709
|
await this.snapshotScope(actor, tenantId, scopeId);
|
|
5664
5710
|
}
|
|
5665
5711
|
}
|
|
5666
|
-
|
|
5667
|
-
.prepare('UPDATE scopes SET vertical_version_id = ?, vertical = ? WHERE scope_id = ?')
|
|
5668
|
-
|
|
5712
|
+
const update = opts?.expectedVersionId === undefined
|
|
5713
|
+
? this.directory.prepare('UPDATE scopes SET vertical_version_id = ?, vertical = ? WHERE scope_id = ?')
|
|
5714
|
+
.run(versionId, v.verticalSlug, scopeId)
|
|
5715
|
+
: this.directory.prepare('UPDATE scopes SET vertical_version_id = ?, vertical = ? WHERE scope_id = ? AND vertical_version_id IS ?')
|
|
5716
|
+
.run(versionId, v.verticalSlug, scopeId, opts.expectedVersionId);
|
|
5717
|
+
if (update.changes === 0) {
|
|
5718
|
+
throw substratError('precondition_failed', 'scope binding changed; reload the scope and retry');
|
|
5719
|
+
}
|
|
5669
5720
|
this.recordAdmin(actor, 'bindScopeVersion', { tenantId, scopeId }, null, {
|
|
5670
5721
|
versionId,
|
|
5671
5722
|
vertical: v.verticalSlug,
|
|
5672
5723
|
version: v.version,
|
|
5724
|
+
...(opts?.expectedVersionId !== undefined ? { expectedVersionId: opts.expectedVersionId } : {}),
|
|
5673
5725
|
...(ack.exportBreak ? { acknowledged: ack } : {}),
|
|
5674
5726
|
});
|
|
5675
5727
|
},
|
|
@@ -5777,7 +5829,7 @@ export class SqliteScopeHost {
|
|
|
5777
5829
|
// The kernel's read, shared with the DO: the envelope and the columns lifted beside
|
|
5778
5830
|
// it (#1242, #1237) are decoded once, and a row that will not decode is stepped over
|
|
5779
5831
|
// rather than stalling the scope on it (#1636).
|
|
5780
|
-
const read = readUndrainedOutbox((offset, count) => page.all(count, offset), Math.min(
|
|
5832
|
+
const read = readUndrainedOutbox((offset, count) => page.all(count, offset), Math.min(assertRowLimit('limit', limit ?? 200), 1000));
|
|
5781
5833
|
this.recordAccess(actor, 'readUndrainedEvents', { tenantId, scopeId }, { limit }, read.events.length);
|
|
5782
5834
|
return undrainedEventsOf(read);
|
|
5783
5835
|
},
|
|
@@ -6296,8 +6348,10 @@ export class SqliteScopeHost {
|
|
|
6296
6348
|
const known = new Set(db.prepare(`SELECT name FROM sqlite_master WHERE type = 'table'`).all().map((r) => r.name));
|
|
6297
6349
|
if (!known.has(input.table))
|
|
6298
6350
|
throw new Error(`unknown table '${input.table}'`);
|
|
6299
|
-
|
|
6300
|
-
|
|
6351
|
+
// The ceiling clamps; a bound SQLite would misread (NaN, non-finite, fractional,
|
|
6352
|
+
// negative) is refused instead of reaching LIMIT / OFFSET (#1632).
|
|
6353
|
+
const limit = Math.min(assertRowLimit('limit', input.limit ?? SCOPE_TABLE_PAGE_DEFAULT), SCOPE_TABLE_PAGE_MAX);
|
|
6354
|
+
const offset = assertRowOffset('offset', input.offset ?? 0);
|
|
6301
6355
|
const stmt = db.prepare(`SELECT * FROM "${input.table}" LIMIT ? OFFSET ?`).raw(true);
|
|
6302
6356
|
const rows = stmt.all(limit, offset).map((row) => row.map(cellToJson));
|
|
6303
6357
|
const columns = stmt.columns().map((c) => c.name);
|
|
@@ -6571,7 +6625,8 @@ export class SqliteScopeHost {
|
|
|
6571
6625
|
// Both scope-side redactions in ONE turn on the scope actor (#1678): issued while an
|
|
6572
6626
|
// invoke held its transaction open, they joined it, and its rollback put the
|
|
6573
6627
|
// person's PII back after this verb had destroyed the key and receipted the erasure.
|
|
6574
|
-
const
|
|
6628
|
+
const scopeSql = redactionSqlOf(db);
|
|
6629
|
+
const { redacted, intentsRedacted, jobRunsRedacted, text } = await this.runtime(tenantId, scopeId).actor.turn(() => ({
|
|
6575
6630
|
redacted: db
|
|
6576
6631
|
.prepare(`UPDATE _substrat_outbox SET payload = NULL
|
|
6577
6632
|
WHERE subject_id = ? AND pii_class != 'none' AND payload IS NOT NULL`)
|
|
@@ -6590,14 +6645,16 @@ export class SqliteScopeHost {
|
|
|
6590
6645
|
.run(REDACTED_DELIVERY_NOTE, REDACTED_DELIVERY_NOTE, subjectId),
|
|
6591
6646
|
// The job-run tables (#1632): a run, its cursor or a step's memo can hold a copy
|
|
6592
6647
|
// of the same event. The kernel's walk, so the DO runs the identical SQL.
|
|
6593
|
-
jobRunsRedacted: redactSubjectJobRuns(
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
stmt.run(...params);
|
|
6598
|
-
return [];
|
|
6599
|
-
}, subjectId, at),
|
|
6648
|
+
jobRunsRedacted: redactSubjectJobRuns(scopeSql, subjectId, at),
|
|
6649
|
+
// The free-text copies (#1632), and the tombstoned intents the directory half
|
|
6650
|
+
// follows. Last, so those ids include every intent tombstoned above.
|
|
6651
|
+
text: redactSubjectScopeText(scopeSql, subjectId, at),
|
|
6600
6652
|
}));
|
|
6653
|
+
const { idempotencyResults, intentIds } = text;
|
|
6654
|
+
// The directory's failure text (#1632) — a drain failure quoting one of those
|
|
6655
|
+
// intents, an issue's exemplar, a sweep record's error. Before the key, for the
|
|
6656
|
+
// ordering reason above.
|
|
6657
|
+
redactSubjectDirectoryText(redactionSqlOf(this.directory), { tenantId, scopeId, subjectId, intentIds });
|
|
6601
6658
|
const { existed } = await this.subjectKeysFor(tenantId, scopeId).destroy(subjectId, at);
|
|
6602
6659
|
const receipt = subjectShredReceipt.parse({
|
|
6603
6660
|
subjectId,
|
|
@@ -6613,7 +6670,7 @@ export class SqliteScopeHost {
|
|
|
6613
6670
|
this.recordAdmin(actor, 'shredSubject', { tenantId, scopeId }, null, receipt);
|
|
6614
6671
|
// BOTH counts: the access log's number is "how much evidence this destroyed", and
|
|
6615
6672
|
// an intent payload is a whole event's worth of it.
|
|
6616
|
-
this.recordAccess(actor, 'shredSubject', { tenantId, scopeId }, { subjectId }, redacted.changes + intentsRedacted + jobRunsRedacted);
|
|
6673
|
+
this.recordAccess(actor, 'shredSubject', { tenantId, scopeId }, { subjectId }, redacted.changes + intentsRedacted + jobRunsRedacted + idempotencyResults);
|
|
6617
6674
|
return receipt;
|
|
6618
6675
|
},
|
|
6619
6676
|
// -- impersonation (K-42, #868) ----------------------------------------
|
|
@@ -7239,6 +7296,7 @@ export class SqliteScopeHost {
|
|
|
7239
7296
|
return info.changes;
|
|
7240
7297
|
},
|
|
7241
7298
|
pruneAccessLog: async (actor, limit) => {
|
|
7299
|
+
assertRowLimit('limit', limit);
|
|
7242
7300
|
// ONLY drained rows. Age alone is not a licence to delete evidence.
|
|
7243
7301
|
const info = this.directory
|
|
7244
7302
|
.prepare(`DELETE FROM _substrat_access_log WHERE id IN (
|
|
@@ -7296,7 +7354,7 @@ export class SqliteScopeHost {
|
|
|
7296
7354
|
` ORDER BY id ${order}`;
|
|
7297
7355
|
if (filter?.limit !== undefined) {
|
|
7298
7356
|
sql += ' LIMIT ?';
|
|
7299
|
-
params.push(filter.limit);
|
|
7357
|
+
params.push(assertRowLimit('limit', filter.limit));
|
|
7300
7358
|
}
|
|
7301
7359
|
const rows = this.directory.prepare(sql).all(...params);
|
|
7302
7360
|
// Reading the audit trail is itself audited. Who examined the record of
|
|
@@ -7338,17 +7396,19 @@ export class SqliteScopeHost {
|
|
|
7338
7396
|
// resolved issue; an ignored one stays ignored — that is what ignoring means.
|
|
7339
7397
|
this.directory
|
|
7340
7398
|
.prepare(`INSERT INTO _substrat_issues
|
|
7341
|
-
(fingerprint, operation, stage, origin, code, status, seen_count, first_seen, last_seen, last_message, last_vertical, last_version, resolved_version, resolved_at)
|
|
7342
|
-
VALUES (?, ?, ?, ?, ?, 'new', 1, ?, ?, ?, ?, ?, NULL, NULL)
|
|
7399
|
+
(fingerprint, operation, stage, origin, code, status, seen_count, first_seen, last_seen, last_message, last_tenant_id, last_owner_kind, last_vertical, last_version, resolved_version, resolved_at)
|
|
7400
|
+
VALUES (?, ?, ?, ?, ?, 'new', 1, ?, ?, ?, ?, ?, ?, ?, NULL, NULL)
|
|
7343
7401
|
ON CONFLICT (fingerprint) DO UPDATE SET
|
|
7344
7402
|
seen_count = seen_count + 1,
|
|
7345
7403
|
last_seen = excluded.last_seen,
|
|
7346
7404
|
last_message = excluded.last_message,
|
|
7405
|
+
last_tenant_id = excluded.last_tenant_id,
|
|
7406
|
+
last_owner_kind = excluded.last_owner_kind,
|
|
7347
7407
|
last_vertical = COALESCE(excluded.last_vertical, last_vertical),
|
|
7348
7408
|
last_version = COALESCE(excluded.last_version, last_version),
|
|
7349
7409
|
origin = COALESCE(excluded.origin, origin),
|
|
7350
7410
|
status = CASE WHEN status = 'resolved' THEN 'regressed' ELSE status END`)
|
|
7351
|
-
.run(fingerprint, entry.operation, entry.stage ?? null, entry.origin ?? null, entry.code ?? null, at, at, entry.message.slice(0, 2000), entry.vertical ?? null, entry.version ?? null);
|
|
7411
|
+
.run(fingerprint, entry.operation, entry.stage ?? null, entry.origin ?? null, entry.code ?? null, at, at, entry.message.slice(0, 2000), entry.tenantId ?? null, issueExemplarOwner(entry.tenantId ?? null), entry.vertical ?? null, entry.version ?? null);
|
|
7352
7412
|
const issueHorizon = new Date(Date.now() - ISSUE_RETENTION_DAYS * 86_400_000).toISOString();
|
|
7353
7413
|
this.directory.prepare('DELETE FROM _substrat_issues WHERE last_seen < ?').run(issueHorizon);
|
|
7354
7414
|
},
|
|
@@ -7407,7 +7467,7 @@ export class SqliteScopeHost {
|
|
|
7407
7467
|
` ORDER BY id ${order}`;
|
|
7408
7468
|
if (filter?.limit !== undefined) {
|
|
7409
7469
|
sql += ' LIMIT ?';
|
|
7410
|
-
params.push(filter.limit);
|
|
7470
|
+
params.push(assertRowLimit('limit', filter.limit));
|
|
7411
7471
|
}
|
|
7412
7472
|
const rows = this.directory.prepare(sql).all(...params);
|
|
7413
7473
|
// Rows can name tenants and scopes, so reading them is recorded like the
|
|
@@ -7481,7 +7541,7 @@ export class SqliteScopeHost {
|
|
|
7481
7541
|
` ORDER BY id ${order}`;
|
|
7482
7542
|
if (filter?.limit !== undefined) {
|
|
7483
7543
|
sql += ' LIMIT ?';
|
|
7484
|
-
params.push(filter.limit);
|
|
7544
|
+
params.push(assertRowLimit('limit', filter.limit));
|
|
7485
7545
|
}
|
|
7486
7546
|
const rows = this.directory.prepare(sql).all(...params);
|
|
7487
7547
|
// Rows can name tenants and scopes, so reading them is recorded (K-24).
|
|
@@ -7505,6 +7565,15 @@ export class SqliteScopeHost {
|
|
|
7505
7565
|
at: r.at,
|
|
7506
7566
|
}));
|
|
7507
7567
|
},
|
|
7568
|
+
pruneTelemetry: async (_actor, limit) => {
|
|
7569
|
+
// A negative LIMIT is no limit at all to SQLite (#1632): refused before any statement.
|
|
7570
|
+
assertRowLimit('limit', limit);
|
|
7571
|
+
const pruned = { opsFailures: 0, issues: 0, sweepRuns: 0 };
|
|
7572
|
+
for (const { table, sql, params } of telemetryRetentionStatements(Date.now(), limit)) {
|
|
7573
|
+
pruned[table] = this.directory.prepare(sql).all(...params).length;
|
|
7574
|
+
}
|
|
7575
|
+
return pruned;
|
|
7576
|
+
},
|
|
7508
7577
|
listIssues: async (actor, filter) => {
|
|
7509
7578
|
const where = [];
|
|
7510
7579
|
const params = [];
|
|
@@ -7525,7 +7594,7 @@ export class SqliteScopeHost {
|
|
|
7525
7594
|
const sql = 'SELECT * FROM _substrat_issues' +
|
|
7526
7595
|
(where.length ? ` WHERE ${where.join(' AND ')}` : '') +
|
|
7527
7596
|
' ORDER BY last_seen DESC, fingerprint LIMIT ?';
|
|
7528
|
-
params.push(filter?.limit ?? 100);
|
|
7597
|
+
params.push(assertRowLimit('limit', filter?.limit ?? 100));
|
|
7529
7598
|
const rows = this.directory.prepare(sql).all(...params);
|
|
7530
7599
|
// Issues aggregate fleet-wide failures; the read is recorded like the rows' own (K-24).
|
|
7531
7600
|
this.recordAccess(actor, 'listIssues', {}, filter, rows.length);
|
|
@@ -7594,8 +7663,10 @@ export class SqliteScopeHost {
|
|
|
7594
7663
|
// Without case, as SQLite resolves a column name: a restore may have added this column
|
|
7595
7664
|
// already, untyped and spelled as a newer kernel's dump spelled it (#1883).
|
|
7596
7665
|
const existing = db.prepare(`PRAGMA table_info(${table})`).all().some((c) => c.name.toLowerCase() === column.toLowerCase());
|
|
7597
|
-
if (
|
|
7598
|
-
|
|
7666
|
+
if (existing)
|
|
7667
|
+
return false;
|
|
7668
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${ddl}`);
|
|
7669
|
+
return true;
|
|
7599
7670
|
}
|
|
7600
7671
|
/**
|
|
7601
7672
|
* #1288: `_substrat_schedule_state`, rebuilt with `kind` in its key on a scope db
|
|
@@ -7801,6 +7872,15 @@ export class SqliteScopeHost {
|
|
|
7801
7872
|
// #1236: the regression's version pair, on a directory whose issues table predates it.
|
|
7802
7873
|
this.ensureColumn(this.directory, '_substrat_issues', 'last_version', 'last_version TEXT');
|
|
7803
7874
|
this.ensureColumn(this.directory, '_substrat_issues', 'resolved_version', 'resolved_version TEXT');
|
|
7875
|
+
// #1632: whose exemplar `last_message` is. Backfilled once, as the columns arrive, from
|
|
7876
|
+
// the retained ops-failure rows that prove it; every other row stays unknown. The columns
|
|
7877
|
+
// and the backfill commit together because this whole pass is `ensureDirectorySchema`'s
|
|
7878
|
+
// one transaction: the backfill's gate is "this call added the column", so a column
|
|
7879
|
+
// committed ahead of a backfill that then failed would read as migrated for good.
|
|
7880
|
+
this.ensureColumn(this.directory, '_substrat_issues', 'last_tenant_id', 'last_tenant_id TEXT');
|
|
7881
|
+
if (this.ensureColumn(this.directory, '_substrat_issues', 'last_owner_kind', 'last_owner_kind TEXT')) {
|
|
7882
|
+
this.directory.exec(ISSUE_EXEMPLAR_OWNER_BACKFILL_SQL);
|
|
7883
|
+
}
|
|
7804
7884
|
this.directory.exec('CREATE INDEX IF NOT EXISTS _substrat_ops_failures_fingerprint ON _substrat_ops_failures (fingerprint, id)');
|
|
7805
7885
|
// #1232: the drained batch's dedupe key, on a directory created before it. The
|
|
7806
7886
|
// unique index rides here too — created after the column exists on every path.
|
|
@@ -8542,6 +8622,7 @@ export class SqliteScopeHost {
|
|
|
8542
8622
|
// from the kernel's (now widened) DDL when it runs — so by the time this ALTER
|
|
8543
8623
|
// executes, the table always already has `kind` in its key, never `invocation_id`.
|
|
8544
8624
|
this.ensureColumn(db, '_substrat_schedule_state', 'invocation_id', 'invocation_id TEXT');
|
|
8625
|
+
this.ensureColumn(db, '_substrat_job_runs', 'subject_id', 'subject_id TEXT');
|
|
8545
8626
|
// #1237: `readInvocation`'s lookup — WHERE invocation_id = ? ORDER BY id — over an outbox
|
|
8546
8627
|
// that is never pruned. No index leads with invocation_id, so without this one SQLite
|
|
8547
8628
|
// walks the PRIMARY KEY from the oldest event until it reaches the call, and reading a
|
|
@@ -8609,6 +8690,16 @@ function cellToJson(v) {
|
|
|
8609
8690
|
return null;
|
|
8610
8691
|
return v;
|
|
8611
8692
|
}
|
|
8693
|
+
/** The kernel's erasure walks over one SQLite connection — a read returns its rows, a write none. */
|
|
8694
|
+
function redactionSqlOf(db) {
|
|
8695
|
+
return (sql, params) => {
|
|
8696
|
+
const stmt = db.prepare(sql);
|
|
8697
|
+
if (stmt.reader)
|
|
8698
|
+
return stmt.all(...params);
|
|
8699
|
+
stmt.run(...params);
|
|
8700
|
+
return [];
|
|
8701
|
+
};
|
|
8702
|
+
}
|
|
8612
8703
|
/**
|
|
8613
8704
|
* The connection module code holds. `guardSpine` is what makes "never write
|
|
8614
8705
|
* `_substrat_*`" a mechanism rather than a lint rule (#954) — the kernel's own
|