@ibgib/ts-gib 0.5.21 → 0.5.23

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.
@@ -11,7 +11,8 @@
11
11
  */
12
12
 
13
13
  import {
14
- firstOfAll, ifWe, ifWeMight, iReckon, respecfully
14
+ firstOfAll, ifWe, ifWeMight, iReckon, respecfully,
15
+ respecfullyDear
15
16
  } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
16
17
  const maam = `[${import.meta.url}]`, sir = maam;
17
18
 
@@ -20,7 +21,6 @@ import { sha256v1, hashToHexCopy } from './sha256v1.mjs';
20
21
  import { IbGibWithDataAndRel8ns, IbGibRel8ns } from '../types.mjs';
21
22
  import { getGib, getGibInfo } from './transforms/transform-helper.mjs';
22
23
 
23
-
24
24
  import { Factory_V1 as factory } from './factory.mjs';
25
25
  import { toNormalizedForHashing } from '../helper.mjs';
26
26
 
@@ -249,3 +249,1005 @@ await respecfully(sir, `when hashing sha256v1`, async () => {
249
249
  }
250
250
 
251
251
  });
252
+
253
+ console.warn(`${sir} These are python edge case tests that I'm creating with Jules, Google's GitHub agent. It is a learning process and these tests are supposed to be helpers to fill out edge cases. I'm doing this in the python_gib repo though, and Jules is not able to run these tests directly. It's still a WIP. (W: 5ebcf87554c8216dc86e664ffaf62525)`)
254
+ console.warn(`${sir} These are python edge case tests that I'm creating with Jules, Google's GitHub agent. It is a learning process and these tests are supposed to be helpers to fill out edge cases. I'm doing this in the python_gib repo though, and Jules is not able to run these tests directly. It's still a WIP. (W: 5ebcf87554c8216dc86e664ffaf62525)`)
255
+ console.warn(`${sir} These are python edge case tests that I'm creating with Jules, Google's GitHub agent. It is a learning process and these tests are supposed to be helpers to fill out edge cases. I'm doing this in the python_gib repo though, and Jules is not able to run these tests directly. It's still a WIP. (W: 5ebcf87554c8216dc86e664ffaf62525)`)
256
+ console.warn(`${sir} These are python edge case tests that I'm creating with Jules, Google's GitHub agent. It is a learning process and these tests are supposed to be helpers to fill out edge cases. I'm doing this in the python_gib repo though, and Jules is not able to run these tests directly. It's still a WIP. (W: 5ebcf87554c8216dc86e664ffaf62525)`)
257
+
258
+ await respecfully(sir, `Python Edge Case Tests for sha256v1`, async () => {
259
+
260
+ const EMPTY_HASH_FOR_ABSENT_FIELD = "";
261
+
262
+ await ifWe(sir, `Edge Case 1: data with mixed undefined and empty string values`, async () => {
263
+ const ibGib_s1: IbGib_V1 = {
264
+ ib: 's1',
265
+ data: { a: undefined, b: '', c: 'val', d: { d1: undefined, d2: 'd2val' } }
266
+ };
267
+
268
+ const expected_ib_hash_s1 = "E8BC163C82EEE18733288C7D4AC636DB3A6DEB013EF2D37B68322BE20EDC45CC";
269
+ const expected_data_hash_s1 = "3310C5015C3426C4EC62CF5F5F3EC5D83F86C26E54C5AC3BD05C1B574B46ADE2";
270
+ const expected_gib_s1 = "9B9D08F270C5249FD1DC2E0453010EBD544C7781FF5CDAFADD7679C2C7DA7247";
271
+
272
+ const ibHash_ts = (await hashToHexCopy(ibGib_s1.ib!))?.toUpperCase() || '';
273
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s1`).isGonnaBe(expected_ib_hash_s1);
274
+
275
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s1.data);
276
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
277
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
278
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s1`).isGonnaBe(expected_data_hash_s1);
279
+
280
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
281
+ // Manual final gib construction based on Python test logic: hash(ib_hash + "" + data_hash)
282
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
283
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
284
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s1 (from py test logic)`).isGonnaBe(expected_gib_s1);
285
+
286
+ const calculatedGib_ts = (await sha256v1(ibGib_s1, ""))?.toUpperCase();
287
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s1 (from sha256v1 call)`).isGonnaBe(expected_gib_s1);
288
+ });
289
+
290
+ await ifWe(sir, `Edge Case 2: rel8ns with a relation mapping to a list containing null`, async () => {
291
+ const ibGib_s2: IbGib_V1 = {
292
+ ib: 's2',
293
+ rel8ns: { next: ['addr1', null as any, 'addr2'], prev: undefined }
294
+ };
295
+
296
+ const expected_ib_hash_s2 = "AD328846AA18B32A335816374511CAC1063C704B8C57999E51DA9F908290A7A4";
297
+ const expected_rel8ns_hash_s2 = "32945B4CE582D29827CA925DCA3155CA397C132F0DB1DB5DFF9AD46A8EFD98FE";
298
+ const expected_gib_s2 = "8DD27B4AFBE3AD7D59768CB4D1A574DC2FEA19546E922101FED6F6ECA9B97C61";
299
+
300
+ const ibHash_ts = (await hashToHexCopy(ibGib_s2.ib!))?.toUpperCase() || '';
301
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s2`).isGonnaBe(expected_ib_hash_s2);
302
+
303
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s2.rel8ns);
304
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
305
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
306
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s2`).isGonnaBe(expected_rel8ns_hash_s2);
307
+
308
+ const actualDataHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
309
+ // Manual final gib construction based on Python test logic: hash(ib_hash + rel8ns_hash + "")
310
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
311
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
312
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s2 (from py test logic)`).isGonnaBe(expected_gib_s2);
313
+
314
+ const calculatedGib_ts = (await sha256v1(ibGib_s2, ""))?.toUpperCase();
315
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s2 (from sha256v1 call)`).isGonnaBe(expected_gib_s2);
316
+ });
317
+
318
+ // skipping because this is not a valid ibgib and I'm trying to understand
319
+ // how to work with Jules (Google's GitHub agent)
320
+ // await ifWe(sir, `Edge Case 3: data is an empty list []`, async () => {
321
+ // const ibGib_s3: IbGib_V1 = { ib: 's3', data: [] };
322
+
323
+ // // const gib = await getGib({ibGib: ibGib_s3});
324
+ // // ibGib_s3.gib
325
+
326
+ // const expected_ib_hash_s3 = "41242B9FAE56FAD4E6E77DFE33CB18D1C3FC583F988CF25EF9F2D9BE0D440BBB";
327
+ // const expected_data_hash_s3 = "4F53CDA18C2BAA0C0354BB5F9A3ECBE5ED12AB4D8E11BA873C2F11161202B945";
328
+ // const expected_gib_s3 = "BA109F5B0C09CF0A27EF976F876EE8F336DC954EF6443F324F19D78020E3E59A";
329
+
330
+ // const ibHash_ts = (await hashToHexCopy(ibGib_s3.ib!))?.toUpperCase() || '';
331
+ // iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s3`).isGonnaBe(expected_ib_hash_s3);
332
+
333
+ // const normalizedData_ts = toNormalizedForHashing(ibGib_s3.data);
334
+ // const stringifiedData_ts = JSON.stringify(normalizedData_ts);
335
+ // const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
336
+ // iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s3`).isGonnaBe(expected_data_hash_s3);
337
+
338
+ // const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
339
+ // const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
340
+ // const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
341
+ // iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s3 (from py test logic)`).isGonnaBe(expected_gib_s3);
342
+
343
+ // const calculatedGib_ts = (await sha256v1(ibGib_s3, ""))?.toUpperCase();
344
+ // iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s3 (from sha256v1 call)`).isGonnaBe(expected_gib_s3);
345
+ // });
346
+
347
+ // skipping because this is not a valid ibgib and I'm trying to understand
348
+ // how to work with Jules (Google's GitHub agent)
349
+ // await ifWe(sir, `Edge Case 4: data contains a list with dictionaries, where inner dicts have null values`, async () => {
350
+ // const ibGib_s4: IbGib_V1 = {
351
+ // ib: 's4',
352
+ // data: { items: [{ id: 1, val: null, name: 'item1' }, { id: 2, val: 'present' }] }
353
+ // };
354
+
355
+ // const expected_ib_hash_s4 = "5B840157E7E86AEF3B3FD0FC24F3ADD34D3E7F210370D429475ED1BCD3E7FCA2";
356
+ // const expected_data_hash_s4 = "2682A15F60291F933B57EE14F0A3D5FD233FC90B3FF1ADD5FD473F859FA6B287";
357
+ // const expected_gib_s4 = "2AE26C6F9A4D53CE32A0A1792E59F34126A25503CE33728EA7CB8A38E29DD0BF";
358
+
359
+ // const ibHash_ts = (await hashToHexCopy(ibGib_s4.ib!))?.toUpperCase() || '';
360
+ // iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s4`).isGonnaBe(expected_ib_hash_s4);
361
+
362
+ // const normalizedData_ts = toNormalizedForHashing(ibGib_s4.data);
363
+ // const stringifiedData_ts = JSON.stringify(normalizedData_ts);
364
+ // const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
365
+ // iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s4`).isGonnaBe(expected_data_hash_s4);
366
+
367
+ // const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
368
+ // const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
369
+ // const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
370
+ // iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s4 (from py test logic)`).isGonnaBe(expected_gib_s4);
371
+
372
+ // const calculatedGib_ts = (await sha256v1(ibGib_s4, ""))?.toUpperCase();
373
+ // iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s4 (from sha256v1 call)`).isGonnaBe(expected_gib_s4);
374
+ // });
375
+
376
+ await ifWe(sir, `Edge Case 5: data key order vs. rel8ns key order`, async () => {
377
+ const ibGib_s5: IbGib_V1 = {
378
+ ib: 's5',
379
+ data: { z: 1, a: 2 },
380
+ rel8ns: { z_rel: ['z1'], a_rel: ['a1'] }
381
+ };
382
+
383
+ const expected_ib_hash_s5 = "3B96FC064FA874A80A132BDA60BEBF54EFBC780A358FDCAE4FBBD7E12B66B630";
384
+ const expected_data_hash_s5 = "C2985C5BA6F7D2A55E768F92490CA09388E95BC4CCCB9FDF11B15F4D42F93E73";
385
+ const expected_rel8ns_hash_s5 = "3C0705B51593C740738A0BFB4D9030C8A8093D8A6049346E823CD033BAAA09E5";
386
+ const expected_gib_s5 = "7AC6FB16BC853C6AE7D375ECEEA810ABB6F60241A1679ADEE4DC6ED4E29BE74A";
387
+
388
+ const ibHash_ts = (await hashToHexCopy(ibGib_s5.ib!))?.toUpperCase() || '';
389
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s5`).isGonnaBe(expected_ib_hash_s5);
390
+
391
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s5.data);
392
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
393
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
394
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s5`).isGonnaBe(expected_data_hash_s5);
395
+
396
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s5.rel8ns);
397
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
398
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
399
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s5`).isGonnaBe(expected_rel8ns_hash_s5);
400
+
401
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
402
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
403
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s5 (from py test logic)`).isGonnaBe(expected_gib_s5);
404
+
405
+ const calculatedGib_ts = (await sha256v1(ibGib_s5, ""))?.toUpperCase();
406
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s5 (from sha256v1 call)`).isGonnaBe(expected_gib_s5);
407
+ });
408
+
409
+ // skipping because this is not a valid ibgib and I'm trying to understand
410
+ // how to work with Jules (Google's GitHub agent)
411
+ // await ifWe(sir, `Edge Case 6: data with special characters in string values and keys`, async () => {
412
+ // const ibGib_s6: IbGib_V1 = {
413
+ // ib: 's6',
414
+ // data: { 'key "1"': 'value with "quotes" and \n newline', 'key_ñ': 'val_ü' }
415
+ // };
416
+
417
+ // const expected_ib_hash_s6 = "71E7690959239CA065841EBA3EBB281072BAA78BA0BB31079B9ACB4A009A9FE3";
418
+ // const expected_data_hash_s6 = "441200D475E6171CD94518A7AD358C29281DBD962163EE7F1B309058098CECE7";
419
+ // const expected_gib_s6 = "9AF9BE9284CFCE565CBFD482EA0797E0D67CCD0AEDF6509BCEA3B9D4D00931BF";
420
+
421
+ // const ibHash_ts = (await hashToHexCopy(ibGib_s6.ib!))?.toUpperCase() || '';
422
+ // iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s6`).isGonnaBe(expected_ib_hash_s6);
423
+
424
+ // const normalizedData_ts = toNormalizedForHashing(ibGib_s6.data);
425
+ // const stringifiedData_ts = JSON.stringify(normalizedData_ts);
426
+ // const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
427
+ // iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s6`).isGonnaBe(expected_data_hash_s6);
428
+
429
+ // const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
430
+ // const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
431
+ // const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
432
+ // iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s6 (from py test logic)`).isGonnaBe(expected_gib_s6);
433
+
434
+ // const calculatedGib_ts = (await sha256v1(ibGib_s6, ""))?.toUpperCase();
435
+ // iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s6 (from sha256v1 call)`).isGonnaBe(expected_gib_s6);
436
+ // });
437
+
438
+ await ifWe(sir, `Edge Case 7a: data is a primitive type (boolean True)`, async () => {
439
+ const ibGib_s7a: IbGib_V1 = { ib: 's7a', data: true as any };
440
+
441
+ const expected_ib_hash_s7a = "612A9EB864ED62C258BDCB155F13F590879BA34AD30DDE91CB9BE38139439E9F";
442
+ const expected_data_hash_s7a = "B5BEA41B6C623F7C09F1BF24DCAE58EBAB3C0CDD90AD966BC43A45B44867E12B";
443
+ const expected_gib_s7a = "53BBABB9F24C75E3C6037D744C241AF710B6E886C22398537AA9332D5626D022";
444
+
445
+ const ibHash_ts = (await hashToHexCopy(ibGib_s7a.ib!))?.toUpperCase() || '';
446
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s7a`).isGonnaBe(expected_ib_hash_s7a);
447
+
448
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s7a.data);
449
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
450
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
451
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s7a`).isGonnaBe(expected_data_hash_s7a);
452
+
453
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
454
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
455
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
456
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s7a (from py test logic)`).isGonnaBe(expected_gib_s7a);
457
+
458
+ const calculatedGib_ts = (await sha256v1(ibGib_s7a, ""))?.toUpperCase();
459
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s7a (from sha256v1 call)`).isGonnaBe(expected_gib_s7a);
460
+ });
461
+
462
+ await ifWe(sir, `Edge Case 7b: data is a primitive type (number)`, async () => {
463
+ const ibGib_s7b: IbGib_V1 = { ib: 's7b', data: 123.45 as any };
464
+
465
+ const expected_ib_hash_s7b = "70348C184BB7E09344EEEE0BA0A766D1DB6C1B1E02520A6534C94F78591EBA46";
466
+ const expected_data_hash_s7b = "4EBC4A141B378980461430980948A55988FBF56F85D084AC33D8A8F61B9FAB88";
467
+ const expected_gib_s7b = "F81D2861750A638FBE6F792D66A8EE2408C5F5CB965755166957C46B1B242F41";
468
+
469
+ const ibHash_ts = (await hashToHexCopy(ibGib_s7b.ib!))?.toUpperCase() || '';
470
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s7b`).isGonnaBe(expected_ib_hash_s7b);
471
+
472
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s7b.data);
473
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
474
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
475
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s7b`).isGonnaBe(expected_data_hash_s7b);
476
+
477
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
478
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
479
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
480
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s7b (from py test logic)`).isGonnaBe(expected_gib_s7b);
481
+
482
+ const calculatedGib_ts = (await sha256v1(ibGib_s7b, ""))?.toUpperCase();
483
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s7b (from sha256v1 call)`).isGonnaBe(expected_gib_s7b);
484
+ });
485
+
486
+ await ifWe(sir, `Edge Case 8: rel8ns with some relations being empty lists, others non-empty`, async () => {
487
+ const ibGib_s8: IbGib_V1 = {
488
+ ib: 's8',
489
+ rel8ns: { past: [], future: ['addr1'], empty_too: [] }
490
+ };
491
+
492
+ const expected_ib_hash_s8 = "1CB7637B6957AC5D6F6CDEC745554AFD3CD1537BB6E7A8E74D41C2EA58B89E97";
493
+ const expected_rel8ns_hash_s8 = "A98E517BB1289561B164706289F2CCE1423EA9ABCA11FC35BFFD4E0817224760";
494
+ const expected_gib_s8 = "EE653CEE56759A6C868A485582E4E66C8B57DFBE1C55CF36BDBF237BF5C09CF8";
495
+
496
+ const ibHash_ts = (await hashToHexCopy(ibGib_s8.ib!))?.toUpperCase() || '';
497
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s8`).isGonnaBe(expected_ib_hash_s8);
498
+
499
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s8.rel8ns);
500
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
501
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
502
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s8`).isGonnaBe(expected_rel8ns_hash_s8);
503
+
504
+ const actualDataHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
505
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
506
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
507
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s8 (from py test logic)`).isGonnaBe(expected_gib_s8);
508
+
509
+ const calculatedGib_ts = (await sha256v1(ibGib_s8, ""))?.toUpperCase();
510
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s8 (from sha256v1 call)`).isGonnaBe(expected_gib_s8);
511
+ });
512
+
513
+ await ifWe(sir, `Edge Case 9: Deeply nested data with mixed undefined/null, lists, and dicts`, async () => {
514
+ const ibGib_s9: IbGib_V1 = {
515
+ ib: 's9',
516
+ data: { level1: { l2_val: 'v2', l2_none: undefined, l2_list: [1, { l3_none: null, l3_val: 'v3' }, 3] } }
517
+ };
518
+
519
+ const expected_ib_hash_s9 = "E72D310DBB213F4C2E34DA28935B38905332EE3628A04DF2DD13859FD769C6C5";
520
+ const expected_data_hash_s9 = "F8C3EF9BFBB9D927B55B3BA1FAAECAD1B35FA9B912AEAF9B75A807DA814CB975";
521
+ const expected_gib_s9 = "DB2F3306E2E91F22B0C7B10787760D0FE25BA79B7E3DFFE38164381EA06BE6A6";
522
+
523
+ const ibHash_ts = (await hashToHexCopy(ibGib_s9.ib!))?.toUpperCase() || '';
524
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s9`).isGonnaBe(expected_ib_hash_s9);
525
+
526
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s9.data);
527
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
528
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
529
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s9`).isGonnaBe(expected_data_hash_s9);
530
+
531
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
532
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
533
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
534
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s9 (from py test logic)`).isGonnaBe(expected_gib_s9);
535
+
536
+ const calculatedGib_ts = (await sha256v1(ibGib_s9, ""))?.toUpperCase();
537
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s9 (from sha256v1 call)`).isGonnaBe(expected_gib_s9);
538
+ });
539
+
540
+ await ifWe(sir, `Edge Case 10a: ibgib with data but no rel8ns key`, async () => {
541
+ const ibGib_s10a: IbGib_V1 = { ib: 's10a', data: { k: 'v' } };
542
+
543
+ const expected_ib_hash_s10a = "7674836E2F8926A8F0BE7998ABB44BACBC041BC51AF761F85E09A1349C60046C";
544
+ const expected_data_hash_s10a = "666C1AA02E8068C6D5CC1D3295009432C16790BEC28EC8CE119D0D1A18D61319";
545
+ const expected_gib_s10a = "81C655EDEC7294CC0900430ED8EE0125EFF15C2F86EAF047C0E8FEFE0D4569E8";
546
+
547
+ const ibHash_ts = (await hashToHexCopy(ibGib_s10a.ib!))?.toUpperCase() || '';
548
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s10a`).isGonnaBe(expected_ib_hash_s10a);
549
+
550
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s10a.data);
551
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
552
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
553
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s10a`).isGonnaBe(expected_data_hash_s10a);
554
+
555
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
556
+ // Manual final gib construction based on Python test logic: hash(ib_hash + "" + data_hash)
557
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
558
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
559
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s10a (from py test logic)`).isGonnaBe(expected_gib_s10a);
560
+
561
+ const calculatedGib_ts = (await sha256v1(ibGib_s10a, ""))?.toUpperCase();
562
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s10a (from sha256v1 call)`).isGonnaBe(expected_gib_s10a);
563
+ });
564
+
565
+ await ifWe(sir, `Edge Case 10b: ibgib with rel8ns but no data key`, async () => {
566
+ const ibGib_s10b: IbGib_V1 = { ib: 's10b', rel8ns: { r: ['a'] } };
567
+
568
+ const expected_ib_hash_s10b = "BF2FDA41B9B401E5F86577387D6C97FCA6AB3F7A4222735C42390B587AC8517D";
569
+ const expected_rel8ns_hash_s10b = "8A47C0659C530ACE4A79B55DE042782ABDFCC89848CDDB71260132B1FFE554AF";
570
+ const expected_gib_s10b = "F35416C53D3683B60C2EE46DD1542A2A1D957F70D991D8DDEDC8C03715ED0DEA";
571
+
572
+ const ibHash_ts = (await hashToHexCopy(ibGib_s10b.ib!))?.toUpperCase() || '';
573
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s10b`).isGonnaBe(expected_ib_hash_s10b);
574
+
575
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s10b.rel8ns);
576
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
577
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
578
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s10b`).isGonnaBe(expected_rel8ns_hash_s10b);
579
+
580
+ const actualDataHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
581
+ // Manual final gib construction based on Python test logic: hash(ib_hash + rel8ns_hash + "")
582
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
583
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
584
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s10b (from py test logic)`).isGonnaBe(expected_gib_s10b);
585
+
586
+ const calculatedGib_ts = (await sha256v1(ibGib_s10b, ""))?.toUpperCase();
587
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s10b (from sha256v1 call)`).isGonnaBe(expected_gib_s10b);
588
+ });
589
+
590
+ });
591
+
592
+ await respecfully(sir, `Python Edge Case Tests for sha256v1`, async () => {
593
+
594
+ const EMPTY_HASH_FOR_ABSENT_FIELD = "";
595
+
596
+ await ifWe(sir, `Edge Case 1: data with mixed undefined and empty string values`, async () => {
597
+ const ibGib_s1: IbGib_V1 = {
598
+ ib: 's1',
599
+ data: { a: undefined, b: '', c: 'val', d: { d1: undefined, d2: 'd2val' } }
600
+ };
601
+
602
+ const expected_ib_hash_s1 = "E8BC163C82EEE18733288C7D4AC636DB3A6DEB013EF2D37B68322BE20EDC45CC";
603
+ const expected_data_hash_s1 = "3310C5015C3426C4EC62CF5F5F3EC5D83F86C26E54C5AC3BD05C1B574B46ADE2";
604
+ const expected_gib_s1 = "9B9D08F270C5249FD1DC2E0453010EBD544C7781FF5CDAFADD7679C2C7DA7247";
605
+
606
+ const ibHash_ts = (await hashToHexCopy(ibGib_s1.ib!))?.toUpperCase() || '';
607
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s1`).isGonnaBe(expected_ib_hash_s1);
608
+
609
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s1.data);
610
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
611
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
612
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s1`).isGonnaBe(expected_data_hash_s1);
613
+
614
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
615
+ // Manual final gib construction based on Python test logic: hash(ib_hash + "" + data_hash)
616
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
617
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
618
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s1 (from py test logic)`).isGonnaBe(expected_gib_s1);
619
+
620
+ const calculatedGib_ts = (await sha256v1(ibGib_s1, ""))?.toUpperCase();
621
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s1 (from sha256v1 call)`).isGonnaBe(expected_gib_s1);
622
+ });
623
+
624
+ await ifWe(sir, `Edge Case 2: rel8ns with a relation mapping to a list containing null`, async () => {
625
+ const ibGib_s2: IbGib_V1 = {
626
+ ib: 's2',
627
+ rel8ns: { next: ['addr1', null as any, 'addr2'], prev: undefined }
628
+ };
629
+
630
+ const expected_ib_hash_s2 = "AD328846AA18B32A335816374511CAC1063C704B8C57999E51DA9F908290A7A4";
631
+ const expected_rel8ns_hash_s2 = "32945B4CE582D29827CA925DCA3155CA397C132F0DB1DB5DFF9AD46A8EFD98FE";
632
+ const expected_gib_s2 = "8DD27B4AFBE3AD7D59768CB4D1A574DC2FEA19546E922101FED6F6ECA9B97C61";
633
+
634
+ const ibHash_ts = (await hashToHexCopy(ibGib_s2.ib!))?.toUpperCase() || '';
635
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s2`).isGonnaBe(expected_ib_hash_s2);
636
+
637
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s2.rel8ns);
638
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
639
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
640
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s2`).isGonnaBe(expected_rel8ns_hash_s2);
641
+
642
+ const actualDataHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
643
+ // Manual final gib construction based on Python test logic: hash(ib_hash + rel8ns_hash + "")
644
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
645
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
646
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s2 (from py test logic)`).isGonnaBe(expected_gib_s2);
647
+
648
+ const calculatedGib_ts = (await sha256v1(ibGib_s2, ""))?.toUpperCase();
649
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s2 (from sha256v1 call)`).isGonnaBe(expected_gib_s2);
650
+ });
651
+
652
+ // skipping because this is not a valid ibgib and I'm trying to understand
653
+ // how to work with Jules (Google's GitHub agent)
654
+ // await ifWe(sir, `Edge Case 3: data is an empty list []`, async () => {
655
+ // // skipped because this is not a valid ibgib
656
+ // const ibGib_s3: IbGib_V1 = { ib: 's3', data: [] };
657
+
658
+ // const expected_ib_hash_s3 = "41242B9FAE56FAD4E6E77DFE33CB18D1C3FC583F988CF25EF9F2D9BE0D440BBB";
659
+ // const expected_data_hash_s3 = "4F53CDA18C2BAA0C0354BB5F9A3ECBE5ED12AB4D8E11BA873C2F11161202B945";
660
+ // const expected_gib_s3 = "BA109F5B0C09CF0A27EF976F876EE8F336DC954EF6443F324F19D78020E3E59A";
661
+
662
+ // const ibHash_ts = (await hashToHexCopy(ibGib_s3.ib!))?.toUpperCase() || '';
663
+ // iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s3`).isGonnaBe(expected_ib_hash_s3);
664
+
665
+ // const normalizedData_ts = toNormalizedForHashing(ibGib_s3.data);
666
+ // const stringifiedData_ts = JSON.stringify(normalizedData_ts);
667
+ // const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
668
+ // iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s3`).isGonnaBe(expected_data_hash_s3);
669
+
670
+ // const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
671
+ // const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
672
+ // const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
673
+ // iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s3 (from py test logic)`).isGonnaBe(expected_gib_s3);
674
+
675
+ // const calculatedGib_ts = (await sha256v1(ibGib_s3, ""))?.toUpperCase();
676
+ // iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s3 (from sha256v1 call)`).isGonnaBe(expected_gib_s3);
677
+ // });
678
+
679
+ // skipping because this is not a valid ibgib and I'm trying to understand
680
+ // how to work with Jules (Google's GitHub agent)
681
+ // await ifWe(sir, `Edge Case 4: data contains a list with dictionaries, where inner dicts have null values`, async () => {
682
+ // const ibGib_s4: IbGib_V1 = {
683
+ // ib: 's4',
684
+ // data: { items: [{ id: 1, val: null, name: 'item1' }, { id: 2, val: 'present' }] }
685
+ // };
686
+
687
+ // const expected_ib_hash_s4 = "5B840157E7E86AEF3B3FD0FC24F3ADD34D3E7F210370D429475ED1BCD3E7FCA2";
688
+ // const expected_data_hash_s4 = "2682A15F60291F933B57EE14F0A3D5FD233FC90B3FF1ADD5FD473F859FA6B287";
689
+ // const expected_gib_s4 = "2AE26C6F9A4D53CE32A0A1792E59F34126A25503CE33728EA7CB8A38E29DD0BF";
690
+
691
+ // const ibHash_ts = (await hashToHexCopy(ibGib_s4.ib!))?.toUpperCase() || '';
692
+ // iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s4`).isGonnaBe(expected_ib_hash_s4);
693
+
694
+ // const normalizedData_ts = toNormalizedForHashing(ibGib_s4.data);
695
+ // const stringifiedData_ts = JSON.stringify(normalizedData_ts);
696
+ // const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
697
+ // iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s4`).isGonnaBe(expected_data_hash_s4);
698
+
699
+ // const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
700
+ // const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
701
+ // const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
702
+ // iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s4 (from py test logic)`).isGonnaBe(expected_gib_s4);
703
+
704
+ // const calculatedGib_ts = (await sha256v1(ibGib_s4, ""))?.toUpperCase();
705
+ // iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s4 (from sha256v1 call)`).isGonnaBe(expected_gib_s4);
706
+ // });
707
+
708
+ await ifWe(sir, `Edge Case 5: data key order vs. rel8ns key order`, async () => {
709
+ const ibGib_s5: IbGib_V1 = {
710
+ ib: 's5',
711
+ data: { z: 1, a: 2 },
712
+ rel8ns: { z_rel: ['z1'], a_rel: ['a1'] }
713
+ };
714
+
715
+ const expected_ib_hash_s5 = "3B96FC064FA874A80A132BDA60BEBF54EFBC780A358FDCAE4FBBD7E12B66B630";
716
+ const expected_data_hash_s5 = "C2985C5BA6F7D2A55E768F92490CA09388E95BC4CCCB9FDF11B15F4D42F93E73";
717
+ const expected_rel8ns_hash_s5 = "3C0705B51593C740738A0BFB4D9030C8A8093D8A6049346E823CD033BAAA09E5";
718
+ const expected_gib_s5 = "7AC6FB16BC853C6AE7D375ECEEA810ABB6F60241A1679ADEE4DC6ED4E29BE74A";
719
+
720
+ const ibHash_ts = (await hashToHexCopy(ibGib_s5.ib!))?.toUpperCase() || '';
721
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s5`).isGonnaBe(expected_ib_hash_s5);
722
+
723
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s5.data);
724
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
725
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
726
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s5`).isGonnaBe(expected_data_hash_s5);
727
+
728
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s5.rel8ns);
729
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
730
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
731
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s5`).isGonnaBe(expected_rel8ns_hash_s5);
732
+
733
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
734
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
735
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s5 (from py test logic)`).isGonnaBe(expected_gib_s5);
736
+
737
+ const calculatedGib_ts = (await sha256v1(ibGib_s5, ""))?.toUpperCase();
738
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s5 (from sha256v1 call)`).isGonnaBe(expected_gib_s5);
739
+ });
740
+
741
+ // skipping because this is not a valid ibgib and I'm trying to understand
742
+ // how to work with Jules (Google's GitHub agent)
743
+ // await ifWe(sir, `Edge Case 6: data with special characters in string values and keys`, async () => {
744
+ // const ibGib_s6: IbGib_V1 = {
745
+ // ib: 's6',
746
+ // data: { 'key "1"': 'value with "quotes" and \n newline', 'key_ñ': 'val_ü' }
747
+ // };
748
+
749
+ // const expected_ib_hash_s6 = "71E7690959239CA065841EBA3EBB281072BAA78BA0BB31079B9ACB4A009A9FE3";
750
+ // const expected_data_hash_s6 = "441200D475E6171CD94518A7AD358C29281DBD962163EE7F1B309058098CECE7";
751
+ // const expected_gib_s6 = "9AF9BE9284CFCE565CBFD482EA0797E0D67CCD0AEDF6509BCEA3B9D4D00931BF";
752
+
753
+ // const ibHash_ts = (await hashToHexCopy(ibGib_s6.ib!))?.toUpperCase() || '';
754
+ // iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s6`).isGonnaBe(expected_ib_hash_s6);
755
+
756
+ // const normalizedData_ts = toNormalizedForHashing(ibGib_s6.data);
757
+ // const stringifiedData_ts = JSON.stringify(normalizedData_ts);
758
+ // const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
759
+ // iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s6`).isGonnaBe(expected_data_hash_s6);
760
+
761
+ // const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
762
+ // const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
763
+ // const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
764
+ // iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s6 (from py test logic)`).isGonnaBe(expected_gib_s6);
765
+
766
+ // const calculatedGib_ts = (await sha256v1(ibGib_s6, ""))?.toUpperCase();
767
+ // iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s6 (from sha256v1 call)`).isGonnaBe(expected_gib_s6);
768
+ // });
769
+
770
+ await ifWe(sir, `Edge Case 7a: data is a primitive type (boolean True)`, async () => {
771
+ const ibGib_s7a: IbGib_V1 = { ib: 's7a', data: true as any };
772
+
773
+ const expected_ib_hash_s7a = "612A9EB864ED62C258BDCB155F13F590879BA34AD30DDE91CB9BE38139439E9F";
774
+ const expected_data_hash_s7a = "B5BEA41B6C623F7C09F1BF24DCAE58EBAB3C0CDD90AD966BC43A45B44867E12B";
775
+ const expected_gib_s7a = "53BBABB9F24C75E3C6037D744C241AF710B6E886C22398537AA9332D5626D022";
776
+
777
+ const ibHash_ts = (await hashToHexCopy(ibGib_s7a.ib!))?.toUpperCase() || '';
778
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s7a`).isGonnaBe(expected_ib_hash_s7a);
779
+
780
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s7a.data);
781
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
782
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
783
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s7a`).isGonnaBe(expected_data_hash_s7a);
784
+
785
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
786
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
787
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
788
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s7a (from py test logic)`).isGonnaBe(expected_gib_s7a);
789
+
790
+ const calculatedGib_ts = (await sha256v1(ibGib_s7a, ""))?.toUpperCase();
791
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s7a (from sha256v1 call)`).isGonnaBe(expected_gib_s7a);
792
+ });
793
+
794
+ await ifWe(sir, `Edge Case 7b: data is a primitive type (number)`, async () => {
795
+ const ibGib_s7b: IbGib_V1 = { ib: 's7b', data: 123.45 as any };
796
+
797
+ const expected_ib_hash_s7b = "70348C184BB7E09344EEEE0BA0A766D1DB6C1B1E02520A6534C94F78591EBA46";
798
+ const expected_data_hash_s7b = "4EBC4A141B378980461430980948A55988FBF56F85D084AC33D8A8F61B9FAB88";
799
+ const expected_gib_s7b = "F81D2861750A638FBE6F792D66A8EE2408C5F5CB965755166957C46B1B242F41";
800
+
801
+ const ibHash_ts = (await hashToHexCopy(ibGib_s7b.ib!))?.toUpperCase() || '';
802
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s7b`).isGonnaBe(expected_ib_hash_s7b);
803
+
804
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s7b.data);
805
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
806
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
807
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s7b`).isGonnaBe(expected_data_hash_s7b);
808
+
809
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
810
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
811
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
812
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s7b (from py test logic)`).isGonnaBe(expected_gib_s7b);
813
+
814
+ const calculatedGib_ts = (await sha256v1(ibGib_s7b, ""))?.toUpperCase();
815
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s7b (from sha256v1 call)`).isGonnaBe(expected_gib_s7b);
816
+ });
817
+
818
+ await ifWe(sir, `Edge Case 8: rel8ns with some relations being empty lists, others non-empty`, async () => {
819
+ const ibGib_s8: IbGib_V1 = {
820
+ ib: 's8',
821
+ rel8ns: { past: [], future: ['addr1'], empty_too: [] }
822
+ };
823
+
824
+ const expected_ib_hash_s8 = "1CB7637B6957AC5D6F6CDEC745554AFD3CD1537BB6E7A8E74D41C2EA58B89E97";
825
+ const expected_rel8ns_hash_s8 = "A98E517BB1289561B164706289F2CCE1423EA9ABCA11FC35BFFD4E0817224760";
826
+ const expected_gib_s8 = "EE653CEE56759A6C868A485582E4E66C8B57DFBE1C55CF36BDBF237BF5C09CF8";
827
+
828
+ const ibHash_ts = (await hashToHexCopy(ibGib_s8.ib!))?.toUpperCase() || '';
829
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s8`).isGonnaBe(expected_ib_hash_s8);
830
+
831
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s8.rel8ns);
832
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
833
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
834
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s8`).isGonnaBe(expected_rel8ns_hash_s8);
835
+
836
+ const actualDataHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
837
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
838
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
839
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s8 (from py test logic)`).isGonnaBe(expected_gib_s8);
840
+
841
+ const calculatedGib_ts = (await sha256v1(ibGib_s8, ""))?.toUpperCase();
842
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s8 (from sha256v1 call)`).isGonnaBe(expected_gib_s8);
843
+ });
844
+
845
+ await ifWe(sir, `Edge Case 9: Deeply nested data with mixed undefined/null, lists, and dicts`, async () => {
846
+ const ibGib_s9: IbGib_V1 = {
847
+ ib: 's9',
848
+ data: { level1: { l2_val: 'v2', l2_none: undefined, l2_list: [1, { l3_none: null, l3_val: 'v3' }, 3] } }
849
+ };
850
+
851
+ const expected_ib_hash_s9 = "E72D310DBB213F4C2E34DA28935B38905332EE3628A04DF2DD13859FD769C6C5";
852
+ const expected_data_hash_s9 = "F8C3EF9BFBB9D927B55B3BA1FAAECAD1B35FA9B912AEAF9B75A807DA814CB975";
853
+ const expected_gib_s9 = "DB2F3306E2E91F22B0C7B10787760D0FE25BA79B7E3DFFE38164381EA06BE6A6";
854
+
855
+ const ibHash_ts = (await hashToHexCopy(ibGib_s9.ib!))?.toUpperCase() || '';
856
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s9`).isGonnaBe(expected_ib_hash_s9);
857
+
858
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s9.data);
859
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
860
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
861
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s9`).isGonnaBe(expected_data_hash_s9);
862
+
863
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
864
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
865
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
866
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s9 (from py test logic)`).isGonnaBe(expected_gib_s9);
867
+
868
+ const calculatedGib_ts = (await sha256v1(ibGib_s9, ""))?.toUpperCase();
869
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s9 (from sha256v1 call)`).isGonnaBe(expected_gib_s9);
870
+ });
871
+
872
+ await ifWe(sir, `Edge Case 10a: ibgib with data but no rel8ns key`, async () => {
873
+ const ibGib_s10a: IbGib_V1 = { ib: 's10a', data: { k: 'v' } };
874
+
875
+ const expected_ib_hash_s10a = "7674836E2F8926A8F0BE7998ABB44BACBC041BC51AF761F85E09A1349C60046C";
876
+ const expected_data_hash_s10a = "666C1AA02E8068C6D5CC1D3295009432C16790BEC28EC8CE119D0D1A18D61319";
877
+ const expected_gib_s10a = "81C655EDEC7294CC0900430ED8EE0125EFF15C2F86EAF047C0E8FEFE0D4569E8";
878
+
879
+ const ibHash_ts = (await hashToHexCopy(ibGib_s10a.ib!))?.toUpperCase() || '';
880
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s10a`).isGonnaBe(expected_ib_hash_s10a);
881
+
882
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s10a.data);
883
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
884
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
885
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s10a`).isGonnaBe(expected_data_hash_s10a);
886
+
887
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
888
+ // Manual final gib construction based on Python test logic: hash(ib_hash + "" + data_hash)
889
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
890
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
891
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s10a (from py test logic)`).isGonnaBe(expected_gib_s10a);
892
+
893
+ const calculatedGib_ts = (await sha256v1(ibGib_s10a, ""))?.toUpperCase();
894
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s10a (from sha256v1 call)`).isGonnaBe(expected_gib_s10a);
895
+ });
896
+
897
+ await ifWe(sir, `Edge Case 10b: ibgib with rel8ns but no data key`, async () => {
898
+ const ibGib_s10b: IbGib_V1 = { ib: 's10b', rel8ns: { r: ['a'] } };
899
+
900
+ const expected_ib_hash_s10b = "BF2FDA41B9B401E5F86577387D6C97FCA6AB3F7A4222735C42390B587AC8517D";
901
+ const expected_rel8ns_hash_s10b = "8A47C0659C530ACE4A79B55DE042782ABDFCC89848CDDB71260132B1FFE554AF";
902
+ const expected_gib_s10b = "F35416C53D3683B60C2EE46DD1542A2A1D957F70D991D8DDEDC8C03715ED0DEA";
903
+
904
+ const ibHash_ts = (await hashToHexCopy(ibGib_s10b.ib!))?.toUpperCase() || '';
905
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s10b`).isGonnaBe(expected_ib_hash_s10b);
906
+
907
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s10b.rel8ns);
908
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
909
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
910
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s10b`).isGonnaBe(expected_rel8ns_hash_s10b);
911
+
912
+ const actualDataHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
913
+ // Manual final gib construction based on Python test logic: hash(ib_hash + rel8ns_hash + "")
914
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
915
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
916
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s10b (from py test logic)`).isGonnaBe(expected_gib_s10b);
917
+
918
+ const calculatedGib_ts = (await sha256v1(ibGib_s10b, ""))?.toUpperCase();
919
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s10b (from sha256v1 call)`).isGonnaBe(expected_gib_s10b);
920
+ });
921
+
922
+ });
923
+
924
+ await respecfully(sir, `Python Edge Case Tests for sha256v1`, async () => {
925
+
926
+ const EMPTY_HASH_FOR_ABSENT_FIELD = ""; // Equivalent to Python's "" for non-existent data/rel8ns hashes
927
+
928
+ await ifWe(sir, `Edge Case 1: data with mixed undefined and empty string values`, async () => {
929
+ const ibGib_s1: IbGib_V1 = {
930
+ ib: 's1',
931
+ data: { a: undefined, b: '', c: 'val', d: { d1: undefined, d2: 'd2val' } }
932
+ };
933
+
934
+ const expected_ib_hash_s1 = "E8BC163C82EEE18733288C7D4AC636DB3A6DEB013EF2D37B68322BE20EDC45CC";
935
+ const expected_data_hash_s1 = "3310C5015C3426C4EC62CF5F5F3EC5D83F86C26E54C5AC3BD05C1B574B46ADE2";
936
+ const expected_gib_s1 = "9B9D08F270C5249FD1DC2E0453010EBD544C7781FF5CDAFADD7679C2C7DA7247";
937
+
938
+ const ibHash_ts = (await hashToHexCopy(ibGib_s1.ib!))?.toUpperCase() || '';
939
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s1`).isGonnaBe(expected_ib_hash_s1);
940
+
941
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s1.data);
942
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
943
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
944
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s1`).isGonnaBe(expected_data_hash_s1);
945
+
946
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
947
+ // Manual final gib construction based on Python test logic: hash(ib_hash + "" + data_hash)
948
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
949
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
950
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s1 (from py test logic)`).isGonnaBe(expected_gib_s1);
951
+
952
+ const calculatedGib_ts = (await sha256v1(ibGib_s1, ""))?.toUpperCase();
953
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s1 (from sha256v1 call)`).isGonnaBe(expected_gib_s1);
954
+ });
955
+
956
+ await ifWe(sir, `Edge Case 2: rel8ns with a relation mapping to a list containing null`, async () => {
957
+ const ibGib_s2: IbGib_V1 = {
958
+ ib: 's2',
959
+ rel8ns: { next: ['addr1', null as any, 'addr2'], prev: undefined }
960
+ };
961
+
962
+ const expected_ib_hash_s2 = "AD328846AA18B32A335816374511CAC1063C704B8C57999E51DA9F908290A7A4";
963
+ const expected_rel8ns_hash_s2 = "32945B4CE582D29827CA925DCA3155CA397C132F0DB1DB5DFF9AD46A8EFD98FE";
964
+ const expected_gib_s2 = "8DD27B4AFBE3AD7D59768CB4D1A574DC2FEA19546E922101FED6F6ECA9B97C61";
965
+
966
+ const ibHash_ts = (await hashToHexCopy(ibGib_s2.ib!))?.toUpperCase() || '';
967
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s2`).isGonnaBe(expected_ib_hash_s2);
968
+
969
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s2.rel8ns);
970
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
971
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
972
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s2`).isGonnaBe(expected_rel8ns_hash_s2);
973
+
974
+ const actualDataHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
975
+ // Manual final gib construction based on Python test logic: hash(ib_hash + rel8ns_hash + "")
976
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
977
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
978
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s2 (from py test logic)`).isGonnaBe(expected_gib_s2);
979
+
980
+ const calculatedGib_ts = (await sha256v1(ibGib_s2, ""))?.toUpperCase();
981
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s2 (from sha256v1 call)`).isGonnaBe(expected_gib_s2);
982
+ });
983
+
984
+ // skipping because this is not a valid ibgib and I'm trying to understand
985
+ // how to work with Jules (Google's GitHub agent)
986
+ // await ifWe(sir, `Edge Case 3: data is an empty list []`, async () => {
987
+ // const ibGib_s3: IbGib_V1 = { ib: 's3', data: [] };
988
+
989
+ // const expected_ib_hash_s3 = "41242B9FAE56FAD4E6E77DFE33CB18D1C3FC583F988CF25EF9F2D9BE0D440BBB";
990
+ // const expected_data_hash_s3 = "4F53CDA18C2BAA0C0354BB5F9A3ECBE5ED12AB4D8E11BA873C2F11161202B945";
991
+ // const expected_gib_s3 = "BA109F5B0C09CF0A27EF976F876EE8F336DC954EF6443F324F19D78020E3E59A";
992
+
993
+ // const ibHash_ts = (await hashToHexCopy(ibGib_s3.ib!))?.toUpperCase() || '';
994
+ // iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s3`).isGonnaBe(expected_ib_hash_s3);
995
+
996
+ // const normalizedData_ts = toNormalizedForHashing(ibGib_s3.data);
997
+ // const stringifiedData_ts = JSON.stringify(normalizedData_ts);
998
+ // const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
999
+ // iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s3`).isGonnaBe(expected_data_hash_s3);
1000
+
1001
+ // const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
1002
+ // const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
1003
+ // const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
1004
+ // iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s3 (from py test logic)`).isGonnaBe(expected_gib_s3);
1005
+
1006
+ // const calculatedGib_ts = (await sha256v1(ibGib_s3, ""))?.toUpperCase();
1007
+ // iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s3 (from sha256v1 call)`).isGonnaBe(expected_gib_s3);
1008
+ // });
1009
+
1010
+ // skipping because this is not a valid ibgib and I'm trying to understand
1011
+ // how to work with Jules (Google's GitHub agent)
1012
+ // await ifWe(sir, `Edge Case 4: data contains a list with dictionaries, where inner dicts have null values`, async () => {
1013
+ // const ibGib_s4: IbGib_V1 = {
1014
+ // ib: 's4',
1015
+ // data: { items: [{ id: 1, val: null, name: 'item1' }, { id: 2, val: 'present' }] }
1016
+ // };
1017
+
1018
+ // const expected_ib_hash_s4 = "5B840157E7E86AEF3B3FD0FC24F3ADD34D3E7F210370D429475ED1BCD3E7FCA2";
1019
+ // const expected_data_hash_s4 = "2682A15F60291F933B57EE14F0A3D5FD233FC90B3FF1ADD5FD473F859FA6B287";
1020
+ // const expected_gib_s4 = "2AE26C6F9A4D53CE32A0A1792E59F34126A25503CE33728EA7CB8A38E29DD0BF";
1021
+
1022
+ // const ibHash_ts = (await hashToHexCopy(ibGib_s4.ib!))?.toUpperCase() || '';
1023
+ // iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s4`).isGonnaBe(expected_ib_hash_s4);
1024
+
1025
+ // const normalizedData_ts = toNormalizedForHashing(ibGib_s4.data);
1026
+ // const stringifiedData_ts = JSON.stringify(normalizedData_ts);
1027
+ // const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
1028
+ // iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s4`).isGonnaBe(expected_data_hash_s4);
1029
+
1030
+ // const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
1031
+ // const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
1032
+ // const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
1033
+ // iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s4 (from py test logic)`).isGonnaBe(expected_gib_s4);
1034
+
1035
+ // const calculatedGib_ts = (await sha256v1(ibGib_s4, ""))?.toUpperCase();
1036
+ // iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s4 (from sha256v1 call)`).isGonnaBe(expected_gib_s4);
1037
+ // });
1038
+
1039
+ await ifWe(sir, `Edge Case 5: data key order vs. rel8ns key order`, async () => {
1040
+ const ibGib_s5: IbGib_V1 = {
1041
+ ib: 's5',
1042
+ data: { z: 1, a: 2 },
1043
+ rel8ns: { z_rel: ['z1'], a_rel: ['a1'] }
1044
+ };
1045
+
1046
+ const expected_ib_hash_s5 = "3B96FC064FA874A80A132BDA60BEBF54EFBC780A358FDCAE4FBBD7E12B66B630";
1047
+ const expected_data_hash_s5 = "C2985C5BA6F7D2A55E768F92490CA09388E95BC4CCCB9FDF11B15F4D42F93E73";
1048
+ const expected_rel8ns_hash_s5 = "3C0705B51593C740738A0BFB4D9030C8A8093D8A6049346E823CD033BAAA09E5";
1049
+ const expected_gib_s5 = "7AC6FB16BC853C6AE7D375ECEEA810ABB6F60241A1679ADEE4DC6ED4E29BE74A";
1050
+
1051
+ const ibHash_ts = (await hashToHexCopy(ibGib_s5.ib!))?.toUpperCase() || '';
1052
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s5`).isGonnaBe(expected_ib_hash_s5);
1053
+
1054
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s5.data);
1055
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
1056
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
1057
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s5`).isGonnaBe(expected_data_hash_s5);
1058
+
1059
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s5.rel8ns);
1060
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
1061
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
1062
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s5`).isGonnaBe(expected_rel8ns_hash_s5);
1063
+
1064
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
1065
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
1066
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s5 (from py test logic)`).isGonnaBe(expected_gib_s5);
1067
+
1068
+ const calculatedGib_ts = (await sha256v1(ibGib_s5, ""))?.toUpperCase();
1069
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s5 (from sha256v1 call)`).isGonnaBe(expected_gib_s5);
1070
+ });
1071
+
1072
+ // skipping because this is not a valid ibgib and I'm trying to understand
1073
+ // how to work with Jules (Google's GitHub agent)
1074
+ // await ifWe(sir, `Edge Case 6: data with special characters in string values and keys`, async () => {
1075
+ // const ibGib_s6: IbGib_V1 = {
1076
+ // ib: 's6',
1077
+ // data: { 'key "1"': 'value with "quotes" and \n newline', 'key_ñ': 'val_ü' }
1078
+ // };
1079
+
1080
+ // const expected_ib_hash_s6 = "71E7690959239CA065841EBA3EBB281072BAA78BA0BB31079B9ACB4A009A9FE3";
1081
+ // const expected_data_hash_s6 = "441200D475E6171CD94518A7AD358C29281DBD962163EE7F1B309058098CECE7";
1082
+ // const expected_gib_s6 = "9AF9BE9284CFCE565CBFD482EA0797E0D67CCD0AEDF6509BCEA3B9D4D00931BF";
1083
+
1084
+ // const ibHash_ts = (await hashToHexCopy(ibGib_s6.ib!))?.toUpperCase() || '';
1085
+ // iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s6`).isGonnaBe(expected_ib_hash_s6);
1086
+
1087
+ // const normalizedData_ts = toNormalizedForHashing(ibGib_s6.data);
1088
+ // const stringifiedData_ts = JSON.stringify(normalizedData_ts);
1089
+ // const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
1090
+ // iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s6`).isGonnaBe(expected_data_hash_s6);
1091
+
1092
+ // const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
1093
+ // const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
1094
+ // const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
1095
+ // iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s6 (from py test logic)`).isGonnaBe(expected_gib_s6);
1096
+
1097
+ // const calculatedGib_ts = (await sha256v1(ibGib_s6, ""))?.toUpperCase();
1098
+ // iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s6 (from sha256v1 call)`).isGonnaBe(expected_gib_s6);
1099
+ // });
1100
+
1101
+ await ifWe(sir, `Edge Case 7a: data is a primitive type (boolean True)`, async () => {
1102
+ const ibGib_s7a: IbGib_V1 = { ib: 's7a', data: true as any };
1103
+
1104
+ const expected_ib_hash_s7a = "612A9EB864ED62C258BDCB155F13F590879BA34AD30DDE91CB9BE38139439E9F";
1105
+ const expected_data_hash_s7a = "B5BEA41B6C623F7C09F1BF24DCAE58EBAB3C0CDD90AD966BC43A45B44867E12B";
1106
+ const expected_gib_s7a = "53BBABB9F24C75E3C6037D744C241AF710B6E886C22398537AA9332D5626D022";
1107
+
1108
+ const ibHash_ts = (await hashToHexCopy(ibGib_s7a.ib!))?.toUpperCase() || '';
1109
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s7a`).isGonnaBe(expected_ib_hash_s7a);
1110
+
1111
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s7a.data);
1112
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
1113
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
1114
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s7a`).isGonnaBe(expected_data_hash_s7a);
1115
+
1116
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
1117
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
1118
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
1119
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s7a (from py test logic)`).isGonnaBe(expected_gib_s7a);
1120
+
1121
+ const calculatedGib_ts = (await sha256v1(ibGib_s7a, ""))?.toUpperCase();
1122
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s7a (from sha256v1 call)`).isGonnaBe(expected_gib_s7a);
1123
+ });
1124
+
1125
+ await ifWe(sir, `Edge Case 7b: data is a primitive type (number)`, async () => {
1126
+ const ibGib_s7b: IbGib_V1 = { ib: 's7b', data: 123.45 as any };
1127
+
1128
+ const expected_ib_hash_s7b = "70348C184BB7E09344EEEE0BA0A766D1DB6C1B1E02520A6534C94F78591EBA46";
1129
+ const expected_data_hash_s7b = "4EBC4A141B378980461430980948A55988FBF56F85D084AC33D8A8F61B9FAB88";
1130
+ const expected_gib_s7b = "F81D2861750A638FBE6F792D66A8EE2408C5F5CB965755166957C46B1B242F41";
1131
+
1132
+ const ibHash_ts = (await hashToHexCopy(ibGib_s7b.ib!))?.toUpperCase() || '';
1133
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s7b`).isGonnaBe(expected_ib_hash_s7b);
1134
+
1135
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s7b.data);
1136
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
1137
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
1138
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s7b`).isGonnaBe(expected_data_hash_s7b);
1139
+
1140
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
1141
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
1142
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
1143
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s7b (from py test logic)`).isGonnaBe(expected_gib_s7b);
1144
+
1145
+ const calculatedGib_ts = (await sha256v1(ibGib_s7b, ""))?.toUpperCase();
1146
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s7b (from sha256v1 call)`).isGonnaBe(expected_gib_s7b);
1147
+ });
1148
+
1149
+ await ifWe(sir, `Edge Case 8: rel8ns with some relations being empty lists, others non-empty`, async () => {
1150
+ const ibGib_s8: IbGib_V1 = {
1151
+ ib: 's8',
1152
+ rel8ns: { past: [], future: ['addr1'], empty_too: [] }
1153
+ };
1154
+
1155
+ const expected_ib_hash_s8 = "1CB7637B6957AC5D6F6CDEC745554AFD3CD1537BB6E7A8E74D41C2EA58B89E97";
1156
+ const expected_rel8ns_hash_s8 = "A98E517BB1289561B164706289F2CCE1423EA9ABCA11FC35BFFD4E0817224760";
1157
+ const expected_gib_s8 = "EE653CEE56759A6C868A485582E4E66C8B57DFBE1C55CF36BDBF237BF5C09CF8";
1158
+
1159
+ const ibHash_ts = (await hashToHexCopy(ibGib_s8.ib!))?.toUpperCase() || '';
1160
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s8`).isGonnaBe(expected_ib_hash_s8);
1161
+
1162
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s8.rel8ns);
1163
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
1164
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
1165
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s8`).isGonnaBe(expected_rel8ns_hash_s8);
1166
+
1167
+ const actualDataHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
1168
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
1169
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
1170
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s8 (from py test logic)`).isGonnaBe(expected_gib_s8);
1171
+
1172
+ const calculatedGib_ts = (await sha256v1(ibGib_s8, ""))?.toUpperCase();
1173
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s8 (from sha256v1 call)`).isGonnaBe(expected_gib_s8);
1174
+ });
1175
+
1176
+ await ifWe(sir, `Edge Case 9: Deeply nested data with mixed undefined/null, lists, and dicts`, async () => {
1177
+ const ibGib_s9: IbGib_V1 = {
1178
+ ib: 's9',
1179
+ data: { level1: { l2_val: 'v2', l2_none: undefined, l2_list: [1, { l3_none: null, l3_val: 'v3' }, 3] } }
1180
+ };
1181
+
1182
+ const expected_ib_hash_s9 = "E72D310DBB213F4C2E34DA28935B38905332EE3628A04DF2DD13859FD769C6C5";
1183
+ const expected_data_hash_s9 = "F8C3EF9BFBB9D927B55B3BA1FAAECAD1B35FA9B912AEAF9B75A807DA814CB975";
1184
+ const expected_gib_s9 = "DB2F3306E2E91F22B0C7B10787760D0FE25BA79B7E3DFFE38164381EA06BE6A6";
1185
+
1186
+ const ibHash_ts = (await hashToHexCopy(ibGib_s9.ib!))?.toUpperCase() || '';
1187
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s9`).isGonnaBe(expected_ib_hash_s9);
1188
+
1189
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s9.data);
1190
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
1191
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
1192
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s9`).isGonnaBe(expected_data_hash_s9);
1193
+
1194
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
1195
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
1196
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
1197
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s9 (from py test logic)`).isGonnaBe(expected_gib_s9);
1198
+
1199
+ const calculatedGib_ts = (await sha256v1(ibGib_s9, ""))?.toUpperCase();
1200
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s9 (from sha256v1 call)`).isGonnaBe(expected_gib_s9);
1201
+ });
1202
+
1203
+ await ifWe(sir, `Edge Case 10a: ibgib with data but no rel8ns key`, async () => {
1204
+ const ibGib_s10a: IbGib_V1 = { ib: 's10a', data: { k: 'v' } };
1205
+
1206
+ const expected_ib_hash_s10a = "7674836E2F8926A8F0BE7998ABB44BACBC041BC51AF761F85E09A1349C60046C";
1207
+ const expected_data_hash_s10a = "666C1AA02E8068C6D5CC1D3295009432C16790BEC28EC8CE119D0D1A18D61319";
1208
+ const expected_gib_s10a = "81C655EDEC7294CC0900430ED8EE0125EFF15C2F86EAF047C0E8FEFE0D4569E8";
1209
+
1210
+ const ibHash_ts = (await hashToHexCopy(ibGib_s10a.ib!))?.toUpperCase() || '';
1211
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s10a`).isGonnaBe(expected_ib_hash_s10a);
1212
+
1213
+ const normalizedData_ts = toNormalizedForHashing(ibGib_s10a.data);
1214
+ const stringifiedData_ts = JSON.stringify(normalizedData_ts);
1215
+ const actualDataHash_ts = (await hashToHexCopy(stringifiedData_ts))?.toUpperCase() || '';
1216
+ iReckon(sir, actualDataHash_ts).asTo(`actualDataHash_ts for s10a`).isGonnaBe(expected_data_hash_s10a);
1217
+
1218
+ const actualRel8nsHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
1219
+ // Manual final gib construction based on Python test logic: hash(ib_hash + "" + data_hash)
1220
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
1221
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
1222
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s10a (from py test logic)`).isGonnaBe(expected_gib_s10a);
1223
+
1224
+ const calculatedGib_ts = (await sha256v1(ibGib_s10a, ""))?.toUpperCase();
1225
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s10a (from sha256v1 call)`).isGonnaBe(expected_gib_s10a);
1226
+ });
1227
+
1228
+ await ifWe(sir, `Edge Case 10b: ibgib with rel8ns but no data key`, async () => {
1229
+ const ibGib_s10b: IbGib_V1 = { ib: 's10b', rel8ns: { r: ['a'] } };
1230
+
1231
+ const expected_ib_hash_s10b = "BF2FDA41B9B401E5F86577387D6C97FCA6AB3F7A4222735C42390B587AC8517D";
1232
+ const expected_rel8ns_hash_s10b = "8A47C0659C530ACE4A79B55DE042782ABDFCC89848CDDB71260132B1FFE554AF";
1233
+ const expected_gib_s10b = "F35416C53D3683B60C2EE46DD1542A2A1D957F70D991D8DDEDC8C03715ED0DEA";
1234
+
1235
+ const ibHash_ts = (await hashToHexCopy(ibGib_s10b.ib!))?.toUpperCase() || '';
1236
+ iReckon(sir, ibHash_ts).asTo(`ibHash_ts for s10b`).isGonnaBe(expected_ib_hash_s10b);
1237
+
1238
+ const normalizedRel8ns_ts = toNormalizedForHashing(ibGib_s10b.rel8ns);
1239
+ const stringifiedRel8ns_ts = JSON.stringify(normalizedRel8ns_ts);
1240
+ const actualRel8nsHash_ts = (await hashToHexCopy(stringifiedRel8ns_ts))?.toUpperCase() || '';
1241
+ iReckon(sir, actualRel8nsHash_ts).asTo(`actualRel8nsHash_ts for s10b`).isGonnaBe(expected_rel8ns_hash_s10b);
1242
+
1243
+ const actualDataHash_ts = EMPTY_HASH_FOR_ABSENT_FIELD;
1244
+ // Manual final gib construction based on Python test logic: hash(ib_hash + rel8ns_hash + "")
1245
+ const combinedSource_manual_ts = ibHash_ts + actualRel8nsHash_ts + actualDataHash_ts;
1246
+ const manualGib_ts = (await hashToHexCopy(combinedSource_manual_ts))?.toUpperCase() || '';
1247
+ iReckon(sir, manualGib_ts).asTo(`manualGib_ts for s10b (from py test logic)`).isGonnaBe(expected_gib_s10b);
1248
+
1249
+ const calculatedGib_ts = (await sha256v1(ibGib_s10b, ""))?.toUpperCase();
1250
+ iReckon(sir, calculatedGib_ts).asTo(`calculatedGib_ts for s10b (from sha256v1 call)`).isGonnaBe(expected_gib_s10b);
1251
+ });
1252
+
1253
+ });