@ibgib/core-gib 0.1.42 → 0.1.43

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.
@@ -1,85 +1,85 @@
1
- import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
2
- import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
1
+ // import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
2
+ // import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
3
3
 
4
- /**
5
- * A simple in-memory map acting as a Space.
6
- * Pure Storage. No Indexing logic.
7
- *
8
- * Copied/Adapted from Keystone Respecs.
9
- */
10
- export class MockIbGibSpace {
11
- store = new Map<string, IbGib_V1>();
4
+ // /**
5
+ // * A simple in-memory map acting as a Space.
6
+ // * Pure Storage. No Indexing logic.
7
+ // *
8
+ // * Copied/Adapted from Keystone Respecs.
9
+ // */
10
+ // export class MockIbGibSpace {
11
+ // store = new Map<string, IbGib_V1>();
12
12
 
13
- constructor(public name: string = "mock_space") { }
13
+ // constructor(public name: string = "mock_space") { }
14
14
 
15
- async put({ ibGib }: { ibGib: IbGib_V1 }): Promise<void> {
16
- const addr = getIbGibAddr({ ibGib });
17
- this.store.set(addr, JSON.parse(JSON.stringify(ibGib))); // Deep copy
18
- }
15
+ // async put({ ibGib }: { ibGib: IbGib_V1 }): Promise<void> {
16
+ // const addr = getIbGibAddr({ ibGib });
17
+ // this.store.set(addr, JSON.parse(JSON.stringify(ibGib))); // Deep copy
18
+ // }
19
19
 
20
- async get({ addr }: { addr: string }): Promise<IbGib_V1 | null> {
21
- const data = this.store.get(addr);
22
- return data ? JSON.parse(JSON.stringify(data)) : null;
23
- }
20
+ // async get({ addr }: { addr: string }): Promise<IbGib_V1 | null> {
21
+ // const data = this.store.get(addr);
22
+ // return data ? JSON.parse(JSON.stringify(data)) : null;
23
+ // }
24
24
 
25
- async witness(arg: any): Promise<any> {
26
- const cmd = arg.data?.cmd;
27
- if (cmd === 'get') {
28
- const addrs = arg.data.ibGibAddrs || [];
29
- const ibGibs: IbGib_V1[] = [];
30
- for (const addr of addrs) {
31
- const ig = await this.get({ addr });
32
- if (ig) ibGibs.push(ig);
33
- }
34
- return { ibGibs };
35
- }
36
- if (cmd === 'put') {
37
- const ibGibs = arg.ibGibs || [];
38
- for (const ibGib of ibGibs) {
39
- await this.put({ ibGib });
40
- }
41
- return { ibGibs: [] }; // Return empty result or whatever witness expects
42
- }
43
- return undefined;
44
- }
45
- }
25
+ // async witness(arg: any): Promise<any> {
26
+ // const cmd = arg.data?.cmd;
27
+ // if (cmd === 'get') {
28
+ // const addrs = arg.data.ibGibAddrs || [];
29
+ // const ibGibs: IbGib_V1[] = [];
30
+ // for (const addr of addrs) {
31
+ // const ig = await this.get({ addr });
32
+ // if (ig) ibGibs.push(ig);
33
+ // }
34
+ // return { ibGibs };
35
+ // }
36
+ // if (cmd === 'put') {
37
+ // const ibGibs = arg.ibGibs || [];
38
+ // for (const ibGib of ibGibs) {
39
+ // await this.put({ ibGib });
40
+ // }
41
+ // return { ibGibs: [] }; // Return empty result or whatever witness expects
42
+ // }
43
+ // return undefined;
44
+ // }
45
+ // }
46
46
 
47
- /**
48
- * A partial mock of Metaspace.
49
- */
50
- export class MockMetaspaceService {
47
+ // /**
48
+ // * A partial mock of Metaspace.
49
+ // */
50
+ // export class MockMetaspaceService {
51
51
 
52
- /**
53
- * Map of TJP Gib (Timeline ID) -> Latest IbGib Addr (Head)
54
- */
55
- timelineHeads = new Map<string, string>();
52
+ // /**
53
+ // * Map of TJP Gib (Timeline ID) -> Latest IbGib Addr (Head)
54
+ // */
55
+ // timelineHeads = new Map<string, string>();
56
56
 
57
- constructor(public space: MockIbGibSpace) { }
57
+ // constructor(public space: MockIbGibSpace) { }
58
58
 
59
- async getLocalUserSpace({ lock }: { lock: boolean }): Promise<MockIbGibSpace> {
60
- return this.space;
61
- }
59
+ // async getLocalUserSpace({ lock }: { lock: boolean }): Promise<MockIbGibSpace> {
60
+ // return this.space;
61
+ // }
62
62
 
63
- async put(args: any): Promise<void> {
64
- const target = args.space || this.space;
65
- return target.put(args);
66
- }
63
+ // async put(args: any): Promise<void> {
64
+ // const target = args.space || this.space;
65
+ // return target.put(args);
66
+ // }
67
67
 
68
- async registerNewIbGib(args: { ibGib: IbGib_V1, space?: any }): Promise<void> {
69
- const { ibGib } = args;
70
- const targetSpace = args.space || this.space;
68
+ // async registerNewIbGib(args: { ibGib: IbGib_V1, space?: any }): Promise<void> {
69
+ // const { ibGib } = args;
70
+ // const targetSpace = args.space || this.space;
71
71
 
72
- // 1. Ensure it is stored
73
- await targetSpace.put({ ibGib });
72
+ // // 1. Ensure it is stored
73
+ // await targetSpace.put({ ibGib });
74
74
 
75
- // 2. Extract TJP
76
- const gib = ibGib.gib || '';
77
- let tjpGib = gib;
78
- if (gib.includes('.')) {
79
- const parts = gib.split('.');
80
- tjpGib = parts.slice(1).join('.');
81
- }
82
- const addr = getIbGibAddr({ ibGib });
83
- this.timelineHeads.set(tjpGib, addr);
84
- }
85
- }
75
+ // // 2. Extract TJP
76
+ // const gib = ibGib.gib || '';
77
+ // let tjpGib = gib;
78
+ // if (gib.includes('.')) {
79
+ // const parts = gib.split('.');
80
+ // tjpGib = parts.slice(1).join('.');
81
+ // }
82
+ // const addr = getIbGibAddr({ ibGib });
83
+ // this.timelineHeads.set(tjpGib, addr);
84
+ // }
85
+ // }
@@ -1,43 +0,0 @@
1
- # Sync Protocol Verification
2
-
3
- This document outlines the testing strategy and verification results for the Symmetric Sync Protocol.
4
-
5
- ## Testing Strategy
6
- We use `respec-gib` (a BDD-style framework) with **In-Memory Simulation (`InnerSpace`)** to verify logic. This allows us to test complex graph scenarios without network or disk I/O overhead.
7
-
8
- ### Key Test Files
9
- * `sync-innerspace.respec.mts`: Basic Push/Pull scenarios.
10
- * `sync-innerspace-multiple-timelines.respec.mts`: Handling multiple independent timelines in one Saga.
11
- * `sync-innerspace-deep-updates.respec.mts`: Syncing timelines with extensive history (ensuring `past` links are traversed).
12
- * `sync-innerspace-partial-update.respec.mts`: **Smart Diff** verification (Sender uses Receiver's context to send only deltas).
13
- * `sync-innerspace-dest-ahead.respec.mts`: Verifying "Fast-Backward" or "Push Offer" logic (Sender offers update, Receiver accepts).
14
- * `sync-innerspace-constants.respec.mts`: Verifying synchronization of **Stones** (Constants/Non-TJPs).
15
-
16
- ## Verification Matrix
17
-
18
- ### 1. Basic Scenarios
19
- | Feature | Description | Status | Test File |
20
- | :--- | :--- | :--- | :--- |
21
- | **Push** | Source syncs a new timeline to an empty Dest. | ✅ Verified | `sync-innerspace.respec.mts` |
22
- | **Pull** | Dest requests data from Source (Reverse Sync). | ⏳ Pending | `sync-innerspace.respec.mts` |
23
- | **Dest Ahead** | Dest has newer data; Source offers Push. | ✅ Verified | `sync-innerspace-dest-ahead.respec.mts` |
24
-
25
- ### 2. Complex Graph Scenarios
26
- | Feature | Description | Status | Test File |
27
- | :--- | :--- | :--- | :--- |
28
- | **Multi-Timeline** | Syncing multiple separate timelines. | ✅ Verified | `sync-innerspace-multiple-timelines.respec.mts` |
29
- | **Deep Updates** | Syncing deep dependency chains (Ancestors). | ✅ Verified | `sync-innerspace-deep-updates.respec.mts` |
30
- | **Smart Diff** | Sender skips data Receiver already has. | ✅ Verified | `sync-innerspace-partial-update.respec.mts` |
31
- | **Constants** | Syncing immutable stones (no TJP). | ✅ Verified | `sync-innerspace-constants.respec.mts` |
32
-
33
- ### 3. Failure & Edge Cases
34
- | Feature | Description | Status | Test File |
35
- | :--- | :--- | :--- | :--- |
36
- | **Validation** | Verifying Integrity Checks (ib/gib). | ⏳ Pending | - |
37
- | **Conflicts** | Divergent branches (Merge Strategy). | ⏳ Pending | - |
38
-
39
- ## Recent Verifications
40
- ### Sync Constants (2026-01-08)
41
- * **Goal**: Ensure constants (ibGibs without `tjp` or `past`) are synced.
42
- * **Result**: Passed.
43
- * **Fixes**: Updated `handleInitFrame` to request missing stones; updated `handleAckFrame` to include "tip" stones in payload even without dependencies.