Skip to content

feat: keep a run's metrics in a local run record - #227

Merged
goldbarth merged 1 commit into
mainfrom
feat/224-run-record
Sep 22, 2026
Merged

goldbarth merged 1 commit into
mainfrom
feat/224-run-record

Conversation

@goldbarth

Copy link
Copy Markdown
Owner

Closes #224
Follows #225 (the record carries the settings it added)

  • A file per generate run, chartula-runs/<UTC time>-<tag>.json: the run metrics as the summary prints them (calls and tokens per operation, both checks' activity, onlyThoroughFlags, notEvaluated), the provenance, each audience's flags or error, the time, repository and mode. Two runs compare from their files alone.
  • One file per run, not appended: each record is a whole JSON document to read and diff on its own, and no run rewrites an earlier one. The time comes first so the files list in run order; two runs in the same second get -2, -3; a tag's / becomes -.
  • Never published: usage is a fact about the run, not the release, so changelog.json and the release notes are untouched. docs/run-record.md says to ignore /chartula-runs/, and this repository does.
  • Provenance in changelog.json's own fields: ChangelogJsonSerializer.ToDocument is shared, so a record and the file its run wrote match without a second source.
  • Versioned apart: its own schemaVersion: 1 and Stability section, documented like changelog.json.
  • preview writes no record: its promise is to write nothing.
  • A run in which nothing rendered is recorded: its tokens were spent. changelog.json is still held back then.
  • Written before the other outputs: every model call is done by then, so the record is complete, and it does not depend on publishing succeeding.
  • Operations with no calls are zeros, a failed audience has no flags: a zero is a value that compares; an empty list would read as a clean check.
  • The run summary names the file under its metrics: Recorded in <path>.
  • Escaping (+, ') follows changelog.json; whether both should relax is changelog.json escapes '+', quotes and every non-ASCII character #226.

Verified, release build: generate --no-publish --tag v0.1.0-preview.1 --since v0.1.0-preview.1~2 on this repository with an invalid ANTHROPIC_API_KEY (no tokens spent): both audiences fail with 401, exit 1, the summary ends with Recorded in .../chartula-runs/20260922T144044Z-v0.1.0-preview.1.json, the file holds both errors, zeroed metrics and the full provenance, and git ignores it.
Not verified end-to-end: a run that renders, which needs a paid model run; covered by the pipeline and serializer tests.

Tests: 6 new in RunRecordJsonSerializerTests, 4 in RunRecordPipelineTests (generate and --no-publish record, preview does not, a run with nothing rendered does), 4 in FileRunRecordWriterTests (name, same second, slash in tag, provenance), 2 in ReleaseCommandMetricsTests, 1 assertion in OutputWiringTests; full suite 677 passing, build and dotnet format clean.

@goldbarth goldbarth self-assigned this Sep 22, 2026
@goldbarth
goldbarth merged commit ebde897 into main Sep 22, 2026
4 checks passed
@goldbarth
goldbarth deleted the feat/224-run-record branch September 22, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep a run's metrics in a local file, not only in the terminal

1 participant