Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions tests/test_progress_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,22 @@ def test_page_snapshot_history_and_dedupe(self):
with open(os.path.join(out, "history.json"), encoding="utf-8") as f:
self.assertEqual(len(json.load(f)), 1)

def test_different_snapshots_in_the_same_second_are_preserved(self):
first = {"generated_at": "2026-11-24T00:00:00Z", "git": {"head": "a" * 40},
"metrics": [], "content_hash": "a" * 64}
second = {**first, "git": {"head": "b" * 40}, "content_hash": "b" * 64}
with tempfile.TemporaryDirectory() as out:
self.assertTrue(pd.write_outputs(first, out))
self.assertTrue(pd.write_outputs(second, out))
self.assertFalse(pd.write_outputs(second, out))

folder = Path(out)
snapshots = [json.loads(path.read_text(encoding="utf-8"))
for path in (folder / "snapshots").glob("progress_*.json")]
self.assertCountEqual(snapshots, [first, second])
history = json.loads((folder / "history.json").read_text(encoding="utf-8"))
self.assertEqual(history, [pd.summary_line(first), pd.summary_line(second)])

def test_unmatched_test_filter_preserves_cached_results(self):
with tempfile.TemporaryDirectory() as out:
cached = os.path.join(out, "unit_results.json")
Expand Down
5 changes: 3 additions & 2 deletions tools/progress_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Writes, into --out only (a folder inside the repository is refused, so nothing here can be committed by accident):
progress.html one self-contained page (no network, no packages; open it from disk)
snapshots/progress_<utc>.json the data behind it; a snapshot equal to the previous one is not written again
snapshots/progress_<utc>_<hash>.json the data behind it; an unchanged snapshot is not written again
history.json one summary line per snapshot, for the trend chart
unit_results.json the last --run-tests outcome, kept so a later run can show what changed since

Expand Down Expand Up @@ -1025,7 +1025,8 @@ def write_outputs(snap, out_dir):
new = not history or history[-1]["content_hash"] != snap["content_hash"][:16]
if new:
stamp = snap["generated_at"].replace("-", "").replace(":", "")
save_text(os.path.join(out_dir, "snapshots", f"progress_{stamp}.json"), dump_json(snap))
archive = f"progress_{stamp}_{snap['content_hash']}.json"
save_text(os.path.join(out_dir, "snapshots", archive), dump_json(snap))
history.append(summary_line(snap))
save_text(hist_path, dump_json(history))
save_text(os.path.join(out_dir, "progress.html"), render_page(snap, history))
Expand Down