Let a jsonl export keep a record a value
Docs / docs (push) Successful in 22s
Playwright Tests / test-playwright (1, 2) (push) Failing after 2m30s
Playwright Tests / test-playwright (2, 2) (push) Failing after 12s
pre-commit / pre-commit (push) Failing after 2m2s
Test Backend / test-backend (push) Failing after 2m34s
Compose Smoke Test / test-compose (push) Failing after 12s
Playwright Tests / merge-reports (push) Failing after 2m49s

`--format jsonl` existed, but `_cell` ran json.dumps at row-build time,
before a format was chosen — so a nested value was a string by then and
jsonl only re-escaped it, leaving a consumer against csv's 128KB field
limit either way. Stringifying moved to the csv writer, so csv is
byte-identical and jsonl carries json. The runs TUI followed, or a record
would draw as a Python repr.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYM38KSb4V4v2T71eifnZv
This commit is contained in:
2026-08-30 17:36:10 +02:00
co-authored by Claude Opus 5
parent 5818e5122a
commit 302be52921
4 changed files with 45 additions and 9 deletions
+10
View File
@@ -4,6 +4,7 @@ The pipeline half — what a hit restores and what a key is made of — is in
`tests/flow/test_runs.py`, which runs without one.
"""
import csv
import json
from datetime import UTC, datetime, timedelta
@@ -954,6 +955,15 @@ def test_an_exported_run_row_carries_every_recorded_input(
"metric.test_metrics.known.perfect"
)
# `final_metrics` alone, short of `.train_loss`, is a record rather than a
# leaf — the shape a large nested blob is. jsonl keeps it a json value;
# csv still has nowhere to put it but a quoted string, unchanged.
nested = _lines(export(format="jsonl", metrics="final_metrics"))
assert nested[0]["metric.final_metrics"] == {"train_loss": 0.5}
rows = list(csv.reader(export(metrics="final_metrics").text.splitlines()))
assert rows[1][-1] == '{"train_loss": 0.5}'
@pytest.fixture
def paged():