Skip to content

refactor(ci): move benchmark aggregation into invokable Python (reld#48) - #162

Merged
zackees merged 1 commit into
feat/54-stacked-benchmark-chartsfrom
refactor/48-benchmark-pipeline
Sep 17, 2026
Merged

zackees merged 1 commit into
feat/54-stacked-benchmark-chartsfrom
refactor/48-benchmark-pipeline

Conversation

@zackees

@zackees zackees commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Closes #48. Wave 3 of #153. Stacked on #161 (#54) — it reuses the combined-index renderer, so merge that first and this retargets to main.

What was still in YAML

Measurement was already Python (ci.benchmark_runner, ci.benchmark_coverage, ci.benchmark_stats). Aggregation was not: a shell loop in the aggregate job knew the target list, where each raw log lands, how history is carried forward, and what the published directory looks like. It re-derived the target list through --print-targets and re-implemented the layout by hand, which is drift by construction, and nobody could run it locally.

What this adds

ci/benchmark_pipeline.py owns target configuration, the benchmark-log-<target>/ input layout, history carry-forward, per-target rendering, the combined page, and validation. It checks what the shell never did: that every target produced latest.json, history.jsonl, benchmark-link.jpg and index.html, failing with the target named rather than publishing a half-written directory. A missing or unparseable raw log, or metadata naming a different target, fails the same way instead of rendering an empty chart.

History carry-forward keeps the old behaviour deliberately: a failed fetch starts an empty file rather than failing the run. Losing a history line is recoverable; refusing to publish is not.

The workflow step is now one call. Publishing stays in YAML, where the token is — nothing in the pipeline can push, and the default-branch guard is untouched.

RED → GREEN

test_benchmark_workflow.py asserted the inline shell contract (benchmark-stats/$target, --metadata-path "benchmark-input/benchmark-log-$target/metadata.json"). Those two tests failed against this refactor and now assert the new contract: the YAML names only the roots and calls ci.benchmark_pipeline.

Local command

uv run --no-sync python -m ci.benchmark_pipeline \
    --input-root benchmark-input --output-root benchmark-stats --no-history-fetch

Verification

uv run --no-sync python -m pytest ci/tests -q — 274 passed, 9 new in test_benchmark_pipeline.py covering all three targets, target isolation (each latest.json names only its own target), missing log, malformed log, mismatched metadata, local history carry-forward, the empty-history path, and a no-network CLI run that writes no git state.

🤖 Generated with Claude Code

The per-target measurement steps were already Python. Aggregation was not: a
shell loop in the aggregate job knew the target list, where each raw log lands,
how history is carried forward, and what the published directory looks like.
Nobody could run it locally, and it drifted from the target manifest by
construction — it re-derived the list through `--print-targets` and the layout
by hand.

`ci/benchmark_pipeline.py` owns all of it, and checks what the shell never did:
that every target produced `latest.json`, `history.jsonl`, `benchmark-link.jpg`
and `index.html`, failing with the target named rather than publishing a
half-written directory. A missing or unparseable raw log fails the same way
instead of rendering an empty chart.

The workflow step is now one call. Publishing stays in YAML, where the token is;
nothing in the pipeline can push.

Local run against logs downloaded from a CI run:

    uv run --no-sync python -m ci.benchmark_pipeline \
        --input-root benchmark-input --output-root benchmark-stats --no-history-fetch

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@zackees
zackees merged commit 75f0231 into feat/54-stacked-benchmark-charts Sep 17, 2026
18 checks passed
@zackees
zackees deleted the refactor/48-benchmark-pipeline branch September 17, 2026 22:10
zackees added a commit that referenced this pull request Sep 17, 2026
…54) (#161)

* ci(bench): make the stacked chart layout the generated default (reld#54)

The README block is already generated and stacked, but nothing asserted the
property: `--check-readme` compares the file against the same generator that
wrote it, so a change back to a column of thumbnails would pass with both sides
agreeing. `ci/tests/test_benchmark_layout.py` now pins the layout itself — one
full-width chart per OS, in the manifest's order, no table — on the generator
and on the committed README.

The published branch had no combined view at all: three per-target directories
and nothing showing them together. `--write-combined-index` writes one at the
root, using the same rule, and the aggregate job now emits it. A chart shrunk
into a thumbnail grid is a chart nobody reads, so each OS gets the full width
and its own row, with the per-target page one click away.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* refactor(ci): move benchmark aggregation into invokable Python (reld#48) (#162)

The per-target measurement steps were already Python. Aggregation was not: a
shell loop in the aggregate job knew the target list, where each raw log lands,
how history is carried forward, and what the published directory looks like.
Nobody could run it locally, and it drifted from the target manifest by
construction — it re-derived the list through `--print-targets` and the layout
by hand.

`ci/benchmark_pipeline.py` owns all of it, and checks what the shell never did:
that every target produced `latest.json`, `history.jsonl`, `benchmark-link.jpg`
and `index.html`, failing with the target named rather than publishing a
half-written directory. A missing or unparseable raw log fails the same way
instead of rendering an empty chart.

The workflow step is now one call. Publishing stays in YAML, where the token is;
nothing in the pipeline can push.

Local run against logs downloaded from a CI run:

    uv run --no-sync python -m ci.benchmark_pipeline \
        --input-root benchmark-input --output-root benchmark-stats --no-history-fetch

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

1 participant