@ibgib/space-gib 0.0.5 → 0.0.7
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/README.md +20 -0
- package/dist/client/bootstrap.mjs +31 -31
- package/dist/client/bootstrap.mjs.map +3 -3
- package/dist/client/chunk-RXFIBFRK.mjs +42 -0
- package/dist/client/chunk-RXFIBFRK.mjs.map +7 -0
- package/dist/client/chunk-ULFNE26Y.mjs +2216 -0
- package/dist/client/chunk-ULFNE26Y.mjs.map +7 -0
- package/dist/client/index.html +35 -14
- package/dist/client/index.mjs +1 -1
- package/dist/client/script.mjs +1 -1
- package/dist/client/style.css +29 -5
- package/dist/server/server.mjs +1447 -270
- package/dist/server/server.mjs.map +4 -4
- package/package.json +5 -5
- package/space-gib.localhost-1783713259760.log +45 -0
- package/src/client/AUTO-GENERATED-version.mts +1 -1
- package/src/client/bootstrap.mts +9 -0
- package/src/client/components/identity-header/identity-header.css +40 -2
- package/src/client/components/identity-header/identity-header.html +3 -2
- package/src/client/components/identity-header/identity-header.mts +127 -49
- package/src/client/components/identity-manager/identity-manager.css +57 -353
- package/src/client/components/identity-manager/identity-manager.html +0 -94
- package/src/client/components/identity-manager/identity-manager.mts +356 -484
- package/src/client/components/keystone-creator/keystone-creator.mts +90 -13
- package/src/client/components/keystone-details/keystone-details.css +472 -0
- package/src/client/components/keystone-details/keystone-details.html +99 -0
- package/src/client/components/keystone-details/keystone-details.mts +821 -0
- package/src/client/components/keystone-scrubber/SCRUBBER_IMPLEMENTATION.md +33 -0
- package/src/client/components/keystone-scrubber/keystone-scrubber.css +46 -0
- package/src/client/components/keystone-scrubber/keystone-scrubber.html +15 -0
- package/src/client/components/keystone-scrubber/keystone-scrubber.mts +356 -0
- package/src/client/dev-tools/common.mts +505 -10
- package/src/client/dev-tools/phase-4-1.mts +19 -4
- package/src/client/dev-tools/phase-4-10.mts +77 -305
- package/src/client/dev-tools/phase-4-2.mts +46 -212
- package/src/client/dev-tools/phase-4-3.mts +57 -198
- package/src/client/dev-tools/phase-4-4.mts +57 -170
- package/src/client/dev-tools/phase-4-5.mts +48 -204
- package/src/client/dev-tools/phase-4-6.mts +37 -103
- package/src/client/dev-tools/phase-4-7.mts +44 -228
- package/src/client/dev-tools/phase-4-8.mts +33 -136
- package/src/client/dev-tools/phase-4-9.mts +33 -137
- package/src/client/dev-tools/phase-4.mts +30 -6
- package/src/client/dev-tools.mts +18 -0
- package/src/client/index.html +35 -14
- package/src/client/style.css +29 -5
- package/src/client/types.mts +4 -1
- package/src/client/ui/shell/space-gib-shell-service.mts +4 -0
- package/src/server/path-constants.mts +12 -0
- package/src/server/serve-gib/handlers/api/keystone/sso-config.handler.mts +66 -0
- package/src/server/serve-gib/handlers/api/keystone/sso-link.handler.mts +119 -0
- package/src/server/serve-gib/handlers/api/keystone/sso-login.handler.mts +189 -0
- package/src/server/server.mts +6 -0
- package/dist/client/chunk-ANGVYAEK.mjs +0 -42
- package/dist/client/chunk-ANGVYAEK.mjs.map +0 -7
- package/dist/client/chunk-IRGFDQRD.mjs +0 -1920
- package/dist/client/chunk-IRGFDQRD.mjs.map +0 -7
- package/dist/respec-gib.node.mjs +0 -5
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { extractErrorMsg, getUUID
|
|
1
|
+
import { extractErrorMsg, getUUID } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
2
2
|
import { Factory_V1 as factory } from '@ibgib/ts-gib/dist/V1/factory.mjs';
|
|
3
|
-
import { ROOT } from '@ibgib/ts-gib/dist/V1/constants.mjs';
|
|
4
3
|
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
5
4
|
import { KeystoneIbGib_V1 } from '@ibgib/core-gib/dist/keystone/keystone-types.mjs';
|
|
6
|
-
import { KeystoneService_V1 } from '@ibgib/core-gib/dist/keystone/keystone-service-v1.mjs';
|
|
7
|
-
import { getGlobalMetaspace_waitIfNeeded } from "@ibgib/web-gib/dist/helpers.mjs";
|
|
8
|
-
import { mut8Timeline } from '@ibgib/core-gib/dist/timeline/timeline-api.mjs';
|
|
9
5
|
import { graphsAreEquivalent } from '@ibgib/core-gib/dist/common/other/graph-helper.mjs';
|
|
10
|
-
import {
|
|
11
|
-
import { SyncSagaCoordinator } from '@ibgib/core-gib/dist/sync/sync-saga-coordinator.mjs';
|
|
12
|
-
import { SyncConflictStrategy } from '@ibgib/core-gib/dist/sync/sync-constants.mjs';
|
|
13
|
-
import { SESSION_KEYSTONE_POLICY, getSpaceGibPoolConfig } from "../../common/keystone-policies.mjs";
|
|
6
|
+
import { getGlobalMetaspace_waitIfNeeded } from "@ibgib/web-gib/dist/helpers.mjs";
|
|
14
7
|
import { SpaceGibApiBridge } from '../api/space-gib-api-bridge.mjs';
|
|
15
8
|
|
|
16
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
debugState, devLog, lc, performPhaseSetup,
|
|
11
|
+
runSyncPass, verifyIdentitiesOnServer
|
|
12
|
+
} from './common.mjs';
|
|
17
13
|
|
|
18
14
|
export function init4_2bSetupButton(): void {
|
|
19
15
|
const btn = document.getElementById('btn-4-2b-setup') as HTMLButtonElement | null;
|
|
@@ -41,14 +37,12 @@ async function performPhaseSync4_2b(): Promise<void> {
|
|
|
41
37
|
btn.disabled = true;
|
|
42
38
|
devLog(`4.2B Sync: Creating Constants and executing three-pass WebSocket Sync...`);
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
if (!domainI) {
|
|
40
|
+
if (!debugState.domainI) {
|
|
46
41
|
devLog(`⚠ 4.2B Sync: Missing setup state. Please run Setup first.`);
|
|
47
42
|
btn.disabled = false;
|
|
48
43
|
return;
|
|
49
44
|
}
|
|
50
45
|
|
|
51
|
-
const domainAddr = getIbGibAddr({ ibGib: domainI });
|
|
52
46
|
const metaspace = await getGlobalMetaspace_waitIfNeeded();
|
|
53
47
|
const space = await metaspace.getLocalUserSpace({});
|
|
54
48
|
if (!space) { throw new Error("No default space."); }
|
|
@@ -67,97 +61,19 @@ async function performPhaseSync4_2b(): Promise<void> {
|
|
|
67
61
|
|
|
68
62
|
// --- Sync 1: C1 First Pass ---
|
|
69
63
|
devLog(`4.2B Sync: Starting Pass 1 (Sync C1)...`);
|
|
70
|
-
|
|
71
|
-
let senderPeer = new SyncPeerWebSocketSender_V1({
|
|
72
|
-
classname: 'SyncPeerWebSocketSender_V1',
|
|
73
|
-
httpEvolveUrl: `${location.protocol}//${location.host}/api/keystone/evolve/${encodeURIComponent(domainAddr)}`,
|
|
74
|
-
wsUrl: `${protocol}//${location.host}/api/sync/ws/${encodeURIComponent(domainAddr)}`
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
let coordinator = new SyncSagaCoordinator();
|
|
78
|
-
let sagaId = await getUUID();
|
|
79
|
-
debugState.sagaId = sagaId;
|
|
80
|
-
debugState.senderPeer = senderPeer;
|
|
81
|
-
|
|
82
|
-
await senderPeer.initializeOpts({
|
|
83
|
-
localMetaspace: metaspace,
|
|
84
|
-
localSpace: space,
|
|
85
|
-
senderIdentity: domainI,
|
|
86
|
-
fnSenderSecret: async () => debugState.domainIMasterSecret!,
|
|
87
|
-
sagaId,
|
|
88
|
-
sessionConnectPoolConfig: SESSION_KEYSTONE_POLICY.CONNECT_POOL as any,
|
|
89
|
-
sessionSyncPoolConfig: SESSION_KEYSTONE_POLICY.DEFAULT_POOL as any,
|
|
90
|
-
targetAddrs: [domainAddr]
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
let syncSaga = await coordinator.sync({
|
|
94
|
-
domainIbGibs: [c1],
|
|
95
|
-
senderIdentity: domainI,
|
|
96
|
-
fnSenderSecret: async () => debugState.domainIMasterSecret!,
|
|
97
|
-
peer: senderPeer,
|
|
98
|
-
localSpace: space,
|
|
99
|
-
metaspace,
|
|
100
|
-
conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
|
|
101
|
-
});
|
|
102
|
-
await syncSaga.done;
|
|
64
|
+
await runSyncPass({ domainIbGibs: [c1], passLabel: 'Pass 1 (Sync C1)', metaspace, space });
|
|
103
65
|
devLog(`4.2B Sync: ✓ Pass 1 Complete.`);
|
|
104
66
|
|
|
105
|
-
const latestSenderAddr1 = await metaspace.getLatestAddr({
|
|
106
|
-
addr: getIbGibAddr({ ibGib: domainI }),
|
|
107
|
-
space,
|
|
108
|
-
});
|
|
109
|
-
const resGetLatestI1 = await metaspace.get({ addrs: [latestSenderAddr1!], space });
|
|
110
|
-
const senderIdentityEvolved1 = resGetLatestI1.ibGibs![0] as KeystoneIbGib_V1;
|
|
111
|
-
|
|
112
67
|
// --- Sync 2: C1 Second Pass (Idempotent check) ---
|
|
113
68
|
devLog(`4.2B Sync: Starting Pass 2 (Sync C1 - Idempotent)...`);
|
|
114
|
-
|
|
115
|
-
classname: 'SyncPeerWebSocketSender_V1',
|
|
116
|
-
httpEvolveUrl: `${location.protocol}//${location.host}/api/keystone/evolve/${encodeURIComponent(domainAddr)}`,
|
|
117
|
-
wsUrl: `${protocol}//${location.host}/api/sync/ws/${encodeURIComponent(domainAddr)}`
|
|
118
|
-
});
|
|
119
|
-
coordinator = new SyncSagaCoordinator();
|
|
120
|
-
sagaId = await getUUID();
|
|
121
|
-
debugState.sagaId = sagaId;
|
|
122
|
-
debugState.senderPeer = senderPeer;
|
|
123
|
-
|
|
124
|
-
await senderPeer.initializeOpts({
|
|
125
|
-
localMetaspace: metaspace,
|
|
126
|
-
localSpace: space,
|
|
127
|
-
senderIdentity: senderIdentityEvolved1,
|
|
128
|
-
fnSenderSecret: async () => debugState.domainIMasterSecret!,
|
|
129
|
-
sagaId,
|
|
130
|
-
sessionConnectPoolConfig: SESSION_KEYSTONE_POLICY.CONNECT_POOL as any,
|
|
131
|
-
sessionSyncPoolConfig: SESSION_KEYSTONE_POLICY.DEFAULT_POOL as any,
|
|
132
|
-
targetAddrs: [domainAddr]
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
syncSaga = await coordinator.sync({
|
|
136
|
-
domainIbGibs: [c1],
|
|
137
|
-
senderIdentity: senderIdentityEvolved1,
|
|
138
|
-
fnSenderSecret: async () => debugState.domainIMasterSecret!,
|
|
139
|
-
peer: senderPeer,
|
|
140
|
-
localSpace: space,
|
|
141
|
-
metaspace,
|
|
142
|
-
conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
|
|
143
|
-
});
|
|
144
|
-
await syncSaga.done;
|
|
69
|
+
await runSyncPass({ domainIbGibs: [c1], passLabel: 'Pass 2 (Sync C1 idempotent)', metaspace, space });
|
|
145
70
|
devLog(`4.2B Sync: ✓ Pass 2 Complete.`);
|
|
146
71
|
|
|
147
|
-
const latestSenderAddr2 = await metaspace.getLatestAddr({
|
|
148
|
-
addr: getIbGibAddr({ ibGib: domainI }),
|
|
149
|
-
space,
|
|
150
|
-
});
|
|
151
|
-
const resGetLatestI2 = await metaspace.get({ addrs: [latestSenderAddr2!], space });
|
|
152
|
-
const senderIdentityEvolved2 = resGetLatestI2.ibGibs![0] as KeystoneIbGib_V1;
|
|
153
|
-
|
|
154
72
|
// 2. Create Constant C2 locally linking to C1
|
|
155
73
|
const c2 = await factory.constant({
|
|
156
74
|
ib: 'constant_c2_' + (await getUUID()).slice(0, 8),
|
|
157
75
|
parentPrimitiveIb: 'root',
|
|
158
|
-
rel8ns: {
|
|
159
|
-
link: [addrC1],
|
|
160
|
-
},
|
|
76
|
+
rel8ns: { link: [addrC1] },
|
|
161
77
|
});
|
|
162
78
|
const addrC2 = getIbGibAddr({ ibGib: c2 });
|
|
163
79
|
await metaspace.put({ ibGib: c2, space });
|
|
@@ -167,37 +83,7 @@ async function performPhaseSync4_2b(): Promise<void> {
|
|
|
167
83
|
|
|
168
84
|
// --- Sync 3: C2 Pass ---
|
|
169
85
|
devLog(`4.2B Sync: Starting Pass 3 (Sync C2)...`);
|
|
170
|
-
|
|
171
|
-
classname: 'SyncPeerWebSocketSender_V1',
|
|
172
|
-
httpEvolveUrl: `${location.protocol}//${location.host}/api/keystone/evolve/${encodeURIComponent(domainAddr)}`,
|
|
173
|
-
wsUrl: `${protocol}//${location.host}/api/sync/ws/${encodeURIComponent(domainAddr)}`
|
|
174
|
-
});
|
|
175
|
-
coordinator = new SyncSagaCoordinator();
|
|
176
|
-
sagaId = await getUUID();
|
|
177
|
-
debugState.sagaId = sagaId;
|
|
178
|
-
debugState.senderPeer = senderPeer;
|
|
179
|
-
|
|
180
|
-
await senderPeer.initializeOpts({
|
|
181
|
-
localMetaspace: metaspace,
|
|
182
|
-
localSpace: space,
|
|
183
|
-
senderIdentity: senderIdentityEvolved2,
|
|
184
|
-
fnSenderSecret: async () => debugState.domainIMasterSecret!,
|
|
185
|
-
sagaId,
|
|
186
|
-
sessionConnectPoolConfig: SESSION_KEYSTONE_POLICY.CONNECT_POOL as any,
|
|
187
|
-
sessionSyncPoolConfig: SESSION_KEYSTONE_POLICY.DEFAULT_POOL as any,
|
|
188
|
-
targetAddrs: [domainAddr]
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
syncSaga = await coordinator.sync({
|
|
192
|
-
domainIbGibs: [c2],
|
|
193
|
-
senderIdentity: senderIdentityEvolved2,
|
|
194
|
-
fnSenderSecret: async () => debugState.domainIMasterSecret!,
|
|
195
|
-
peer: senderPeer,
|
|
196
|
-
localSpace: space,
|
|
197
|
-
metaspace,
|
|
198
|
-
conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
|
|
199
|
-
});
|
|
200
|
-
await syncSaga.done;
|
|
86
|
+
await runSyncPass({ domainIbGibs: [c2], passLabel: 'Pass 3 (Sync C2)', metaspace, space });
|
|
201
87
|
devLog(`4.2B Sync: ✓ Pass 3 Complete.`);
|
|
202
88
|
|
|
203
89
|
devLog(`✓ 4.2B Sync Sequence Complete! Ready for State Checks.`);
|
|
@@ -216,9 +102,7 @@ async function performPhaseSync4_2b(): Promise<void> {
|
|
|
216
102
|
export function init4_2bSyncButton(): void {
|
|
217
103
|
const btn = document.getElementById('btn-4-2b-sync') as HTMLButtonElement | null;
|
|
218
104
|
if (!btn) { return; }
|
|
219
|
-
btn.addEventListener('click', () => {
|
|
220
|
-
performPhaseSync4_2b();
|
|
221
|
-
});
|
|
105
|
+
btn.addEventListener('click', () => { performPhaseSync4_2b(); });
|
|
222
106
|
}
|
|
223
107
|
|
|
224
108
|
export function init4_2bCheckButton(): void {
|
|
@@ -240,142 +124,92 @@ export function init4_2bCheckButton(): void {
|
|
|
240
124
|
const c1Addr = getIbGibAddr({ ibGib: targetC1 });
|
|
241
125
|
const c2Addr = getIbGibAddr({ ibGib: targetC2 });
|
|
242
126
|
const domainAddr = getIbGibAddr({ ibGib: domainI });
|
|
127
|
+
const apiBridge = new SpaceGibApiBridge();
|
|
243
128
|
|
|
244
129
|
// 1. Verify C1 and C2 exist locally
|
|
245
130
|
const localC1Res = await metaspace.get({ addrs: [c1Addr], space });
|
|
246
131
|
const localC2Res = await metaspace.get({ addrs: [c2Addr], space });
|
|
247
132
|
if (!localC1Res.success || !localC1Res.ibGibs?.[0]) {
|
|
248
|
-
devLog('✗ Check: Constant C1 NOT found locally.');
|
|
249
|
-
return;
|
|
133
|
+
devLog('✗ Check: Constant C1 NOT found locally.'); return;
|
|
250
134
|
}
|
|
251
135
|
if (!localC2Res.success || !localC2Res.ibGibs?.[0]) {
|
|
252
|
-
devLog('✗ Check: Constant C2 NOT found locally.');
|
|
253
|
-
return;
|
|
136
|
+
devLog('✗ Check: Constant C2 NOT found locally.'); return;
|
|
254
137
|
}
|
|
255
138
|
devLog(`✓ Check: Constants C1 and C2 exist locally.`);
|
|
256
139
|
|
|
257
|
-
// 2.
|
|
258
|
-
const apiBridge = new SpaceGibApiBridge();
|
|
140
|
+
// 2. Verify C1 and C2 on server, C2 dependency graph matches
|
|
259
141
|
const serverC1Res = await apiBridge.getIbGib(domainAddr, c1Addr);
|
|
260
142
|
const serverC2Res = await apiBridge.getIbGib(domainAddr, c2Addr);
|
|
261
143
|
if (!serverC1Res.success || !serverC1Res.ibGib) {
|
|
262
|
-
devLog(`✗ Check: Constant C1 NOT found on server: ${serverC1Res.message}`);
|
|
263
|
-
return;
|
|
144
|
+
devLog(`✗ Check: Constant C1 NOT found on server: ${serverC1Res.message}`); return;
|
|
264
145
|
}
|
|
265
146
|
if (!serverC2Res.success || !serverC2Res.ibGib) {
|
|
266
|
-
devLog(`✗ Check: Constant C2 NOT found on server: ${serverC2Res.message}`);
|
|
267
|
-
return;
|
|
147
|
+
devLog(`✗ Check: Constant C2 NOT found on server: ${serverC2Res.message}`); return;
|
|
268
148
|
}
|
|
269
149
|
devLog(`✓ Check: Constants C1 and C2 exist on server.`);
|
|
270
150
|
|
|
271
|
-
const localC2Graph = await metaspace.getDependencyGraph({
|
|
272
|
-
ibGibAddr: c2Addr,
|
|
273
|
-
space
|
|
274
|
-
});
|
|
151
|
+
const localC2Graph = await metaspace.getDependencyGraph({ ibGibAddr: c2Addr, space });
|
|
275
152
|
const serverC2GetGraphRes = await apiBridge.getIbGibGraph(domainAddr, c2Addr, true);
|
|
276
153
|
if (!serverC2GetGraphRes.success || !serverC2GetGraphRes.graph) {
|
|
277
|
-
devLog(`✗ Check: Failed to fetch C2 graph from server: ${serverC2GetGraphRes.message}`);
|
|
278
|
-
return;
|
|
154
|
+
devLog(`✗ Check: Failed to fetch C2 graph from server: ${serverC2GetGraphRes.message}`); return;
|
|
279
155
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const c2GraphsEqual = graphsAreEquivalent({ graphA: localC2Graph, graphB: serverC2Graph });
|
|
283
|
-
if (c2GraphsEqual) {
|
|
284
|
-
devLog('✓ Check: C2 dependency graphs are equivalent on client and server.');
|
|
285
|
-
} else {
|
|
286
|
-
devLog('✗ Check: C2 dependency graphs mismatch between client and server!');
|
|
287
|
-
return;
|
|
156
|
+
if (!graphsAreEquivalent({ graphA: localC2Graph, graphB: serverC2GetGraphRes.graph })) {
|
|
157
|
+
devLog('✗ Check: C2 dependency graphs mismatch between client and server!'); return;
|
|
288
158
|
}
|
|
159
|
+
devLog('✓ Check: C2 dependency graphs are equivalent on client and server.');
|
|
289
160
|
|
|
290
|
-
// 3. Verify
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
if (!latestLocalIAddr) {
|
|
296
|
-
devLog('✗ Check: Evolved domain keystone tip I3 NOT found in local space!');
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
161
|
+
// 3. Verify domain keystone n=1, then verify domain/delegate/session on server.
|
|
162
|
+
// I only evolves once (delegate registration during setup).
|
|
163
|
+
// The delegate is the sync sender and evolves during sync passes, not I.
|
|
164
|
+
const latestLocalIAddr = await metaspace.getLatestAddr({ addr: domainAddr, space });
|
|
165
|
+
if (!latestLocalIAddr) { devLog('✗ Check: Domain keystone tip not found locally!'); return; }
|
|
299
166
|
const localIRes = await metaspace.get({ addrs: [latestLocalIAddr], space });
|
|
300
167
|
const localI = localIRes.ibGibs?.[0] as KeystoneIbGib_V1 | undefined;
|
|
301
|
-
if (!localI) {
|
|
302
|
-
devLog('✗ Check: Failed to load evolved I from local space.');
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
devLog(`✓ Check: Evolved Domain Keystone exists locally: ${latestLocalIAddr}`);
|
|
168
|
+
if (!localI) { devLog('✗ Check: Failed to load domain keystone!'); return; }
|
|
306
169
|
|
|
307
170
|
const nI = localI.data?.n;
|
|
308
171
|
devLog(`✓ Check: Evolved I tip is at n = ${nI}.`);
|
|
309
|
-
if (nI !==
|
|
310
|
-
devLog(`✗ Check: Expected I to evolve to n =
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
const serverIGetRes = await apiBridge.getIbGib(domainAddr, latestLocalIAddr);
|
|
315
|
-
if (!serverIGetRes.success || !serverIGetRes.ibGib) {
|
|
316
|
-
devLog(`✗ Check: Evolved Domain Keystone tip NOT found on server!`);
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
devLog(`✓ Check: Evolved Domain Keystone tip exists on server.`);
|
|
320
|
-
|
|
321
|
-
// 4. Verify session identity S tip exists locally and on server
|
|
322
|
-
const syncProof = localI.data?.proofs?.find(p => p.claim?.verb === 'sync');
|
|
323
|
-
const sessionIdentityTjpAddr = syncProof?.claim?.target;
|
|
324
|
-
if (!sessionIdentityTjpAddr) {
|
|
325
|
-
devLog('✗ Check: Evolved I sync claim does not target a session keystone.');
|
|
326
|
-
return;
|
|
172
|
+
if (nI !== 1) {
|
|
173
|
+
devLog(`✗ Check: Expected I to evolve to n = 1 (delegate registration only), got n = ${nI}.`); return;
|
|
327
174
|
}
|
|
328
175
|
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
space
|
|
176
|
+
const { sessionIdentityTjpAddr } = await verifyIdentitiesOnServer({
|
|
177
|
+
localI, metaspace, space, apiBridge, domainAddr
|
|
332
178
|
});
|
|
179
|
+
|
|
180
|
+
// 4. Verify session keystone S n=3 and graph matches.
|
|
181
|
+
// The session S from the final (3rd) pass goes through connect(n=1), sync(n=2), disconnect(n=3).
|
|
182
|
+
const latestLocalSAddr = await metaspace.getLatestAddr({ addr: sessionIdentityTjpAddr, space });
|
|
333
183
|
if (!latestLocalSAddr) {
|
|
334
|
-
devLog('✗ Check: Latest Session Keystone (S) NOT found in local space.');
|
|
335
|
-
return;
|
|
184
|
+
devLog('✗ Check: Latest Session Keystone (S) NOT found in local space.'); return;
|
|
336
185
|
}
|
|
337
186
|
devLog(`✓ Check: Found latest session keystone (S) locally: ${latestLocalSAddr}`);
|
|
338
187
|
|
|
339
188
|
const localSRes = await metaspace.get({ addrs: [latestLocalSAddr], space });
|
|
340
189
|
const sessionS = localSRes.ibGibs?.[0] as KeystoneIbGib_V1 | undefined;
|
|
341
|
-
if (!sessionS) {
|
|
342
|
-
devLog('✗ Check: Failed to load latest Session Keystone (S) locally.');
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
190
|
+
if (!sessionS) { devLog('✗ Check: Failed to load Session Keystone (S) locally.'); return; }
|
|
345
191
|
|
|
346
192
|
const nS = sessionS.data?.n;
|
|
347
193
|
devLog(`✓ Check: Latest session S tip evolved to n = ${nS}.`);
|
|
348
194
|
if (nS !== 3) {
|
|
349
|
-
devLog(`✗ Check: Expected latest session S to evolve to n = 3, got n = ${nS}.`);
|
|
350
|
-
return;
|
|
195
|
+
devLog(`✗ Check: Expected latest session S to evolve to n = 3 (connect+sync+disconnect), got n = ${nS}.`); return;
|
|
351
196
|
}
|
|
352
197
|
|
|
353
198
|
const serverSGetRes = await apiBridge.getIbGib(domainAddr, latestLocalSAddr);
|
|
354
199
|
if (!serverSGetRes.success || !serverSGetRes.ibGib) {
|
|
355
|
-
devLog(`✗ Check: Latest Session Keystone (S) NOT found on server!`);
|
|
356
|
-
return;
|
|
200
|
+
devLog(`✗ Check: Latest Session Keystone (S) NOT found on server!`); return;
|
|
357
201
|
}
|
|
358
202
|
devLog(`✓ Check: Latest Session Keystone (S) exists on server.`);
|
|
359
203
|
|
|
360
|
-
|
|
361
|
-
const localSGraph = await metaspace.getDependencyGraph({
|
|
362
|
-
ibGibAddr: latestLocalSAddr,
|
|
363
|
-
space
|
|
364
|
-
});
|
|
204
|
+
const localSGraph = await metaspace.getDependencyGraph({ ibGibAddr: latestLocalSAddr, space });
|
|
365
205
|
const serverSGetGraphRes = await apiBridge.getIbGibGraph(domainAddr, sessionIdentityTjpAddr, true);
|
|
366
206
|
if (!serverSGetGraphRes.success || !serverSGetGraphRes.graph) {
|
|
367
|
-
devLog(`✗ Check: Failed to fetch session S graph from server: ${serverSGetGraphRes.message}`);
|
|
368
|
-
return;
|
|
207
|
+
devLog(`✗ Check: Failed to fetch session S graph from server: ${serverSGetGraphRes.message}`); return;
|
|
369
208
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
const sGraphsEqual = graphsAreEquivalent({ graphA: localSGraph, graphB: serverSGraph });
|
|
373
|
-
if (sGraphsEqual) {
|
|
374
|
-
devLog('✓ Check: Session Keystone (S) dependency graphs are equivalent on client and server.');
|
|
375
|
-
} else {
|
|
376
|
-
devLog('✗ Check: Session Keystone (S) dependency graphs mismatch between client and server!');
|
|
377
|
-
return;
|
|
209
|
+
if (!graphsAreEquivalent({ graphA: localSGraph, graphB: serverSGetGraphRes.graph })) {
|
|
210
|
+
devLog('✗ Check: Session Keystone (S) dependency graphs mismatch between client and server!'); return;
|
|
378
211
|
}
|
|
212
|
+
devLog('✓ Check: Session Keystone (S) dependency graphs are equivalent on client and server.');
|
|
379
213
|
|
|
380
214
|
devLog('🎉 ALL PHASE 4.2B TRANSACTION SYNC CHECKS PASSED FLAWLESSLY! ✓');
|
|
381
215
|
btn.textContent = '✓ 4.2B All Passed';
|