Skip to content

Commit 1c66666

Browse files
fix(test): align baseline refresh slack and export timestamp rollover
1 parent 2fb39bc commit 1c66666

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
seed-baselines-local:
77
@echo "WARNING: seed-baselines-local uses this host's timings; CI gates on ubuntu-latest." >&2
88
PYTHONPATH=. pytest tests/benchmarks/ --benchmark-only --benchmark-json=benchmarks/_raw.json -o addopts=
9-
PYTHONPATH=. python scripts/reduce_baselines.py benchmarks/_raw.json benchmarks/baselines.json
9+
PYTHONPATH=. python scripts/reduce_baselines.py benchmarks/_raw.json benchmarks/baselines.json --slack 1.5
1010

1111
# Deprecated alias — kept for muscle memory; see seed-baselines-local warning above.
1212
update-baselines: seed-baselines-local

benchmarks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Or manually:
6464

6565
```bash
6666
PYTHONPATH=. pytest tests/benchmarks/ --benchmark-only --benchmark-json=benchmarks/_raw.json -o addopts=
67-
PYTHONPATH=. python scripts/reduce_baselines.py benchmarks/_raw.json benchmarks/baselines.json
67+
PYTHONPATH=. python scripts/reduce_baselines.py benchmarks/_raw.json benchmarks/baselines.json --slack 1.5
6868
```
6969

7070
Baselines must be captured on **ubuntu-latest** to match the gated CI runner. Cross-OS variance causes spurious failures.

tests/benchmarks/conftest.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import tracemalloc
77
from collections.abc import Callable
88
from copy import deepcopy
9+
from datetime import UTC, datetime, timedelta
910
from pathlib import Path
1011
from typing import Any, TypeVar
1112

@@ -18,6 +19,13 @@
1819

1920
T = TypeVar("T")
2021

22+
_EXPORT_SESSION_BASE = datetime(2026, 6, 12, 0, 0, tzinfo=UTC)
23+
24+
25+
def export_session_first_timestamp(index: int) -> str:
26+
"""Return a unique, valid ISO timestamp for export-corpus session *index*."""
27+
return (_EXPORT_SESSION_BASE + timedelta(minutes=index)).strftime("%Y-%m-%dT%H:%M:%SZ")
28+
2129

2230
class TracemallocPeak:
2331
"""Measure peak Python heap bytes for one callable invocation."""
@@ -102,7 +110,7 @@ def export_corpus(tmp_path: Path, request: pytest.FixtureRequest) -> Path:
102110
project.mkdir()
103111
for i in range(count):
104112
# Unique first_timestamp per session so export filenames do not collide in ZIP benches.
105-
first_ts = f"2026-06-12T{i // 60:02d}:{i % 60:02d}:00Z"
113+
first_ts = export_session_first_timestamp(i)
106114
write_jsonl(project / f"session_{i:04d}.jsonl", 20, first_timestamp=first_ts)
107115
return project
108116

0 commit comments

Comments
 (0)