One function

_normalize_ts in agentevals-dev/agentevals

The author described this change as fix(streaming): normalize timestamps across common units. It counts as a record because the check below fails on the code as it stood at 221febbe0 and passes on 363b28b28, with nothing else changed between the two runs.

Fix saved2026-07-11
Sharing licenceApache-2.0 · LICENSE
Change size+9 5

What the code was meant to do, written into the code itself as a docstring

Normalize a nanosecond timestamp (string or int) to seconds.

The change

11 def _normalize_ts(raw_ts) -> float:
2- """Normalize a nanosecond timestamp (string or int) to seconds."""
2+ """Normalize a contemporary Unix timestamp by inferring its unit from magnitude."""
33 try:
4- ns = int(raw_ts)
4+ timestamp = int(raw_ts)
55 except (TypeError, ValueError):
66 return 0.0
7- if ns > 1e15:
8- return ns / 1e9
9- return float(ns)
7+ if timestamp >= 1e17:
8+ return timestamp / 1e9
9+ if timestamp >= 1e14:
10+ return timestamp / 1e6
11+ if timestamp >= 1e11:
12+ return timestamp / 1e3
13+ return float(timestamp)

The check that tells the two apart

failpass·tests/test_incremental_processor.py::test_normalizes_timestamp_units[1770000000000-1770000000.0]

Check file tests/test_incremental_processor.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it221febbe05927923242a5edc12e68a2b70fd5ae9
Broken version dated2026-07-10
Moduleagentevals.streaming.incremental_processor
Units changed_normalize_ts
Fingerprintb89c87c58d4c3584
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.