hikoutei 0.10.16-dev → 0.10.18-dev
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/contracts/api/entity.d.ts +10 -5
- package/dist/contracts/api/entity.d.ts.map +1 -1
- package/dist/contracts/api/entity.js +18 -10
- package/dist/contracts/api/entity.js.map +1 -1
- package/dist/contracts/sync-orm/mapping/identity.d.ts +10 -5
- package/dist/contracts/sync-orm/mapping/identity.d.ts.map +1 -1
- package/dist/contracts/sync-orm/mapping/identity.js +25 -11
- package/dist/contracts/sync-orm/mapping/identity.js.map +1 -1
- package/dist/orm/mapping/observationMapping.d.ts +4 -4
- package/dist/orm/mapping/observationMapping.d.ts.map +1 -1
- package/dist/orm/mapping/observationMapping.js +2 -1
- package/dist/orm/mapping/observationMapping.js.map +1 -1
- package/dist/orm/persistence/support/helpers.d.ts +5 -1
- package/dist/orm/persistence/support/helpers.d.ts.map +1 -1
- package/dist/orm/persistence/support/helpers.js +16 -6
- package/dist/orm/persistence/support/helpers.js.map +1 -1
- package/dist/persistence/providers/mikro-orm/api/MikroOrmScalarPersistenceProvider.js +36 -4
- package/dist/persistence/providers/mikro-orm/api/MikroOrmScalarPersistenceProvider.js.map +1 -1
- package/dist/persistence/providers/mikro-orm/engine/MikroOrmScalarEntityRuntime.js +5 -0
- package/dist/persistence/providers/mikro-orm/engine/MikroOrmScalarEntityRuntime.js.map +1 -1
- package/dist/persistence/providers/mikro-orm/observation/MikroOrmMappedObservation.js +18 -4
- package/dist/persistence/providers/mikro-orm/observation/MikroOrmMappedObservation.js.map +1 -1
- package/dist/storage/sqlite/migrateSchema.d.ts.map +1 -1
- package/dist/storage/sqlite/migrateSchema.js +16 -1
- package/dist/storage/sqlite/migrateSchema.js.map +1 -1
- package/dist/storage/sqlite/schema.d.ts +21 -0
- package/dist/storage/sqlite/schema.d.ts.map +1 -1
- package/dist/storage/sqlite/schema.js +27 -0
- package/dist/storage/sqlite/schema.js.map +1 -1
- package/dist/storage/sync/outbound/reconciliationSql.d.ts +81 -0
- package/dist/storage/sync/outbound/reconciliationSql.d.ts.map +1 -1
- package/dist/storage/sync/outbound/reconciliationSql.js +139 -1
- package/dist/storage/sync/outbound/reconciliationSql.js.map +1 -1
- package/dist/sync-engine/api/internalEntityManager.d.ts.map +1 -1
- package/dist/sync-engine/api/internalEntityManager.js +3 -1
- package/dist/sync-engine/api/internalEntityManager.js.map +1 -1
- package/dist/sync-engine/orm/persistence/scalar/unitOfWork.d.ts.map +1 -1
- package/dist/sync-engine/orm/persistence/scalar/unitOfWork.js +102 -9
- package/dist/sync-engine/orm/persistence/scalar/unitOfWork.js.map +1 -1
- package/dist/sync-engine/sync/outbound/reconciliation/CleanupScanner.d.ts.map +1 -1
- package/dist/sync-engine/sync/outbound/reconciliation/CleanupScanner.js +8 -3
- package/dist/sync-engine/sync/outbound/reconciliation/CleanupScanner.js.map +1 -1
- package/dist/sync-engine/sync/outbound/reconciliation/ReconciliationScanner.d.ts.map +1 -1
- package/dist/sync-engine/sync/outbound/reconciliation/ReconciliationScanner.js +103 -53
- package/dist/sync-engine/sync/outbound/reconciliation/ReconciliationScanner.js.map +1 -1
- package/dist/sync-engine/sync/outbound/reconciliation/cleanup.d.ts +110 -0
- package/dist/sync-engine/sync/outbound/reconciliation/cleanup.d.ts.map +1 -1
- package/dist/sync-engine/sync/outbound/reconciliation/cleanup.js +307 -1
- package/dist/sync-engine/sync/outbound/reconciliation/cleanup.js.map +1 -1
- package/dist/sync-engine/sync/outbound/reconciliation/diff.d.ts +51 -7
- package/dist/sync-engine/sync/outbound/reconciliation/diff.d.ts.map +1 -1
- package/dist/sync-engine/sync/outbound/reconciliation/diff.js +53 -43
- package/dist/sync-engine/sync/outbound/reconciliation/diff.js.map +1 -1
- package/dist/sync-engine/sync/outbound/reconciliation/shared.d.ts +33 -11
- package/dist/sync-engine/sync/outbound/reconciliation/shared.d.ts.map +1 -1
- package/dist/sync-engine/sync/outbound/reconciliation/shared.js +93 -58
- package/dist/sync-engine/sync/outbound/reconciliation/shared.js.map +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ import { computeSyncVisibleHash, } from "../../../../contracts/sheets/syncSheets
|
|
|
18
18
|
* choice: the affected locators are dropped from the index so neither the
|
|
19
19
|
* drift classifier nor the failed-head matcher can silently pick one row.
|
|
20
20
|
*/
|
|
21
|
-
function buildObservedRowIndex(snapshot, businessKeyField) {
|
|
21
|
+
export function buildObservedRowIndex(snapshot, businessKeyField) {
|
|
22
22
|
const rowsByAnchor = new Map();
|
|
23
23
|
const ambiguousAnchors = new Set();
|
|
24
24
|
const rowsByIdentity = new Map();
|
|
@@ -60,7 +60,7 @@ function buildObservedRowIndex(snapshot, businessKeyField) {
|
|
|
60
60
|
* duplicate set. Returns undefined when no row can prove ownership of this
|
|
61
61
|
* binding.
|
|
62
62
|
*/
|
|
63
|
-
function resolveObservedRow(index, desiredRow, businessKeyField) {
|
|
63
|
+
export function resolveObservedRow(index, desiredRow, businessKeyField) {
|
|
64
64
|
const identity = desiredRowIdentity(desiredRow, businessKeyField);
|
|
65
65
|
// The primary locator's ambiguity is fatal: when the desired anchor is
|
|
66
66
|
// duplicated, identity fallback would silently pick one of the rows that
|
|
@@ -76,39 +76,38 @@ function resolveObservedRow(index, desiredRow, businessKeyField) {
|
|
|
76
76
|
}
|
|
77
77
|
export function computeDrifts(args) {
|
|
78
78
|
const index = buildObservedRowIndex(args.snapshot, args.sheet.businessKeyField);
|
|
79
|
-
|
|
80
|
-
for (const desiredRow of args.desired) {
|
|
81
|
-
const observed = resolveObservedRow(index, desiredRow, args.sheet.businessKeyField);
|
|
82
|
-
if (observed === undefined) {
|
|
83
|
-
drifts.push({ kind: "missing", desired: desiredRow, observed: undefined });
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
const observedHash = computeObservedHash(observed, args.systemFields);
|
|
87
|
-
const desiredHash = computeSyncVisibleHash(desiredRow.fields);
|
|
88
|
-
if (observedHash !== desiredHash) {
|
|
89
|
-
drifts.push({ kind: "drifted", desired: desiredRow, observed });
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return drifts;
|
|
79
|
+
return classifyDesiredChunk(index, args.desired, args.systemFields, args.sheet.businessKeyField);
|
|
93
80
|
}
|
|
94
81
|
/**
|
|
95
|
-
*
|
|
82
|
+
* Classifies one chunk of desired rows against a prebuilt snapshot index.
|
|
96
83
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
84
|
+
* The chunked scan calls this per completed entity batch with the scan-wide
|
|
85
|
+
* index; results concatenate in chunk order, which is the global
|
|
86
|
+
* `(entity_id, field_name)` order, so chunked classification is identical to
|
|
87
|
+
* one full-load `computeDrifts` call. Returns only drift targets; matched
|
|
88
|
+
* rows are simply absent (the scan counts them as scanned-minus-missing).
|
|
102
89
|
*/
|
|
103
|
-
export function
|
|
104
|
-
const
|
|
105
|
-
const matched = new Map();
|
|
90
|
+
export function classifyDesiredChunk(index, desired, systemFields, businessKeyField) {
|
|
91
|
+
const drifts = [];
|
|
106
92
|
for (const desiredRow of desired) {
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
|
|
93
|
+
const drift = classifyDesiredRow(index, desiredRow, systemFields, businessKeyField);
|
|
94
|
+
if (drift !== undefined)
|
|
95
|
+
drifts.push(drift);
|
|
110
96
|
}
|
|
111
|
-
return
|
|
97
|
+
return drifts;
|
|
98
|
+
}
|
|
99
|
+
/** Classifies one desired row: missing, drifted, or matched (undefined). */
|
|
100
|
+
export function classifyDesiredRow(index, desiredRow, systemFields, businessKeyField) {
|
|
101
|
+
const observed = resolveObservedRow(index, desiredRow, businessKeyField);
|
|
102
|
+
if (observed === undefined) {
|
|
103
|
+
return { kind: "missing", desired: desiredRow, observed: undefined };
|
|
104
|
+
}
|
|
105
|
+
const observedHash = computeObservedHash(observed, systemFields);
|
|
106
|
+
const desiredHash = computeSyncVisibleHash(desiredRow.fields);
|
|
107
|
+
if (observedHash !== desiredHash) {
|
|
108
|
+
return { kind: "drifted", desired: desiredRow, observed };
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
112
111
|
}
|
|
113
112
|
/** Reads a business-key value from a snapshot row for unanchored fast appends. */
|
|
114
113
|
export function snapshotIdentity(row, identityField) {
|
|
@@ -183,6 +182,29 @@ export function countMatchedRows(snapshot, desired, identityField) {
|
|
|
183
182
|
return matched;
|
|
184
183
|
}
|
|
185
184
|
export function countExtraRows(snapshot, desired, identityField) {
|
|
185
|
+
// First-wins anchor ownership plus every desired identity, as lightweight
|
|
186
|
+
// keys: the chunked scan accumulates the same keys without retaining rows.
|
|
187
|
+
const desiredAnchors = new Map();
|
|
188
|
+
const desiredIdentities = new Set();
|
|
189
|
+
for (const row of desired) {
|
|
190
|
+
if (!desiredAnchors.has(row.anchorReference)) {
|
|
191
|
+
desiredAnchors.set(row.anchorReference, desiredRowIdentity(row, identityField));
|
|
192
|
+
}
|
|
193
|
+
const identity = desiredRowIdentity(row, identityField);
|
|
194
|
+
if (identity !== undefined)
|
|
195
|
+
desiredIdentities.add(identity);
|
|
196
|
+
}
|
|
197
|
+
return countExtraRowsForKeys(snapshot, identityField, desiredAnchors, desiredIdentities);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Counts surplus snapshot rows from pre-accumulated desired keys.
|
|
201
|
+
*
|
|
202
|
+
* The chunked scan feeds one chunk at a time into `desiredAnchors` (first
|
|
203
|
+
* row wins per anchor) and `desiredIdentities`, then calls this once: the
|
|
204
|
+
* count is identical to `countExtraRows` while only small key strings are
|
|
205
|
+
* retained instead of full desired rows.
|
|
206
|
+
*/
|
|
207
|
+
export function countExtraRowsForKeys(snapshot, identityField, desiredAnchors, desiredIdentities) {
|
|
186
208
|
// Identities that appear more than once in the snapshot cannot prove
|
|
187
209
|
// ownership. A desired row carrying one of these identities is quarantined:
|
|
188
210
|
// its anchor never suppresses the extra count, and the duplicated identity
|
|
@@ -199,15 +221,6 @@ export function countExtraRows(snapshot, desired, identityField) {
|
|
|
199
221
|
seen.add(identity);
|
|
200
222
|
}
|
|
201
223
|
}
|
|
202
|
-
const desiredByAnchor = new Map();
|
|
203
|
-
const desiredIdentities = new Set();
|
|
204
|
-
for (const row of desired) {
|
|
205
|
-
if (!desiredByAnchor.has(row.anchorReference))
|
|
206
|
-
desiredByAnchor.set(row.anchorReference, row);
|
|
207
|
-
const identity = desiredRowIdentity(row, identityField);
|
|
208
|
-
if (identity !== undefined)
|
|
209
|
-
desiredIdentities.add(identity);
|
|
210
|
-
}
|
|
211
224
|
const anchorCounts = new Map();
|
|
212
225
|
for (const row of snapshot.rows) {
|
|
213
226
|
if (row.physicalAnchor.kind !== PRESENCE_KINDS.PRESENT)
|
|
@@ -223,11 +236,8 @@ export function countExtraRows(snapshot, desired, identityField) {
|
|
|
223
236
|
// business key that appears elsewhere.
|
|
224
237
|
if (row.physicalAnchor.kind === PRESENCE_KINDS.PRESENT &&
|
|
225
238
|
(anchorCounts.get(row.physicalAnchor.value) ?? 0) === 1) {
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
? undefined
|
|
229
|
-
: desiredRowIdentity(desiredRow, identityField);
|
|
230
|
-
if (desiredRow !== undefined &&
|
|
239
|
+
const desiredIdentity = desiredAnchors.get(row.physicalAnchor.value);
|
|
240
|
+
if (desiredAnchors.has(row.physicalAnchor.value) &&
|
|
231
241
|
(desiredIdentity === undefined || !duplicateIdentities.has(desiredIdentity))) {
|
|
232
242
|
continue;
|
|
233
243
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../../../../../../../src/sync/outbound/reconciliation/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,wBAAwB,GACzB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAA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AAK,CAAC;AACf,CAAC"}
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
* modules can import from one place without importing each other.
|
|
10
10
|
*/
|
|
11
11
|
import type { NormalizedCell } from "../../../../contracts/encoding/types.js";
|
|
12
|
+
import { READ_DESIRED_SYSTEM_STATE_SQL, RECONCILIATION_SCAN_CHUNK_SIZE, RECONCILIATION_SCAN_ENTITY_PAGE_SIZE, readActiveEntityPageWithSql, readEntityBindingsWithSql, readEntityFieldsWithSql, readReconciliationDesiredSystemStateChunkWithSql, type ReconciliationDesiredChunkCursor, type ReconciliationDesiredEntityChunk, type ReconciliationDesiredSystemStateRow } from "../../../../storage/sync/outbound/reconciliationSql.js";
|
|
12
13
|
import type { SqlExecutor, SqlStorageAdapter } from "../../../../contracts/storage/sql.js";
|
|
13
14
|
import type { SyncSheetsProvider } from "../../../../contracts/sheets/syncSheets.js";
|
|
15
|
+
export { READ_DESIRED_SYSTEM_STATE_SQL, RECONCILIATION_SCAN_CHUNK_SIZE, RECONCILIATION_SCAN_ENTITY_PAGE_SIZE, readActiveEntityPageWithSql, readEntityBindingsWithSql, readEntityFieldsWithSql, readReconciliationDesiredSystemStateChunkWithSql, };
|
|
16
|
+
export type { ReconciliationDesiredChunkCursor, ReconciliationDesiredEntityChunk, ReconciliationDesiredSystemStateRow, };
|
|
14
17
|
export declare const DEFAULT_RECONCILIATION_ROLE = "typed-sheets-reconciler";
|
|
15
18
|
export declare const DEFAULT_RECONCILIATION_LEASE_MS = 60000;
|
|
16
19
|
export declare const DEFAULT_SYSTEM_TOMBSTONE_FIELD = "_deleted";
|
|
@@ -24,15 +27,6 @@ export interface DesiredRow {
|
|
|
24
27
|
readonly fields: Record<string, NormalizedCell>;
|
|
25
28
|
readonly fieldRevisionHash: string;
|
|
26
29
|
}
|
|
27
|
-
export interface DesiredRowSqlShape {
|
|
28
|
-
readonly entity_id: string;
|
|
29
|
-
readonly row_binding_id: string;
|
|
30
|
-
readonly anchor_reference: string;
|
|
31
|
-
readonly entity_revision: number;
|
|
32
|
-
readonly field_name: string;
|
|
33
|
-
readonly normalized_value: string;
|
|
34
|
-
readonly ownership: string;
|
|
35
|
-
}
|
|
36
30
|
export interface LatestVisibleSqlShape {
|
|
37
31
|
readonly confirmed_visible_revision: number | null;
|
|
38
32
|
readonly confirmed_snapshot_hash: string | null;
|
|
@@ -46,7 +40,6 @@ export interface LatestEffectSqlShape {
|
|
|
46
40
|
readonly last_error_code: string | null;
|
|
47
41
|
readonly payload_json: string | null;
|
|
48
42
|
}
|
|
49
|
-
export declare const READ_DESIRED_SYSTEM_STATE_SQL = "\n SELECT\n entity.entity_id AS entity_id,\n binding.row_binding_id AS row_binding_id,\n binding.anchor_reference AS anchor_reference,\n entity.entity_revision AS entity_revision,\n field.field_name AS field_name,\n field.normalized_value AS normalized_value,\n field.ownership AS ownership\n FROM entity_state AS entity\n JOIN row_binding AS binding\n ON binding.entity_id = entity.entity_id\n AND binding.logical_sheet_id = ?\n AND binding.state = 'active'\n JOIN entity_field_state AS field\n ON field.entity_id = entity.entity_id\n WHERE entity.status = 'active'\n ORDER BY entity.entity_id, field.field_name\n";
|
|
50
43
|
export declare const READ_LATEST_VISIBLE_STATE_SQL = "\n SELECT confirmed_visible_revision, confirmed_snapshot_hash\n FROM sheet_visible_state\n WHERE physical_sheet_id = ? AND projection = 'system_state' AND row_binding_id = ?\n";
|
|
51
44
|
export declare const READ_LATEST_EFFECT_SQL = "\n SELECT effect_id, stream_sequence, expected_visible_revision, expected_visible_hash, status, last_error_code, payload_json\n FROM sheet_effect_outbox\n WHERE logical_sheet_id = ? AND target_kind = 'entity' AND target_id = ?\n ORDER BY stream_sequence DESC\n LIMIT 1\n";
|
|
52
45
|
/**
|
|
@@ -82,6 +75,11 @@ export interface FailedHeadsSqlShape {
|
|
|
82
75
|
* superseded by reconciliation, mirroring `readTerminalFailedHeadWithSql`.
|
|
83
76
|
*/
|
|
84
77
|
export declare function readTerminalFailedHeads(context: ScanContext): Promise<ReadonlyMap<string, string>>;
|
|
78
|
+
/**
|
|
79
|
+
* Reads terminal failed heads inside the caller's SQL context so the chunked
|
|
80
|
+
* scan can share one read with its pages instead of opening a second one.
|
|
81
|
+
*/
|
|
82
|
+
export declare function readTerminalFailedHeadsWithSql(sql: SqlExecutor, logicalSheetId: string): Promise<ReadonlyMap<string, string>>;
|
|
85
83
|
export interface ScanContext {
|
|
86
84
|
readonly storage: SqlStorageAdapter;
|
|
87
85
|
readonly provider: SyncSheetsProvider;
|
|
@@ -97,7 +95,31 @@ export interface ScanContext {
|
|
|
97
95
|
readonly leaseDurationMs: number;
|
|
98
96
|
}
|
|
99
97
|
export declare function readDesiredSystemState(context: ScanContext): Promise<readonly DesiredRow[]>;
|
|
100
|
-
export declare function readDesiredSystemStateWithSql(sql: SqlExecutor, context: ScanContext): Promise<readonly DesiredRow[]>;
|
|
98
|
+
export declare function readDesiredSystemStateWithSql(sql: SqlExecutor, context: Pick<ScanContext, "logicalSheetId" | "tombstoneField">): Promise<readonly DesiredRow[]>;
|
|
99
|
+
/** One entity's fields accumulated across chunk boundaries. */
|
|
100
|
+
export interface PartialDesiredRow {
|
|
101
|
+
readonly entityId: string;
|
|
102
|
+
readonly rowBindingId: string;
|
|
103
|
+
readonly anchorReference: string;
|
|
104
|
+
readonly entityRevision: number;
|
|
105
|
+
readonly fields: Record<string, NormalizedCell>;
|
|
106
|
+
}
|
|
107
|
+
/** Completed desired rows plus the trailing entity still missing fields. */
|
|
108
|
+
export interface DesiredChunkResult {
|
|
109
|
+
readonly completed: readonly DesiredRow[];
|
|
110
|
+
readonly carry: PartialDesiredRow | undefined;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Groups one ordered page of flat canonical rows into completed desired
|
|
114
|
+
* rows. A page may split an entity's fields across the boundary, so the
|
|
115
|
+
* trailing entity is returned as `carry` and must seed the next call; only
|
|
116
|
+
* `flushDesiredCarry` after the last page finalizes it. Completed rows are
|
|
117
|
+
* finalized (tombstone default + revision hash) exactly like the full-load
|
|
118
|
+
* reader, in global `(entity_id, field_name)` order.
|
|
119
|
+
*/
|
|
120
|
+
export declare function assembleDesiredChunk(rows: readonly ReconciliationDesiredSystemStateRow[], carry: PartialDesiredRow | undefined, tombstoneField: string | undefined): DesiredChunkResult;
|
|
121
|
+
/** Finalizes the trailing entity after the last page. */
|
|
122
|
+
export declare function flushDesiredCarry(carry: PartialDesiredRow | undefined, tombstoneField: string | undefined): DesiredRow | undefined;
|
|
101
123
|
export declare function ensureTombstoneField(row: DesiredRow, tombstoneField: string | undefined): void;
|
|
102
124
|
export declare function computeFieldRevisionHash(fields: Readonly<Record<string, NormalizedCell>>): string;
|
|
103
125
|
export declare function decodeNormalizedCell(value: string): NormalizedCell;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/sync/outbound/reconciliation/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAI5E,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/sync/outbound/reconciliation/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAI5E,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,oCAAoC,EACpC,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,EACvB,gDAAgD,EAEhD,KAAK,gCAAgC,EACrC,KAAK,gCAAgC,EACrC,KAAK,mCAAmC,EACzC,MAAM,8DAA8D,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;A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SAAS,GACjC,UAAU,GAAG,SAAS,CAGxB;AAkBD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAM9F;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,GAAG,MAAM,CAKjG;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAiBlE"}
|
|
@@ -13,28 +13,13 @@ import { isRecoverableEffectErrorCode, } from "@hikoutei/ikisaki";
|
|
|
13
13
|
import { NORMALIZED_CELL_KINDS } from "../../../../contracts/encoding/constants.js";
|
|
14
14
|
import { isNormalizedCell } from "../../../../contracts/encoding/normalizedCell.js";
|
|
15
15
|
import { STORAGE_ERROR_CODES, StorageError } from "../../../../storage/errors.js";
|
|
16
|
+
import { READ_DESIRED_SYSTEM_STATE_SQL, RECONCILIATION_SCAN_CHUNK_SIZE, RECONCILIATION_SCAN_ENTITY_PAGE_SIZE, readActiveEntityPageWithSql, readEntityBindingsWithSql, readEntityFieldsWithSql, readReconciliationDesiredSystemStateChunkWithSql, readReconciliationDesiredSystemStateWithSql as readFlatDesiredSystemStateWithSql, } from "../../../../storage/sync/outbound/reconciliationSql.js";
|
|
17
|
+
// The desired-state query lives in storage; this module re-exports the
|
|
18
|
+
// shared pieces so scanner role modules keep importing from one place.
|
|
19
|
+
export { READ_DESIRED_SYSTEM_STATE_SQL, RECONCILIATION_SCAN_CHUNK_SIZE, RECONCILIATION_SCAN_ENTITY_PAGE_SIZE, readActiveEntityPageWithSql, readEntityBindingsWithSql, readEntityFieldsWithSql, readReconciliationDesiredSystemStateChunkWithSql, };
|
|
16
20
|
export const DEFAULT_RECONCILIATION_ROLE = "typed-sheets-reconciler";
|
|
17
21
|
export const DEFAULT_RECONCILIATION_LEASE_MS = 60_000;
|
|
18
22
|
export const DEFAULT_SYSTEM_TOMBSTONE_FIELD = "_deleted";
|
|
19
|
-
export const READ_DESIRED_SYSTEM_STATE_SQL = `
|
|
20
|
-
SELECT
|
|
21
|
-
entity.entity_id AS entity_id,
|
|
22
|
-
binding.row_binding_id AS row_binding_id,
|
|
23
|
-
binding.anchor_reference AS anchor_reference,
|
|
24
|
-
entity.entity_revision AS entity_revision,
|
|
25
|
-
field.field_name AS field_name,
|
|
26
|
-
field.normalized_value AS normalized_value,
|
|
27
|
-
field.ownership AS ownership
|
|
28
|
-
FROM entity_state AS entity
|
|
29
|
-
JOIN row_binding AS binding
|
|
30
|
-
ON binding.entity_id = entity.entity_id
|
|
31
|
-
AND binding.logical_sheet_id = ?
|
|
32
|
-
AND binding.state = 'active'
|
|
33
|
-
JOIN entity_field_state AS field
|
|
34
|
-
ON field.entity_id = entity.entity_id
|
|
35
|
-
WHERE entity.status = 'active'
|
|
36
|
-
ORDER BY entity.entity_id, field.field_name
|
|
37
|
-
`;
|
|
38
23
|
export const READ_LATEST_VISIBLE_STATE_SQL = `
|
|
39
24
|
SELECT confirmed_visible_revision, confirmed_snapshot_hash
|
|
40
25
|
FROM sheet_visible_state
|
|
@@ -82,53 +67,103 @@ export const READ_FAILED_HEADS_SQL = `
|
|
|
82
67
|
* superseded by reconciliation, mirroring `readTerminalFailedHeadWithSql`.
|
|
83
68
|
*/
|
|
84
69
|
export async function readTerminalFailedHeads(context) {
|
|
85
|
-
return context.storage.read(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
70
|
+
return context.storage.read(({ sql }) => readTerminalFailedHeadsWithSql(sql, context.logicalSheetId));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Reads terminal failed heads inside the caller's SQL context so the chunked
|
|
74
|
+
* scan can share one read with its pages instead of opening a second one.
|
|
75
|
+
*/
|
|
76
|
+
export async function readTerminalFailedHeadsWithSql(sql, logicalSheetId) {
|
|
77
|
+
const rows = await sql.all(READ_FAILED_HEADS_SQL, [
|
|
78
|
+
logicalSheetId,
|
|
79
|
+
]);
|
|
80
|
+
const byTarget = new Map();
|
|
81
|
+
for (const row of rows) {
|
|
82
|
+
if (isRecoverableEffectErrorCode(row.last_error_code))
|
|
83
|
+
continue;
|
|
84
|
+
if (!byTarget.has(row.target_id))
|
|
85
|
+
byTarget.set(row.target_id, row.effect_id);
|
|
86
|
+
}
|
|
87
|
+
return byTarget;
|
|
98
88
|
}
|
|
99
89
|
export async function readDesiredSystemState(context) {
|
|
100
90
|
return context.storage.read(({ sql }) => readDesiredSystemStateWithSql(sql, context));
|
|
101
91
|
}
|
|
102
92
|
export async function readDesiredSystemStateWithSql(sql, context) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
93
|
+
// The flat rows come from the storage-owned reader; grouping stays here
|
|
94
|
+
// because DesiredRow (decoded cells, tombstone default, revision hash) is
|
|
95
|
+
// the scanner's internal contract, not a storage shape.
|
|
96
|
+
const rows = await readFlatDesiredSystemStateWithSql(sql, context.logicalSheetId);
|
|
97
|
+
const { completed, carry } = assembleDesiredChunk(rows, undefined, context.tombstoneField);
|
|
98
|
+
const flushed = flushDesiredCarry(carry, context.tombstoneField);
|
|
99
|
+
return flushed === undefined ? completed : [...completed, flushed];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Groups one ordered page of flat canonical rows into completed desired
|
|
103
|
+
* rows. A page may split an entity's fields across the boundary, so the
|
|
104
|
+
* trailing entity is returned as `carry` and must seed the next call; only
|
|
105
|
+
* `flushDesiredCarry` after the last page finalizes it. Completed rows are
|
|
106
|
+
* finalized (tombstone default + revision hash) exactly like the full-load
|
|
107
|
+
* reader, in global `(entity_id, field_name)` order.
|
|
108
|
+
*/
|
|
109
|
+
export function assembleDesiredChunk(rows, carry, tombstoneField) {
|
|
110
|
+
const completed = [];
|
|
111
|
+
let current = carry === undefined ? undefined : {
|
|
112
|
+
entityId: carry.entityId,
|
|
113
|
+
rowBindingId: carry.rowBindingId,
|
|
114
|
+
anchorReference: carry.anchorReference,
|
|
115
|
+
entityRevision: carry.entityRevision,
|
|
116
|
+
fields: { ...carry.fields },
|
|
117
|
+
};
|
|
118
|
+
const finalizeCurrent = () => {
|
|
119
|
+
if (current === undefined)
|
|
120
|
+
return undefined;
|
|
121
|
+
completed.push(finalizeDesiredRow(current, tombstoneField));
|
|
122
|
+
return undefined;
|
|
123
|
+
};
|
|
107
124
|
for (const row of rows) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (existing === undefined) {
|
|
111
|
-
const fields = {};
|
|
112
|
-
fields[row.field_name] = cell;
|
|
113
|
-
byEntity.set(row.entity_id, {
|
|
114
|
-
entityId: row.entity_id,
|
|
115
|
-
rowBindingId: row.row_binding_id,
|
|
116
|
-
anchorReference: row.anchor_reference,
|
|
117
|
-
entityRevision: row.entity_revision,
|
|
118
|
-
fields,
|
|
119
|
-
fieldRevisionHash: "",
|
|
120
|
-
});
|
|
121
|
-
continue;
|
|
125
|
+
if (current !== undefined && current.entityId !== row.entityId) {
|
|
126
|
+
current = finalizeCurrent();
|
|
122
127
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
if (current === undefined) {
|
|
129
|
+
current = {
|
|
130
|
+
entityId: row.entityId,
|
|
131
|
+
rowBindingId: row.rowBindingId,
|
|
132
|
+
anchorReference: row.anchorReference,
|
|
133
|
+
entityRevision: row.entityRevision,
|
|
134
|
+
fields: {},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
current.fields[row.fieldName] = decodeNormalizedCell(row.normalizedValue);
|
|
130
138
|
}
|
|
131
|
-
return
|
|
139
|
+
return {
|
|
140
|
+
completed,
|
|
141
|
+
carry: current === undefined ? undefined : {
|
|
142
|
+
entityId: current.entityId,
|
|
143
|
+
rowBindingId: current.rowBindingId,
|
|
144
|
+
anchorReference: current.anchorReference,
|
|
145
|
+
entityRevision: current.entityRevision,
|
|
146
|
+
fields: current.fields,
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/** Finalizes the trailing entity after the last page. */
|
|
151
|
+
export function flushDesiredCarry(carry, tombstoneField) {
|
|
152
|
+
if (carry === undefined)
|
|
153
|
+
return undefined;
|
|
154
|
+
return finalizeDesiredRow(carry, tombstoneField);
|
|
155
|
+
}
|
|
156
|
+
function finalizeDesiredRow(row, tombstoneField) {
|
|
157
|
+
const desired = {
|
|
158
|
+
entityId: row.entityId,
|
|
159
|
+
rowBindingId: row.rowBindingId,
|
|
160
|
+
anchorReference: row.anchorReference,
|
|
161
|
+
entityRevision: row.entityRevision,
|
|
162
|
+
fields: row.fields,
|
|
163
|
+
fieldRevisionHash: "",
|
|
164
|
+
};
|
|
165
|
+
ensureTombstoneField(desired, tombstoneField);
|
|
166
|
+
return { ...desired, fieldRevisionHash: computeFieldRevisionHash(desired.fields) };
|
|
132
167
|
}
|
|
133
168
|
export function ensureTombstoneField(row, tombstoneField) {
|
|
134
169
|
if (tombstoneField === undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../../../../../src/sync/outbound/reconciliation/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,EACL,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../../../../../src/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
|
|
1
1
|
{
|
|
2
2
|
"name": "hikoutei",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.18-dev",
|
|
4
4
|
"description": "Typed repository and safe write layer for Google Sheets-backed MVPs. SQLite-authoritative entity lifecycle with asynchronous Google Sheets projection.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|