@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
package/tmp.md CHANGED
@@ -1,11 +1,129 @@
1
- OK, ty. The space-wide sync approach is not tenable. That is like trying to sync Alice's entire logical drive with Bob's entire logical drive instead of a particular folder on the drive. Your thinking that a single Domain IbGib does not contain many timelines is faulty. A dependency graph of a "single" domain may contain multiple, or even many/a great many, timelines. Think of this like in set theory and we are creating an isomorphic projection of nodes. I say isomorphic and not homomorphic, because we may have to do merges for timelines, so it really is a "one-way" projection. Though obviously, with "sync" being bi-directional, we are ultimately converging on both endpoints having "equivalent" timelines (there may be orphans on one and/or the other after merges, with either endpoint effectively doing a "rebase"). So our sync process has to start with getting a "live" dependency graph of a single domain ibgib. We can actually do multiple domain ibgibs, and then unify the entire dependency graph in the sync transmission ibgib, but I think it's best to just build for the single ibgib scenario. You can look at@beautifulMention, but I would really recommend looking at the entire @beautifulMentionfile. This is a non-trivial recursive function, but you should be able to fully grok it by looking at both the jsdocs/comments in that file and the code itself. Always look at the code itself of course!
1
+ OK great! We're making progress for sure. Here are some issues and questions that I've come across.
2
2
 
3
- That dependency graph comes in the form a @beautifulMention as defined by this:
3
+ ---
4
+
5
+ around line 154
6
+
7
+ ```
8
+ // 5. MERGE RESULT (Optimistic Commit)
9
+ // we need to refactor this to a `finalizeSaga` method that...
10
+ // * moves all ibgibs stored in temp space to target space in
11
+ // one go (commit phase 1)
12
+ // * registers each timeline AFTER commit space via
13
+ // metaspace.registerNewIbGib (commit phase 2)
14
+ // * need to add a skipBroadcast flag so we can register
15
+ // without broadcasting until the very tip of each timeline
16
+ // * deletes the temp space
17
+ ```
18
+
19
+ I want to keep this in because we will need to do the `registerNewIbGib`
20
+ somewhere when we do the commit transaction process.
21
+
22
+ ---
23
+
24
+ around line 283:
25
+
26
+ ```
27
+ if (!remoteFrameAddr) {
28
+ // warnings are mostly to be avoided. i use warnings primarily for temporary code reminders to remember to do something before prod.
29
+ // console.warn(`${lc} Peer response has no sagaFrame. Ending loop.`);
30
+ // currentFrame = null;
31
+ // break;
32
+
33
+ // question: are we prepared to error out the saga when an exception arrives?
34
+ throw new Error(`Peer response has no sagaFrame. Ending loop. (E: 0224e84a83e1c7ee288aaed6bdc40826)`);
35
+ ```
36
+
37
+ ---
38
+
39
+ around line 421:
40
+
41
+ Why does "Commit" run on either sender/receiver?
42
+
43
+ ---
44
+
45
+ around line 512:
46
+
47
+ Added todo to change to use `getLatestAddrs({tjpAddrs: remoteTjps})`
48
+
49
+ ---
50
+
51
+ around line 626:
52
+
53
+ I reverted to my corrected, more explicit separate error conditional checks.
54
+
55
+ ---
56
+
57
+ around line 639:
58
+
59
+ readded todo:
60
+
61
+ // todo: change this to batch getFromSpace. Also, do not get addrs that are primitive.
62
+
63
+ ---
64
+
65
+ in sync-saga-context-helpers.mts, shouldn't sagaFrame be required in createSyncSagaContext?
66
+ This would change the CreateSyncSagaContextOptions also, and would throw if this was falsy.
67
+
68
+ ---
69
+
70
+ In just sync-saga-coordinator.mts alone, there are 68 uses of the word "payload"
71
+ (case-insensitive).
72
+
73
+ But the term `payload` is defined in multiple places differently. In some
74
+ places, this is defined as `IbGib_V1[]`, others it is `any`, and still others
75
+ it is `string[]`.
76
+
77
+ For example, in CreateSyncSagaContextOptions, this is defined as:
4
78
 
5
79
  ```
6
80
  /**
7
- * Map of addr -> ibGib
81
+ * Payload addresses (strings) for bulk data.
8
82
  */
9
- export type FlatIbGibGraph = { [addr: string]: IbGib_V1 };
83
+ payload?: string[];
10
84
  ```
11
85
 
86
+ But `getStageAndPayloadFromFrame` has in its return type `payload: any`.
87
+
88
+ And in `executeSagaLoop`: `let nextPayload: IbGib_V1[] = [];`
89
+
90
+ This is being used in different contexts and is causing confusion
91
+ as to how it is being used. We need to create different, explicitly named
92
+ variable and property names that are specific to the immediate use case. And we
93
+ should have zero `any` types being used, except in extremely rare difficult
94
+ compilation contexts (like when we have to cast to any before casting to some
95
+ other type). The only reason I allow `any` at all is mainly for backwards compat
96
+ (would be too much work to do the whole codebase).
97
+
98
+ In my prototype, I also came across a similar problem. My solution was to always
99
+ be explicit with [x]IbGib's vs. [x]Addrs. Sometimes it seemed like overkill, but
100
+ it was a way to reduce difficulty in reading and following code.
101
+
102
+ So, we need to change these to `payloadIbGibs` and `payloadAddrs` in ALL
103
+ locations, so we can be explicit.
104
+
105
+ ---
106
+
107
+ analyzeTimelines returns this:
108
+
109
+ ```
110
+ {
111
+ srcStones: IbGib_V1[],
112
+ srcTimelinesMap: { [tjp: string]: IbGib_V1[] },
113
+ srcSortedTjps: string[],
114
+ srcGraph: { [addr: string]: IbGib_V1 },
115
+ }
116
+ ```
117
+
118
+ But the calling code is
119
+
120
+ ```
121
+ const { srcTimelinesMap, srcGraph } = await this.analyzeTimelines({ domainIbGibs, space: localSpace });
122
+ ```
123
+
124
+ Where are we synchronizing the src stones? I understand when we create our initial knowledgeVector, we usually want just our timelines. But we still need to synchronize stones as well. What if one of our `domainIbGibs` is itself a stone? All of the dna for the timelines will be in srcStones. I could just be missing something of your algorithm, but to me, we need to include the stone addrs in the knowledge vector. Perhaps we can skip the dna for the timelines initially, but ultimately we will need to send those as well.
125
+
126
+
127
+ ---
128
+
129
+ So that is just some of the issues. I haven't gone through the entire file yet. Please let's talk about these, and do NOT make any changes to the file. We are in full discussion mode right now!!