Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions benchmarks/prefix_data_generator/tests/test_roundtrip_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Expand Down Expand Up @@ -142,6 +144,18 @@ 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:")
Expand Down
Loading