FEATURE: CSV Reports
| Field | Value |
|---|---|
| Version | 20261024 V1 |
| Description | Aggregates filtered execution records into six CSV reports. |
| Depends On | FEATURE-LogIntake.md |
| Provides | summary, commands, targets, models, daily, failures CSV reports |
| Consumes | log parsing, record validation, duplicate detection, target and date filtering |
Purpose
Provide the six operator reports from validated records after the filters supplied by FEATURE-LogIntake.md. All report values derive from those records; no report answer or total is hardcoded.
Behavior
summaryreports the filtered record count, whole-file skipped count, success and failure counts, earliest and latest start dates, token totals, cost, and minutes. If no records match, the date fields are empty and numeric totals are zero.commandsgroups by command name and sorts by calls descending, then command name ascending.targetsgroups by Target and sorts by Target ascending.modelsgroups by provider and selected model. Use the non-empty executed model fromresult.stats.model, otherwisejob.model; sort by provider, then model, ascending.dailygroups by start date and sorts ascending.failuresincludes failed records only, sorted by start time, then execution ID, ascending. Render a missing or null return code as an empty field, andtimed_outastrueorfalse.commands,targets,models, anddailyend with aTOTALrow over the filtered records.failuresandsummaryhave no total row. An empty grouped report still includes its header and a zero-valuedTOTALrow.- CSV output has one header row, comma-separated fields, and
\nline endings. Costs use four decimal places. Minutes sum elapsed milliseconds and convert to tenths with integer arithmetic:t = (ms + 3000) / 6000, rendered ast / 10, a decimal point, andt % 10.
Programmatic Acceptance
=== AC reports-conformance ===
Intent: The six reports, filters, skipped-line handling, formatting, ordering, and empty-result output pass the supplied known-answer suite.
Suite: scoped
import os import subprocess
result = subprocess.run( ["sh", "bin/test.sh"], capture_output=True, text=True, env={**os.environ}, ) print(result.stdout) print(result.stderr, file=import("sys").stderr) assert result.returncode == 0 === END AC reports-conformance ===
=== AC model-selection ===
Intent: The report aggregation assigns a record to its executed model when present and its requested model otherwise.
Suite: scoped
import os
from pathlib import Path import subprocess import sys
result = subprocess.run( ["sh", "bin/test.sh"], capture_output=True, text=True, env={**os.environ}, ) print(result.stdout) print(result.stderr, file=sys.stderr) assert result.returncode == 0 === END AC model-selection ===
User Acceptance
- None.
Guardrails
- Do not read or modify
sources/run.shfrom application code. - Do not hardcode report rows, counts, totals, or expected answers.
- Do not write to the log being read.