@ibgib/ts-gib 0.5.23 → 0.5.24

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.5.24
2
+ * fixed `fork` bug that did not clear past when cloneRel8ns was set.
3
+
1
4
  ## 0.5.22/23
2
5
  * Tweaked `toNormalizedForHashing` to normalize arrays slightly differently.
3
6
  * Instead of returning the raw array, the fn now maps each member to its
@@ -1 +1 @@
1
- {"version":3,"file":"fork.d.mts","sourceRoot":"","sources":["../../../src/V1/transforms/fork.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAuC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAItE;;;;;;;;;;;GAWG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAoFjG"}
1
+ {"version":3,"file":"fork.d.mts","sourceRoot":"","sources":["../../../src/V1/transforms/fork.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAuC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAItE;;;;;;;;;;;GAWG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAqFjG"}
@@ -56,6 +56,7 @@ export async function fork(opts) {
56
56
  const rel8ns = cloneRel8ns && src.rel8ns && Object.keys(src.rel8ns).length > 0 ?
57
57
  clone(src.rel8ns) :
58
58
  {};
59
+ delete rel8ns.past;
59
60
  const data = cloneData && src?.data ? clone(src.data) : {};
60
61
  if (opts.nCounter) {
61
62
  data.n = 0;
@@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IACzC,IAAI,GAAG,EAAE;QACL,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,YAAY,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;QACtD,MAAM,CAAC,GAAG,GAAG,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5C,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;YACxB,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KACvD;IAED,QAAQ,CAAC,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAE5C,MAAM,MAAM,GAA8B,EAAE,QAAQ,EAAE,CAAC;IACvD,IAAI,YAAY,EAAE;QAAE,MAAM,CAAC,IAAI,GAAG,CAAC,YAAa,CAAC,CAAA;KAAE;IACnD,OAAO,MAAM,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibgib/ts-gib",
3
- "version": "0.5.23",
3
+ "version": "0.5.24",
4
4
  "description": "ibgib library with low-level graphing-related substrate functionality, e.g. creating raw ibgibs and transformations. node19+ needed for heavily-used webcrypto hashing isomorphically consumed in node and browsers (apps).",
5
5
  "repository": {
6
6
  "url": "https://gitlab.com/ibgib/ts-gib",
@@ -588,666 +588,3 @@ await respecfully(sir, `Python Edge Case Tests for sha256v1`, async () => {
588
588
  });
589
589
 
590
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
- });
@@ -57,6 +57,7 @@ export async function fork(opts: TransformOpts_Fork<IbGib_V1>): Promise<Transfor
57
57
  cloneRel8ns && src.rel8ns && Object.keys(src.rel8ns).length > 0 ?
58
58
  clone(src.rel8ns) :
59
59
  {};
60
+ delete rel8ns.past;
60
61
  const data: any = cloneData && src?.data ? clone(src!.data) : {};
61
62
  if (opts.nCounter) { data.n = 0; }
62
63
  const ancestor = linkedRel8ns?.includes(Rel8n.ancestor) ?
@@ -29,7 +29,7 @@ import { IbGib_V1, IbGibRel8ns_V1, Rel8n } from '../types.mjs';
29
29
  import { fork } from './fork.mjs';
30
30
  import { TransformOpts_Fork, IbGibAddr, Ib, TransformResult } from '../../types.mjs';
31
31
  import { getIbGibAddr, toNormalizedForHashing } from '../../helper.mjs';
32
- import { ROOT, } from '../constants.mjs';
32
+ import { GIB, ROOT, ROOT_ADDR, } from '../constants.mjs';
33
33
  import { mut8 } from './mut8.mjs';
34
34
  import { getGib } from './transform-helper.mjs';
35
35
 
@@ -54,6 +54,7 @@ await respecfully(sir, `when forking the root`, async () => {
54
54
  iReckon(sir, newIbGib.data!.timestamp).isGonnaBeUndefined();
55
55
  } else {
56
56
  // data being falsy is passing so no expect statement needed
57
+ iReckon(sir, true).isGonnaBeTrue();
57
58
  }
58
59
  });
59
60
 
@@ -229,6 +230,45 @@ await respecfully(sir, `when forking a regular ibgib`, async () => {
229
230
  iReckon(sir, newIbGib?.rel8ns!.ancestor![0]).isGonnaBe(srcAddr);
230
231
  });
231
232
 
233
+ await ifWe(sir, `cloneRel8ns but not past`, async () => {
234
+ // this is to enforce our line that deletes the past even when
235
+ // cloneRel8ns is true. I can't believe I didn't have this implemented
236
+ // earlier! hmm...
237
+ // here is the added line: `delete rel8ns.past;`
238
+ const testIb = 'fork_test yo';
239
+ const testGib = GIB;
240
+ const testData = { x: 1, y: 2, deeper: { zzz: 333 } };
241
+ const rel8dAddrs_past = ["0^gib", "1^gib", "2^gib"];
242
+ const rel8dAddrs_test = ["a^gib", "b^gib", "c^gib"];
243
+ const testRel8ns: IbGibRel8ns_V1 = {
244
+ ancestor: [ROOT_ADDR],
245
+ past: rel8dAddrs_past,
246
+ test: rel8dAddrs_test,
247
+ }
248
+ const testIbGibWithRel8ns: IbGib_V1 = {
249
+ ib: testIb,
250
+ gib: testGib,
251
+ rel8ns: testRel8ns,
252
+ data: testData,
253
+ };
254
+ const testIbGibAddr = getIbGibAddr({ ibGib: testIbGibWithRel8ns });
255
+ const { newIbGib } = await fork({
256
+ src: testIbGibWithRel8ns,
257
+ cloneData: true,
258
+ cloneRel8ns: true,
259
+ dna: true,
260
+ nCounter: true,
261
+ tjp: { timestamp: true, uuid: true },
262
+ });
263
+
264
+ const expectedRel8ns_ancestor = [ROOT_ADDR, testIbGibAddr];
265
+
266
+ iReckon(maam, newIbGib).isGonnaBeTruthy();
267
+ iReckon(maam, newIbGib!.rel8ns).asTo('should have rel8ns').isGonnaBeTruthy();
268
+ iReckon(maam, newIbGib!.rel8ns!.ancestor).asTo('ancestor is as expected').isGonnaBe(expectedRel8ns_ancestor);
269
+ iReckon(maam, newIbGib!.rel8ns!.test).asTo('test rel8dAddrs is as expected (unchanged)').isGonnaBe(rel8dAddrs_test);
270
+ iReckon(maam, newIbGib!.rel8ns!.past).asTo('undefined past').isGonnaBeUndefined();
271
+ });
232
272
  // TODO: TEST FORK cloneRel8ns option ONCE REL8 IS IMPLEMENTED
233
273
  // it(`cloneRel8ns`, async () => {
234
274
  // const testData = {x: 1, y: 2, deeper: { zzz: 333 }};