@ibgib/core-gib 0.1.59 → 0.1.61

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 (206) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/common/other/graph-helper.d.mts.map +1 -1
  3. package/dist/common/other/graph-helper.mjs +7 -6
  4. package/dist/common/other/graph-helper.mjs.map +1 -1
  5. package/dist/keystone/keystone-config-builder.d.mts +1 -2
  6. package/dist/keystone/keystone-config-builder.d.mts.map +1 -1
  7. package/dist/keystone/keystone-config-builder.mjs +4 -19
  8. package/dist/keystone/keystone-config-builder.mjs.map +1 -1
  9. package/dist/keystone/keystone-constants.d.mts +2 -0
  10. package/dist/keystone/keystone-constants.d.mts.map +1 -1
  11. package/dist/keystone/keystone-constants.mjs +2 -0
  12. package/dist/keystone/keystone-constants.mjs.map +1 -1
  13. package/dist/keystone/keystone-helpers.d.mts +5 -15
  14. package/dist/keystone/keystone-helpers.d.mts.map +1 -1
  15. package/dist/keystone/keystone-helpers.mjs +59 -73
  16. package/dist/keystone/keystone-helpers.mjs.map +1 -1
  17. package/dist/keystone/keystone-policy-types.d.mts +6 -4
  18. package/dist/keystone/keystone-policy-types.d.mts.map +1 -1
  19. package/dist/keystone/keystone-service-v1.d.mts.map +1 -1
  20. package/dist/keystone/keystone-service-v1.mjs +4 -8
  21. package/dist/keystone/keystone-service-v1.mjs.map +1 -1
  22. package/dist/keystone/keystone-service-v1.respec.mjs +182 -33
  23. package/dist/keystone/keystone-service-v1.respec.mjs.map +1 -1
  24. package/dist/keystone/keystone-types.d.mts +4 -11
  25. package/dist/keystone/keystone-types.d.mts.map +1 -1
  26. package/dist/keystone/policy/keystone-profile-builder.d.mts +25 -0
  27. package/dist/keystone/policy/keystone-profile-builder.d.mts.map +1 -0
  28. package/dist/keystone/policy/keystone-profile-builder.mjs +117 -0
  29. package/dist/keystone/policy/keystone-profile-builder.mjs.map +1 -0
  30. package/dist/keystone/policy/profiles/profile-high.json +84 -0
  31. package/dist/keystone/policy/profiles/profile-low.json +84 -0
  32. package/dist/keystone/policy/profiles/profile-medium.json +84 -0
  33. package/dist/keystone/policy/profiles/profile-session.json +84 -0
  34. package/dist/keystone/policy/profiles/profile-test.json +84 -0
  35. package/dist/keystone/policy/schemas/connect-pool.high.schema.json +23 -0
  36. package/dist/keystone/policy/schemas/connect-pool.low.schema.json +23 -0
  37. package/dist/keystone/policy/schemas/connect-pool.medium.schema.json +23 -0
  38. package/dist/keystone/policy/schemas/keystone.high.schema.json +26 -0
  39. package/dist/keystone/policy/schemas/keystone.low.schema.json +26 -0
  40. package/dist/keystone/policy/schemas/keystone.medium.schema.json +26 -0
  41. package/dist/keystone/policy/schemas/manage-pool.high.schema.json +23 -0
  42. package/dist/keystone/policy/schemas/manage-pool.low.schema.json +23 -0
  43. package/dist/keystone/policy/schemas/manage-pool.medium.schema.json +23 -0
  44. package/dist/keystone/policy/schemas/revoke-pool.high.schema.json +23 -0
  45. package/dist/keystone/policy/schemas/revoke-pool.low.schema.json +23 -0
  46. package/dist/keystone/policy/schemas/revoke-pool.medium.schema.json +23 -0
  47. package/dist/keystone/policy/schemas/sign-pool.high.schema.json +23 -0
  48. package/dist/keystone/policy/schemas/sign-pool.low.schema.json +23 -0
  49. package/dist/keystone/policy/schemas/sign-pool.medium.schema.json +23 -0
  50. package/dist/keystone/policy/schemas/sync-pool.high.schema.json +23 -0
  51. package/dist/keystone/policy/schemas/sync-pool.low.schema.json +23 -0
  52. package/dist/keystone/policy/schemas/sync-pool.medium.schema.json +23 -0
  53. package/dist/sync/sync-conflict-adv-multitimelines.withid.respec.d.mts +8 -0
  54. package/dist/sync/sync-conflict-adv-multitimelines.withid.respec.d.mts.map +1 -0
  55. package/dist/sync/sync-conflict-adv-multitimelines.withid.respec.mjs +582 -0
  56. package/dist/sync/sync-conflict-adv-multitimelines.withid.respec.mjs.map +1 -0
  57. package/dist/sync/sync-conflict-basic-divergence.withid.respec.d.mts +7 -0
  58. package/dist/sync/sync-conflict-basic-divergence.withid.respec.d.mts.map +1 -0
  59. package/dist/sync/sync-conflict-basic-divergence.withid.respec.mjs +274 -0
  60. package/dist/sync/sync-conflict-basic-divergence.withid.respec.mjs.map +1 -0
  61. package/dist/sync/sync-conflict-basic-multitimelines.withid.respec.d.mts +8 -0
  62. package/dist/sync/sync-conflict-basic-multitimelines.withid.respec.d.mts.map +1 -0
  63. package/dist/sync/sync-conflict-basic-multitimelines.withid.respec.mjs +322 -0
  64. package/dist/sync/sync-conflict-basic-multitimelines.withid.respec.mjs.map +1 -0
  65. package/dist/sync/sync-conflict-text-merge.withid.respec.d.mts +7 -0
  66. package/dist/sync/sync-conflict-text-merge.withid.respec.d.mts.map +1 -0
  67. package/dist/sync/sync-conflict-text-merge.withid.respec.mjs +307 -0
  68. package/dist/sync/sync-conflict-text-merge.withid.respec.mjs.map +1 -0
  69. package/dist/sync/sync-innerspace-constants.withid.respec.d.mts +8 -0
  70. package/dist/sync/sync-innerspace-constants.withid.respec.d.mts.map +1 -0
  71. package/dist/sync/sync-innerspace-constants.withid.respec.mjs +233 -0
  72. package/dist/sync/sync-innerspace-constants.withid.respec.mjs.map +1 -0
  73. package/dist/sync/sync-innerspace-deep-updates.withid.respec.d.mts +7 -0
  74. package/dist/sync/sync-innerspace-deep-updates.withid.respec.d.mts.map +1 -0
  75. package/dist/sync/sync-innerspace-deep-updates.withid.respec.mjs +233 -0
  76. package/dist/sync/sync-innerspace-deep-updates.withid.respec.mjs.map +1 -0
  77. package/dist/sync/sync-innerspace-dest-ahead.withid.respec.d.mts +7 -0
  78. package/dist/sync/sync-innerspace-dest-ahead.withid.respec.d.mts.map +1 -0
  79. package/dist/sync/sync-innerspace-dest-ahead.withid.respec.mjs +225 -0
  80. package/dist/sync/sync-innerspace-dest-ahead.withid.respec.mjs.map +1 -0
  81. package/dist/sync/sync-innerspace-multiple-timelines.respec.mjs.map +1 -1
  82. package/dist/sync/sync-innerspace-multiple-timelines.withid.respec.d.mts +7 -0
  83. package/dist/sync/sync-innerspace-multiple-timelines.withid.respec.d.mts.map +1 -0
  84. package/dist/sync/sync-innerspace-multiple-timelines.withid.respec.mjs +235 -0
  85. package/dist/sync/sync-innerspace-multiple-timelines.withid.respec.mjs.map +1 -0
  86. package/dist/sync/sync-innerspace-partial-update.withid.respec.d.mts +7 -0
  87. package/dist/sync/sync-innerspace-partial-update.withid.respec.d.mts.map +1 -0
  88. package/dist/sync/sync-innerspace-partial-update.withid.respec.mjs +211 -0
  89. package/dist/sync/sync-innerspace-partial-update.withid.respec.mjs.map +1 -0
  90. package/dist/sync/sync-innerspace.withid.respec.d.mts +8 -0
  91. package/dist/sync/sync-innerspace.withid.respec.d.mts.map +1 -0
  92. package/dist/sync/sync-innerspace.withid.respec.mjs +260 -0
  93. package/dist/sync/sync-innerspace.withid.respec.mjs.map +1 -0
  94. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs +1 -1
  95. package/dist/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs.map +1 -1
  96. package/dist/sync/sync-peer/sync-peer-types.d.mts +12 -1
  97. package/dist/sync/sync-peer/sync-peer-types.d.mts.map +1 -1
  98. package/dist/sync/sync-peer/sync-peer-v1.d.mts +7 -0
  99. package/dist/sync/sync-peer/sync-peer-v1.d.mts.map +1 -1
  100. package/dist/sync/sync-peer/sync-peer-v1.mjs +43 -1
  101. package/dist/sync/sync-peer/sync-peer-v1.mjs.map +1 -1
  102. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-peer-websocket-receiver-v1.d.mts +2 -0
  103. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-peer-websocket-receiver-v1.d.mts.map +1 -1
  104. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-peer-websocket-receiver-v1.mjs +28 -9
  105. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-peer-websocket-receiver-v1.mjs.map +1 -1
  106. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-websocket-peer-helpers.d.mts +1 -1
  107. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-websocket-peer-helpers.d.mts.map +1 -1
  108. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-websocket-peer-helpers.mjs +5 -3
  109. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-websocket-peer-helpers.mjs.map +1 -1
  110. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-sender/sync-peer-websocket-sender-v1.d.mts +16 -0
  111. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-sender/sync-peer-websocket-sender-v1.d.mts.map +1 -1
  112. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-sender/sync-peer-websocket-sender-v1.mjs +223 -79
  113. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-sender/sync-peer-websocket-sender-v1.mjs.map +1 -1
  114. package/dist/sync/sync-saga-context/sync-saga-context-helpers.d.mts.map +1 -1
  115. package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs +41 -2
  116. package/dist/sync/sync-saga-context/sync-saga-context-helpers.mjs.map +1 -1
  117. package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts +4 -0
  118. package/dist/sync/sync-saga-context/sync-saga-context-types.d.mts.map +1 -1
  119. package/dist/sync/sync-saga-coordinator.d.mts +6 -0
  120. package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
  121. package/dist/sync/sync-saga-coordinator.mjs +213 -137
  122. package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
  123. package/dist/sync/sync-withid.pingpong.respec.mjs +70 -2
  124. package/dist/sync/sync-withid.pingpong.respec.mjs.map +1 -1
  125. package/dist/timeline/timeline-api.d.mts.map +1 -1
  126. package/dist/timeline/timeline-api.mjs +1 -14
  127. package/dist/timeline/timeline-api.mjs.map +1 -1
  128. package/dist/witness/space/reconciliation-space/reconciliation-space-base.d.mts.map +1 -1
  129. package/dist/witness/space/reconciliation-space/reconciliation-space-base.mjs +0 -40
  130. package/dist/witness/space/reconciliation-space/reconciliation-space-base.mjs.map +1 -1
  131. package/dist/witness/space/reconciliation-space/reconciliation-space-helper.d.mts.map +1 -1
  132. package/dist/witness/space/reconciliation-space/reconciliation-space-helper.mjs +6 -6
  133. package/dist/witness/space/reconciliation-space/reconciliation-space-helper.mjs.map +1 -1
  134. package/ibgib-foundations.md +2 -1
  135. package/package.json +1 -1
  136. package/src/common/other/graph-helper.mts +7 -6
  137. package/src/keystone/README.md +19 -15
  138. package/src/keystone/docs/CRYPTANALYSIS.md +185 -0
  139. package/src/keystone/docs/architecture.md +24 -1
  140. package/src/keystone/docs/profiles.md +124 -0
  141. package/src/keystone/keystone-config-builder.mts +3 -21
  142. package/src/keystone/keystone-constants.mts +2 -0
  143. package/src/keystone/keystone-helpers.mts +74 -77
  144. package/src/keystone/keystone-policy-types.mts +6 -4
  145. package/src/keystone/keystone-service-v1.mts +4 -9
  146. package/src/keystone/keystone-service-v1.respec.mts +214 -32
  147. package/src/keystone/keystone-types.mts +5 -9
  148. package/src/keystone/policy/IMPLEMENTATION.md +60 -0
  149. package/src/keystone/policy/README.md +94 -0
  150. package/src/keystone/policy/keystone-profile-builder.mts +131 -0
  151. package/src/keystone/policy/profiles/profile-high.json +84 -0
  152. package/src/keystone/policy/profiles/profile-low.json +84 -0
  153. package/src/keystone/policy/profiles/profile-medium.json +84 -0
  154. package/src/keystone/policy/profiles/profile-session.json +84 -0
  155. package/src/keystone/policy/profiles/profile-test.json +84 -0
  156. package/src/keystone/policy/schemas/connect-pool.high.schema.json +23 -0
  157. package/src/keystone/policy/schemas/connect-pool.low.schema.json +23 -0
  158. package/src/keystone/policy/schemas/connect-pool.medium.schema.json +23 -0
  159. package/src/keystone/policy/schemas/keystone.high.schema.json +26 -0
  160. package/src/keystone/policy/schemas/keystone.low.schema.json +26 -0
  161. package/src/keystone/policy/schemas/keystone.medium.schema.json +26 -0
  162. package/src/keystone/policy/schemas/manage-pool.high.schema.json +23 -0
  163. package/src/keystone/policy/schemas/manage-pool.low.schema.json +23 -0
  164. package/src/keystone/policy/schemas/manage-pool.medium.schema.json +23 -0
  165. package/src/keystone/policy/schemas/revoke-pool.high.schema.json +23 -0
  166. package/src/keystone/policy/schemas/revoke-pool.low.schema.json +23 -0
  167. package/src/keystone/policy/schemas/revoke-pool.medium.schema.json +23 -0
  168. package/src/keystone/policy/schemas/sign-pool.high.schema.json +23 -0
  169. package/src/keystone/policy/schemas/sign-pool.low.schema.json +23 -0
  170. package/src/keystone/policy/schemas/sign-pool.medium.schema.json +23 -0
  171. package/src/keystone/policy/schemas/sync-pool.high.schema.json +23 -0
  172. package/src/keystone/policy/schemas/sync-pool.low.schema.json +23 -0
  173. package/src/keystone/policy/schemas/sync-pool.medium.schema.json +23 -0
  174. package/src/sync/docs/security-3b.md +92 -0
  175. package/src/sync/docs/security.md +139 -38
  176. package/src/sync/sync-conflict-adv-multitimelines.withid.respec.mts +706 -0
  177. package/src/sync/sync-conflict-basic-divergence.withid.respec.mts +321 -0
  178. package/src/sync/sync-conflict-basic-multitimelines.withid.respec.mts +374 -0
  179. package/src/sync/sync-conflict-text-merge.withid.respec.mts +347 -0
  180. package/src/sync/sync-innerspace-constants.withid.respec.mts +264 -0
  181. package/src/sync/sync-innerspace-deep-updates.withid.respec.mts +272 -0
  182. package/src/sync/sync-innerspace-dest-ahead.withid.respec.mts +266 -0
  183. package/src/sync/sync-innerspace-multiple-timelines.respec.mts +0 -1
  184. package/src/sync/sync-innerspace-multiple-timelines.withid.respec.mts +273 -0
  185. package/src/sync/sync-innerspace-partial-update.withid.respec.mts +249 -0
  186. package/src/sync/sync-innerspace.withid.respec.mts +265 -0
  187. package/src/sync/sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mts +1 -1
  188. package/src/sync/sync-peer/sync-peer-types.mts +11 -1
  189. package/src/sync/sync-peer/sync-peer-v1.mts +47 -1
  190. package/src/sync/sync-peer/sync-peer-websocket/README.md +42 -0
  191. package/src/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-peer-websocket-receiver-v1.mts +26 -9
  192. package/src/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-websocket-peer-helpers.mts +5 -3
  193. package/src/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-sender/sync-peer-websocket-sender-v1.mts +242 -78
  194. package/src/sync/sync-saga-context/sync-saga-context-helpers.mts +46 -4
  195. package/src/sync/sync-saga-context/sync-saga-context-types.mts +5 -0
  196. package/src/sync/sync-saga-coordinator.mts +221 -137
  197. package/src/sync/sync-withid.pingpong.respec.mts +76 -3
  198. package/src/timeline/timeline-api.mts +1 -15
  199. package/src/timeline/timeline-api.respec.mts +3 -3
  200. package/src/witness/space/reconciliation-space/reconciliation-space-base.mts +0 -46
  201. package/src/witness/space/reconciliation-space/reconciliation-space-helper.mts +6 -5
  202. package/tsconfig.json +6 -1
  203. package/src/keystone/keystone-policy.schema.json +0 -51
  204. package/src/sync/docs/ping_pong_plan.md +0 -147
  205. package/src/witness/space/reconciliation-space/reconciliation-space-base.mts.OLD.md +0 -884
  206. package/src/witness/space/reconciliation-space/reconciliation-space-helper.mts.OLD.md +0 -125
@@ -184,6 +184,27 @@ Context ibgib now has a clean, consistent pair:
184
184
 
185
185
  ---
186
186
 
187
+ ## respec-gib Testing Framework
188
+
189
+ Because `ibgib` has unique execution environments and a high need for custom asynchronous block handling, it uses a custom testing framework located in `@ibgib/helper-gib/dist/respec-gib`.
190
+
191
+ ### Key Framework APIs
192
+ * **`respecfully`**: The equivalent of `describe` or an outer test suite block. It is async and MUST be awaited.
193
+ * **`ifWe`**: The equivalent of `it`, used for defining a specific test case block. It is async and MUST be awaited. It cannot be nested.
194
+ * **`ifWeMight`**: A focused test case (equivalent to `fit` or `it.only`). It is async, MUST be awaited, and cannot be nested.
195
+ * **`iReckon`**: The assertion fluent API (equivalent to `expect`). It is synchronous and should NOT be awaited. Available assertions include: `willEqual(expected)`, `isGonnaBe(expected)`, `isGonnaBeTruthy()`, `isGonnaBeFalsy()`, `isGonnaBeTrue()`, `isGonnaBeFalse()`, `isGonnaBeUndefined()`, and `includes(expected)`. You can modify assertions using `.not` and `.asTo(label)`.
196
+
197
+ ### Crucial Execution & Logging Nuances
198
+ > [!IMPORTANT]
199
+ > **File Focus vs. Code Execution**:
200
+ > The test runner scans all test files for the presence of `ifWeMight` (or `respecfullyDear`) to determine which *files* get selected and executed. However, once a file is selected and run, **the entire file executes**.
201
+ >
202
+ > **The Logging Caveat**:
203
+ > The `ifWeMight` filter **only** determines which test results are ultimately *reported* in the test summary output. This means all code and `console.log` statements in any standard `ifWe` blocks within the same file will **still execute and write to the logs**.
204
+ > This behavior can make test logs extremely noisy and confusing. If you are focusing on a single test, you should temporarily change all other `ifWeMight` blocks to `ifWe`, and use a single `ifWeMight` block or comment out other logs/tests to keep console output readable.
205
+
206
+ ---
207
+
187
208
  ## Implementation Plan
188
209
 
189
210
  Each phase below is a discrete, verifiable step. We proceed **one checkbox at a time**, **reviewing/discussing** code/results before moving to the next. Each phase has two targets: **innerspace** (automated unit test) and **space-gib** (manual/integrated e2e).
@@ -285,29 +306,29 @@ We still call `senderCoordinator.sync(...)` — the phase focus is on what `peer
285
306
 
286
307
  **Goal**: With identity fully established and transport connected, sync a single ibgib `X` from source to dest. Verify S evolves correctly per turn (`sync` pool), and X's full dependency graph arrives on dest. After commit, both sender and receiver durable spaces must contain: the same evolved I, the full S dependency graph, and the full X dependency graph.
287
308
 
288
- #### Phase 3A — Innerspace unit test (`sync-withid.fullsync.respec.mts`)
309
+ #### Phase 3A — Innerspace unit test (`sync-withid.pingpong.respec.mts`)
289
310
 
290
- - [ ] Create `sync-withid.fullsync.respec.mts`
291
- - [ ] Create `r1_alpha_v0_source` via `TestTransformer`
292
- - [ ] Call `senderCoordinator.sync({ domainIbGibs: [alpha], senderIdentity, senderSecret, ... })`
293
- - [ ] `ifWeMight` — `"alpha dep graph matches on source and dest"`: use `getDependencyGraph` + `graphsAreEquivalent`
294
- - [ ] `ifWeMight` — `"sessionIdentity evolved the expected number of times"`: assert `S.data.n` equals the known deterministic turn count
295
- - [ ] 🔲 **TODO**: Manually inspect the full session keystone graph after a first run and count the exact number of outgoing turns (Init + Delta(s) + Commit), then hard-code that number into this assertion
296
- - [ ] `ifWeMight` — `"sender durable space has I (evolved frame)"`: assert I1 addr is in `sourceSpace`
297
- - [ ] `ifWeMight` — `"receiver durable space has I (evolved frame)"`: assert I1 addr is in `destSpace`
298
- - [ ] `ifWeMight` — `"sender durable space has full S dep graph"`: use `getDependencyGraph` on S in `sourceSpace`
299
- - [ ] `ifWeMight` — `"receiver durable space has full S dep graph"`: use `getDependencyGraph` on S in `destSpace`
311
+ - [x] Create `sync-withid.pingpong.respec.mts`
312
+ - [x] Create `r1_alpha_v0_source` (represented by `xStone` test domain ibgib)
313
+ - [x] Call `senderCoordinator.sync({ domainIbGibs: [alpha], senderIdentity, senderSecret, ... })`
314
+ - [x] `ifWeMight` — `"alpha dep graph matches on source and dest"`: use `getDependencyGraph` + `graphsAreEquivalent`
315
+ - [x] `ifWeMight` — `"sessionIdentity evolved the expected number of times"`: assert `S.data.n` equals the known deterministic turn count
316
+ - [x] **TODO**: Manually inspect the full session keystone graph after a first run and count the exact number of outgoing turns (Init + Delta(s) + Commit), then hard-code that number into this assertion
317
+ - [x] `ifWeMight` — `"sender durable space has I (evolved frame)"`: assert I1 addr is in `sourceSpace`
318
+ - [x] `ifWeMight` — `"receiver durable space has I (evolved frame)"`: assert I1 addr is in `destSpace`
319
+ - [x] `ifWeMight` — `"sender durable space has full S dep graph"`: use `getDependencyGraph` on S in `sourceSpace`
320
+ - [x] `ifWeMight` — `"receiver durable space has full S dep graph"`: use `getDependencyGraph` on S in `destSpace`
300
321
 
301
322
  #### Phase 3B — Space-Gib integrated (manual)
302
323
 
303
- - [ ] Trigger a sync of a known test ibgib via `dev-tools.mts` (add "sync - fullsync" button to a new row)
304
- - [ ] Confirm S evolves on each outgoing turn (inspect frame `data.n` in debugger)
305
- - [ ] Confirm X's full dependency graph is present on the client after commit
306
- - [ ] Confirm X's full dependency graph is present on the server after commit
307
- - [ ] Confirm S's full dependency graph is present on the client after commit
308
- - [ ] Confirm S's full dependency graph is present on the server after commit
309
- - [ ] Confirm I's evolved frame (I1) is present on the client after commit
310
- - [ ] Confirm I's evolved frame (I1) is present on the server after commit
324
+ - [x] Trigger a sync of a known test ibgib via `dev-tools.mts` (add "sync - fullsync" button to a new row)
325
+ - [x] Confirm S evolves on each outgoing turn (inspect frame `data.n` in debugger)
326
+ - [x] Confirm X's full dependency graph is present on the client after commit
327
+ - [x] Confirm X's full dependency graph is present on the server after commit
328
+ - [x] Confirm S's full dependency graph is present on the client after commit
329
+ - [x] Confirm S's full dependency graph is present on the server after commit
330
+ - [x] Confirm I's evolved frame (I1) is present on the client after commit
331
+ - [x] Confirm I's evolved frame (I1) is present on the server after commit
311
332
 
312
333
 
313
334
  ---
@@ -320,14 +341,14 @@ The sync proper will not be called. The test only cares that the pre-connect ide
320
341
 
321
342
  #### Phase 1A — Innerspace unit test
322
343
 
323
- - [ ] Create `sync-with-identity-basic.respec.mts` with scaffold:
344
+ - [x] Create `sync-withid.establish.respec.mts` with scaffold:
324
345
  - `Metaspace_Innerspace` + two `InnerSpace_V1` (source/dest) + `SyncSagaCoordinator` pair + `newTestPeer()` factory
325
346
  - A `senderSecret` constant (test-only plaintext)
326
347
  - A `KeystoneService_V1` instance (new'd inline)
327
- - [ ] Add `respecfully` block: `"Phase 1: establishSessionIdentity"`
328
- - [ ] `ifWeMight` — `"creates sessionIdentity genesis (S) locally"`: assert `S^Stjp` was generated and exists in `sourceSpace`
329
- - [ ] `ifWeMight` — `"evolves senderIdentity (I → I1) with sync claim"`: assert `I1` frame has a proof whose `claim.verb === 'sync'` and `claim.target === S^Stjp`
330
- - [ ] `ifWeMight` — `"posts I1 and S to destSpace (receiver)"`: assert both addrs are retrievable from `destSpace`
348
+ - [x] Add `respecfully` block: `"Phase 1: establishSessionIdentity"`
349
+ - [x] `ifWeMight` — `"creates sessionIdentity genesis (S) locally"`: assert `S^Stjp` was generated and exists in `sourceSpace`
350
+ - [x] `ifWeMight` — `"evolves senderIdentity (I → I1) with sync claim"`: assert `I1` frame has a proof whose `claim.verb === 'sync'` and `claim.target === S^Stjp`
351
+ - [x] `ifWeMight` — `"posts I1 and S to destSpace (receiver)"`: assert both addrs are retrievable from `destSpace`
331
352
 
332
353
  #### Phase 1B — Space-Gib integrated (manual)
333
354
 
@@ -344,7 +365,7 @@ The sync proper will not be called. The test only cares that the pre-connect ide
344
365
 
345
366
  #### Phase 2A — Innerspace unit test
346
367
 
347
- - [x] Extend `sync-with-identity-basic.respec.mts` with a `respecfully` block: `"Phase 2: connect"` (Note: implemented in separate file `sync-withid.connect.respec.mts`)
368
+ - [x] Create `sync-withid.connect.respec.mts` with a `respecfully` block: `"Phase 2: connect"`
348
369
  - [x] `ifWeMight` — `"connect completes without error"`: call `peer.connect()` and assert no exception
349
370
  - [x] `ifWeMight` — `"connect pool is depleted by exactly one challenge"`: assert `S.data.pools['connect'].used` increased by the expected count
350
371
 
@@ -362,19 +383,99 @@ The sync proper will not be called. The test only cares that the pre-connect ide
362
383
 
363
384
  #### Phase 3A — Innerspace unit test
364
385
 
365
- - [ ] Extend `sync-with-identity-basic.respec.mts` or create `sync-with-identity-singletimeline.respec.mts`
366
- - [ ] Create `r1_alpha_v0_source` via `TestTransformer`
367
- - [ ] Call `senderCoordinator.sync({ domainIbGibs: [alpha], senderIdentity, senderSecret, ... })`
368
- - [ ] `ifWeMight` — `"alpha dep graph matches on source and dest"`: use `getDependencyGraph` + `graphsAreEquivalent`
369
- - [ ] `ifWeMight` — `"sessionIdentity evolved once per sync turn"`: assert `S.data.n` equals number of outgoing turns
386
+ - [x] Create `sync-withid.pingpong.respec.mts`
387
+ - [x] Create `r1_alpha_v0_source` via `TestTransformer` (represented by `xStone` test domain ibgib)
388
+ - [x] Call `senderCoordinator.sync({ domainIbGibs: [alpha], senderIdentity, senderSecret, ... })`
389
+ - [x] `ifWeMight` — `"alpha dep graph matches on source and dest"`: use `getDependencyGraph` + `graphsAreEquivalent`
390
+ - [x] `ifWeMight` — `"sessionIdentity evolved once per sync turn"`: assert `S.data.n` equals number of outgoing turns
370
391
 
371
392
  #### Phase 3B — Space-Gib integrated (manual)
372
393
 
373
- - [ ] Trigger a sync of a known test ibgib via `dev-tools.mts` or equivalent UI
374
- - [ ] Confirm S evolves on each outgoing turn (inspect frame `data.n` in debugger)
375
- - [ ] Confirm X's full dependency graph is present on the client after commit
376
- - [ ] Confirm X's full dependency graph is present on the server after commit
377
- - [ ] Confirm S's full dependency graph is present on the client after commit
378
- - [ ] Confirm S's full dependency graph is present on the server after commit
379
- - [ ] Confirm I's full dependency graph is present on the client after commit
380
- - [ ] Confirm I's full dependency graph is present on the server after commit
394
+ - [x] Trigger a sync of a known test ibgib via `dev-tools.mts` or equivalent UI
395
+ - [x] Confirm S evolves on each outgoing turn (inspect frame `data.n` in debugger)
396
+ - [x] Confirm X's full dependency graph is present on the client after commit
397
+ - [x] Confirm X's full dependency graph is present on the server after commit
398
+ - [x] Confirm S's full dependency graph is present on the client after commit
399
+ - [x] Confirm S's full dependency graph is present on the server after commit
400
+ - [x] Confirm I's full dependency graph is present on the client after commit
401
+ - [x] Confirm I's full dependency graph is present on the server after commit
402
+
403
+ ---
404
+
405
+ ### Phase 4 — Advanced Data and Conflict Scenarios
406
+
407
+ **Goal**: Extend the WebSocket peer and Space-Gib interface to manually execute and verify all advanced data and conflict scenarios currently covered by the InnerSpace unit tests.
408
+
409
+ > [!IMPORTANT]
410
+ > **Guidelines & Testing Reminders**:
411
+ > - Before starting the implementation of any automated test (A) or manual verification (B) in Phase 4, you **MUST** scan/re-scan the variable naming and structural guidelines in [testing.md](file:///c:/Users/billm/antigravity/ibgib/libs/core-gib/src/sync/docs/testing.md) to align the codebase structure and naming conventions.
412
+ > - **Manual Testing (B) Rule**: The AI assistant **MUST NOT** use the browser subagent to perform manual browser/UI testing for any "B" manual verification phases in space-gib. The user will run all B testing themselves to conserve tokens.
413
+ > - **Executing Focused Tests**: After changing previous test phase file's ifWeMight blocks -> ifWe to defocus that file, and after you have setup the new test file with ifWeMight blocks, use `npm run test:core-gib` to execute the new *.respec.mts file. (NOTE: If you search files for these blocks, be sure to include the open paren, e.g., "ifWeMight(", because often ifWeMight remains unused in import statements). After you have executed the tests and they pass, do NOT change it back to ifWe blocks immediately, so I can execute and look at the tests myself.
414
+
415
+ For each scenario:
416
+ 1. **Automated Verification (A)**: Copy the grandfathered non-identity unit test file (e.g., `sync-innerspace.respec.mts`) to a new file named with `.withid.` in the filename (e.g., `sync-innerspace.withid.respec.mts`). Incorporate identity setup (referencing `sync-withid.pingpong.respec.mts` for setup pattern) and ensure the test runs and passes.
417
+ * **Test naming/structure convention**: The new `.withid.respec.mts` tests must follow the variable and structural naming guidelines outlined in [testing.md](file:///c:/Users/billm/antigravity/ibgib/libs/core-gib/src/sync/docs/testing.md).
418
+ * **Identity Verification Checks**: Each `.withid.respec.mts` test must verify that the session identity `S` evolved the expected number of times, the user identity `I` evolved the expected number of times on both spaces, and that the full dependency graphs for `S` and `I` are correctly synced to both spaces.
419
+ 2. **Manual Verification (B)**: Create manual websocket peer tests with corresponding buttons/UI elements integrated via Dev Tools.
420
+ * **Dont use browser testing**: We must minimize token use, so I will do all of the manual testing in the browser. Do not do automated browser testing in B phases.
421
+
422
+ #### 1. Sync InnerSpace (Basic Push Sync)
423
+ - [x] Phase 4.1A — Automated InnerSpace Verification (`sync-innerspace.withid.respec.mts`)
424
+ - [x] Phase 4.1B — WebSocket Peer Manual Verification (integrated via Dev Tools)
425
+ * Tests basic push sync of a single timeline and its mutations from Source to Destination.
426
+ * Verifies that the target timeline tip and its dependency graph successfully arrive at the destination.
427
+
428
+ #### 2. Sync Constants (No TJP)
429
+ - [x] Phase 4.2A — Automated InnerSpace Verification (`sync-innerspace-constants.withid.respec.mts`)
430
+ - [x] Phase 4.2B — WebSocket Peer Manual Verification (integrated via Dev Tools)
431
+ * Tests syncing "constants" (ibGibs without timelines/TJPs) and verifies that dependencies (linked constants) are resolved.
432
+ * Ensures idempotency/smart diffing (payloads are not re-sent if they already exist in the destination space).
433
+
434
+ #### 3. Sync Destination with Partial History
435
+ - [x] Phase 4.3A — Automated InnerSpace Verification (`sync-innerspace-partial-update.withid.respec.mts`)
436
+ - [x] Phase 4.3B — WebSocket Peer Manual Verification (integrated via Dev Tools)
437
+ * Tests push synchronization when the destination already contains a partial timeline history (e.g., up to V1), but the sender has newer frames (V2).
438
+ * Verifies that only the delta is transmitted and correctly linked to the existing history at the destination.
439
+ - [x] INTERSTITIAL — Refactor `dev-tools.mts` to split it into a `dev-tools` directory containing modular sub-files to reduce file size.
440
+
441
+ #### 4. Sync Deep History Updates
442
+ - [x] Phase 4.4A — Automated InnerSpace Verification (`sync-innerspace-deep-updates.withid.respec.mts`)
443
+ - [x] Phase 4.4B — WebSocket Peer Manual Verification (integrated via Dev Tools)
444
+ * Tests push synchronization of a timeline tip with a deep mutation history (multiple updates).
445
+ * Verifies that the destination receives all intermediate frames, preserving the full timeline history and graph integrity.
446
+
447
+ #### 5. Sync Destination Ahead (Remote Newer)
448
+ - [x] Phase 4.5A — Automated InnerSpace Verification (`sync-innerspace-dest-ahead.withid.respec.mts`)
449
+ - [x] Phase 4.5B — WebSocket Peer Manual Verification (integrated via Dev Tools)
450
+ * Tests synchronization when the destination (remote) actually has a newer frame (V2) than the sender's local tip (V1).
451
+ * Verifies that the sender learns of the remote tip and pulls it down so both client and server converge to the dest-ahead tip.
452
+
453
+ #### 6. Sync Multiple Independent Timelines
454
+ - [x] Phase 4.6A — Automated InnerSpace Verification (`sync-innerspace-multiple-timelines.withid.respec.mts`)
455
+ - [x] Phase 4.6B — WebSocket Peer Manual Verification (integrated via Dev Tools)
456
+ * Tests synchronization of multiple independent timelines (e.g., Timeline A and Timeline B) in a single sync coordinator call.
457
+ * Verifies that both timeline tips and their respective dependency graphs are transferred and updated correctly.
458
+
459
+ #### 7. Basic Divergence Conflict Resolution
460
+ - [x] Phase 4.7A — Automated InnerSpace Verification (`sync-conflict-basic-divergence.withid.respec.mts`)
461
+ - [x] Phase 4.7B — WebSocket Peer Manual Verification (integrated via Dev Tools)
462
+ * Tests divergence when source and destination edit different fields on a shared base timeline simultaneously.
463
+ * Verifies that optimistic merge automatically produces a merged tip (V3) containing both edits and records the graft metadata (`graftbase`, `graftorphan`).
464
+
465
+ #### 8. Divergence with Related Timelines
466
+ - [x] Phase 4.8A — Automated InnerSpace Verification (`sync-conflict-basic-multitimelines.withid.respec.mts`)
467
+ - [x] Phase 4.8B — WebSocket Peer Manual Verification (integrated via Dev Tools)
468
+ * Tests advanced divergence where one of the divergent updates also references/relates a new independent timeline (Beta).
469
+ * Verifies that during optimistic merge, the dependent timeline is synced automatically alongside the merged tip.
470
+
471
+ #### 9. Text Field Merge (LCS) Conflict Resolution
472
+ - [x] Phase 4.9A — Automated InnerSpace Verification (`sync-conflict-text-merge.withid.respec.mts`)
473
+ - [x] Phase 4.9B — WebSocket Peer Manual Verification (integrated via Dev Tools)
474
+ * Tests automatic merging of conflicting string edits within the `ibgib.data.text` field using the LCS (Longest Common Subsequence) merge algorithm.
475
+ * Verifies merging of simple appends (beginning vs. end) and interleaved edits in different paragraphs.
476
+
477
+ #### 10. Advanced Multi-Round/Timeline Permutations
478
+ - [x] Phase 4.10A — Automated InnerSpace Verification (`sync-conflict-adv-multitimelines.withid.respec.mts`)
479
+ - [x] Phase 4.10B — WebSocket Peer Manual Verification (integrated via Dev Tools)
480
+ * Tests complex multi-round/timeline permutations with parallel divergent edits across multiple rounds.
481
+ * Verifies that nested or sequential merges resolve correctly using the optimistic graft strategy.