@ibgib/core-gib 0.1.13 → 0.1.15

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.
Files changed (104) hide show
  1. package/dist/keystone/keystone-helpers.mjs +3 -3
  2. package/dist/keystone/keystone-helpers.mjs.map +1 -1
  3. package/dist/sync/sync-constants.d.mts +6 -1
  4. package/dist/sync/sync-constants.d.mts.map +1 -1
  5. package/dist/sync/sync-constants.mjs +5 -0
  6. package/dist/sync/sync-constants.mjs.map +1 -1
  7. package/dist/sync/sync-helpers.d.mts +18 -2
  8. package/dist/sync/sync-helpers.d.mts.map +1 -1
  9. package/dist/sync/sync-helpers.mjs +84 -3
  10. package/dist/sync/sync-helpers.mjs.map +1 -1
  11. package/dist/sync/sync-innerspace.respec.d.mts +1 -1
  12. package/dist/sync/sync-innerspace.respec.mjs +52 -370
  13. package/dist/sync/sync-innerspace.respec.mjs.map +1 -1
  14. package/dist/sync/sync-peer/sync-peer-innerspace-v1.d.mts +39 -0
  15. package/dist/sync/sync-peer/sync-peer-innerspace-v1.d.mts.map +1 -0
  16. package/dist/sync/sync-peer/sync-peer-innerspace-v1.mjs +112 -0
  17. package/dist/sync/sync-peer/sync-peer-innerspace-v1.mjs.map +1 -0
  18. package/dist/sync/sync-peer/sync-peer-types.d.mts +30 -0
  19. package/dist/sync/sync-peer/sync-peer-types.d.mts.map +1 -0
  20. package/dist/sync/sync-peer/sync-peer-types.mjs +5 -0
  21. package/dist/sync/sync-peer/sync-peer-types.mjs.map +1 -0
  22. package/dist/sync/sync-peer/sync-peer-v1.d.mts +22 -0
  23. package/dist/sync/sync-peer/sync-peer-v1.d.mts.map +1 -0
  24. package/dist/sync/sync-peer/sync-peer-v1.mjs +13 -0
  25. package/dist/sync/sync-peer/sync-peer-v1.mjs.map +1 -0
  26. package/dist/sync/sync-saga-context/sync-saga-context-constants.d.mts +8 -0
  27. package/dist/sync/sync-saga-context/sync-saga-context-constants.d.mts.map +1 -0
  28. package/dist/sync/sync-saga-context/sync-saga-context-constants.mjs +8 -0
  29. package/dist/sync/sync-saga-context/sync-saga-context-constants.mjs.map +1 -0
  30. package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts +54 -0
  31. package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts.map +1 -0
  32. package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs +87 -0
  33. package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs.map +1 -0
  34. package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts +66 -0
  35. package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts.map +1 -0
  36. package/dist/sync/sync-saga-context/sync-saga-context-types.mjs +12 -0
  37. package/dist/sync/sync-saga-context/sync-saga-context-types.mjs.map +1 -0
  38. package/dist/sync/sync-saga-coordinator.d.mts +201 -121
  39. package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
  40. package/dist/sync/sync-saga-coordinator.mjs +710 -434
  41. package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
  42. package/dist/sync/sync-saga-coordinator.respec.mjs +7 -7
  43. package/dist/sync/sync-saga-coordinator.respec.mjs.map +1 -1
  44. package/dist/sync/sync-saga-message/sync-saga-message-constants.d.mts +2 -0
  45. package/dist/sync/sync-saga-message/sync-saga-message-constants.d.mts.map +1 -0
  46. package/dist/sync/sync-saga-message/sync-saga-message-constants.mjs +2 -0
  47. package/dist/sync/sync-saga-message/sync-saga-message-constants.mjs.map +1 -0
  48. package/dist/sync/sync-saga-message/sync-saga-message-helpers.d.mts +15 -0
  49. package/dist/sync/sync-saga-message/sync-saga-message-helpers.d.mts.map +1 -0
  50. package/dist/sync/sync-saga-message/sync-saga-message-helpers.mjs +43 -0
  51. package/dist/sync/sync-saga-message/sync-saga-message-helpers.mjs.map +1 -0
  52. package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts +51 -0
  53. package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts.map +1 -0
  54. package/dist/sync/sync-saga-message/sync-saga-message-types.mjs +2 -0
  55. package/dist/sync/sync-saga-message/sync-saga-message-types.mjs.map +1 -0
  56. package/dist/sync/sync-types.d.mts +85 -4
  57. package/dist/sync/sync-types.d.mts.map +1 -1
  58. package/dist/sync/sync-types.mjs +27 -1
  59. package/dist/sync/sync-types.mjs.map +1 -1
  60. package/dist/timeline/timeline-api.d.mts +16 -3
  61. package/dist/timeline/timeline-api.d.mts.map +1 -1
  62. package/dist/timeline/timeline-api.mjs +7 -7
  63. package/dist/timeline/timeline-api.mjs.map +1 -1
  64. package/dist/witness/space/outer-space/outer-space-types.d.mts +2 -0
  65. package/dist/witness/space/outer-space/outer-space-types.d.mts.map +1 -1
  66. package/dist/witness/space/space-base-v1.d.mts +19 -1
  67. package/dist/witness/space/space-base-v1.d.mts.map +1 -1
  68. package/dist/witness/space/space-base-v1.mjs +66 -6
  69. package/dist/witness/space/space-base-v1.mjs.map +1 -1
  70. package/dist/witness/space/space-helper.d.mts +14 -0
  71. package/dist/witness/space/space-helper.d.mts.map +1 -1
  72. package/dist/witness/space/space-helper.mjs +44 -1
  73. package/dist/witness/space/space-helper.mjs.map +1 -1
  74. package/dist/witness/space/space-respec-helper.d.mts.map +1 -1
  75. package/dist/witness/space/space-respec-helper.mjs +1 -1
  76. package/dist/witness/space/space-respec-helper.mjs.map +1 -1
  77. package/dist/witness/space/space-types.d.mts +12 -1
  78. package/dist/witness/space/space-types.d.mts.map +1 -1
  79. package/dist/witness/space/space-types.mjs +4 -0
  80. package/dist/witness/space/space-types.mjs.map +1 -1
  81. package/package.json +2 -2
  82. package/src/keystone/keystone-helpers.mts +3 -3
  83. package/src/sync/README.md +275 -0
  84. package/src/sync/sync-constants.mts +9 -1
  85. package/src/sync/sync-helpers.mts +105 -6
  86. package/src/sync/sync-innerspace.respec.mts +55 -402
  87. package/src/sync/sync-peer/sync-peer-innerspace-v1.mts +150 -0
  88. package/src/sync/sync-peer/sync-peer-types.mts +43 -0
  89. package/src/sync/sync-peer/sync-peer-v1.mts +28 -0
  90. package/src/sync/sync-saga-context/sync-saga-context-constants.mts +8 -0
  91. package/src/sync/sync-saga-context/sync-saga-context-helpers.mts +147 -0
  92. package/src/sync/sync-saga-context/sync-saga-context-types.mts +80 -0
  93. package/src/sync/sync-saga-coordinator.mts +913 -517
  94. package/src/sync/sync-saga-coordinator.respec.mts +7 -7
  95. package/src/sync/sync-saga-message/sync-saga-message-constants.mts +1 -0
  96. package/src/sync/sync-saga-message/sync-saga-message-helpers.mts +59 -0
  97. package/src/sync/sync-saga-message/sync-saga-message-types.mts +66 -0
  98. package/src/sync/sync-types.mts +107 -4
  99. package/src/timeline/timeline-api.mts +20 -4
  100. package/src/witness/space/space-base-v1.mts +62 -12
  101. package/src/witness/space/space-helper.mts +50 -1
  102. package/src/witness/space/space-respec-helper.mts +2 -1
  103. package/src/witness/space/space-types.mts +13 -1
  104. package/tmp.md +122 -4
@@ -2,404 +2,86 @@
2
2
  * @module sync-innerspace.respec
3
3
  *
4
4
  * Verifies SyncSagaCoordinator using InnerSpace (in-memory/local) spaces.
5
- * This avoids disk I/O issues and focuses on the synchronization logic.
5
+ * This utilizes SyncPeerInnerspace_V1 for local-to-local synchronization simulations.
6
6
  */
7
7
  import { respecfully, iReckon, ifWeMight } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
8
8
  const maam = `[${import.meta.url}]`, sir = maam;
9
- import { pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
10
9
  import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
11
10
  import { SyncSagaCoordinator } from './sync-saga-coordinator.mjs';
12
- import { putInSpace, getFromSpace } from '../witness/space/space-helper.mjs';
11
+ import { getFromSpace } from '../witness/space/space-helper.mjs';
13
12
  import { Metaspace_Innerspace } from '../witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mjs';
14
13
  import { InnerSpace_V1 } from '../witness/space/inner-space/inner-space-v1.mjs';
15
14
  import { createTimelineRootHelper, getTestKeystoneServiceHelper } from '../agent-helpers.mjs';
16
15
  import { mut8Timeline } from '../timeline/timeline-api.mjs';
17
- import { getDependencyGraph } from '../common/other/graph-helper.mjs';
18
- import { getTjpAddr } from '../common/other/ibgib-helper.mjs';
16
+ import { SyncPeerInnerspace_V1 } from './sync-peer/sync-peer-innerspace-v1.mjs';
19
17
  const logalot = true;
20
18
  const lc = `[sync-innerspace.respec]`;
21
- /**
22
- * naive helper function to determine if two dependency graphs are equal.
23
- *
24
- * naive: only checks length of keys and if keys all match.
25
- *
26
- * @param a dependency graph from one space
27
- * @param b dep. graph from another space
28
- * @returns true if graphs are equal in size and keys, else false.
29
- */
30
- function naiveGraphsAreEqual(a, b) {
31
- const keysA = Object.keys(a);
32
- const keysB = Object.keys(b);
33
- if (keysA.length !== keysB.length) {
34
- false;
35
- }
36
- return keysA.every(key => !!b[key]);
37
- }
38
19
  await respecfully(sir, `Sync InnerSpaces`, async () => {
39
20
  let metaspace;
40
21
  let sourceSpace;
41
22
  let destSpace;
42
- // Setup before each test? Or once?
43
- // For now, let's just do it inside the test block to be safe/simple.
44
- // await ifWeMight(sir, `Basic Push Sync (Source -> Dest)`, async () => {
45
- // // 1. Setup Spaces
46
- // metaspace = new Metaspace_Innerspace(undefined);
47
- // await metaspace.initialize({
48
- // getFnAlert: () => async ({ title, msg }) => { console.log(`[Alert] ${title}: ${msg}`); },
49
- // getFnPrompt: () => async ({ title, msg }) => { console.log(`[Prompt] ${title}: ${msg}`); return ''; },
50
- // getFnPromptPassword: () => async (title, msg) => { console.log(`[PromptPwd] ${title}: ${msg}`); return null; },
51
- // });
52
- // // Create two distinct inner spaces manually or via metaspace if supported
53
- // // Metaspace_Innerspace typically manages one local user space, but we can instantiate InnerSpace_V1 directly.
54
- // sourceSpace = new InnerSpace_V1({ name: 'source', uuid: 'source_uuid' } as any);
55
- // await (sourceSpace as any).initialize();
56
- // destSpace = new InnerSpace_V1({ name: 'dest', uuid: 'dest_uuid' } as any);
57
- // await (destSpace as any).initialize();
58
- // // 2. Seed Source Data
59
- // // 2.1 Create a "Stone"
60
- // console.log(`${lc} Creating Stone...`);
61
- // const stone = await createStoneHelper({
62
- // ib: 'stone_data',
63
- // data: { some: 'data' },
64
- // });
65
- // const stoneAddr = getIbGibAddr({ ibGib: stone });
66
- // await putInSpace({ space: sourceSpace, ibGibs: [stone] });
67
- // // 2.2 Create a "Living" Timeline (Root)
68
- // console.log(`${lc} Creating Timeline Root...`);
69
- // const root = await createTimelineRootHelper({
70
- // ib: 'timeline_root',
71
- // data: { type: 'root', n: 0 },
72
- // space: sourceSpace,
73
- // });
74
- // const rootAddr = getIbGibAddr({ ibGib: root });
75
- // // 2.3 Evolve Timeline (Root -> Child)
76
- // // using mut8Timeline to simulate evolution
77
- // console.log(`${lc} Evolving Timeline...`);
78
- // const child = await mut8Timeline({
79
- // timeline: root,
80
- // mut8Opts: {
81
- // dataToAddOrPatch: { type: 'child', n: 1 }
82
- // },
83
- // metaspace,
84
- // space: sourceSpace,
85
- // // We use skipLock=true for simplicity in single-threaded test setup if locking is complex,
86
- // // but timeline-api handles locking. Let's try default first.
87
- // // Actually InnerSpace locking might be no-op or simple.
88
- // });
89
- // const childAddr = getIbGibAddr({ ibGib: child });
90
- // // 2.4 Rel8 Child to Stone (Dependency)
91
- // console.log(`${lc} Linking Child to Stone...`);
92
- // const childWithRel = await appendToTimeline({
93
- // timeline: child,
94
- // rel8nInfos: [{
95
- // rel8nName: 'linked_stone',
96
- // ibGibs: [stone]
97
- // }],
98
- // metaspace,
99
- // space: sourceSpace,
100
- // });
101
- // const childWithRelAddr = getIbGibAddr({ ibGib: childWithRel });
102
- // // 3. Setup Sync Coordinator
103
- // console.log(`${lc} Setting up Coordinator...`);
104
- // const mockKeystone = await getTestKeystoneServiceHelper();
105
- // const identity = await (mockKeystone as any).getIdentity();
106
- // const coordinator = new SyncSagaCoordinator(mockKeystone);
107
- // // 4. Run Sync
108
- // console.log(`${lc} Running Sync...`);
109
- // const syncRes = await coordinator.sync({
110
- // source: sourceSpace,
111
- // dest: destSpace,
112
- // domainIbGibs: [childWithRel], // Sync starting from the tip
113
- // identity
114
- // });
115
- // // 5. Verify Dest (Full Dependency Graph)
116
- // console.log(`${lc} Verifying Destination (Full Graph)...`);
117
- // // We expect the graph to contain:
118
- // // 1. childWithRel
119
- // // 2. child (past of childWithRel)
120
- // // 3. root (ancestor of child, past of child)
121
- // // 4. stone (linked to childWithRel)
122
- // // 5. primitives (timeline_root, child, stone_data, identity, fork, mut8, rel8, root^gib, etc.)
123
- // // Let's get the graph from the source first to know what to expect (ground truth)
124
- // const sourceGraph = await getDependencyGraph({
125
- // ibGibs: [childWithRel],
126
- // space: sourceSpace,
127
- // });
128
- // const sourceAddrs = Object.keys(sourceGraph);
129
- // console.log(`${lc} Source Graph Size: ${sourceAddrs.length}`);
130
- // // Now get the graph from the destination
131
- // const destGraph = await getDependencyGraph({
132
- // ibGibs: [childWithRel],
133
- // space: destSpace,
134
- // });
135
- // const destAddrs = Object.keys(destGraph);
136
- // console.log(`${lc} Dest Graph Size: ${destAddrs.length}`);
137
- // // Assert
138
- // iReckon(sir, destAddrs.length).asTo('dest graph size').isGonnaBe(sourceAddrs.length);
139
- // for (const addr of sourceAddrs) {
140
- // const inDest = !!destGraph[addr];
141
- // if (!inDest) {
142
- // console.error(`${lc} Missing in dest: ${addr}`);
143
- // }
144
- // iReckon(sir, inDest).asTo(`addr present in dest: ${addr}`).isGonnaBeTrue();
145
- // }
146
- // console.log(`${lc} Verified Full Dependency Graph synced.`);
147
- // });
148
- // await ifWeMight(sir, `Idempotency (No-op if already synced)`, async () => {
149
- // // 1. Setup Spaces
150
- // const metaspace = new Metaspace_Innerspace(undefined);
151
- // await metaspace.initialize({
152
- // getFnAlert: () => async ({ title, msg }) => { console.log(`[Alert] ${title}: ${msg}`); },
153
- // getFnPrompt: () => async ({ title, msg }) => { console.log(`[Prompt] ${title}: ${msg}`); return ''; },
154
- // getFnPromptPassword: () => async (title, msg) => { console.log(`[PromptPwd] ${title}: ${msg}`); return null; },
155
- // });
156
- // const sourceSpace = new InnerSpace_V1({ name: 'source_idem', uuid: 'source_idem_uuid' } as any);
157
- // await (sourceSpace as any).initialize();
158
- // const destSpace = new InnerSpace_V1({ name: 'dest_idem', uuid: 'dest_idem_uuid' } as any);
159
- // await (destSpace as any).initialize();
160
- // // 2. Seed Source and Sync ONCE
161
- // const root = await createTimelineRootHelper({
162
- // ib: 'timeline_root',
163
- // data: { type: 'root', n: 0 },
164
- // space: sourceSpace,
165
- // });
166
- // const mockKeystone = await getTestKeystoneServiceHelper();
167
- // const identity = await (mockKeystone as any).getIdentity();
168
- // const coordinator = new SyncSagaCoordinator(mockKeystone);
169
- // console.log(`${lc} Running First Sync...`);
170
- // await coordinator.sync({
171
- // source: sourceSpace,
172
- // dest: destSpace,
173
- // domainIbGibs: [root],
174
- // identity
175
- // });
176
- // // Verify Initial State
177
- // const rootAddr = getIbGibAddr({ ibGib: root });
178
- // const getRoot1 = await getFromSpace({ space: destSpace, addr: rootAddr });
179
- // iReckon(sir, getRoot1.success).asTo('First Sync success').isGonnaBeTrue();
180
- // // 3. Run Sync AGAIN (Should be No-op)
181
- // console.log(`${lc} Running Second Sync...`);
182
- // await coordinator.sync({
183
- // source: sourceSpace,
184
- // dest: destSpace,
185
- // domainIbGibs: [root],
186
- // identity
187
- // });
188
- // // 4. Verify State Unchanged / Still Valid
189
- // const getRoot2 = await getFromSpace({ space: destSpace, addr: rootAddr });
190
- // iReckon(sir, getRoot2.success).asTo('Second Sync success').isGonnaBeTrue();
191
- // // Ensure no duplication or errors in destination (checking count in dependency graph might be good proxy?)
192
- // const destGraph = await getDependencyGraph({
193
- // ibGibs: [root],
194
- // space: destSpace,
195
- // });
196
- // iReckon(sir, Object.keys(destGraph).length).asTo('Dest Graph Size unchanged').isGonnaBe(Object.keys(destGraph).length); // Trivial assertion, mostly checking for no throw
197
- // console.log(`${lc} Verified Idempotency.`);
198
- // });
199
- await ifWeMight(sir, `Dest Ahead (Pull/Fast-Backward)`, async () => {
23
+ await ifWeMight(sir, `Basic Push Sync (Source -> Dest)`, async () => {
200
24
  // 1. Setup Spaces
201
- // Metaspace_Innerspace automatically initializes spaces so we don't need manual initialize calls for these if they were standard.
202
- // But here we are instantiating them directly.
203
- // User pointed out initialize is called in constructor.
204
- const metaspace = new Metaspace_Innerspace(undefined);
25
+ metaspace = new Metaspace_Innerspace(undefined);
205
26
  await metaspace.initialize({
206
27
  getFnAlert: () => async ({ title, msg }) => { console.log(`[Alert] ${title}: ${msg}`); },
207
28
  getFnPrompt: () => async ({ title, msg }) => { console.log(`[Prompt] ${title}: ${msg}`); return ''; },
208
29
  getFnPromptPassword: () => async (title, msg) => { console.log(`[PromptPwd] ${title}: ${msg}`); return null; },
209
30
  });
210
- // const sourceSpace = new InnerSpace_V1({ name: 'source_pull', uuid: 'source_pull_uuid' } as any);
211
- const sourceSpace = new InnerSpace_V1({ name: 'source_pull', });
212
- // await (sourceSpace as any).initialize(); // Already initialized in ctor
213
- // const destSpace = new InnerSpace_V1({ name: 'dest_pull', uuid: 'dest_pull_uuid' } as any);
214
- const destSpace = new InnerSpace_V1({ name: 'dest_pull', });
215
- // await (destSpace as any).initialize(); // Already initialized in ctor
216
- // 2. Setup Initial Shared State
217
- // Create root in Source, Sync to Dest
218
- console.log(`${lc} Seeding initial shared state...`);
31
+ sourceSpace = new InnerSpace_V1({ name: 'source', uuid: 'source_uuid' });
32
+ await sourceSpace.initialize();
33
+ destSpace = new InnerSpace_V1({ name: 'dest', uuid: 'dest_uuid' });
34
+ await destSpace.initialize();
35
+ // 2. Seed Source Data
36
+ console.log(`${lc} Creating data in Source...`);
219
37
  const root = await createTimelineRootHelper({
220
- ib: 'timeline_pull',
221
- data: { type: 'root', state: 'initial' },
38
+ ib: 'timeline_root',
39
+ data: { type: 'root', n: 0 },
222
40
  space: sourceSpace,
223
41
  });
224
- const rootAddr = getIbGibAddr({ ibGib: root });
225
- if (logalot) {
226
- console.log(`${lc} rootAddr: ${rootAddr} (I: 486bcba15f0a3307f8e6aa88089d1825)`);
227
- }
228
- const tjpAddr = getTjpAddr({ ibGib: root, defaultIfNone: 'incomingAddr' }) || rootAddr; // Root is typically its own TJP if not explicit
229
- if (logalot) {
230
- console.log(`${lc} tjpAddr: ${tjpAddr} (I: b9326dfb66b8efe8a829673335869c25)`);
231
- }
232
- if (logalot) {
233
- console.log(`${lc} root:\n${pretty(root)} (I: 3051584310780a36c8435d7881d2f825)`);
234
- }
42
+ const child = await mut8Timeline({
43
+ timeline: root,
44
+ mut8Opts: {
45
+ dataToAddOrPatch: { type: 'child', n: 1 }
46
+ },
47
+ metaspace,
48
+ space: sourceSpace,
49
+ });
50
+ const childAddr = getIbGibAddr({ ibGib: child });
51
+ // 3. Setup Coordinators & Peer
52
+ console.log(`${lc} Setting up Coordinators...`);
235
53
  const mockKeystone = await getTestKeystoneServiceHelper();
236
54
  const identity = await mockKeystone.getIdentity();
237
- const coordinator = new SyncSagaCoordinator(mockKeystone);
238
- await coordinator.sync({
239
- source: sourceSpace,
240
- dest: destSpace,
241
- domainIbGibs: [root],
242
- identity
55
+ // Sender Coordinator
56
+ const senderCoordinator = new SyncSagaCoordinator(mockKeystone);
57
+ // Receiver Coordinator
58
+ // Note: Receiver acts "globally" usually, but here we treat it as bound to the dest operations?
59
+ // Actually SyncSagaCoordinator isn't bound to a space. It works ON a space.
60
+ // So we can reuse or create separate instances. Let's create separate to simulate remote.
61
+ const receiverCoordinator = new SyncSagaCoordinator(mockKeystone);
62
+ // Peer (The "Network")
63
+ const peer = new SyncPeerInnerspace_V1({
64
+ senderSpace: sourceSpace, // "Client"
65
+ receiverSpace: destSpace, // "Server"
66
+ receiverCoordinator: receiverCoordinator,
67
+ receiverMetaspace: metaspace,
243
68
  });
244
- let rootGraph_source = await getDependencyGraph({ ibGib: root, space: sourceSpace });
245
- let rootGraph_dest = await getDependencyGraph({ ibGib: root, space: destSpace });
246
- let rootsSynced = naiveGraphsAreEqual(rootGraph_source, rootGraph_dest);
247
- if (rootsSynced) {
248
- if (logalot) {
249
- console.log(`${lc} rootsSynced (I: 493982dbc9f40170fd26a0d8e0b69825)`);
250
- }
251
- }
252
- else {
253
- throw new Error(`(UNEXPECTED) graphs are not equal after simple root push sync? (E: f10be8a3d285f260989419c8b99bc225)`);
254
- }
255
- // 3. Evolve DESTINATION (Simulate external update)
256
- // We act "as if" we are on Dest side evolving it. This is like we are
257
- // syncing with the remote, and there were changes created by someone
258
- // else but we have no local changes.
259
- console.log(`${lc} Evolving Destination (making Source behind)...`);
260
- const childDest = await mut8Timeline({
261
- timeline: root, // works because mut8Timeline just needs the ib/data/rel8ns/n, doesn't need to be "in" the space object-wise, but we persist to destSpace
262
- mut8Opts: { dataToAddOrPatch: { type: 'modified in dest', state: 'ahead' } },
263
- metaspace,
264
- space: destSpace,
265
- });
266
- const childDestAddr = getIbGibAddr({ ibGib: childDest });
267
- if (logalot) {
268
- console.log(`${lc} childDest:\n${pretty(childDest)}(I: ff4868842d8757df98cfe59ec5bea825)`);
269
- }
270
- // Log debugging info for TJP
271
- const childDestTjpAddr = getTjpAddr({ ibGib: childDest });
272
- console.log(`${lc} childDestAddr: ${childDestAddr}`);
273
- console.log(`${lc} rootAddr (Expected TJP?): ${rootAddr}`);
274
- console.log(`${lc} childDest TJP Addr: ${childDestTjpAddr}`);
275
- // If TJP is missing or mismatched, that's why getLatestAddrs fails
276
- if (!childDestTjpAddr || childDestTjpAddr !== tjpAddr) {
277
- // NOTE: THIS DOES NOT HIT
278
- console.warn(`${lc} WARNING: childDest TJP (${childDestTjpAddr}) does not match root/expected TJP (${tjpAddr}). This likely causes sync to miss it.`);
279
- // Hack fix for test verification if mut8Timeline is slightly broken on TJP propagation for raw tests
280
- if (!childDest.rel8ns) {
281
- childDest.rel8ns = {};
282
- }
283
- childDest.rel8ns.tjp = [tjpAddr];
284
- // Re-put to update index?? No, InnerSpace uses in-memory map references often if we modified object.
285
- // Better to re-put explicitly if we modified it.
286
- await putInSpace({ space: destSpace, ibGibs: [childDest] });
287
- }
288
- console.log(`${lc} sourceSpace UUID: ${sourceSpace.data.uuid}`);
289
- console.log(`${lc} destSpace UUID: ${destSpace.data.uuid}`);
290
- // Verify Source DOES NOT have childDest
291
- const getChildInSource = await getFromSpace({ space: sourceSpace, addr: childDestAddr });
292
- iReckon(sir, getChildInSource.success).asTo('Source is behind').isGonnaBeFalse(); // Or success=true/addrsNotFound depending on impl
293
- // 4. Run Sync from Source
294
- // Checks:
295
- // - Source should detect it is behind (or "conflict" in current generic terms).
296
- // - Source should Pull 'childDest' from Dest.
297
- // - Source should update itself.
298
- console.log(`${lc} Running Sync (Pull)...`);
299
- await coordinator.sync({
300
- source: sourceSpace,
301
- dest: destSpace,
302
- domainIbGibs: [root], // We start with what Source knows (root)
69
+ // 4. Run Sync
70
+ console.log(`${lc} Running Sync...`);
71
+ const syncRes = await senderCoordinator.sync({
72
+ peer: peer,
73
+ localSpace: sourceSpace,
74
+ targetSpace: undefined, // Not used when peer is provided
75
+ metaspace: metaspace,
76
+ domainIbGibs: [child], // Sync the child
303
77
  identity
304
- });
305
- // 5. Verify Source Caught Up
306
- const getChildInSourcePost = await getFromSpace({ space: sourceSpace, addr: childDestAddr });
307
- console.log(`${lc} getChildInSourcePost success: ${getChildInSourcePost.success}`);
308
- if (getChildInSourcePost.ibGibs) {
309
- console.log(`${lc} getChildInSourcePost found: ${getChildInSourcePost.ibGibs.length} ibGibs`);
310
- }
311
- else {
312
- console.log(`${lc} getChildInSourcePost found: 0 ibGibs (undefined)`);
313
- }
314
- iReckon(sir, getChildInSourcePost.success).asTo('Source pulled new frame').isGonnaBeTrue();
315
- iReckon(sir, getChildInSourcePost.ibGibs?.[0]).asTo('Source has childDest').isGonnaBeTruthy();
316
- console.log(`${lc} Verified Dest Ahead / Pull.`);
78
+ }); // Type cast if needed until we align optional params
79
+ // 5. Verify Dest
80
+ console.log(`${lc} Verifying Destination...`);
81
+ const getChildInDest = await getFromSpace({ space: destSpace, addr: childAddr });
82
+ iReckon(sir, getChildInDest.success).asTo('Child present in Dest').isGonnaBeTrue();
83
+ iReckon(sir, getChildInDest.ibGibs?.[0]?.data?.n).asTo('Child content matches').isGonnaBe(1);
84
+ console.log(`${lc} Verified Basic Push.`);
317
85
  });
318
- // await ifWeMight(sir, `Divergent (Conflict Detection)`, async () => {
319
- // interface TestData extends IbGibData_V1 {
320
- // type: string;
321
- // state?: string;
322
- // branch?: string;
323
- // }
324
- // // 1. Setup
325
- // const metaspace = new Metaspace_Innerspace(undefined);
326
- // await metaspace.initialize({
327
- // getFnAlert: () => async ({ title, msg }) => { console.log(`[Alert] ${title}: ${msg}`); },
328
- // getFnPrompt: () => async ({ title, msg }) => { console.log(`[Prompt] ${title}: ${msg}`); return ''; },
329
- // getFnPromptPassword: () => async (title, msg) => { console.log(`[PromptPwd] ${title}: ${msg}`); return null; },
330
- // });
331
- // const sourceSpace = new InnerSpace_V1({ name: 'source_div', uuid: 'source_div_uuid' } as any);
332
- // // await (sourceSpace as any).initialize();
333
- // const destSpace = new InnerSpace_V1({ name: 'dest_div', uuid: 'dest_div_uuid' } as any);
334
- // // await (destSpace as any).initialize();
335
- // // 2. Setup Shared Root
336
- // const root = await createTimelineRootHelper<TestData>({
337
- // ib: 'timeline_div',
338
- // data: { type: 'root' },
339
- // space: sourceSpace,
340
- // });
341
- // const rootAddr = getIbGibAddr({ ibGib: root });
342
- // const tjpAddr = getTjpAddr({ ibGib: root }) || rootAddr;
343
- // // Sync root to dest so they share base
344
- // await putInSpace({ space: destSpace, ibGibs: [root] });
345
- // // NOTE: Must manually index TJP in dest if putInSpace doesn't trigger full indexing (InnerSpace might need register)
346
- // // Ideally we run a sync to init, but manual put + hack fix is faster for setup.
347
- // // Actually, let's use coordinator to sync root first to ensure clean state.
348
- // const mockKeystone = await getTestKeystoneServiceHelper();
349
- // const identity = await (mockKeystone as any).getIdentity();
350
- // const coordinator = new SyncSagaCoordinator(mockKeystone);
351
- // await coordinator.sync({
352
- // source: sourceSpace,
353
- // dest: destSpace,
354
- // domainIbGibs: [root],
355
- // identity
356
- // });
357
- // // 3. Diverge!
358
- // // Source creates Child A
359
- // const childA = await mut8Timeline({
360
- // timeline: root,
361
- // mut8Opts: { dataToAddOrPatch: { branch: 'A' } },
362
- // metaspace,
363
- // space: sourceSpace,
364
- // });
365
- // const childAAddr = getIbGibAddr({ ibGib: childA });
366
- // // Dest (simulated) creates Child B from Root (Forking history)
367
- // const childB = await mut8Timeline({
368
- // timeline: root,
369
- // mut8Opts: { dataToAddOrPatch: { branch: 'B' } }, // Logic: same n=1, but different content/hash
370
- // metaspace,
371
- // space: destSpace,
372
- // });
373
- // const childBAddr = getIbGibAddr({ ibGib: childB });
374
- // // Ensure TJP indexing on Dest (test hack)
375
- // const childBTjp = getTjpAddr({ ibGib: childB });
376
- // if (!childBTjp || childBTjp !== tjpAddr) {
377
- // if (!childB.rel8ns) childB.rel8ns = {};
378
- // childB.rel8ns.tjp = [tjpAddr];
379
- // await putInSpace({ space: destSpace, ibGibs: [childB] });
380
- // }
381
- // console.log(`${lc} Divergence Setup:`);
382
- // console.log(`${lc} Root: ${rootAddr}`);
383
- // console.log(`${lc} Source Tip (A): ${childAAddr}`);
384
- // console.log(`${lc} Dest Tip (B): ${childBAddr}`);
385
- // // 4. Sync with Strategy: 'abort' (Expect Error)
386
- // console.log(`${lc} Running Sync (Abort Strategy)...`);
387
- // let caughtError;
388
- // try {
389
- // await coordinator.sync({
390
- // source: sourceSpace,
391
- // dest: destSpace,
392
- // domainIbGibs: [childA],
393
- // identity,
394
- // conflictStrategy: 'abort', // Should throw
395
- // });
396
- // } catch (e) {
397
- // caughtError = e;
398
- // console.log(`${lc} Caught expected error: ${e.message}`);
399
- // }
400
- // iReckon(sir, caughtError).asTo('Should throw on conflict with abort strategy').isGonnaBeTruthy();
401
- // // 5. Sync with Strategy: 'optimistic' (Expect Merge)
402
- // // TODO: Implement optimistic merging
403
- // });
404
86
  });
405
87
  //# sourceMappingURL=sync-innerspace.respec.mjs.map
@@ -1 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;IAC9D,4HAA4H;IAC5H,uFAAuF;IACvF,mFAAmF;IACnF,iEAAiE;IACjE,kEAAkE;IAClE,iEAAiE;IAEjE,+BAA+B;IAC/B,+BAA+B;IAC/B,2BAA2B;IAC3B,gCAAgC;IAChC,mBAAmB;IACnB,UAAU;IAEV,qBAAqB;IACrB,gCAAgC;IAChC,0CAA0C;IAC1C,0BAA0B;IAC1B,2DAA2D;IAC3D,qBAAqB;IACrB,8BAA8B;IAC9B,UAAU;IACV,0DAA0D;IAE1D,sEAAsE;IACtE,0CAA0C;IAC1C,0BAA0B;IAC1B,0GAA0G;IAC1G,qBAAqB;IACrB,4BAA4B;IAC5B,UAAU;IACV,0DAA0D;IAE1D,iDAAiD;IACjD,uDAAuD;IACvD,iDAAiD;IACjD,kDAAkD;IAClD,yCAAyC;IACzC,oEAAoE;IACpE,QAAQ;IAER,8CAA8C;IAC9C,gDAAgD;IAChD,4DAA4D;IAC5D,4DAA4D;IAE5D,uDAAuD;IACvD,6DAA6D;IAC7D,uBAAuB;IACvB,YAAY;IACZ,mCAAmC;IACnC,mCAAmC;IACnC,+BAA+B;IAC/B,sCAAsC;IACtC,wBAAwB;IACxB,yDAAyD;IACzD,cAAc;IACd,oBAAoB;IACpB,2BAA2B;IAC3B,oEAAoE;IACpE,QAAQ;IACR,wGAAwG;IAExG,4DAA4D;IAC5D,4CAA4C;IAC5C,MAAM;AAEV,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"sync-innerspace.respec.mjs","sourceRoot":"","sources":["../../src/sync/sync-innerspace.respec.mts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACH,WAAW,EAAmB,OAAO,EACrC,SAAS,EACZ,MAAM,kDAAkD,CAAC;AAC1D,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EA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CAAC;AAEP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @module SyncPeerInnerspace_V1
3
+ */
4
+ import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
5
+ import { SyncSagaContextIbGib_V1 } from '../sync-saga-context/sync-saga-context-types.mjs';
6
+ import { SyncPeer_V1 } from './sync-peer-v1.mjs';
7
+ import { SyncSagaCoordinator } from '../sync-saga-coordinator.mjs';
8
+ import { MetaspaceService } from '../../witness/space/metaspace/metaspace-types.mjs';
9
+ export interface SyncPeerInnerspaceOptions {
10
+ senderSpace: IbGibSpaceAny;
11
+ receiverSpace: IbGibSpaceAny;
12
+ receiverCoordinator: SyncSagaCoordinator;
13
+ receiverMetaspace: MetaspaceService;
14
+ }
15
+ /**
16
+ * Concrete implementation of SyncPeer for local in-memory simulation (Innerspace to Innerspace).
17
+ *
18
+ * Acts as the "Network" layer, transferring data between two local spaces and
19
+ * executing the receiver's coordinator logic.
20
+ */
21
+ export declare class SyncPeerInnerspace_V1 extends SyncPeer_V1 {
22
+ opts: SyncPeerInnerspaceOptions;
23
+ protected lc: string;
24
+ constructor(opts: SyncPeerInnerspaceOptions);
25
+ /**
26
+ * Simulates the network transmission and receiver execution.
27
+ */
28
+ witness(arg: SyncSagaContextIbGib_V1): Promise<SyncSagaContextIbGib_V1 | undefined>;
29
+ /**
30
+ * Helper to copy ibgibs from A to B.
31
+ */
32
+ protected transfer({ addr, addrs, from, to }: {
33
+ addr?: string;
34
+ addrs?: string[];
35
+ from: IbGibSpaceAny;
36
+ to: IbGibSpaceAny;
37
+ }): Promise<void>;
38
+ }
39
+ //# sourceMappingURL=sync-peer-innerspace-v1.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-peer-innerspace-v1.d.mts","sourceRoot":"","sources":["../../../src/sync/sync-peer/sync-peer-innerspace-v1.mts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAInE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAErF,MAAM,WAAW,yBAAyB;IACtC,WAAW,EAAE,aAAa,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,gBAAgB,CAAC;CACvC;AAED;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,WAAW;IAKvC,IAAI,EAAE,yBAAyB;IAH1C,SAAS,CAAC,EAAE,EAAE,MAAM,CAAqC;gBAG9C,IAAI,EAAE,yBAAyB;IAK1C;;OAEG;IACG,OAAO,CAAC,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC;IAmFzF;;OAEG;cACa,QAAQ,CAAC,EACrB,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,EAAE,EACL,EAAE;QACC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QACjB,IAAI,EAAE,aAAa,CAAC;QACpB,EAAE,EAAE,aAAa,CAAA;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC;CAYpB"}