From 9b79d65f810a62248eb31d0f0699e2505d02835c Mon Sep 17 00:00:00 2001 From: Micah Villmow <4211002+mvillmow@users.noreply.github.com> Date: Fri, 1 May 2026 22:20:07 +0000 Subject: [PATCH 1/2] test: fail prefix roundtrip when no traces are tested --- .../tests/test_roundtrip_hashes.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/benchmarks/prefix_data_generator/tests/test_roundtrip_hashes.py b/benchmarks/prefix_data_generator/tests/test_roundtrip_hashes.py index aaa880bb1ad8..2f19ebb35cd2 100644 --- a/benchmarks/prefix_data_generator/tests/test_roundtrip_hashes.py +++ b/benchmarks/prefix_data_generator/tests/test_roundtrip_hashes.py @@ -97,6 +97,7 @@ def test_hash_roundtrip_direct(self): # Phase 2: Test roundtrip roundtrip_hasher = RollingHasher(block_size=DEFAULT_BLOCK_SIZE) mismatches = [] + generation_failures = [] tested = 0 for i, trace in enumerate(traces): @@ -113,6 +114,7 @@ def test_hash_roundtrip_direct(self): ) except Exception as e: print(f" Trace {i}: Generation failed - {e}") + generation_failures.append((i, str(e))) continue # Step 2: Re-encode text (simulates what server does) @@ -142,6 +144,19 @@ def test_hash_roundtrip_direct(self): print(f"\nTested {tested} traces with hash_ids") + if tested == 0: + failure_details = "" + if generation_failures: + preview = "; ".join( + f"trace {i}: {error}" + for i, error in generation_failures[:5] + ) + failure_details = f" Generation failures: {preview}" + pytest.fail( + "No traces were successfully tested for hash roundtrip." + f"{failure_details}" + ) + # Report results if mismatches: print(f"\nFound {len(mismatches)} hash mismatches:") From 1348e271488b5667b493d46d4042fe0ce480573e Mon Sep 17 00:00:00 2001 From: Micah Villmow <4211002+mvillmow@users.noreply.github.com> Date: Mon, 4 May 2026 16:50:09 +0000 Subject: [PATCH 2/2] test: format prefix roundtrip failure details --- .../prefix_data_generator/tests/test_roundtrip_hashes.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/benchmarks/prefix_data_generator/tests/test_roundtrip_hashes.py b/benchmarks/prefix_data_generator/tests/test_roundtrip_hashes.py index 2f19ebb35cd2..3300617154ba 100644 --- a/benchmarks/prefix_data_generator/tests/test_roundtrip_hashes.py +++ b/benchmarks/prefix_data_generator/tests/test_roundtrip_hashes.py @@ -148,8 +148,7 @@ def test_hash_roundtrip_direct(self): failure_details = "" if generation_failures: preview = "; ".join( - f"trace {i}: {error}" - for i, error in generation_failures[:5] + f"trace {i}: {error}" for i, error in generation_failures[:5] ) failure_details = f" Generation failures: {preview}" pytest.fail(