@microdelta/history 0.0.0 → 0.1.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/README.md +19 -4
- package/dist/api/history.alpha.d.ts +3 -0
- package/dist/api/history.beta.d.ts +3 -0
- package/dist/api/history.conformance.store.alpha.d.ts +3 -0
- package/dist/api/history.conformance.store.beta.d.ts +3 -0
- package/dist/api/history.conformance.store.public.d.ts +3 -0
- package/dist/api/history.conformance.store.raw.alpha.d.ts +215 -0
- package/dist/api/history.conformance.store.raw.beta.d.ts +215 -0
- package/dist/api/history.conformance.store.raw.public.d.ts +215 -0
- package/dist/api/history.conformance.store.raw.untrimmed.d.ts +215 -0
- package/dist/api/history.conformance.store.untrimmed.d.ts +3 -0
- package/dist/api/history.public.d.ts +3 -0
- package/dist/api/history.root.raw.alpha.d.ts +1058 -0
- package/dist/api/history.root.raw.beta.d.ts +393 -0
- package/dist/api/history.root.raw.public.d.ts +393 -0
- package/dist/api/history.root.raw.untrimmed.d.ts +1059 -0
- package/dist/api/history.shared.alpha.d.ts +1091 -0
- package/dist/api/history.shared.beta.d.ts +426 -0
- package/dist/api/history.shared.public.d.ts +426 -0
- package/dist/api/history.shared.untrimmed.d.ts +1092 -0
- package/dist/api/history.untrimmed.d.ts +3 -0
- package/dist/api/tsdoc-metadata.json +11 -0
- package/dist/src/completed-results.d.ts +99 -0
- package/dist/src/completed-results.d.ts.map +1 -0
- package/dist/src/completed-results.js +2 -0
- package/dist/src/completed-results.js.map +1 -0
- package/dist/src/durable/contracts.d.ts +339 -0
- package/dist/src/durable/contracts.d.ts.map +1 -0
- package/dist/src/durable/contracts.js +2 -0
- package/dist/src/durable/contracts.js.map +1 -0
- package/dist/src/durable/errors.d.ts +69 -0
- package/dist/src/durable/errors.d.ts.map +1 -0
- package/dist/src/durable/errors.js +87 -0
- package/dist/src/durable/errors.js.map +1 -0
- package/dist/src/durable/index.d.ts +9 -0
- package/dist/src/durable/index.d.ts.map +1 -0
- package/dist/src/durable/index.js +590 -0
- package/dist/src/durable/index.js.map +1 -0
- package/dist/src/durable/locator.d.ts +31 -0
- package/dist/src/durable/locator.d.ts.map +1 -0
- package/dist/src/durable/locator.js +50 -0
- package/dist/src/durable/locator.js.map +1 -0
- package/dist/src/durable/schema.d.ts +28 -0
- package/dist/src/durable/schema.d.ts.map +1 -0
- package/dist/src/durable/schema.js +266 -0
- package/dist/src/durable/schema.js.map +1 -0
- package/dist/src/durable/selected-index.d.ts +94 -0
- package/dist/src/durable/selected-index.d.ts.map +1 -0
- package/dist/src/durable/selected-index.js +592 -0
- package/dist/src/durable/selected-index.js.map +1 -0
- package/dist/src/index.d.ts +26 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +13 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/store/index.d.ts +128 -0
- package/dist/src/store/index.d.ts.map +1 -0
- package/dist/src/store/index.js +33 -0
- package/dist/src/store/index.js.map +1 -0
- package/dist/src/store/memory/index.d.ts +24 -0
- package/dist/src/store/memory/index.d.ts.map +1 -0
- package/dist/src/store/memory/index.js +162 -0
- package/dist/src/store/memory/index.js.map +1 -0
- package/dist/src/types.d.ts +100 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/test/conformance/store/index.d.ts +34 -0
- package/dist/test/conformance/store/index.d.ts.map +1 -0
- package/dist/test/conformance/store/index.js +368 -0
- package/dist/test/conformance/store/index.js.map +1 -0
- package/package.json +48 -8
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IDurableHistory, IDurableHistoryOptions } from './contracts.js';
|
|
2
|
+
/**
|
|
3
|
+
* Open (creating when empty) the durable History store for one logical store.
|
|
4
|
+
* The file is rejected before any work unless it is empty or holds exactly
|
|
5
|
+
* this schema version for this logical store.
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export declare function openDurableHistory(options: IDurableHistoryOptions): IDurableHistory;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/durable/index.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAQV,eAAe,EACf,sBAAsB,EAWvB,MAAM,gBAAgB,CAAC;AAwIxB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,eAAe,CAmgBnF"}
|
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
import { decodeSnapshot, encodeSnapshot } from '@microdelta/value';
|
|
2
|
+
import { AttemptConflictError, AttemptStateError, HistoryClockError, HistoryIntegrityError, StaleWriterError, } from './errors.js';
|
|
3
|
+
import { parseReference, referenceFor } from './locator.js';
|
|
4
|
+
import { initializeSchema } from './schema.js';
|
|
5
|
+
import { buildIndex, createSelectedIndex, indexVersion } from './selected-index.js';
|
|
6
|
+
/** Identity tag for embedded SQL; the text is passed through unchanged. */
|
|
7
|
+
const sql = String.raw;
|
|
8
|
+
/** The only payload encoding History stores for completed results. */
|
|
9
|
+
const payloadEncoding = 'MDS1';
|
|
10
|
+
/** Require a non-empty string argument. */
|
|
11
|
+
function requireName(value, name) {
|
|
12
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
13
|
+
throw new TypeError(`${name} must be a non-empty string`);
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
/** Require a positive safe-integer argument. */
|
|
18
|
+
function requirePositive(value, name) {
|
|
19
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value <= 0) {
|
|
20
|
+
throw new TypeError(`${name} must be a positive safe integer`);
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
/** Require a nonnegative safe-integer argument. */
|
|
25
|
+
function requireNonnegative(value, name) {
|
|
26
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0) {
|
|
27
|
+
throw new TypeError(`${name} must be a nonnegative safe integer`);
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
/** Add two safe integers or fail rather than round. */
|
|
32
|
+
function safeSum(left, right, name) {
|
|
33
|
+
const sum = left + right;
|
|
34
|
+
if (!Number.isSafeInteger(sum)) {
|
|
35
|
+
throw new RangeError(`${name} exceeds the safe integer range`);
|
|
36
|
+
}
|
|
37
|
+
return sum;
|
|
38
|
+
}
|
|
39
|
+
/** Copy and validate a scoped subject argument. */
|
|
40
|
+
function scopedSubject(value) {
|
|
41
|
+
return { analysis: requireName(value.analysis, 'analysis'), environment: requireName(value.environment, 'environment'), subject: requireName(value.subject, 'subject') };
|
|
42
|
+
}
|
|
43
|
+
/** Copy and validate a versioned subject argument. */
|
|
44
|
+
function versionedSubject(value) {
|
|
45
|
+
return { ...scopedSubject(value), version: requirePositive(value.version, 'version') };
|
|
46
|
+
}
|
|
47
|
+
/** Copy and validate an attempt request. */
|
|
48
|
+
function attemptRequest(value) {
|
|
49
|
+
return { ...versionedSubject(value), attemptKey: requireName(value.attemptKey, 'attemptKey'), intentDigest: requireName(value.intentDigest, 'intentDigest') };
|
|
50
|
+
}
|
|
51
|
+
/** Validate a presented lease's shape; authority is checked against storage separately. */
|
|
52
|
+
function leaseArgument(lease) {
|
|
53
|
+
return { holder: requireName(lease.holder, 'lease holder'), fence: requirePositive(lease.fence, 'lease fence'), expiresAt: requireNonnegative(lease.expiresAt, 'lease expiry') };
|
|
54
|
+
}
|
|
55
|
+
/** Validate and canonicalize an owner-defined versioned record. */
|
|
56
|
+
function storeRecord(record, name) {
|
|
57
|
+
return {
|
|
58
|
+
format: requireName(record.format, `${name} format`),
|
|
59
|
+
formatVersion: requirePositive(record.formatVersion, `${name} format version`),
|
|
60
|
+
content: encodeSnapshot(record.content),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Decode a stored versioned record into frozen data, or fail as corruption. */
|
|
64
|
+
function loadRecord(format, formatVersion, content, name) {
|
|
65
|
+
if (typeof format !== 'string' || format.length === 0 || typeof formatVersion !== 'number' || !Number.isSafeInteger(formatVersion) || formatVersion <= 0 || typeof content !== 'string') {
|
|
66
|
+
throw new HistoryIntegrityError(`Stored ${name} has a malformed version tag`);
|
|
67
|
+
}
|
|
68
|
+
let decoded;
|
|
69
|
+
try {
|
|
70
|
+
decoded = decodeSnapshot(content);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
throw new HistoryIntegrityError(`Stored ${name} is not canonical MDS1: ${error instanceof Error ? error.message : String(error)}`);
|
|
74
|
+
}
|
|
75
|
+
return Object.freeze({ format, formatVersion, content: decoded });
|
|
76
|
+
}
|
|
77
|
+
/** Narrow a stored cell to text. */
|
|
78
|
+
function text(row, column) {
|
|
79
|
+
const value = row[column];
|
|
80
|
+
if (typeof value !== 'string') {
|
|
81
|
+
throw new HistoryIntegrityError(`Stored History column ${column} is not text`);
|
|
82
|
+
}
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
/** Narrow a stored cell to a safe integer. */
|
|
86
|
+
function integer(row, column) {
|
|
87
|
+
const value = row[column];
|
|
88
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value)) {
|
|
89
|
+
throw new HistoryIntegrityError(`Stored History column ${column} is not an integer`);
|
|
90
|
+
}
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
/** Narrow a stored attempt state. */
|
|
94
|
+
function attemptState(row) {
|
|
95
|
+
const state = text(row, 'state');
|
|
96
|
+
if (state !== 'allocated' && state !== 'staged' && state !== 'completed' && state !== 'failed' && state !== 'interrupted') {
|
|
97
|
+
throw new HistoryIntegrityError(`Unsupported stored attempt state ${state}`);
|
|
98
|
+
}
|
|
99
|
+
return state;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Open (creating when empty) the durable History store for one logical store.
|
|
103
|
+
* The file is rejected before any work unless it is empty or holds exactly
|
|
104
|
+
* this schema version for this logical store.
|
|
105
|
+
* @alpha
|
|
106
|
+
*/
|
|
107
|
+
export function openDurableHistory(options) {
|
|
108
|
+
const logicalStore = requireName(options.logicalStore, 'logicalStore');
|
|
109
|
+
const clock = options.clock;
|
|
110
|
+
const connection = options.sqlite.openSqlite(options.location);
|
|
111
|
+
try {
|
|
112
|
+
initializeSchema(connection, logicalStore);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
connection.close();
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
const statements = {
|
|
119
|
+
writer: connection.prepare(sql `/* writer */ SELECT last_fence, holder, expires_at, time_high_water FROM history_writer WHERE singleton = 1`),
|
|
120
|
+
observeTime: connection.prepare(sql `/* writer */ UPDATE history_writer SET time_high_water = ? WHERE singleton = 1`),
|
|
121
|
+
setHolder: connection.prepare(sql `/* writer */ UPDATE history_writer SET last_fence = ?, holder = ?, expires_at = ? WHERE singleton = 1`),
|
|
122
|
+
sequences: connection.prepare(sql `/* sequence */ SELECT last_attempt, last_publication, last_acceptance FROM history_sequences WHERE singleton = 1`),
|
|
123
|
+
setAttemptSequence: connection.prepare(sql `/* allocate */ UPDATE history_sequences SET last_attempt = ? WHERE singleton = 1`),
|
|
124
|
+
setPublicationSequence: connection.prepare(sql `/* publish */ UPDATE history_sequences SET last_publication = ? WHERE singleton = 1`),
|
|
125
|
+
setAcceptanceSequence: connection.prepare(sql `/* accept */ UPDATE history_sequences SET last_acceptance = ? WHERE singleton = 1`),
|
|
126
|
+
attemptByKey: connection.prepare(sql `/* attempt */ SELECT * FROM history_attempts WHERE analysis = ? AND environment = ? AND subject = ? AND attempt_key = ?`),
|
|
127
|
+
attemptById: connection.prepare(sql `/* attempt */ SELECT * FROM history_attempts WHERE attempt_id = ?`),
|
|
128
|
+
insertAttempt: connection.prepare(sql `/* allocate */ INSERT INTO history_attempts
|
|
129
|
+
(attempt_id, analysis, environment, subject, version, attempt_key, intent_digest, state, allocated_fence)
|
|
130
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, 'allocated', ?)`),
|
|
131
|
+
stageAttempt: connection.prepare(sql `/* stage */ UPDATE history_attempts
|
|
132
|
+
SET state = 'staged', staged_payload = ?, staged_provenance_format = ?, staged_provenance_version = ?, staged_provenance = ?
|
|
133
|
+
WHERE attempt_id = ? AND state = 'allocated'`),
|
|
134
|
+
insertDependency: connection.prepare(sql `/* stage */ INSERT INTO history_dependencies (attempt_id, position, dependency_id) VALUES (?, ?, ?)`),
|
|
135
|
+
insertResult: connection.prepare(sql `/* publish */ INSERT INTO history_results
|
|
136
|
+
(result_id, analysis, environment, subject, version, publication, published_fence, encoding, index_version, payload, provenance_format, provenance_version, provenance)
|
|
137
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`),
|
|
138
|
+
completeAttempt: connection.prepare(sql `/* publish */ UPDATE history_attempts
|
|
139
|
+
SET state = 'completed', ended_fence = ?, staged_payload = NULL, staged_provenance_format = NULL, staged_provenance_version = NULL, staged_provenance = NULL
|
|
140
|
+
WHERE attempt_id = ? AND state = 'staged'`),
|
|
141
|
+
setCurrent: connection.prepare(sql `/* publish */ INSERT INTO history_current (analysis, environment, subject, result_id) VALUES (?, ?, ?, ?)
|
|
142
|
+
ON CONFLICT (analysis, environment, subject) DO UPDATE SET result_id = excluded.result_id`),
|
|
143
|
+
abandonAttempt: connection.prepare(sql `/* abandon */ UPDATE history_attempts
|
|
144
|
+
SET state = ?, ended_fence = ?, outcome_format = ?, outcome_version = ?, outcome = ?
|
|
145
|
+
WHERE attempt_id = ? AND state IN ('allocated', 'staged')`),
|
|
146
|
+
reference: connection.prepare(sql `/* reference */ SELECT r.result_id, r.analysis, r.environment, r.encoding, r.index_version, a.state
|
|
147
|
+
FROM history_results r LEFT JOIN history_attempts a ON a.attempt_id = r.result_id WHERE r.result_id = ?`),
|
|
148
|
+
envelope: connection.prepare(sql `/* envelope */ SELECT result_id, analysis, environment, subject, version, publication, encoding, index_version,
|
|
149
|
+
provenance_format, provenance_version, provenance FROM history_results WHERE result_id = ?`),
|
|
150
|
+
candidates: connection.prepare(sql `/* candidates */ SELECT result_id, analysis, environment, subject, version, publication, encoding, index_version,
|
|
151
|
+
provenance_format, provenance_version, provenance FROM history_results
|
|
152
|
+
WHERE analysis = ? AND environment = ? AND subject = ? AND version = ? ORDER BY publication DESC`),
|
|
153
|
+
dependencies: connection.prepare(sql `/* envelope */ SELECT d.position, d.dependency_id, r.result_id AS present, r.analysis, r.environment
|
|
154
|
+
FROM history_dependencies d LEFT JOIN history_results r ON r.result_id = d.dependency_id WHERE d.attempt_id = ? ORDER BY d.position`),
|
|
155
|
+
current: connection.prepare(sql `/* current */ SELECT c.result_id, r.result_id AS present
|
|
156
|
+
FROM history_current c LEFT JOIN history_results r ON r.result_id = c.result_id AND r.analysis = c.analysis AND r.environment = c.environment AND r.subject = c.subject
|
|
157
|
+
WHERE c.analysis = ? AND c.environment = ? AND c.subject = ?`),
|
|
158
|
+
insertAcceptance: connection.prepare(sql `/* accept */ INSERT INTO history_acceptances (acceptance_id, result_id, fence, evidence_format, evidence_version, evidence) VALUES (?, ?, ?, ?, ?, ?)`),
|
|
159
|
+
insertAcceptanceDependency: connection.prepare(sql `/* accept */ INSERT INTO history_acceptance_dependencies (acceptance_id, position, dependency_id) VALUES (?, ?, ?)`),
|
|
160
|
+
acceptances: connection.prepare(sql `/* acceptance */ SELECT acceptance_id, fence, evidence_format, evidence_version, evidence FROM history_acceptances WHERE result_id = ? ORDER BY acceptance_id`),
|
|
161
|
+
acceptanceDependencies: connection.prepare(sql `/* acceptance */ SELECT d.position, d.dependency_id, r.result_id AS present, r.analysis, r.environment
|
|
162
|
+
FROM history_acceptance_dependencies d LEFT JOIN history_results r ON r.result_id = d.dependency_id WHERE d.acceptance_id = ? ORDER BY d.position`),
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Resolve an exact reference to a completed result of this store: the
|
|
166
|
+
* locator grammar, logical store, analysis, environment, existence,
|
|
167
|
+
* completion and stored encoding must all match. Any mismatch is an
|
|
168
|
+
* integrity failure; the current pointer is never consulted.
|
|
169
|
+
*/
|
|
170
|
+
function resolveResult(reference, expectedScope) {
|
|
171
|
+
const parts = parseReference(reference);
|
|
172
|
+
if (parts.logicalStore !== logicalStore) {
|
|
173
|
+
throw new HistoryIntegrityError('Completed-result reference belongs to a different logical store');
|
|
174
|
+
}
|
|
175
|
+
if (expectedScope !== undefined && (parts.analysis !== expectedScope.analysis || parts.environment !== expectedScope.environment)) {
|
|
176
|
+
throw new HistoryIntegrityError('Completed-result reference belongs to a different analysis or environment');
|
|
177
|
+
}
|
|
178
|
+
const row = statements.reference.get(parts.resultId);
|
|
179
|
+
if (row === undefined) {
|
|
180
|
+
throw new HistoryIntegrityError(`Missing exact completed result ${reference.locator}`);
|
|
181
|
+
}
|
|
182
|
+
if (row.analysis !== parts.analysis || row.environment !== parts.environment) {
|
|
183
|
+
throw new HistoryIntegrityError('Completed-result reference scope does not match the stored result');
|
|
184
|
+
}
|
|
185
|
+
if (row.encoding !== payloadEncoding || row.index_version !== indexVersion) {
|
|
186
|
+
throw new HistoryIntegrityError(`Stored result uses unsupported encoding ${String(row.encoding)} or index version ${String(row.index_version)}`);
|
|
187
|
+
}
|
|
188
|
+
if (row.state !== 'completed') {
|
|
189
|
+
throw new HistoryIntegrityError('Stored result is not backed by a completed attempt');
|
|
190
|
+
}
|
|
191
|
+
return { resultId: parts.resultId, scope: { analysis: parts.analysis, environment: parts.environment } };
|
|
192
|
+
}
|
|
193
|
+
const index = createSelectedIndex(connection, options.sha256, (reference) => resolveResult(reference).resultId);
|
|
194
|
+
/** Issue the exact reference for a stored result row. */
|
|
195
|
+
function referenceOf(resultId, scope) {
|
|
196
|
+
return referenceFor({ logicalStore, analysis: scope.analysis, environment: scope.environment, resultId });
|
|
197
|
+
}
|
|
198
|
+
/** Read the singleton writer row. */
|
|
199
|
+
function readWriter() {
|
|
200
|
+
const row = statements.writer.get();
|
|
201
|
+
if (row === undefined) {
|
|
202
|
+
throw new HistoryIntegrityError('History writer row is missing');
|
|
203
|
+
}
|
|
204
|
+
const holder = row.holder;
|
|
205
|
+
if (holder !== null && typeof holder !== 'string') {
|
|
206
|
+
throw new HistoryIntegrityError('Stored writer holder is malformed');
|
|
207
|
+
}
|
|
208
|
+
return { lastFence: integer(row, 'last_fence'), holder: holder ?? null, expiresAt: integer(row, 'expires_at'), timeHighWater: integer(row, 'time_high_water') };
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Evaluate "now" for a holder operation inside its transaction: the larger
|
|
212
|
+
* of a valid host reading and the persisted high-water, which is then
|
|
213
|
+
* persisted. A host failure or invalid reading aborts the transaction.
|
|
214
|
+
*/
|
|
215
|
+
function observeTime(writer) {
|
|
216
|
+
const reading = clock.currentEpochMilliseconds();
|
|
217
|
+
if (!Number.isSafeInteger(reading) || reading < 0) {
|
|
218
|
+
throw new HistoryClockError(`Clock reading ${String(reading)} is not a nonnegative safe integer of epoch milliseconds`);
|
|
219
|
+
}
|
|
220
|
+
const now = Math.max(reading, writer.timeHighWater);
|
|
221
|
+
if (now !== writer.timeHighWater) {
|
|
222
|
+
statements.observeTime.run(now);
|
|
223
|
+
}
|
|
224
|
+
return now;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Run one ownership-sensitive mutation. Inside one transaction the time is
|
|
228
|
+
* observed and holder, fence and unexpired lease are checked before
|
|
229
|
+
* `operation` runs. A stale lease commits only the time observation and then
|
|
230
|
+
* fails with {@link StaleWriterError}; any other failure rolls everything back.
|
|
231
|
+
*/
|
|
232
|
+
function asHolder(presented, operation) {
|
|
233
|
+
const lease = leaseArgument(presented);
|
|
234
|
+
let outcome;
|
|
235
|
+
let stale;
|
|
236
|
+
connection.transaction(() => {
|
|
237
|
+
const writer = readWriter();
|
|
238
|
+
const now = observeTime(writer);
|
|
239
|
+
if (writer.holder !== lease.holder || writer.lastFence !== lease.fence) {
|
|
240
|
+
stale = `Writer lease ${lease.holder}/${String(lease.fence)} is not the current holder`;
|
|
241
|
+
}
|
|
242
|
+
else if (writer.expiresAt <= now) {
|
|
243
|
+
stale = `Writer lease ${lease.holder}/${String(lease.fence)} expired at ${String(writer.expiresAt)}`;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
outcome = { value: operation(now) };
|
|
247
|
+
}
|
|
248
|
+
return undefined;
|
|
249
|
+
});
|
|
250
|
+
if (outcome === undefined) {
|
|
251
|
+
throw new StaleWriterError(stale ?? 'Writer lease is not current');
|
|
252
|
+
}
|
|
253
|
+
return outcome.value;
|
|
254
|
+
}
|
|
255
|
+
/** Read one attempt row by identity inside the caller's transaction. */
|
|
256
|
+
function requireAttemptRow(attemptId) {
|
|
257
|
+
const row = statements.attemptById.get(attemptId);
|
|
258
|
+
if (row === undefined) {
|
|
259
|
+
throw new AttemptStateError(`Unknown attempt ${String(attemptId)}`);
|
|
260
|
+
}
|
|
261
|
+
return row;
|
|
262
|
+
}
|
|
263
|
+
/** Convert a stored attempt row to its frozen record. */
|
|
264
|
+
function attemptOf(row) {
|
|
265
|
+
const scope = { analysis: text(row, 'analysis'), environment: text(row, 'environment') };
|
|
266
|
+
const attemptId = integer(row, 'attempt_id');
|
|
267
|
+
const state = attemptState(row);
|
|
268
|
+
const endedFence = row.ended_fence === null ? null : integer(row, 'ended_fence');
|
|
269
|
+
const outcome = row.outcome === null ? null : loadRecord(row.outcome_format, row.outcome_version, row.outcome, 'attempt outcome');
|
|
270
|
+
return Object.freeze({
|
|
271
|
+
...scope,
|
|
272
|
+
subject: text(row, 'subject'),
|
|
273
|
+
version: integer(row, 'version'),
|
|
274
|
+
attemptKey: text(row, 'attempt_key'),
|
|
275
|
+
intentDigest: text(row, 'intent_digest'),
|
|
276
|
+
attemptId,
|
|
277
|
+
state,
|
|
278
|
+
allocatedFence: integer(row, 'allocated_fence'),
|
|
279
|
+
endedFence,
|
|
280
|
+
result: state === 'completed' ? referenceOf(attemptId, scope) : null,
|
|
281
|
+
outcome,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Read an attempt's or acceptance's dependency rows and verify each still
|
|
286
|
+
* names a stored result in the same scope, in contiguous recorded order.
|
|
287
|
+
*/
|
|
288
|
+
function dependenciesOf(rows, scope) {
|
|
289
|
+
return Object.freeze(rows.map((row, position) => {
|
|
290
|
+
if (integer(row, 'position') !== position) {
|
|
291
|
+
throw new HistoryIntegrityError('Stored dependencies are not in contiguous order');
|
|
292
|
+
}
|
|
293
|
+
const dependencyId = integer(row, 'dependency_id');
|
|
294
|
+
if (row.present === null) {
|
|
295
|
+
throw new HistoryIntegrityError(`Stored dependency on result ${String(dependencyId)} is dangling`);
|
|
296
|
+
}
|
|
297
|
+
if (row.analysis !== scope.analysis || row.environment !== scope.environment) {
|
|
298
|
+
throw new HistoryIntegrityError(`Stored dependency on result ${String(dependencyId)} is outside the dependent's scope`);
|
|
299
|
+
}
|
|
300
|
+
// A returned dependency must satisfy the same exact contract as any reference: completed, in scope, supported.
|
|
301
|
+
const reference = referenceOf(dependencyId, scope);
|
|
302
|
+
resolveResult(reference, scope);
|
|
303
|
+
return reference;
|
|
304
|
+
}));
|
|
305
|
+
}
|
|
306
|
+
/** Convert a stored result row to its frozen envelope, verifying its metadata. */
|
|
307
|
+
function envelopeOf(row) {
|
|
308
|
+
const resultId = integer(row, 'result_id');
|
|
309
|
+
const scope = { analysis: text(row, 'analysis'), environment: text(row, 'environment') };
|
|
310
|
+
// Candidate and exact metadata are authoritative only for a result that
|
|
311
|
+
// resolves exactly: a completed producing attempt, in scope, supported encoding.
|
|
312
|
+
resolveResult(referenceOf(resultId, scope), scope);
|
|
313
|
+
return Object.freeze({
|
|
314
|
+
...scope,
|
|
315
|
+
subject: text(row, 'subject'),
|
|
316
|
+
version: integer(row, 'version'),
|
|
317
|
+
reference: referenceOf(resultId, scope),
|
|
318
|
+
attemptId: resultId,
|
|
319
|
+
publication: integer(row, 'publication'),
|
|
320
|
+
encoding: payloadEncoding,
|
|
321
|
+
provenance: loadRecord(row.provenance_format, row.provenance_version, row.provenance, 'provenance'),
|
|
322
|
+
dependencies: dependenciesOf(statements.dependencies.all(resultId), scope),
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
/** Resolve each dependency reference to a stored result in `scope`, inside the caller's transaction. */
|
|
326
|
+
function dependencyIds(references, scope) {
|
|
327
|
+
return references.map((reference) => resolveResult(reference, scope).resultId);
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Every path that reports an attempt's durable outcome to a caller
|
|
331
|
+
* (re-allocation of an existing key, re-publication, recovery), and every
|
|
332
|
+
* lifecycle transition (stage, publish, abandon) before it changes anything,
|
|
333
|
+
* first checks the attempt against stored results. A completed attempt's exact result must
|
|
334
|
+
* resolve; an attempt recorded as not completed must have no result row.
|
|
335
|
+
* Either contradiction is an integrity failure, never a success and never
|
|
336
|
+
* presented as incomplete work that a caller might resume.
|
|
337
|
+
*/
|
|
338
|
+
function verifiedAttempt(attempt) {
|
|
339
|
+
if (attempt.result !== null) {
|
|
340
|
+
resolveResult(attempt.result, attempt);
|
|
341
|
+
}
|
|
342
|
+
else if (statements.reference.get(attempt.attemptId) !== undefined) {
|
|
343
|
+
throw new HistoryIntegrityError(`Attempt ${String(attempt.attemptId)} is recorded as ${attempt.state} but has a published result`);
|
|
344
|
+
}
|
|
345
|
+
return attempt;
|
|
346
|
+
}
|
|
347
|
+
/** Recovery view of one attempt record. */
|
|
348
|
+
function recoveryOf(attempt) {
|
|
349
|
+
switch (attempt.state) {
|
|
350
|
+
case 'allocated':
|
|
351
|
+
case 'staged':
|
|
352
|
+
return Object.freeze({ kind: 'incomplete', attempt });
|
|
353
|
+
case 'failed':
|
|
354
|
+
case 'interrupted':
|
|
355
|
+
return Object.freeze({ kind: 'unsuccessful', attempt });
|
|
356
|
+
case 'completed':
|
|
357
|
+
if (attempt.result === null) {
|
|
358
|
+
throw new HistoryIntegrityError('Completed attempt has no result reference');
|
|
359
|
+
}
|
|
360
|
+
return Object.freeze({ kind: 'completed', attempt, reference: attempt.result });
|
|
361
|
+
default: {
|
|
362
|
+
const exhaustive = attempt.state;
|
|
363
|
+
return exhaustive;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
/** Reject a stored attempt whose identity differs from the request that names its key. */
|
|
368
|
+
function assertSameExecution(attempt, request) {
|
|
369
|
+
if (attempt.intentDigest !== request.intentDigest || attempt.version !== request.version) {
|
|
370
|
+
throw new AttemptConflictError(`Attempt key ${request.attemptKey} already identifies a different execution intent or version`);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/** Read and convert one acceptance record's dependencies. */
|
|
374
|
+
function acceptanceOf(row, reference, scope) {
|
|
375
|
+
const acceptanceId = integer(row, 'acceptance_id');
|
|
376
|
+
return Object.freeze({
|
|
377
|
+
acceptanceId,
|
|
378
|
+
reference,
|
|
379
|
+
fence: integer(row, 'fence'),
|
|
380
|
+
evidence: loadRecord(row.evidence_format, row.evidence_version, row.evidence, 'acceptance evidence'),
|
|
381
|
+
dependencies: dependenciesOf(statements.acceptanceDependencies.all(acceptanceId), scope),
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
/** Read the store-wide sequence row. */
|
|
385
|
+
function readSequences() {
|
|
386
|
+
const row = statements.sequences.get();
|
|
387
|
+
if (row === undefined) {
|
|
388
|
+
throw new HistoryIntegrityError('History sequence row is missing');
|
|
389
|
+
}
|
|
390
|
+
return { lastAttempt: integer(row, 'last_attempt'), lastPublication: integer(row, 'last_publication'), lastAcceptance: integer(row, 'last_acceptance') };
|
|
391
|
+
}
|
|
392
|
+
const history = {
|
|
393
|
+
logicalStore,
|
|
394
|
+
reader: index.reader,
|
|
395
|
+
acquireWriter(request) {
|
|
396
|
+
const holder = requireName(request.holder, 'holder');
|
|
397
|
+
const leaseMilliseconds = requirePositive(request.leaseMilliseconds, 'leaseMilliseconds');
|
|
398
|
+
let acquisition;
|
|
399
|
+
connection.transaction(() => {
|
|
400
|
+
const writer = readWriter();
|
|
401
|
+
const now = observeTime(writer);
|
|
402
|
+
if (writer.holder !== null && writer.expiresAt > now) {
|
|
403
|
+
acquisition = Object.freeze({ kind: 'held', holder: writer.holder, expiresAt: writer.expiresAt });
|
|
404
|
+
return undefined;
|
|
405
|
+
}
|
|
406
|
+
const fence = safeSum(writer.lastFence, 1, 'writer fence');
|
|
407
|
+
const expiresAt = safeSum(now, leaseMilliseconds, 'lease expiry');
|
|
408
|
+
statements.setHolder.run(fence, holder, expiresAt);
|
|
409
|
+
acquisition = Object.freeze({ kind: 'acquired', lease: Object.freeze({ holder, fence, expiresAt }) });
|
|
410
|
+
return undefined;
|
|
411
|
+
});
|
|
412
|
+
if (acquisition === undefined) {
|
|
413
|
+
throw new HistoryIntegrityError('Writer acquisition produced no outcome');
|
|
414
|
+
}
|
|
415
|
+
return acquisition;
|
|
416
|
+
},
|
|
417
|
+
renewWriter(lease, leaseMilliseconds) {
|
|
418
|
+
const duration = requirePositive(leaseMilliseconds, 'leaseMilliseconds');
|
|
419
|
+
return asHolder(lease, (now) => {
|
|
420
|
+
const expiresAt = safeSum(now, duration, 'lease expiry');
|
|
421
|
+
statements.setHolder.run(lease.fence, lease.holder, expiresAt);
|
|
422
|
+
return Object.freeze({ holder: lease.holder, fence: lease.fence, expiresAt });
|
|
423
|
+
});
|
|
424
|
+
},
|
|
425
|
+
releaseWriter(lease) {
|
|
426
|
+
asHolder(lease, (now) => {
|
|
427
|
+
// Release clears the holder but never resets the fence counter.
|
|
428
|
+
statements.setHolder.run(lease.fence, null, now);
|
|
429
|
+
});
|
|
430
|
+
},
|
|
431
|
+
currentWriter() {
|
|
432
|
+
const writer = readWriter();
|
|
433
|
+
return writer.holder === null ? undefined : Object.freeze({ holder: writer.holder, fence: writer.lastFence, expiresAt: writer.expiresAt });
|
|
434
|
+
},
|
|
435
|
+
allocateAttempt(lease, presented) {
|
|
436
|
+
const request = attemptRequest(presented);
|
|
437
|
+
return asHolder(lease, () => {
|
|
438
|
+
const existing = statements.attemptByKey.get(request.analysis, request.environment, request.subject, request.attemptKey);
|
|
439
|
+
if (existing !== undefined) {
|
|
440
|
+
const attempt = attemptOf(existing);
|
|
441
|
+
assertSameExecution(attempt, request);
|
|
442
|
+
return verifiedAttempt(attempt);
|
|
443
|
+
}
|
|
444
|
+
const attemptId = safeSum(readSequences().lastAttempt, 1, 'attempt identity');
|
|
445
|
+
statements.setAttemptSequence.run(attemptId);
|
|
446
|
+
statements.insertAttempt.run(attemptId, request.analysis, request.environment, request.subject, request.version, request.attemptKey, request.intentDigest, lease.fence);
|
|
447
|
+
return attemptOf(requireAttemptRow(attemptId));
|
|
448
|
+
});
|
|
449
|
+
},
|
|
450
|
+
stageAttempt(lease, request) {
|
|
451
|
+
const attemptId = requirePositive(request.attemptId, 'attemptId');
|
|
452
|
+
const payload = encodeSnapshot(request.payload);
|
|
453
|
+
const root = decodeSnapshot(payload);
|
|
454
|
+
if (root === null || typeof root !== 'object') {
|
|
455
|
+
throw new TypeError('A completed result payload needs a record or array root');
|
|
456
|
+
}
|
|
457
|
+
const provenance = storeRecord(request.provenance, 'provenance');
|
|
458
|
+
const references = [...request.dependencies];
|
|
459
|
+
return asHolder(lease, () => {
|
|
460
|
+
const attempt = verifiedAttempt(attemptOf(requireAttemptRow(attemptId)));
|
|
461
|
+
if (attempt.state !== 'allocated') {
|
|
462
|
+
throw new AttemptStateError(`Attempt ${String(attemptId)} cannot be staged from state ${attempt.state}`);
|
|
463
|
+
}
|
|
464
|
+
const dependencies = dependencyIds(references, attempt);
|
|
465
|
+
statements.stageAttempt.run(payload, provenance.format, provenance.formatVersion, provenance.content, attemptId);
|
|
466
|
+
dependencies.forEach((dependencyId, position) => {
|
|
467
|
+
statements.insertDependency.run(attemptId, position, dependencyId);
|
|
468
|
+
});
|
|
469
|
+
return attemptOf(requireAttemptRow(attemptId));
|
|
470
|
+
});
|
|
471
|
+
},
|
|
472
|
+
publishAttempt(lease, presentedId) {
|
|
473
|
+
const attemptId = requirePositive(presentedId, 'attemptId');
|
|
474
|
+
return asHolder(lease, () => {
|
|
475
|
+
const row = requireAttemptRow(attemptId);
|
|
476
|
+
const attempt = verifiedAttempt(attemptOf(row));
|
|
477
|
+
if (attempt.state === 'completed') {
|
|
478
|
+
// Already verified above: its exact result resolves, so re-publication acknowledges it.
|
|
479
|
+
if (attempt.result === null) {
|
|
480
|
+
throw new HistoryIntegrityError(`Completed attempt ${String(attemptId)} has no result reference`);
|
|
481
|
+
}
|
|
482
|
+
return attempt.result;
|
|
483
|
+
}
|
|
484
|
+
if (attempt.state !== 'staged') {
|
|
485
|
+
throw new AttemptStateError(`Attempt ${String(attemptId)} cannot be published from state ${attempt.state}`);
|
|
486
|
+
}
|
|
487
|
+
const payload = text(row, 'staged_payload');
|
|
488
|
+
const root = decodeSnapshot(payload);
|
|
489
|
+
if (root === null || typeof root !== 'object') {
|
|
490
|
+
throw new HistoryIntegrityError('Staged payload root is not a container');
|
|
491
|
+
}
|
|
492
|
+
const rows = buildIndex(root, options.sha256);
|
|
493
|
+
const publication = safeSum(readSequences().lastPublication, 1, 'publication sequence');
|
|
494
|
+
statements.setPublicationSequence.run(publication);
|
|
495
|
+
statements.insertResult.run(attemptId, attempt.analysis, attempt.environment, attempt.subject, attempt.version, publication, lease.fence, payloadEncoding, indexVersion, payload, text(row, 'staged_provenance_format'), integer(row, 'staged_provenance_version'), text(row, 'staged_provenance'));
|
|
496
|
+
index.insert(attemptId, rows);
|
|
497
|
+
if (statements.completeAttempt.run(lease.fence, attemptId).changes !== 1) {
|
|
498
|
+
throw new HistoryIntegrityError(`Attempt ${String(attemptId)} changed state during publication`);
|
|
499
|
+
}
|
|
500
|
+
statements.setCurrent.run(attempt.analysis, attempt.environment, attempt.subject, attemptId);
|
|
501
|
+
return referenceOf(attemptId, attempt);
|
|
502
|
+
});
|
|
503
|
+
},
|
|
504
|
+
abandonAttempt(lease, request) {
|
|
505
|
+
const attemptId = requirePositive(request.attemptId, 'attemptId');
|
|
506
|
+
const outcome = request.outcome;
|
|
507
|
+
if (outcome !== 'failed' && outcome !== 'interrupted') {
|
|
508
|
+
throw new TypeError('An abandoned attempt outcome must be "failed" or "interrupted"');
|
|
509
|
+
}
|
|
510
|
+
const evidence = storeRecord(request.evidence, 'outcome evidence');
|
|
511
|
+
return asHolder(lease, () => {
|
|
512
|
+
const attempt = verifiedAttempt(attemptOf(requireAttemptRow(attemptId)));
|
|
513
|
+
if (attempt.state !== 'allocated' && attempt.state !== 'staged') {
|
|
514
|
+
throw new AttemptStateError(`Attempt ${String(attemptId)} cannot be abandoned from state ${attempt.state}`);
|
|
515
|
+
}
|
|
516
|
+
statements.abandonAttempt.run(outcome, lease.fence, evidence.format, evidence.formatVersion, evidence.content, attemptId);
|
|
517
|
+
return attemptOf(requireAttemptRow(attemptId));
|
|
518
|
+
});
|
|
519
|
+
},
|
|
520
|
+
recoverAttempt(presented) {
|
|
521
|
+
const request = attemptRequest(presented);
|
|
522
|
+
const row = statements.attemptByKey.get(request.analysis, request.environment, request.subject, request.attemptKey);
|
|
523
|
+
if (row === undefined) {
|
|
524
|
+
return Object.freeze({ kind: 'absent' });
|
|
525
|
+
}
|
|
526
|
+
const attempt = attemptOf(row);
|
|
527
|
+
assertSameExecution(attempt, request);
|
|
528
|
+
return recoveryOf(verifiedAttempt(attempt));
|
|
529
|
+
},
|
|
530
|
+
findCandidates(presented) {
|
|
531
|
+
const subject = versionedSubject(presented);
|
|
532
|
+
return Object.freeze(statements.candidates.all(subject.analysis, subject.environment, subject.subject, subject.version).map(envelopeOf));
|
|
533
|
+
},
|
|
534
|
+
readCurrent(presented) {
|
|
535
|
+
const subject = scopedSubject(presented);
|
|
536
|
+
const row = statements.current.get(subject.analysis, subject.environment, subject.subject);
|
|
537
|
+
if (row === undefined) {
|
|
538
|
+
return undefined;
|
|
539
|
+
}
|
|
540
|
+
if (row.present === null) {
|
|
541
|
+
throw new HistoryIntegrityError('Current pointer names a missing or wrong-scope result');
|
|
542
|
+
}
|
|
543
|
+
const reference = referenceOf(integer(row, 'result_id'), subject);
|
|
544
|
+
// The latest publication must itself resolve exactly; a corrupted target is never offered as current.
|
|
545
|
+
resolveResult(reference, subject);
|
|
546
|
+
return reference;
|
|
547
|
+
},
|
|
548
|
+
readEnvelope(reference) {
|
|
549
|
+
const { resultId } = resolveResult(reference);
|
|
550
|
+
const row = statements.envelope.get(resultId);
|
|
551
|
+
if (row === undefined) {
|
|
552
|
+
throw new HistoryIntegrityError(`Missing exact completed result ${reference.locator}`);
|
|
553
|
+
}
|
|
554
|
+
return envelopeOf(row);
|
|
555
|
+
},
|
|
556
|
+
verifyResult(reference) {
|
|
557
|
+
const { resultId } = resolveResult(reference);
|
|
558
|
+
return index.verify(resultId);
|
|
559
|
+
},
|
|
560
|
+
recordAcceptance(lease, request) {
|
|
561
|
+
const evidence = storeRecord(request.evidence, 'acceptance evidence');
|
|
562
|
+
const references = [...request.dependencies];
|
|
563
|
+
return asHolder(lease, () => {
|
|
564
|
+
const { resultId, scope } = resolveResult(request.reference);
|
|
565
|
+
const dependencies = dependencyIds(references, scope);
|
|
566
|
+
const acceptanceId = safeSum(readSequences().lastAcceptance, 1, 'acceptance identity');
|
|
567
|
+
statements.setAcceptanceSequence.run(acceptanceId);
|
|
568
|
+
statements.insertAcceptance.run(acceptanceId, resultId, lease.fence, evidence.format, evidence.formatVersion, evidence.content);
|
|
569
|
+
dependencies.forEach((dependencyId, position) => {
|
|
570
|
+
statements.insertAcceptanceDependency.run(acceptanceId, position, dependencyId);
|
|
571
|
+
});
|
|
572
|
+
const row = statements.acceptances.all(resultId).find((candidate) => candidate.acceptance_id === acceptanceId);
|
|
573
|
+
if (row === undefined) {
|
|
574
|
+
throw new HistoryIntegrityError('Recorded acceptance is not readable');
|
|
575
|
+
}
|
|
576
|
+
return acceptanceOf(row, referenceOf(resultId, scope), scope);
|
|
577
|
+
});
|
|
578
|
+
},
|
|
579
|
+
readAcceptances(reference) {
|
|
580
|
+
const { resultId, scope } = resolveResult(reference);
|
|
581
|
+
const exact = referenceOf(resultId, scope);
|
|
582
|
+
return Object.freeze(statements.acceptances.all(resultId).map((row) => acceptanceOf(row, exact, scope)));
|
|
583
|
+
},
|
|
584
|
+
close() {
|
|
585
|
+
connection.close();
|
|
586
|
+
},
|
|
587
|
+
};
|
|
588
|
+
return Object.freeze(history);
|
|
589
|
+
}
|
|
590
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/durable/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAwBnE,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEpF,2EAA2E;AAC3E,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;AAEvB,sEAAsE;AACtE,MAAM,eAAe,GAAG,MAAM,CAAC;AAiB/B,2CAA2C;AAC3C,SAAS,WAAW,CAAC,KAAc,EAAE,IAAY;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,6BAA6B,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,gDAAgD;AAChD,SAAS,eAAe,CAAC,KAAc,EAAE,IAAY;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,I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