hikoutei 0.4.2 → 0.4.3
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/application/sync/outbound/SheetsEffectDispatcher.d.ts +64 -0
- package/dist/application/sync/outbound/SheetsEffectDispatcher.d.ts.map +1 -0
- package/dist/application/sync/outbound/SheetsEffectDispatcher.js +440 -0
- package/dist/application/sync/outbound/SheetsEffectDispatcher.js.map +1 -0
- package/dist/application/sync/service/SyncServiceBootstrap.d.ts +3 -4
- package/dist/application/sync/service/SyncServiceBootstrap.d.ts.map +1 -1
- package/dist/application/sync/service/SyncServiceBootstrap.js +7 -4
- package/dist/application/sync/service/SyncServiceBootstrap.js.map +1 -1
- package/dist/application/sync/telemetry/syncTiming.d.ts +20 -33
- package/dist/application/sync/telemetry/syncTiming.d.ts.map +1 -1
- package/dist/application/sync/telemetry/syncTiming.js +14 -12
- package/dist/application/sync/telemetry/syncTiming.js.map +1 -1
- package/dist/infrastructure/storage/errors.d.ts +10 -5
- package/dist/infrastructure/storage/errors.d.ts.map +1 -1
- package/dist/infrastructure/storage/errors.js +10 -7
- package/dist/infrastructure/storage/errors.js.map +1 -1
- package/dist/infrastructure/storage/index.d.ts +6 -4
- package/dist/infrastructure/storage/index.d.ts.map +1 -1
- package/dist/infrastructure/storage/index.js +3 -2
- package/dist/infrastructure/storage/index.js.map +1 -1
- package/dist/infrastructure/storage/sqlite/schema.d.ts +12 -11
- package/dist/infrastructure/storage/sqlite/schema.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite/schema.js +17 -109
- package/dist/infrastructure/storage/sqlite/schema.js.map +1 -1
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.d.ts +2 -2
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.js +2 -2
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.js.map +1 -1
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceContext.d.ts +1 -2
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceContext.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceContext.js +1 -2
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceContext.js.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationCanonical.d.ts +1 -1
- package/dist/infrastructure/storage/state/observation/observationCanonical.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.d.ts +1 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.js +1 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.js.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationTypes.d.ts +1 -1
- package/dist/infrastructure/storage/state/observation/observationTypes.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationValidation.d.ts +1 -1
- package/dist/infrastructure/storage/state/observation/observationValidation.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationWriter.d.ts +1 -1
- package/dist/infrastructure/storage/state/observation/observationWriter.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationWriter.js +1 -2
- package/dist/infrastructure/storage/state/observation/observationWriter.js.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.d.ts +1 -2
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.js +1 -2
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.js.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterContracts.d.ts +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterContracts.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.d.ts +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.js +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.js.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterSql.d.ts +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterSql.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterSql.js +2 -2
- package/dist/infrastructure/storage/state/resolution/resolutionWriterSql.js.map +1 -1
- package/dist/infrastructure/storage/sync/shared/spreadsheetAuthority.d.ts +1 -1
- package/dist/infrastructure/storage/sync/shared/spreadsheetAuthority.d.ts.map +1 -1
- package/dist/infrastructure/storage/sync/shared/spreadsheetAuthority.js +1 -1
- package/dist/infrastructure/storage/sync/shared/spreadsheetAuthority.js.map +1 -1
- package/dist/infrastructure/storage/sync/shared/syncRegistry.d.ts +1 -1
- package/dist/infrastructure/storage/sync/shared/syncRegistry.js +1 -1
- package/package.json +13 -7
- package/dist/application/sync/outbound/effects/AdaptiveEffectBatchController.d.ts +0 -66
- package/dist/application/sync/outbound/effects/AdaptiveEffectBatchController.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/AdaptiveEffectBatchController.js +0 -123
- package/dist/application/sync/outbound/effects/AdaptiveEffectBatchController.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.d.ts +0 -111
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.js +0 -369
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorker.d.ts +0 -127
- package/dist/application/sync/outbound/effects/SyncEffectWorker.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorker.js +0 -552
- package/dist/application/sync/outbound/effects/SyncEffectWorker.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.d.ts +0 -85
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.js +0 -74
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.d.ts +0 -31
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.js +0 -222
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.d.ts +0 -14
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.js +0 -25
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.d.ts +0 -61
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.js +0 -296
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTiming.d.ts +0 -17
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTiming.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTiming.js +0 -80
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTiming.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.d.ts +0 -13
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.js +0 -248
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.js.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.d.ts +0 -141
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.d.ts.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.js +0 -318
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.js.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.d.ts +0 -143
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.d.ts.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.js +0 -16
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.js.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.d.ts +0 -33
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.d.ts.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.js +0 -259
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.js.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.d.ts +0 -27
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.d.ts.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.js +0 -316
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.js.map +0 -1
- package/dist/infrastructure/storage/sync/shared/writerLease.d.ts +0 -76
- package/dist/infrastructure/storage/sync/shared/writerLease.d.ts.map +0 -1
- package/dist/infrastructure/storage/sync/shared/writerLease.js +0 -189
- package/dist/infrastructure/storage/sync/shared/writerLease.js.map +0 -1
- package/docs/advanced-sheets-gateway-concurrency-problem.md +0 -434
- package/docs/architecture.md +0 -224
- package/docs/ci.md +0 -293
- package/docs/code-guidelines.md +0 -248
- package/docs/development.md +0 -74
- package/docs/gateway-removal-inventory.md +0 -147
- package/docs/git-workflow.md +0 -224
- package/docs/google-sheets-sync-scaling-strategy.md +0 -459
- package/docs/mikro-orm-adapter-spike.md +0 -89
- package/docs/quick-start.md +0 -137
- package/docs/sql-layer-plan.md +0 -59
- package/docs/sync-bulk-write-benchmark.md +0 -2117
- package/docs/sync-observability.md +0 -100
- package/docs/task-queue-write-model.md +0 -640
- package/docs/typed-sheets-mvp-scope-2026-06-29.md +0 -490
- package/docs/typed-sheets-plan.md +0 -417
- package/docs/write-and-synchronization-flow.md +0 -179
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Keeps the bounded effect worker running until the durable outbox is idle.
|
|
3
|
-
*
|
|
4
|
-
* The supervisor provides liveness around `runSyncEffectWorker*()`: one pass
|
|
5
|
-
* still handles a bounded batch, while this loop starts the next pass and
|
|
6
|
-
* backs off after failures. It also coalesces manual and background triggers so
|
|
7
|
-
* one process cannot run two effect passes concurrently.
|
|
8
|
-
*/
|
|
9
|
-
import { randomUUID } from "node:crypto";
|
|
10
|
-
import { NON_NEGATIVE_SAFE_INTEGER_MINIMUM, POSITIVE_SAFE_INTEGER_MINIMUM, } from "../../../../domain/index.js";
|
|
11
|
-
import { runSyncEffectWorkerWithAdapter, } from "./SyncEffectWorker.js";
|
|
12
|
-
import { AdaptiveEffectBatchController, } from "./AdaptiveEffectBatchController.js";
|
|
13
|
-
const DEFAULT_MAX_EFFECTS = 20;
|
|
14
|
-
const DEFAULT_IDLE_INTERVAL_MS = 1_000;
|
|
15
|
-
const DEFAULT_ERROR_BACKOFF_INITIAL_MS = 1_000;
|
|
16
|
-
const DEFAULT_ERROR_BACKOFF_MAX_MS = 30_000;
|
|
17
|
-
const DEFAULT_JITTER_MAX_MS = 1_000;
|
|
18
|
-
const DEFAULT_RECONCILIATION_INTERVAL_MS = 60_000;
|
|
19
|
-
/**
|
|
20
|
-
* Runs one bounded effect pass at a time and continues while work is making
|
|
21
|
-
* progress. `stop()` waits for the current remote call to finish before the
|
|
22
|
-
* loop exits, so the caller does not close SQLite underneath an active pass.
|
|
23
|
-
*/
|
|
24
|
-
export class SyncEffectWorkerSupervisor {
|
|
25
|
-
runPass;
|
|
26
|
-
idleIntervalMs;
|
|
27
|
-
errorBackoffInitialMs;
|
|
28
|
-
errorBackoffMaxMs;
|
|
29
|
-
random;
|
|
30
|
-
wait;
|
|
31
|
-
now;
|
|
32
|
-
reconciliation;
|
|
33
|
-
reconciliationIntervalMs;
|
|
34
|
-
onReport;
|
|
35
|
-
onError;
|
|
36
|
-
running = false;
|
|
37
|
-
acceptingPasses = true;
|
|
38
|
-
loopPromise;
|
|
39
|
-
inFlightPass;
|
|
40
|
-
inFlightReconciliation;
|
|
41
|
-
stopPromise;
|
|
42
|
-
nextReconciliationAt = 0;
|
|
43
|
-
wakeWaiter;
|
|
44
|
-
constructor(options) {
|
|
45
|
-
this.runPass = options.runPass;
|
|
46
|
-
this.idleIntervalMs = requirePositiveSafeInteger(options.idleIntervalMs ?? DEFAULT_IDLE_INTERVAL_MS, "sync effect supervisor idle interval");
|
|
47
|
-
this.errorBackoffInitialMs = requirePositiveSafeInteger(options.errorBackoffInitialMs ?? DEFAULT_ERROR_BACKOFF_INITIAL_MS, "sync effect supervisor error backoff");
|
|
48
|
-
this.errorBackoffMaxMs = requirePositiveSafeInteger(options.errorBackoffMaxMs ?? DEFAULT_ERROR_BACKOFF_MAX_MS, "sync effect supervisor maximum error backoff");
|
|
49
|
-
if (this.errorBackoffMaxMs < this.errorBackoffInitialMs) {
|
|
50
|
-
throw new RangeError("sync effect supervisor maximum error backoff must be at least the initial backoff");
|
|
51
|
-
}
|
|
52
|
-
this.random = options.random ?? Math.random;
|
|
53
|
-
this.wait = options.wait ?? defaultWait;
|
|
54
|
-
this.now = options.now ?? Date.now;
|
|
55
|
-
this.reconciliation = options.reconciliation;
|
|
56
|
-
this.reconciliationIntervalMs = requirePositiveSafeInteger(options.reconciliation?.intervalMs ?? DEFAULT_RECONCILIATION_INTERVAL_MS, "sync effect supervisor reconciliation interval");
|
|
57
|
-
this.onReport = options.onReport;
|
|
58
|
-
this.onError = options.onError;
|
|
59
|
-
}
|
|
60
|
-
/** Starts the background drain loop; repeated calls are harmless. */
|
|
61
|
-
start() {
|
|
62
|
-
if (this.running || !this.acceptingPasses)
|
|
63
|
-
return;
|
|
64
|
-
this.running = true;
|
|
65
|
-
this.nextReconciliationAt = this.now();
|
|
66
|
-
this.loopPromise = this.runLoop();
|
|
67
|
-
}
|
|
68
|
-
/** Returns whether the supervisor is accepting background work. */
|
|
69
|
-
isRunning() {
|
|
70
|
-
return this.running;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Runs one pass or joins the pass already running in this process.
|
|
74
|
-
* Manual HTTP triggers therefore cannot create a second concurrent worker.
|
|
75
|
-
*/
|
|
76
|
-
runOnce() {
|
|
77
|
-
if (!this.acceptingPasses) {
|
|
78
|
-
return Promise.reject(new Error("sync effect supervisor is stopped"));
|
|
79
|
-
}
|
|
80
|
-
if (this.inFlightPass !== undefined)
|
|
81
|
-
return this.inFlightPass;
|
|
82
|
-
const pass = Promise.resolve().then(() => this.runPass());
|
|
83
|
-
this.inFlightPass = pass;
|
|
84
|
-
void pass.then(() => this.clearInFlightPass(pass), () => this.clearInFlightPass(pass));
|
|
85
|
-
return pass;
|
|
86
|
-
}
|
|
87
|
-
/** Stops scheduling new passes and waits for the active pass to finish. */
|
|
88
|
-
stop() {
|
|
89
|
-
if (this.stopPromise !== undefined)
|
|
90
|
-
return this.stopPromise;
|
|
91
|
-
this.acceptingPasses = false;
|
|
92
|
-
this.running = false;
|
|
93
|
-
this.wakeWaiter?.();
|
|
94
|
-
this.stopPromise = (async () => {
|
|
95
|
-
const loop = this.loopPromise;
|
|
96
|
-
if (loop !== undefined)
|
|
97
|
-
await loop.catch(() => undefined);
|
|
98
|
-
const inFlightPass = this.inFlightPass;
|
|
99
|
-
if (inFlightPass !== undefined)
|
|
100
|
-
await inFlightPass.catch(() => undefined);
|
|
101
|
-
const inFlightReconciliation = this.inFlightReconciliation;
|
|
102
|
-
if (inFlightReconciliation !== undefined) {
|
|
103
|
-
await inFlightReconciliation.catch(() => undefined);
|
|
104
|
-
}
|
|
105
|
-
this.loopPromise = undefined;
|
|
106
|
-
})();
|
|
107
|
-
return this.stopPromise;
|
|
108
|
-
}
|
|
109
|
-
async runLoop() {
|
|
110
|
-
let errorBackoff = this.errorBackoffInitialMs;
|
|
111
|
-
while (this.running) {
|
|
112
|
-
try {
|
|
113
|
-
let report = await this.runOnce();
|
|
114
|
-
this.notifyReport(report);
|
|
115
|
-
if (!this.running)
|
|
116
|
-
break;
|
|
117
|
-
const reconciliation = await this.runScheduledReconciliation(report);
|
|
118
|
-
if (reconciliation !== undefined && reconciliation.effectsEnqueued > 0 && this.running) {
|
|
119
|
-
// The scan only enqueues corrections. Drain those corrections before
|
|
120
|
-
// sleeping so a discovered drift does not wait for another tick.
|
|
121
|
-
report = await this.runOnce();
|
|
122
|
-
this.notifyReport(report);
|
|
123
|
-
}
|
|
124
|
-
if (!this.running)
|
|
125
|
-
break;
|
|
126
|
-
if (hasImmediateProgress(report) ||
|
|
127
|
-
(reconciliation !== undefined && reconciliation.effectsEnqueued > 0)) {
|
|
128
|
-
if (report.failed > 0 || isResponseLossRetryLoop(report)) {
|
|
129
|
-
// Back off when the pass only requeued work (a response-loss or
|
|
130
|
-
// postcondition-unapplied loop) or failed outright, so a struggling
|
|
131
|
-
// remote is not retried in a tight immediate loop. The backoff is
|
|
132
|
-
// bounded by errorBackoffMaxMs and resets as soon as forward
|
|
133
|
-
// progress resumes; lease expiry and recovery still keep effects
|
|
134
|
-
// live.
|
|
135
|
-
const delay = withJitter(errorBackoff, this.random);
|
|
136
|
-
await this.waitFor(Math.min(this.errorBackoffMaxMs, delay));
|
|
137
|
-
errorBackoff = nextBackoff(errorBackoff, this.errorBackoffMaxMs);
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
errorBackoff = this.errorBackoffInitialMs;
|
|
141
|
-
}
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
errorBackoff = this.errorBackoffInitialMs;
|
|
145
|
-
await this.waitFor(this.idleIntervalMs);
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
this.notifyError(error);
|
|
149
|
-
if (!this.running)
|
|
150
|
-
break;
|
|
151
|
-
const delay = withJitter(errorBackoff, this.random);
|
|
152
|
-
await this.waitFor(Math.min(this.errorBackoffMaxMs, delay));
|
|
153
|
-
errorBackoff = nextBackoff(errorBackoff, this.errorBackoffMaxMs);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
/** Runs the reconciliation task when its interval has elapsed. */
|
|
158
|
-
async runScheduledReconciliation(workerReport) {
|
|
159
|
-
const reconciliation = this.reconciliation;
|
|
160
|
-
if (reconciliation === undefined || this.now() < this.nextReconciliationAt)
|
|
161
|
-
return undefined;
|
|
162
|
-
// Reconciliation is a safety net, not part of the normal write path. Wait
|
|
163
|
-
// until the just-completed worker pass reports no remaining ready work.
|
|
164
|
-
if (!isWorkerPassIdle(workerReport))
|
|
165
|
-
return undefined;
|
|
166
|
-
this.nextReconciliationAt = this.now() + this.reconciliationIntervalMs;
|
|
167
|
-
try {
|
|
168
|
-
if (reconciliation.isOutboxIdle !== undefined && !(await reconciliation.isOutboxIdle())) {
|
|
169
|
-
return undefined;
|
|
170
|
-
}
|
|
171
|
-
const report = await this.runReconciliationOnce(reconciliation);
|
|
172
|
-
this.notifyReconciliationReport(reconciliation, report);
|
|
173
|
-
return report;
|
|
174
|
-
}
|
|
175
|
-
catch (error) {
|
|
176
|
-
this.notifyReconciliationError(reconciliation, error);
|
|
177
|
-
return undefined;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/** Coalesces a manual/scheduled reconciliation call in this process. */
|
|
181
|
-
runReconciliationOnce(reconciliation) {
|
|
182
|
-
if (this.inFlightReconciliation !== undefined)
|
|
183
|
-
return this.inFlightReconciliation;
|
|
184
|
-
const pass = Promise.resolve().then(() => reconciliation.run());
|
|
185
|
-
this.inFlightReconciliation = pass;
|
|
186
|
-
void pass.then(() => this.clearInFlightReconciliation(pass), () => this.clearInFlightReconciliation(pass));
|
|
187
|
-
return pass;
|
|
188
|
-
}
|
|
189
|
-
notifyReconciliationReport(reconciliation, report) {
|
|
190
|
-
try {
|
|
191
|
-
reconciliation.onReport?.(report);
|
|
192
|
-
}
|
|
193
|
-
catch (error) {
|
|
194
|
-
this.notifyError(error);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
notifyReconciliationError(reconciliation, error) {
|
|
198
|
-
if (reconciliation.onError === undefined) {
|
|
199
|
-
this.notifyError(error);
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
try {
|
|
203
|
-
reconciliation.onError(error);
|
|
204
|
-
}
|
|
205
|
-
catch (callbackError) {
|
|
206
|
-
this.notifyError(callbackError);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
notifyReport(report) {
|
|
210
|
-
try {
|
|
211
|
-
this.onReport?.(report);
|
|
212
|
-
}
|
|
213
|
-
catch (error) {
|
|
214
|
-
this.notifyError(error);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
notifyError(error) {
|
|
218
|
-
try {
|
|
219
|
-
this.onError?.(error);
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
// Observability callbacks must not terminate the drain loop.
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
async waitFor(durationMs) {
|
|
226
|
-
if (!this.running)
|
|
227
|
-
return;
|
|
228
|
-
if (this.wait !== defaultWait) {
|
|
229
|
-
await this.wait(durationMs);
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
await new Promise((resolve) => {
|
|
233
|
-
const timer = setTimeout(() => {
|
|
234
|
-
if (this.wakeWaiter === wake)
|
|
235
|
-
this.wakeWaiter = undefined;
|
|
236
|
-
resolve();
|
|
237
|
-
}, durationMs);
|
|
238
|
-
const wake = () => {
|
|
239
|
-
clearTimeout(timer);
|
|
240
|
-
if (this.wakeWaiter === wake)
|
|
241
|
-
this.wakeWaiter = undefined;
|
|
242
|
-
resolve();
|
|
243
|
-
};
|
|
244
|
-
this.wakeWaiter = wake;
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
clearInFlightPass(pass) {
|
|
248
|
-
if (this.inFlightPass === pass)
|
|
249
|
-
this.inFlightPass = undefined;
|
|
250
|
-
}
|
|
251
|
-
clearInFlightReconciliation(pass) {
|
|
252
|
-
if (this.inFlightReconciliation === pass)
|
|
253
|
-
this.inFlightReconciliation = undefined;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
/** Creates a supervisor that supplies a fresh timestamp to every worker pass. */
|
|
257
|
-
export function createSyncEffectWorkerSupervisor(options) {
|
|
258
|
-
const workerId = options.workerId ?? `sync-effect-worker:${randomUUID()}`;
|
|
259
|
-
const maxEffects = options.maxEffects ?? DEFAULT_MAX_EFFECTS;
|
|
260
|
-
const now = options.now ?? Date.now;
|
|
261
|
-
validateWorkerOptions(workerId, maxEffects, options.maxFastAppendCandidates, options.appendDispatchIntervalMs);
|
|
262
|
-
const batchController = options.batchController ?? new AdaptiveEffectBatchController({
|
|
263
|
-
...(options.appendDispatchIntervalMs === undefined
|
|
264
|
-
? {}
|
|
265
|
-
: { appendDispatchIntervalMs: options.appendDispatchIntervalMs }),
|
|
266
|
-
});
|
|
267
|
-
const workerOptions = {
|
|
268
|
-
storage: options.storage,
|
|
269
|
-
provider: options.provider,
|
|
270
|
-
batchController,
|
|
271
|
-
clock: now,
|
|
272
|
-
workerId,
|
|
273
|
-
maxEffects,
|
|
274
|
-
now: now(),
|
|
275
|
-
...(options.writerRole === undefined ? {} : { writerRole: options.writerRole }),
|
|
276
|
-
...(options.writerLeaseDurationMs === undefined
|
|
277
|
-
? {}
|
|
278
|
-
: { writerLeaseDurationMs: options.writerLeaseDurationMs }),
|
|
279
|
-
...(options.effectLeaseDurationMs === undefined
|
|
280
|
-
? {}
|
|
281
|
-
: { effectLeaseDurationMs: options.effectLeaseDurationMs }),
|
|
282
|
-
...(options.requestTimeoutMs === undefined
|
|
283
|
-
? {}
|
|
284
|
-
: { requestTimeoutMs: options.requestTimeoutMs }),
|
|
285
|
-
...(options.maxFastAppendCandidates === undefined
|
|
286
|
-
? {}
|
|
287
|
-
: { maxFastAppendCandidates: options.maxFastAppendCandidates }),
|
|
288
|
-
...(options.appendDispatchIntervalMs === undefined
|
|
289
|
-
? {}
|
|
290
|
-
: { appendDispatchIntervalMs: options.appendDispatchIntervalMs }),
|
|
291
|
-
...(options.makeRepairReplan === undefined
|
|
292
|
-
? {}
|
|
293
|
-
: { makeRepairReplan: options.makeRepairReplan }),
|
|
294
|
-
...(options.onTiming === undefined ? {} : { onTiming: options.onTiming }),
|
|
295
|
-
};
|
|
296
|
-
return new SyncEffectWorkerSupervisor({
|
|
297
|
-
...options,
|
|
298
|
-
now,
|
|
299
|
-
runPass: () => runSyncEffectWorkerWithAdapter({ ...workerOptions, now: now() }),
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
function hasImmediateProgress(report) {
|
|
303
|
-
return report.claimed > 0;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* A pass claimed work but reached no terminal state and only requeued it is a
|
|
307
|
-
* response-loss / postcondition-unapplied retry loop against the remote.
|
|
308
|
-
* `requeued` always implies `deferred` in the worker, so it covers both the
|
|
309
|
-
* fast-append and regular recovery paths. Forward progress elsewhere (an
|
|
310
|
-
* applied/superseded/conflicted/blocked/replanned/failed effect) keeps the
|
|
311
|
-
* drain loop running immediately.
|
|
312
|
-
*/
|
|
313
|
-
function isResponseLossRetryLoop(report) {
|
|
314
|
-
return report.claimed > 0 &&
|
|
315
|
-
report.requeued > 0 &&
|
|
316
|
-
!hasForwardProgress(report);
|
|
317
|
-
}
|
|
318
|
-
function hasForwardProgress(report) {
|
|
319
|
-
return report.applied > 0 ||
|
|
320
|
-
report.superseded > 0 ||
|
|
321
|
-
report.conflicted > 0 ||
|
|
322
|
-
report.blockedCandidate > 0 ||
|
|
323
|
-
report.replanned > 0 ||
|
|
324
|
-
report.failed > 0;
|
|
325
|
-
}
|
|
326
|
-
function isWorkerPassIdle(report) {
|
|
327
|
-
return report.selected === 0 &&
|
|
328
|
-
report.claimed === 0 &&
|
|
329
|
-
report.expiredLeasesRecovered === 0 &&
|
|
330
|
-
report.deferred === 0 &&
|
|
331
|
-
report.requeued === 0 &&
|
|
332
|
-
report.replanned === 0;
|
|
333
|
-
}
|
|
334
|
-
function nextBackoff(current, maximum) {
|
|
335
|
-
return Math.min(maximum, current * 2);
|
|
336
|
-
}
|
|
337
|
-
function withJitter(durationMs, random) {
|
|
338
|
-
const sample = random();
|
|
339
|
-
const normalized = Number.isFinite(sample) ? Math.max(0, Math.min(1, sample)) : 0;
|
|
340
|
-
return durationMs + Math.floor(normalized * DEFAULT_JITTER_MAX_MS);
|
|
341
|
-
}
|
|
342
|
-
function validateWorkerOptions(workerId, maxEffects, maxFastAppendCandidates, appendDispatchIntervalMs) {
|
|
343
|
-
if (workerId.length === NON_NEGATIVE_SAFE_INTEGER_MINIMUM) {
|
|
344
|
-
throw new RangeError("sync effect supervisor worker ID is required");
|
|
345
|
-
}
|
|
346
|
-
if (!Number.isSafeInteger(maxEffects) || maxEffects < POSITIVE_SAFE_INTEGER_MINIMUM) {
|
|
347
|
-
throw new RangeError("sync effect supervisor maxEffects must be a positive safe integer");
|
|
348
|
-
}
|
|
349
|
-
if (maxFastAppendCandidates !== undefined &&
|
|
350
|
-
(!Number.isSafeInteger(maxFastAppendCandidates) ||
|
|
351
|
-
maxFastAppendCandidates < POSITIVE_SAFE_INTEGER_MINIMUM)) {
|
|
352
|
-
throw new RangeError("sync effect supervisor maxFastAppendCandidates must be a positive safe integer");
|
|
353
|
-
}
|
|
354
|
-
if (appendDispatchIntervalMs !== undefined &&
|
|
355
|
-
(!Number.isSafeInteger(appendDispatchIntervalMs) ||
|
|
356
|
-
appendDispatchIntervalMs < NON_NEGATIVE_SAFE_INTEGER_MINIMUM)) {
|
|
357
|
-
throw new RangeError("sync effect supervisor appendDispatchIntervalMs must be a non-negative safe integer");
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function requirePositiveSafeInteger(value, name) {
|
|
361
|
-
if (!Number.isSafeInteger(value) || value < POSITIVE_SAFE_INTEGER_MINIMUM) {
|
|
362
|
-
throw new RangeError(name + " must be a positive safe integer");
|
|
363
|
-
}
|
|
364
|
-
return value;
|
|
365
|
-
}
|
|
366
|
-
function defaultWait(durationMs) {
|
|
367
|
-
return new Promise((resolve) => setTimeout(resolve, durationMs));
|
|
368
|
-
}
|
|
369
|
-
//# sourceMappingURL=SyncEffectSupervisor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SyncEffectSupervisor.js","sourceRoot":"","sources":["../../../../../src/application/sync/outbound/effects/SyncEffectSupervisor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,iCAAiC,EACjC,6BAA6B,GAC9B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,8BAA8B,GAG/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,6BAA6B,GAE9B,MAAM,oCAAoC,CAAC;AAE5C,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,wBAAwB,GAAG,KAAK,CAAC;AACvC,MAAM,gCAAgC,GAAG,KAAK,CAAC;AAC/C,MAAM,4BAA4B,GAAG,MAAM,CAAC;AAC5C,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,kCAAkC,GAAG,MAAM,CAAC;AAuDlD;;;;GAIG;AACH,MAAM,OAAO,0BAA0B;IACpB,OAAO,CAAU;IACjB,cAAc,CAAS;IACvB,qBAAqB,CAAS;IAC9B,iBAAiB,CAAS;IAC1B,MAAM,CAAe;IACrB,IAAI,CAAiC;IACrC,GAAG,CAAe;IAClB,cAAc,CAA8D;IAC5E,wBAAwB,CAAS;IACjC,QAAQ,CAAyD;IACjE,OAAO,CAAyC;IACzD,OAAO,GAAG,KAAK,CAAC;IAChB,eAAe,GAAG,IAAI,CAAC;IACvB,WAAW,CAA4B;IACvC,YAAY,CAA8C;IAC1D,sBAAsB,CAAgD;IACtE,WAAW,CAA4B;IACvC,oBAAo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C,MAAM,CAAC,aAAa,CAAC,wBAAwB,CAAC;YAC9C,wBAAwB,GAAG,iCAAiC,CAAC,EAC/D,CAAC;QACD,MAAM,IAAI,UAAU,CAClB,qFAAqF,CACtF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,0BAA0B,CAAC,KAAa,EAAE,IAAY;IAC7D,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,6BAA6B,EAAE,CAAC;QAC1E,MAAM,IAAI,UAAU,CAAC,IAAI,GAAG,kCAAkC,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,UAAkB;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fenced outbox worker for projection effects.
|
|
3
|
-
*
|
|
4
|
-
* It owns only claim/result transitions. Canonical state and any repair
|
|
5
|
-
* replan payload are supplied by the writer boundary; the provider is never
|
|
6
|
-
* allowed to choose a winner or silently retry a response-lost write.
|
|
7
|
-
*/
|
|
8
|
-
import { type Presence } from "../../../../domain/index.js";
|
|
9
|
-
import { type ApplyResultOptions, type ClaimEffectOptions, type ClaimLeaseOptions, type ClaimResult, type MarkDeliveryUncertainOptions, type FencingContext, type RenewEffectLeaseOptions, type NewEffect, type PendingEffect, type RetryClaimedEffectOptions, type WriterLease, type WriterLeaseClaimResult } from "../../../../infrastructure/storage/index.js";
|
|
10
|
-
import type { SqlStorageAdapter } from "../../../../adapter/persistence/contracts/sql.js";
|
|
11
|
-
import type { SyncEffectPostcondition, SyncProjectionEffect, SyncEffectResult, SyncEffectWorkerProvider } from "../../sheets/syncSheets.js";
|
|
12
|
-
import { type SyncTimingSink } from "../../telemetry/syncTiming.js";
|
|
13
|
-
import type { AdaptiveEffectBatchController } from "./AdaptiveEffectBatchController.js";
|
|
14
|
-
/** An effect plus evidence supplied to a writer-owned system-repair replanner. */
|
|
15
|
-
export interface RepairReplanRequest {
|
|
16
|
-
readonly effect: PendingEffect;
|
|
17
|
-
readonly providerResult: Presence<SyncEffectResult>;
|
|
18
|
-
readonly postcondition: Presence<SyncEffectPostcondition>;
|
|
19
|
-
}
|
|
20
|
-
/** Callback that creates a fresh effect without mutating the old evidence. */
|
|
21
|
-
export type RepairReplanFactory = (request: RepairReplanRequest) => Presence<NewEffect>;
|
|
22
|
-
/** Shared construction options for a bounded effect-worker pass. */
|
|
23
|
-
export interface SyncEffectWorkerBaseOptions {
|
|
24
|
-
readonly provider: SyncEffectWorkerProvider;
|
|
25
|
-
readonly workerId: string;
|
|
26
|
-
readonly now: number;
|
|
27
|
-
readonly maxEffects: number;
|
|
28
|
-
readonly writerRole?: string;
|
|
29
|
-
readonly writerLeaseDurationMs?: number;
|
|
30
|
-
readonly effectLeaseDurationMs?: number;
|
|
31
|
-
/** Internal transport timeout used to validate lease headroom. */
|
|
32
|
-
readonly requestTimeoutMs?: number;
|
|
33
|
-
readonly batchController?: AdaptiveEffectBatchController;
|
|
34
|
-
/**
|
|
35
|
-
* Internal bulk-append claim window for the real provider runtime. When
|
|
36
|
-
* set, a pass claims up to this many append candidates through a dedicated
|
|
37
|
-
* ready fast-append selection (so a regular/recovery backlog ahead of them
|
|
38
|
-
* cannot starve appends), and keeps the regular/recovery claim window at
|
|
39
|
-
* the bounded 20-effect limit. Direct workers and fake providers omit it
|
|
40
|
-
* and keep the 20-item window.
|
|
41
|
-
*/
|
|
42
|
-
readonly maxFastAppendCandidates?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Internal minimum interval between fast-append request starts. Only the
|
|
45
|
-
* full provider runtime sets it; the batch controller owns the actual wait.
|
|
46
|
-
*/
|
|
47
|
-
readonly appendDispatchIntervalMs?: number;
|
|
48
|
-
/** Shared supervisor clock used to refresh fencing timestamps after remote I/O. */
|
|
49
|
-
readonly clock?: () => number;
|
|
50
|
-
readonly makeRepairReplan?: RepairReplanFactory;
|
|
51
|
-
/** Optional diagnostics sink for worker and provider phases. */
|
|
52
|
-
readonly onTiming?: SyncTimingSink;
|
|
53
|
-
}
|
|
54
|
-
export type SyncEffectWorkerFullOptions = Omit<SyncEffectWorkerBaseOptions, "provider"> & {
|
|
55
|
-
readonly provider: SyncEffectWorkerProvider;
|
|
56
|
-
};
|
|
57
|
-
/** Construction options for a worker running through an async storage adapter. */
|
|
58
|
-
export interface SyncEffectWorkerWithAdapterOptions extends SyncEffectWorkerBaseOptions {
|
|
59
|
-
readonly storage: SqlStorageAdapter;
|
|
60
|
-
}
|
|
61
|
-
/** Counters that make partial results and recovery visible to callers. */
|
|
62
|
-
export interface SyncEffectWorkerReport {
|
|
63
|
-
readonly lease: Presence<WriterLease>;
|
|
64
|
-
readonly expiredLeasesRecovered: number;
|
|
65
|
-
readonly selected: number;
|
|
66
|
-
readonly claimed: number;
|
|
67
|
-
readonly applied: number;
|
|
68
|
-
readonly blockedCandidate: number;
|
|
69
|
-
readonly superseded: number;
|
|
70
|
-
readonly conflicted: number;
|
|
71
|
-
readonly failed: number;
|
|
72
|
-
readonly deferred: number;
|
|
73
|
-
readonly requeued: number;
|
|
74
|
-
readonly replanned: number;
|
|
75
|
-
readonly responseLossRecovered: number;
|
|
76
|
-
}
|
|
77
|
-
export interface ClaimedEffect {
|
|
78
|
-
readonly pending: PendingEffect;
|
|
79
|
-
readonly claimToken: string;
|
|
80
|
-
readonly providerEffect: Presence<SyncProjectionEffect>;
|
|
81
|
-
readonly invalidPayloadError: Presence<string>;
|
|
82
|
-
}
|
|
83
|
-
/** Persistence operations used by the shared effect-worker state machine. */
|
|
84
|
-
export interface EffectWorkerStorage {
|
|
85
|
-
claimWriterLease(options: ClaimLeaseOptions): Promise<WriterLeaseClaimResult>;
|
|
86
|
-
recoverExpiredLeases(fence: FencingContext): Promise<number>;
|
|
87
|
-
listReadyEffects(limit: number, now?: number): Promise<readonly PendingEffect[]>;
|
|
88
|
-
listReadyFastAppendEffects(limit: number, now?: number): Promise<readonly PendingEffect[]>;
|
|
89
|
-
claimEffect(options: ClaimEffectOptions): Promise<ClaimResult>;
|
|
90
|
-
ensureSpreadsheetAuthority(options: FencingContext & {
|
|
91
|
-
readonly physicalSheetId: string;
|
|
92
|
-
readonly ownerId: string;
|
|
93
|
-
}): Promise<boolean>;
|
|
94
|
-
markDeliveryUncertain(options: MarkDeliveryUncertainOptions): Promise<boolean>;
|
|
95
|
-
renewEffectLease(options: RenewEffectLeaseOptions): Promise<boolean>;
|
|
96
|
-
applyEffectResult(options: ApplyResultOptions): Promise<boolean>;
|
|
97
|
-
releaseUnprocessedEffect(options: Pick<FencingContext, "role" | "writerEpoch" | "fencingToken" | "now"> & {
|
|
98
|
-
readonly effectId: string;
|
|
99
|
-
readonly claimToken: string;
|
|
100
|
-
}): Promise<boolean>;
|
|
101
|
-
retryClaimedEffect(options: RetryClaimedEffectOptions): Promise<boolean>;
|
|
102
|
-
supersedeAndReplan(fence: FencingContext, oldEffectId: string, newEffect: NewEffect): Promise<void>;
|
|
103
|
-
isUserInputCandidateBlocked(item: ClaimedEffect): Promise<boolean>;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Processes effects through an adapter-owned SQL connection.
|
|
107
|
-
*
|
|
108
|
-
* This is the MikroORM-compatible worker entrypoint. It never opens the
|
|
109
|
-
* legacy synchronous `node:sqlite` database beside the ORM connection.
|
|
110
|
-
*/
|
|
111
|
-
export declare function runSyncEffectWorkerWithAdapter(options: SyncEffectWorkerWithAdapterOptions): Promise<SyncEffectWorkerReport>;
|
|
112
|
-
export interface MutableReport {
|
|
113
|
-
lease: Presence<WriterLease>;
|
|
114
|
-
expiredLeasesRecovered: number;
|
|
115
|
-
selected: number;
|
|
116
|
-
claimed: number;
|
|
117
|
-
applied: number;
|
|
118
|
-
blockedCandidate: number;
|
|
119
|
-
superseded: number;
|
|
120
|
-
conflicted: number;
|
|
121
|
-
failed: number;
|
|
122
|
-
deferred: number;
|
|
123
|
-
requeued: number;
|
|
124
|
-
replanned: number;
|
|
125
|
-
responseLossRecovered: number;
|
|
126
|
-
}
|
|
127
|
-
//# sourceMappingURL=SyncEffectWorker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SyncEffectWorker.d.ts","sourceRoot":"","sources":["../../../../../src/application/sync/outbound/effects/SyncEffectWorker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAcL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC5B,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AAC1F,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAUpC,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;AAmDvC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAExF,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IACpD,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAC;CAC3D;AAED,8EAA8E;AAC9E,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,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