@ibgib/core-gib 0.1.20 → 0.1.22
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/sync/graft-info/graft-info-constants.d.mts +5 -0
- package/dist/sync/graft-info/graft-info-constants.d.mts.map +1 -0
- package/dist/sync/graft-info/graft-info-constants.mjs +5 -0
- package/dist/sync/graft-info/graft-info-constants.mjs.map +1 -0
- package/dist/sync/graft-info/graft-info-helpers.d.mts +49 -0
- package/dist/sync/graft-info/graft-info-helpers.d.mts.map +1 -0
- package/dist/sync/graft-info/graft-info-helpers.mjs +236 -0
- package/dist/sync/graft-info/graft-info-helpers.mjs.map +1 -0
- package/dist/sync/graft-info/graft-info-helpers.respec.d.mts +2 -0
- package/dist/sync/graft-info/graft-info-helpers.respec.d.mts.map +1 -0
- package/dist/sync/graft-info/graft-info-helpers.respec.mjs +70 -0
- package/dist/sync/graft-info/graft-info-helpers.respec.mjs.map +1 -0
- package/dist/sync/graft-info/graft-info-types.d.mts +31 -0
- package/dist/sync/{merge-info/merge-info-types.d.mts.map → graft-info/graft-info-types.d.mts.map} +1 -1
- package/dist/sync/graft-info/graft-info-types.mjs +2 -0
- package/dist/sync/graft-info/graft-info-types.mjs.map +1 -0
- package/dist/sync/strategies/conflict-optimistic.d.mts +1 -1
- package/dist/sync/strategies/conflict-optimistic.d.mts.map +1 -1
- package/dist/sync/strategies/conflict-optimistic.mjs +10 -60
- package/dist/sync/strategies/conflict-optimistic.mjs.map +1 -1
- package/dist/sync/sync-conflict.respec.mjs +155 -34
- package/dist/sync/sync-conflict.respec.mjs.map +1 -1
- package/dist/sync/sync-constants.d.mts +9 -11
- package/dist/sync/sync-constants.d.mts.map +1 -1
- package/dist/sync/sync-constants.mjs +3 -5
- package/dist/sync/sync-constants.mjs.map +1 -1
- package/dist/sync/sync-helpers.d.mts +2 -0
- package/dist/sync/sync-helpers.d.mts.map +1 -1
- package/dist/sync/sync-helpers.mjs +11 -9
- package/dist/sync/sync-helpers.mjs.map +1 -1
- package/dist/sync/sync-innerspace-constants.respec.mjs +5 -1
- package/dist/sync/sync-innerspace-constants.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-deep-updates.respec.mjs +5 -1
- package/dist/sync/sync-innerspace-deep-updates.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-dest-ahead.respec.mjs +8 -4
- package/dist/sync/sync-innerspace-dest-ahead.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs +5 -1
- package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace-partial-update.respec.mjs +5 -1
- package/dist/sync/sync-innerspace-partial-update.respec.mjs.map +1 -1
- package/dist/sync/sync-innerspace.respec.mjs +5 -1
- package/dist/sync/sync-innerspace.respec.mjs.map +1 -1
- package/dist/sync/sync-peer/sync-peer-constants.d.mts +2 -0
- package/dist/sync/sync-peer/sync-peer-constants.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-constants.mjs +2 -0
- package/dist/sync/sync-peer/sync-peer-constants.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-helpers.d.mts +2 -0
- package/dist/sync/sync-peer/sync-peer-helpers.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-helpers.mjs +2 -0
- package/dist/sync/sync-peer/sync-peer-helpers.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.d.mts +8 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs +8 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-helpers.d.mts +18 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-helpers.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-helpers.mjs +54 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-helpers.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.d.mts +80 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.mjs +5 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts +43 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.d.mts.map +1 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs +229 -0
- package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs.map +1 -0
- package/dist/sync/sync-peer/sync-peer-types.d.mts +12 -0
- package/dist/sync/sync-peer/sync-peer-types.d.mts.map +1 -1
- package/dist/sync/sync-peer/sync-peer-v1.d.mts +15 -7
- package/dist/sync/sync-peer/sync-peer-v1.d.mts.map +1 -1
- package/dist/sync/sync-peer/sync-peer-v1.mjs +105 -24
- package/dist/sync/sync-peer/sync-peer-v1.mjs.map +1 -1
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts +5 -8
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts.map +1 -1
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs +34 -18
- package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs.map +1 -1
- package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts +26 -22
- package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts.map +1 -1
- package/dist/sync/sync-saga-context/sync-saga-context-types.mjs +1 -9
- package/dist/sync/sync-saga-context/sync-saga-context-types.mjs.map +1 -1
- package/dist/sync/sync-saga-coordinator.d.mts +48 -51
- package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
- package/dist/sync/sync-saga-coordinator.mjs +720 -420
- package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
- package/dist/sync/sync-saga-message/sync-saga-message-helpers.d.mts.map +1 -1
- package/dist/sync/sync-saga-message/sync-saga-message-helpers.mjs +1 -0
- package/dist/sync/sync-saga-message/sync-saga-message-helpers.mjs.map +1 -1
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts +1 -12
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts.map +1 -1
- package/dist/sync/sync-types.d.mts +15 -3
- package/dist/sync/sync-types.d.mts.map +1 -1
- package/dist/witness/light-witness-base-v1.d.mts.map +1 -1
- package/dist/witness/light-witness-base-v1.mjs +2 -0
- package/dist/witness/light-witness-base-v1.mjs.map +1 -1
- package/dist/witness/space/inner-space/inner-space-v1.mjs +1 -1
- package/dist/witness/space/inner-space/inner-space-v1.mjs.map +1 -1
- package/ibgib-foundations.md +20 -2
- package/package.json +1 -1
- package/src/sync/README.md +31 -22
- package/src/sync/graft-info/graft-info-constants.mts +4 -0
- package/src/sync/graft-info/graft-info-helpers.mts +308 -0
- package/src/sync/graft-info/graft-info-helpers.respec.mts +83 -0
- package/src/sync/graft-info/graft-info-types.mts +33 -0
- package/src/sync/strategies/conflict-optimistic.mts +11 -70
- package/src/sync/sync-conflict.respec.mts +177 -37
- package/src/sync/sync-constants.mts +5 -9
- package/src/sync/sync-helpers.mts +11 -7
- package/src/sync/sync-innerspace-constants.respec.mts +5 -1
- package/src/sync/sync-innerspace-deep-updates.respec.mts +5 -1
- package/src/sync/sync-innerspace-dest-ahead.respec.mts +7 -3
- package/src/sync/sync-innerspace-multiple-timelines.respec.mts +5 -1
- package/src/sync/sync-innerspace-partial-update.respec.mts +8 -2
- package/src/sync/sync-innerspace.respec.mts +5 -1
- package/src/sync/sync-peer/sync-peer-constants.mts +0 -0
- package/src/sync/sync-peer/sync-peer-helpers.mts +0 -0
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mts +8 -0
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-helpers.mts +72 -0
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-types.mts +87 -0
- package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mts +242 -0
- package/src/sync/sync-peer/sync-peer-types.mts +13 -1
- package/src/sync/sync-peer/sync-peer-v1.mts +93 -27
- package/src/sync/sync-saga-context/sync-saga-context-helpers.mts +47 -29
- package/src/sync/sync-saga-context/sync-saga-context-types.mts +29 -30
- package/src/sync/sync-saga-coordinator.mts +782 -441
- package/src/sync/sync-saga-message/sync-saga-message-helpers.mts +2 -0
- package/src/sync/sync-saga-message/sync-saga-message-types.mts +0 -11
- package/src/sync/sync-types.mts +17 -3
- package/src/witness/light-witness-base-v1.mts +2 -1
- package/src/witness/space/inner-space/inner-space-v1.mts +1 -1
- package/test_output.log +489 -0
- package/tmp.md +61 -2
- package/dist/sync/merge-info/merge-info-constants.d.mts +0 -2
- package/dist/sync/merge-info/merge-info-constants.d.mts.map +0 -1
- package/dist/sync/merge-info/merge-info-constants.mjs +0 -2
- package/dist/sync/merge-info/merge-info-constants.mjs.map +0 -1
- package/dist/sync/merge-info/merge-info-helpers.d.mts +0 -51
- package/dist/sync/merge-info/merge-info-helpers.d.mts.map +0 -1
- package/dist/sync/merge-info/merge-info-helpers.mjs +0 -92
- package/dist/sync/merge-info/merge-info-helpers.mjs.map +0 -1
- package/dist/sync/merge-info/merge-info-helpers.respec.d.mts +0 -2
- package/dist/sync/merge-info/merge-info-helpers.respec.d.mts.map +0 -1
- package/dist/sync/merge-info/merge-info-helpers.respec.mjs +0 -32
- package/dist/sync/merge-info/merge-info-helpers.respec.mjs.map +0 -1
- package/dist/sync/merge-info/merge-info-types.d.mts +0 -26
- package/dist/sync/merge-info/merge-info-types.mjs +0 -2
- package/dist/sync/merge-info/merge-info-types.mjs.map +0 -1
- package/dist/sync/sync-local-spaces.respec.d.mts +0 -2
- package/dist/sync/sync-local-spaces.respec.d.mts.map +0 -1
- package/dist/sync/sync-local-spaces.respec.mjs +0 -159
- package/dist/sync/sync-local-spaces.respec.mjs.map +0 -1
- package/dist/sync/sync-peer/sync-peer-innerspace-v1.d.mts +0 -39
- package/dist/sync/sync-peer/sync-peer-innerspace-v1.d.mts.map +0 -1
- package/dist/sync/sync-peer/sync-peer-innerspace-v1.mjs +0 -131
- package/dist/sync/sync-peer/sync-peer-innerspace-v1.mjs.map +0 -1
- package/dist/sync/sync-saga-coordinator.respec.d.mts +0 -2
- package/dist/sync/sync-saga-coordinator.respec.d.mts.map +0 -1
- package/dist/sync/sync-saga-coordinator.respec.mjs +0 -40
- package/dist/sync/sync-saga-coordinator.respec.mjs.map +0 -1
- package/src/sync/merge-info/merge-info-constants.mts +0 -1
- package/src/sync/merge-info/merge-info-helpers.mts +0 -134
- package/src/sync/merge-info/merge-info-helpers.respec.mts +0 -41
- package/src/sync/merge-info/merge-info-types.mts +0 -28
- package/src/sync/sync-local-spaces.respec.mts +0 -200
- package/src/sync/sync-peer/sync-peer-innerspace-v1.mts +0 -167
- package/src/sync/sync-saga-coordinator.respec.mts +0 -52
package/tmp.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
|
|
1
|
+
Great! Ty for going through that! In crafting my response for you, I have since updated the libs\core-gib\src\sync\README.md file, so please re-read that file for me. There were several inaccuracies and it is much improved.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Now for your questions. Let's get to them!
|
|
4
|
+
|
|
5
|
+
## foundational
|
|
6
|
+
|
|
7
|
+
1. I don't know if the conflict merging aspect is working well or not. I have implemented a similar optimistic strategy before in a previous sync prototype that worked well (though that implementation was very slow). This approach is the same, except two additions: a) naive text merge if the transform targets `data.text`, and b) adding "graft info" (libs\core-gib\src\sync\graft-info) to the timeline after the merge so that original divergent states aren't lost. Both of these should be straightforward though. The main problem right now is trying to isolate the various stages of the "ping-pong" exchange.
|
|
8
|
+
|
|
9
|
+
2. Tjp is fully implemented and has been for several years now. Including the tjpGib in the full address, instead of just using a bare hash, has proved immensely useful (and as you know, this is completely novel/innovative as there is no other protocol that does this).
|
|
10
|
+
|
|
11
|
+
3. We originally had control and domain payloads grouped together and we had to separate them. However, this was done poorly by the original agent, and may yet still be incomplete. AFAICT though, the most recent attempt at completing the separation was successful. The current blocking issue is that it's hard to tell what is causing the test in sync-conflict.respec.mts to fail. The logging gets too verbose and is hard to track throughout the entire transaction.
|
|
12
|
+
|
|
13
|
+
4. We are deferring integrating the session keystones until we get the non-keystone workflow going.
|
|
14
|
+
|
|
15
|
+
## current state
|
|
16
|
+
|
|
17
|
+
5. The immediate symptom is the test in `sync-conflict.respect.mts` is failing. You can see the output of the most recent run in C:\Users\billm\antigravity\ibgib\libs\core-gib\test_output.log . But it is a coarse test, and really, it's hard to even read the test itself. But it's also hard to try to create more granular unit tests, though that may be the right path forward.
|
|
18
|
+
|
|
19
|
+
6. AFAICT the v16 implementation plan has been partially implemented. For example, `handleAckFrame` in `saga-coordinator.mts` still has not had the `payloadIbGibs` separated properly, i.e., there is still a variable called `payloadIbGibs`, despite us mandating that there should be NO references to this. Every instance of that string should be separated into control and domain payload ibgibs. It's actually looking like that `handleAckFrame` is not right anymore, though the libs\core-gib\src\sync\sync-innerspace-dest-ahead.respec.mts test is still passing so it's not completely wrong. But if you read through that method, you'll see it's not right and there is a not-implemented error line in there.
|
|
20
|
+
|
|
21
|
+
The same is true for `payloadAddrs`, which should NOT exist anywhere. But it still is on `SyncDeltaData`. It should not be "deprecated", it should have been removed and references to it should have led us to more places to complete the separation of control and domain addrs.
|
|
22
|
+
|
|
23
|
+
7. I think part of the problem is that our implementation plans have been too complex and we didn't follow through to ensure that each and every piece was taken care of. Perhaps a todo/checklist would be more appropriate. But I devote quite a bit of time to refine the implementation plan, and then the nuances get lost. So we have a bunch of messy, half-completed code. Granted, this is a relatively complex sync algorithm, but it should absolutely be feasible.
|
|
24
|
+
|
|
25
|
+
But let me speak to your specific questions on this:
|
|
26
|
+
|
|
27
|
+
* Too many iterations/refactorings without clear direction?
|
|
28
|
+
* I don't mind the iterations. I mind thinking that something is complete and it is not. This is partially my fault in not breaking it down and unit testing it more granularly, but that would add a huge amount of overhead, and what inevitably happens is we troubleshoot the tests and not the code.
|
|
29
|
+
* Type boundaries bleeding between concerns?
|
|
30
|
+
* Our types are pretty well created by this point.
|
|
31
|
+
* The polling mechanism feeling hacky?
|
|
32
|
+
* No, the polling mechanism is fine.
|
|
33
|
+
* Race conditions or timing issues?
|
|
34
|
+
* There have been no race conditions that I know of.
|
|
35
|
+
|
|
36
|
+
I had previous success with Antigravity on other smaller tasks, but this one seems to have been a little too advanced for the Gemini 3 High model. Your model seems to be performing better, however we hit the smaller context window rather quickly. Overall, I am just trying not to have to go through every single LoC myself, though it's looking like that is more and more likely.
|
|
37
|
+
|
|
38
|
+
Here is another example I've come across that is messy. Look at the following code found in `sync-saga-coordinator.mts`:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
// 4. EXECUTE SAGA LOOP (FSM)
|
|
42
|
+
// Inject tempSpace into peer so it can pull control payloads to the right place
|
|
43
|
+
if ('opts' in peer && peer.opts) {
|
|
44
|
+
(peer.opts as any).senderTempSpace = tempSpace;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This is terrible! This is a hack so that if we have a `SyncPeerInnerspace_V1`, we set its temp space. This is "messy" to say the least.
|
|
49
|
+
|
|
50
|
+
### sync test results
|
|
51
|
+
|
|
52
|
+
* libs\core-gib\src\sync\sync-innerspace.respec.mts PASSING
|
|
53
|
+
* libs\core-gib\src\sync\sync-innerspace-constants.respec.mts PASSING
|
|
54
|
+
* libs\core-gib\src\sync\sync-innerspace-dest-ahead.respec.mts PASSING
|
|
55
|
+
* libs\core-gib\src\sync\sync-innerspace-deep-updates.respec.mts PASSING
|
|
56
|
+
* libs\core-gib\src\sync\sync-innerspace-multiple-timelines.respec.mts PASSING
|
|
57
|
+
* libs\core-gib\src\sync\sync-innerspace-partial-update.respec.mts PASSING
|
|
58
|
+
* libs\core-gib\src\sync\sync-conflict.respec.mts FAILING
|
|
59
|
+
|
|
60
|
+
## how you can help
|
|
61
|
+
|
|
62
|
+
All of the simpler tests that don't require a Delta frame back and forth (short back-and-forth to resolve the conflict) are all passing. I _think_ that the merge logic itself is fine, though I haven't gone through that with a fine-tooth comb yet. To me, the most obvious problem right now is that the mechanism for passing domain ibgibs back and forth is not working. For example, look in libs\core-gib\src\sync\sync-saga-coordinator.mts for `srcGraph`. That was added early on in the code sketch. IIRC, it was supposed to be for the domain ibgibs in the original sender's location. Is that another name for payloadIbGibs, but stored in a map? How does it get populated? How do the payload ibgibs go from the peer to the handle____ methods? So don't do any coding right now. Perhaps this whole conversation will just be you and I talking about the code as I go through it. So just point me to things that you see and I will make changes, because I need to wrap this up in the next 3 days. Do note that I have made some changes since starting this message to you, and it doesn't build at the moment. But overall there are still things that you can just point me to if you just examine the logic.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge-info-constants.d.mts","sourceRoot":"","sources":["../../../src/sync/merge-info/merge-info-constants.mts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge-info-constants.mjs","sourceRoot":"","sources":["../../../src/sync/merge-info/merge-info-constants.mts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
2
|
-
import { MetaspaceService } from "../../witness/space/metaspace/metaspace-types.mjs";
|
|
3
|
-
import { MergeInfoData_V1, MergeInfoIbGib_V1, MergeInfoIb_V1 } from "./merge-info-types.mjs";
|
|
4
|
-
import { IbGibSpaceAny } from "../../witness/space/space-base-v1.mjs";
|
|
5
|
-
/**
|
|
6
|
-
* Validates and constructs the `ib` object for a Merge Info ibGib.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getMergeInfoIb({ data }: {
|
|
9
|
-
data: MergeInfoData_V1;
|
|
10
|
-
}): Promise<string>;
|
|
11
|
-
/**
|
|
12
|
-
* Parses a standard Merge Info 'ib' string.
|
|
13
|
-
*/
|
|
14
|
-
export declare function parseMergeInfoIb({ ib }: {
|
|
15
|
-
ib: string;
|
|
16
|
-
}): Promise<MergeInfoIb_V1>;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new MergeInfo ibGib.
|
|
19
|
-
*/
|
|
20
|
-
export declare function createMergeInfo({ algo, ancestors, details, }: {
|
|
21
|
-
algo: string;
|
|
22
|
-
ancestors: IbGib_V1[];
|
|
23
|
-
details?: string;
|
|
24
|
-
}): Promise<MergeInfoIbGib_V1>;
|
|
25
|
-
/**
|
|
26
|
-
* Naive text merge.
|
|
27
|
-
* Strategies:
|
|
28
|
-
* 1. Concat (A + B)
|
|
29
|
-
* 2. structured diff (not impl)
|
|
30
|
-
*/
|
|
31
|
-
export declare function mergeText({ textA, textB, }: {
|
|
32
|
-
textA: string;
|
|
33
|
-
textB: string;
|
|
34
|
-
}): Promise<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Combines two divergent timelines by applying missing DNA from one branch to another.
|
|
37
|
-
*
|
|
38
|
-
* Logic:
|
|
39
|
-
* 1. Identify missing DNA (transforms) in `targetTip` that exist in `sourceTip` (relative to LCA).
|
|
40
|
-
* 2. Replay those transforms onto `targetTip`.
|
|
41
|
-
* 3. Create a MergeInfo stone describing this operation.
|
|
42
|
-
* 4. Relate the new tip to the MergeInfo.
|
|
43
|
-
*/
|
|
44
|
-
export declare function combineDivergentTimelines({ targetTip, sourceTip, lca, space, metaspace, }: {
|
|
45
|
-
targetTip: IbGib_V1;
|
|
46
|
-
sourceTip: IbGib_V1;
|
|
47
|
-
lca: IbGib_V1;
|
|
48
|
-
space: IbGibSpaceAny;
|
|
49
|
-
metaspace: MetaspaceService;
|
|
50
|
-
}): Promise<IbGib_V1>;
|
|
51
|
-
//# sourceMappingURL=merge-info-helpers.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge-info-helpers.d.mts","sourceRoot":"","sources":["../../../src/sync/merge-info/merge-info-helpers.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAI3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAItE;;GAEG;AACH,wBAAsB,cAAc,CAAC,EACjC,IAAI,EACP,EAAE;IACC,IAAI,EAAE,gBAAgB,CAAA;CACzB,GAAG,OAAO,CAAC,MAAM,CAAC,CAKlB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,EACnC,EAAE,EACL,EAAE;IACC,EAAE,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,cAAc,CAAC,CAgB1B;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,EAClC,IAAI,EACJ,SAAS,EACT,OAAO,GACV,EAAE;IACC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA0B7B;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,EAC5B,KAAK,EACL,KAAK,GACR,EAAE;IACC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,MAAM,CAAC,CAKlB;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAAC,EAC5C,SAAS,EACT,SAAS,EACT,GAAG,EACH,KAAK,EACL,SAAS,GACZ,EAAE;IACC,SAAS,EAAE,QAAQ,CAAC;IACpB,SAAS,EAAE,QAAQ,CAAC;IACpB,GAAG,EAAE,QAAQ,CAAC;IACd,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,gBAAgB,CAAC;CAC/B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAGpB"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Factory_V1 } from "@ibgib/ts-gib/dist/V1/factory.mjs";
|
|
2
|
-
import { getIbGibAddr } from "@ibgib/ts-gib/dist/helper.mjs";
|
|
3
|
-
import { extractErrorMsg } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
4
|
-
import { MERGE_INFO_ATOM } from "./merge-info-constants.mjs";
|
|
5
|
-
const lc = `[merge-info-helpers]`;
|
|
6
|
-
/**
|
|
7
|
-
* Validates and constructs the `ib` object for a Merge Info ibGib.
|
|
8
|
-
*/
|
|
9
|
-
export async function getMergeInfoIb({ data }) {
|
|
10
|
-
if (!data.algo) {
|
|
11
|
-
throw new Error(`(UNEXPECTED) data.algo required for MergeInfoIb (E: 8a9b0c1d2e3f4g5h)`);
|
|
12
|
-
}
|
|
13
|
-
// merge_info algo
|
|
14
|
-
return [MERGE_INFO_ATOM, data.algo].join(' ');
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Parses a standard Merge Info 'ib' string.
|
|
18
|
-
*/
|
|
19
|
-
export async function parseMergeInfoIb({ ib }) {
|
|
20
|
-
try {
|
|
21
|
-
const parts = ib.split(' ');
|
|
22
|
-
if (parts[0] !== MERGE_INFO_ATOM) {
|
|
23
|
-
throw new Error(`Atom mismatch. Expected ${MERGE_INFO_ATOM} (E: 8f03c92a95144b618821915632599266)`);
|
|
24
|
-
}
|
|
25
|
-
if (parts.length < 2) {
|
|
26
|
-
throw new Error(`Invalid merge info ib. Expected at least 2 parts. (E: 9c2b4c8a6d34469f8263544710183355)`);
|
|
27
|
-
}
|
|
28
|
-
const algo = parts.slice(1).join(' '); // allow spaces in algo? usually single word but safe to join.
|
|
29
|
-
return {
|
|
30
|
-
atom: MERGE_INFO_ATOM,
|
|
31
|
-
algo,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Creates a new MergeInfo ibGib.
|
|
41
|
-
*/
|
|
42
|
-
export async function createMergeInfo({ algo, ancestors, details, }) {
|
|
43
|
-
const data = {
|
|
44
|
-
algo,
|
|
45
|
-
details,
|
|
46
|
-
};
|
|
47
|
-
const ib = await getMergeInfoIb({ data });
|
|
48
|
-
const rel8ns = {};
|
|
49
|
-
if (ancestors && ancestors.length > 0) {
|
|
50
|
-
rel8ns.ancestors = ancestors.map(a => getIbGibAddr({ ibGib: a }));
|
|
51
|
-
}
|
|
52
|
-
const res = await Factory_V1.stone({
|
|
53
|
-
ib,
|
|
54
|
-
data,
|
|
55
|
-
rel8ns,
|
|
56
|
-
parentPrimitiveIb: MERGE_INFO_ATOM,
|
|
57
|
-
uuid: true, // Should be unique per merge event? Yes.
|
|
58
|
-
});
|
|
59
|
-
// Unwrapping if necessary, though recent checking suggests Factory returns ibGib directly.
|
|
60
|
-
// Wait, recent check in SyncSagaCoordinator showed Factory_V1.stone returns the ibGib directly.
|
|
61
|
-
// But check the implementation plan/previous learnings.
|
|
62
|
-
// Confirmed: Factory_V1.stone returns the ibGib directly.
|
|
63
|
-
return res;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Naive text merge.
|
|
67
|
-
* Strategies:
|
|
68
|
-
* 1. Concat (A + B)
|
|
69
|
-
* 2. structured diff (not impl)
|
|
70
|
-
*/
|
|
71
|
-
export async function mergeText({ textA, textB, }) {
|
|
72
|
-
// Very naive: Just concat with a marker for now.
|
|
73
|
-
// User wants "best effort at being non-destructive".
|
|
74
|
-
if (textA === textB) {
|
|
75
|
-
return textA;
|
|
76
|
-
}
|
|
77
|
-
return `${textA}\n\n>>> MERGE SEPARATOR <<<\n\n${textB}`;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Combines two divergent timelines by applying missing DNA from one branch to another.
|
|
81
|
-
*
|
|
82
|
-
* Logic:
|
|
83
|
-
* 1. Identify missing DNA (transforms) in `targetTip` that exist in `sourceTip` (relative to LCA).
|
|
84
|
-
* 2. Replay those transforms onto `targetTip`.
|
|
85
|
-
* 3. Create a MergeInfo stone describing this operation.
|
|
86
|
-
* 4. Relate the new tip to the MergeInfo.
|
|
87
|
-
*/
|
|
88
|
-
export async function combineDivergentTimelines({ targetTip, sourceTip, lca, space, metaspace, }) {
|
|
89
|
-
// stub implementation
|
|
90
|
-
return targetTip;
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=merge-info-helpers.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge-info-helpers.mjs","sourceRoot":"","sources":["../../../src/sync/merge-info/merge-info-helpers.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAGlF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI7D,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACjC,IAAI,EAGP;IACG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAAC,CAAC;IAE7G,kBAAkB;IAClB,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,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EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC;QAC/B,EAAE;QACF,IAAI;QACJ,MAAM;QACN,iBAAiB,EAAE,eAAe;QAClC,IAAI,EAAE,IAAI,EAAE,yCAAyC;KACxD,CAAC,CAAC;IAEH,2FAA2F;IAC3F,gGAAgG;IAChG,wDAAwD;IACxD,0DAA0D;IAC1D,OAAO,GAAwB,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,EAC5B,KAAK,EACL,KAAK,GAIR;IACG,iDAAiD;IACjD,qDAAqD;IACrD,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IACtC,OAAO,GAAG,KAAK,kCAAkC,KAAK,EAAE,CAAC;AAC7D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,EAC5C,SAAS,EACT,SAAS,EACT,GAAG,EACH,KAAK,EACL,SAAS,GAOZ;IACG,sBAAsB;IACtB,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge-info-helpers.respec.d.mts","sourceRoot":"","sources":["../../../src/sync/merge-info/merge-info-helpers.respec.mts"],"names":[],"mappings":""}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module merge-info-helpers.respec
|
|
3
|
-
*/
|
|
4
|
-
import { iReckon, respecfully, ifWeMight } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
5
|
-
import { mergeText } from './merge-info-helpers.mjs';
|
|
6
|
-
const maam = `[${import.meta.url}]`;
|
|
7
|
-
const sir = maam;
|
|
8
|
-
await respecfully(sir, 'Merge Info Helpers', async () => {
|
|
9
|
-
await respecfully(sir, 'mergeText', async () => {
|
|
10
|
-
await ifWeMight(sir, 'mergeText should concat different strings', async () => {
|
|
11
|
-
const textA = "Hello";
|
|
12
|
-
const textB = "World";
|
|
13
|
-
const res = await mergeText({ textA, textB });
|
|
14
|
-
iReckon(sir, res).asTo('result').isGonnaBeTruthy();
|
|
15
|
-
iReckon(sir, res.includes(textA)).asTo('includes A').isGonnaBeTruthy();
|
|
16
|
-
iReckon(sir, res.includes(textB)).asTo('includes B').isGonnaBeTruthy();
|
|
17
|
-
iReckon(sir, res.includes('MERGE SEPARATOR')).asTo('includes separator').isGonnaBeTruthy();
|
|
18
|
-
});
|
|
19
|
-
await ifWeMight(sir, 'mergeText should return same string if identical', async () => {
|
|
20
|
-
const textA = "Hello";
|
|
21
|
-
const res = await mergeText({ textA, textB: textA });
|
|
22
|
-
iReckon(sir, res).asTo('result').isGonnaBe(textA);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
await respecfully(sir, 'combineDivergentTimelines', async () => {
|
|
26
|
-
await ifWeMight(sir, 'combineDivergentTimelines should work (Stub)', async () => {
|
|
27
|
-
// Validation of stub for now, just to ensure scaffolding works.
|
|
28
|
-
iReckon(sir, true).asTo('stub executed').isGonnaBeTruthy();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=merge-info-helpers.respec.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge-info-helpers.respec.mjs","sourceRoot":"","sources":["../../../src/sync/merge-info/merge-info-helpers.respec.mts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,WAAW,EAAQ,SAAS,EAAE,MAAM,kDAAkD,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;AACpC,MAAM,GAAG,GAAG,IAAI,CAAC;AAEjB,MAAM,WAAW,CAAC,G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AAG,EAAE,2BAA2B,EAAE,KAAK,IAAI,EAAE;QAE3D,MAAM,SAAS,CAAC,GAAG,EAAE,8CAA8C,EAAE,KAAK,IAAI,EAAE;YAC5E,gEAAgE;YAChE,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,eAAe,EAAE,CAAC;QAC/D,CAAC,CAAC,CAAC;IAEP,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { IbGib_V1, IbGibData_V1, IbGibRel8ns_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
2
|
-
import { MERGE_INFO_ATOM } from "./merge-info-constants.mjs";
|
|
3
|
-
export interface MergeInfoIb_V1 {
|
|
4
|
-
atom: typeof MERGE_INFO_ATOM;
|
|
5
|
-
algo: string;
|
|
6
|
-
}
|
|
7
|
-
export interface MergeInfoData_V1 extends IbGibData_V1 {
|
|
8
|
-
/**
|
|
9
|
-
* The algorithm or strategy used to perform the merge.
|
|
10
|
-
*/
|
|
11
|
-
algo: string;
|
|
12
|
-
/**
|
|
13
|
-
* Optional details about the merge, e.g. validation results or specifics about conflicts resolved.
|
|
14
|
-
*/
|
|
15
|
-
details?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface MergeInfoRel8ns_V1 extends IbGibRel8ns_V1 {
|
|
18
|
-
/**
|
|
19
|
-
* The ibGibs that were merged together.
|
|
20
|
-
* For a timeline merge, these are the tips of the divergent branches.
|
|
21
|
-
*/
|
|
22
|
-
ancestors?: string[];
|
|
23
|
-
}
|
|
24
|
-
export interface MergeInfoIbGib_V1 extends IbGib_V1<MergeInfoData_V1, MergeInfoRel8ns_V1> {
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=merge-info-types.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge-info-types.mjs","sourceRoot":"","sources":["../../../src/sync/merge-info/merge-info-types.mts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync-local-spaces.respec.d.mts","sourceRoot":"","sources":["../../src/sync/sync-local-spaces.respec.mts"],"names":[],"mappings":""}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { rm } from 'node:fs/promises';
|
|
2
|
-
import { default as pathUtils } from 'path';
|
|
3
|
-
import { respecfully, lastOfAll } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
4
|
-
const maam = `[${import.meta.url}]`, sir = maam;
|
|
5
|
-
import { IBGIB_ENCODING } from '../witness/space/filesystem-space/filesystem-constants.mjs';
|
|
6
|
-
import { NodeFilesystemSpace_V1 } from '../witness/space/filesystem-space/node-filesystem-space/node-filesystem-space-v1.mjs';
|
|
7
|
-
import { getUUID } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
8
|
-
const logalot = true;
|
|
9
|
-
const lc = `[sync-local-spaces.respec]`;
|
|
10
|
-
// Helper to create a temp space
|
|
11
|
-
const createTempSpace = async ({ baseDir, name }) => {
|
|
12
|
-
const uuid = await getUUID();
|
|
13
|
-
const initialData = {
|
|
14
|
-
version: '1',
|
|
15
|
-
classname: NodeFilesystemSpace_V1.name,
|
|
16
|
-
uuid,
|
|
17
|
-
name,
|
|
18
|
-
description: `Temp space for ${name}`,
|
|
19
|
-
baseDir,
|
|
20
|
-
baseSubPath: 'ibgib', // keep short to avoid long path issues
|
|
21
|
-
spaceSubPath: name,
|
|
22
|
-
ibgibsSubPath: 'ibgibs',
|
|
23
|
-
metaSubPath: 'meta',
|
|
24
|
-
binSubPath: 'bin',
|
|
25
|
-
dnaSubPath: 'dna',
|
|
26
|
-
encoding: IBGIB_ENCODING,
|
|
27
|
-
mitigateLongPaths: true,
|
|
28
|
-
// other defaults
|
|
29
|
-
catchAllErrors: false,
|
|
30
|
-
trace: false,
|
|
31
|
-
};
|
|
32
|
-
// mimic constructor logic if needed, or just new it up
|
|
33
|
-
const space = new NodeFilesystemSpace_V1(initialData);
|
|
34
|
-
// Explicitly initialize if needed (based on findings, constructor calls super which calls initialize?
|
|
35
|
-
// Actually source had it commented out in ctor. Let's call it via a witness "put" which should verify initialization)
|
|
36
|
-
return space;
|
|
37
|
-
};
|
|
38
|
-
// class MockKeystoneService implements KeystoneService_V1 {
|
|
39
|
-
// async getIdentity(): Promise<KeystoneIbGib_V1> {
|
|
40
|
-
// // Return a dummy identity
|
|
41
|
-
// const res = await Factory_V1.firstGen({
|
|
42
|
-
// ib: 'identity',
|
|
43
|
-
// data: { uuid: await getUUID() },
|
|
44
|
-
// dna: true,
|
|
45
|
-
// });
|
|
46
|
-
// return res.newIbGib as KeystoneIbGib_V1;
|
|
47
|
-
// }
|
|
48
|
-
// // Implement other methods as no-ops or simple mocks
|
|
49
|
-
// async sign(ibGib: any): Promise<any> { return ibGib; }
|
|
50
|
-
// async verify(ibGib: any): Promise<boolean> { return true; }
|
|
51
|
-
// // Add other required properties/methods of KeystoneService_V1 if any (checking interface might be needed)
|
|
52
|
-
// // Assuming for now these are the core ones used by Coordinator.
|
|
53
|
-
// // If strict interface, might need more.
|
|
54
|
-
// }
|
|
55
|
-
await respecfully(sir, `Sync Local Spaces`, async () => {
|
|
56
|
-
const TEST_ROOT = pathUtils.join(process.cwd(), 'tmp_sync_test_' + await getUUID());
|
|
57
|
-
lastOfAll(sir, async () => {
|
|
58
|
-
if (!logalot) {
|
|
59
|
-
await rm(TEST_ROOT, { recursive: true, force: true });
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
console.log(`${lc} Leaving TEST_ROOT for inspection: ${TEST_ROOT}`);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
await respecfully(sir, `Basic Push Sync (Source -> Dest)`, async () => {
|
|
66
|
-
// // 1. Setup Spaces
|
|
67
|
-
// const srcDir = pathUtils.join(TEST_ROOT, 'source');
|
|
68
|
-
// const destDir = pathUtils.join(TEST_ROOT, 'dest');
|
|
69
|
-
// const sourceSpace = await createTempSpace({ baseDir: srcDir, name: 'source' });
|
|
70
|
-
// const destSpace = await createTempSpace({ baseDir: destDir, name: 'dest' });
|
|
71
|
-
// // 2. Seed Source Data
|
|
72
|
-
// // 2.1 Create a "Stone" (Primitive-like or just immutable data)
|
|
73
|
-
// const stoneRes = await Factory_V1.firstGen({
|
|
74
|
-
// ib: 'stone_data',
|
|
75
|
-
// data: { some: 'data', timestamp: getTimestampInTicks() },
|
|
76
|
-
// dna: false,
|
|
77
|
-
// });
|
|
78
|
-
// const stone = stoneRes.newIbGib;
|
|
79
|
-
// const stoneAddr = getIbGibAddr({ ibGib: stone });
|
|
80
|
-
// // 2.2 Create a "Living" Timeline (Root -> Child)
|
|
81
|
-
// const rootRes = await Factory_V1.firstGen({
|
|
82
|
-
// ib: 'timeline_root',
|
|
83
|
-
// data: { type: 'root' },
|
|
84
|
-
// dna: true,
|
|
85
|
-
// });
|
|
86
|
-
// const root = rootRes.newIbGib;
|
|
87
|
-
// const rootAddr = getIbGibAddr({ ibGib: root });
|
|
88
|
-
// const childRes = await mut8({
|
|
89
|
-
// type: 'fork',
|
|
90
|
-
// src: root,
|
|
91
|
-
// dna: true,
|
|
92
|
-
// data: { type: 'child', n: 1 }
|
|
93
|
-
// });
|
|
94
|
-
// const child = childRes.newIbGib;
|
|
95
|
-
// const childAddr = getIbGibAddr({ ibGib: child });
|
|
96
|
-
// // Put into Source
|
|
97
|
-
// await putInSpace({
|
|
98
|
-
// space: sourceSpace,
|
|
99
|
-
// ibGibs: [stone, root, child]
|
|
100
|
-
// });
|
|
101
|
-
// // 3. Setup Sync Coordinator
|
|
102
|
-
// const mockKeystone = new MockKeystoneService() as unknown as KeystoneService_V1;
|
|
103
|
-
// const identity = await mockKeystone.getIdentity();
|
|
104
|
-
// const coordinator = new SyncSagaCoordinator(mockKeystone);
|
|
105
|
-
// // Define domain (roots to sync)
|
|
106
|
-
// const domainIbGibs = [root]; // We only explicitly track the "Living" root. Stone is standalone?
|
|
107
|
-
// // Actually for the test let's explicitly include both or rely on dependency graph.
|
|
108
|
-
// // If 'stone' is not related to 'root', it won't be picked up unless we add it to domain.
|
|
109
|
-
// // Let's Rel8 the stone to the child to test dependency traversal.
|
|
110
|
-
// const childWithRelRes = await rel8({
|
|
111
|
-
// src: child,
|
|
112
|
-
// rel8nsToAddByAddr: { 'linked_stone': [stoneAddr] },
|
|
113
|
-
// dna: true,
|
|
114
|
-
// });
|
|
115
|
-
// const childWithRel = childWithRelRes.newIbGib;
|
|
116
|
-
// const childWithRelAddr = getIbGibAddr({ ibGib: childWithRel });
|
|
117
|
-
// // Update Source with linked child
|
|
118
|
-
// await putInSpace({
|
|
119
|
-
// space: sourceSpace,
|
|
120
|
-
// ibGibs: [childWithRel]
|
|
121
|
-
// });
|
|
122
|
-
// // 4. Run Sync
|
|
123
|
-
// const syncRes = await coordinator.sync({
|
|
124
|
-
// source: sourceSpace,
|
|
125
|
-
// dest: destSpace,
|
|
126
|
-
// domainIbGibs: [childWithRel], // Sync starting from the tip
|
|
127
|
-
// identity
|
|
128
|
-
// });
|
|
129
|
-
// // 5. Verify Dest
|
|
130
|
-
// // Check Stone
|
|
131
|
-
// const getStone = await getFromSpace({
|
|
132
|
-
// space: destSpace,
|
|
133
|
-
// addr: stoneAddr
|
|
134
|
-
// });
|
|
135
|
-
// if (!getStone.success || !getStone.ibGibs?.[0]) {
|
|
136
|
-
// throw new Error(`Dest failed to get Stone: ${stoneAddr}`);
|
|
137
|
-
// }
|
|
138
|
-
// console.log(`${lc} Verified Stone synced.`);
|
|
139
|
-
// // Check ChildWithRel (Tip)
|
|
140
|
-
// const getChild = await getFromSpace({
|
|
141
|
-
// space: destSpace,
|
|
142
|
-
// addr: childWithRelAddr
|
|
143
|
-
// });
|
|
144
|
-
// if (!getChild.success || !getChild.ibGibs?.[0]) {
|
|
145
|
-
// throw new Error(`Dest failed to get ChildWithRel: ${childWithRelAddr}`);
|
|
146
|
-
// }
|
|
147
|
-
// console.log(`${lc} Verified Timeline Tip synced.`);
|
|
148
|
-
// // Check Root (Dependency)
|
|
149
|
-
// const getRoot = await getFromSpace({
|
|
150
|
-
// space: destSpace,
|
|
151
|
-
// addr: rootAddr
|
|
152
|
-
// });
|
|
153
|
-
// if (!getRoot.success || !getRoot.ibGibs?.[0]) {
|
|
154
|
-
// throw new Error(`Dest failed to get Root: ${rootAddr}`);
|
|
155
|
-
// }
|
|
156
|
-
// console.log(`${lc} Verified Root synced.`);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
//# sourceMappingURL=sync-local-spaces.respec.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync-local-spaces.respec.mjs","sourceRoot":"","sources":["../../src/sync/sync-local-spaces.respec.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE5C,OAAO,EACH,WAAW,EAAE,SAAS,EACzB,MAAM,kDAAkD,CAAC;AAC1D,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;AAKhD,OAAO,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,sFAAsF,CAAC;AAI9H,OAAO,EAAuB,OAAO,EAAE,MAAM,iDAAiD,CAAC;AAO/F,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,EAAE,GAAG,4BAA4B,CAAC;AAExC,gCAAgC;AAChC,MAAM,eAAe,GAAG,KAAK,EAAE,EAC3B,OAAO,EACP,IAAI,EAIP,EAAmC,EAAE;IAClC,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE,CAAC;IAC7B,MAAM,WAAW,GAA+B;QAC5C,OAAO,EAAE,GAAG;QACZ,SAAS,EAAE,sBAAsB,CAAC,IAAI;Q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ACpD,+EAA+E;QAC/E,IAAI;QACJ,sDAAsD;QAEtD,6BAA6B;QAC7B,uCAAuC;QACvC,wBAAwB;QACxB,qBAAqB;QACrB,MAAM;QACN,kDAAkD;QAClD,+DAA+D;QAC/D,IAAI;QACJ,8CAA8C;IAElD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module SyncPeerInnerspace_V1
|
|
3
|
-
*/
|
|
4
|
-
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
5
|
-
import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
|
|
6
|
-
import { SyncSagaContextIbGib_V1 } from '../sync-saga-context/sync-saga-context-types.mjs';
|
|
7
|
-
import { SyncPeer_V1 } from './sync-peer-v1.mjs';
|
|
8
|
-
import { SyncSagaCoordinator } from '../sync-saga-coordinator.mjs';
|
|
9
|
-
import { MetaspaceService } from '../../witness/space/metaspace/metaspace-types.mjs';
|
|
10
|
-
export interface SyncPeerInnerspaceOptions {
|
|
11
|
-
senderSpace: IbGibSpaceAny;
|
|
12
|
-
receiverSpace: IbGibSpaceAny;
|
|
13
|
-
receiverCoordinator: SyncSagaCoordinator;
|
|
14
|
-
receiverMetaspace: MetaspaceService;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Concrete implementation of SyncPeer for local in-memory simulation (Innerspace to Innerspace).
|
|
18
|
-
*
|
|
19
|
-
* Acts as the "Network" layer, transferring data between two local spaces and
|
|
20
|
-
* executing the receiver's coordinator logic.
|
|
21
|
-
*/
|
|
22
|
-
export declare class SyncPeerInnerspace_V1 extends SyncPeer_V1 {
|
|
23
|
-
opts: SyncPeerInnerspaceOptions;
|
|
24
|
-
protected lc: string;
|
|
25
|
-
constructor(opts: SyncPeerInnerspaceOptions);
|
|
26
|
-
protected getLocalIbGib(addr: string): Promise<IbGib_V1 | undefined>;
|
|
27
|
-
protected push(addr: string): Promise<void>;
|
|
28
|
-
protected pull(addr: string): Promise<void>;
|
|
29
|
-
protected sendRequest(context: SyncSagaContextIbGib_V1): Promise<SyncSagaContextIbGib_V1 | undefined>;
|
|
30
|
-
/**
|
|
31
|
-
* Helper to copy single ibgib from A to B.
|
|
32
|
-
*/
|
|
33
|
-
protected transfer({ addr, from, to }: {
|
|
34
|
-
addr: string;
|
|
35
|
-
from: IbGibSpaceAny;
|
|
36
|
-
to: IbGibSpaceAny;
|
|
37
|
-
}): Promise<void>;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=sync-peer-innerspace-v1.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAK3D,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;AAGnE,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;AAID;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,WAAW;IAKvC,IAAI,EAAE,yBAAyB;IAH1C,SAAS,CAAC,EAAE,EAAE,MAAM,CAAqC;gBAG9C,IAAI,EAAE,yBAAyB;cAK1B,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,G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