Reconcile page-split timestamps for ten-pull transactions

This commit is contained in:
Golumpa 2026-07-30 17:10:33 +01:00
parent d04a80c3f1
commit a48da863ea
4 changed files with 113 additions and 0 deletions

View file

@ -1,7 +1,24 @@
from tests.support import * # noqa: F401,F403
from nte_history_exporter.decoder.arc import annotate_arc_groups
class ArcDecodingTests(unittest.TestCase):
def test_page_split_timestamp_variants_form_one_ten_pull(self):
rows = [
{
"page": 1 if index < 5 else 2,
"timestamp_raw_hex": "aa" if index < 5 else "bb",
"timestamp_decoded": "2026-07-11 07:21:22",
}
for index in range(10)
]
annotate_arc_groups(rows)
self.assertEqual([row["timestamp_group_ordinal"] for row in rows], list(range(10)))
self.assertEqual({row["timestamp_raw_hex"] for row in rows}, {"aa"})
self.assertEqual(rows[5]["timestamp_reconciled_from_raw_hex"], "bb")
def test_arc_key_timestamp_and_uid_match_fixture(self):
fixture = load_network_fixture()
row = fixture_session().build_rows("arc_miracle_box")[0]

View file

@ -2,6 +2,27 @@ from tests.support import * # noqa: F401,F403
class UidCompatibilityTests(unittest.TestCase):
def test_monopoly_page_split_timestamp_variants_complete_ten_pull(self):
rows = [self._synthetic_row(1, "aa", "dice") for _ in range(5)]
rows += [self._synthetic_row(2, "bb", "dice") for _ in range(5)]
for row in rows:
row["timestamp_decoded"] = "2026-07-11 07:21:22"
annotated = annotate_groups(rows)
self.assertEqual([row["timestamp_group_ordinal"] for row in annotated], list(range(10)))
self.assertEqual({row["timestamp_raw_hex"] for row in annotated}, {"aa"})
def test_monopoly_singles_with_same_second_remain_separate(self):
rows = [self._synthetic_row(1, "aa", "dice"), self._synthetic_row(2, "bb", "dice")]
for row in rows:
row["timestamp_decoded"] = "2026-07-11 07:21:22"
annotated = annotate_groups(rows)
self.assertEqual([row["timestamp_group_ordinal"] for row in annotated], [0, 0])
self.assertEqual([row["timestamp_raw_hex"] for row in annotated], ["aa", "bb"])
def test_uid_source_matches_committed_network_fixture(self):
fixture = load_network_fixture()
rows = annotate_groups(fixture_session().build_rows("permanent"))