Skip to content

Commit c00354d

Browse files
joseph-isaacsclaude
andcommitted
ci(bench): keep compact-only SQL benchmark results in their own PR comment
Sharing one comment per benchmark id across presets let a `pr-compact` run (Parquet + Vortex Compact, no Vortex) replace the Vortex results posted by `action/bench-sql`, and the same happens for `appian-nvme` and `tpch-s3-10` under `pr-all`, which are compact-only there too. The matrix now emits a `comment_key` per entry: the benchmark id when the run includes regular Vortex, otherwise `<id>-compact`. The workflow tags PR comments by it, so every label upserts the same comment except runs whose formats differ. Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ixWKUArMHQ19JTDMdggWV
1 parent 7ba832e commit c00354d

3 files changed

Lines changed: 29 additions & 5 deletions

File tree

‎.github/workflows/sql-bench-matrix.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ jobs:
258258
with:
259259
file-path: comment.md
260260
# There is exactly one comment per comment-tag. If a comment with this tag already exists,
261-
# this action will *update* the comment instead of posting a new comment. The preset is
262-
# deliberately not part of the tag, so every preset that runs a benchmark updates the same
263-
# comment and the latest run wins.
264-
comment-tag: bench-pr-comment-${{ matrix.id }}
261+
# this action will *update* the comment instead of posting a new comment. `comment_key`
262+
# ignores the preset, so every label that runs a benchmark updates the same comment, but
263+
# separates compact-only runs, whose formats differ (see bench-orchestrator ci_matrix).
264+
comment-tag: bench-pr-comment-${{ matrix.comment_key }}
265265

266266
- name: Comment PR on failure
267267
if: failure() && inputs.mode == 'pr' && github.event.pull_request.head.repo.fork == false
@@ -271,7 +271,7 @@ jobs:
271271
# 🚨🚨🚨❌❌❌ SQL BENCHMARK FAILED ❌❌❌🚨🚨🚨
272272
273273
Benchmark `${{ matrix.name }}` (${{ inputs.matrix_preset }}) failed! Check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
274-
comment-tag: bench-pr-comment-${{ matrix.id }}
274+
comment-tag: bench-pr-comment-${{ matrix.comment_key }}
275275

276276
- name: Upload Benchmark Results
277277
if: inputs.mode == 'develop'

‎bench-orchestrator/bench_orchestrator/ci_matrix/render.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,19 @@ def _data_formats(coverage: Coverage) -> list[Format]:
2626
return [fmt for fmt in _FORMAT_ORDER if fmt in present and fmt not in _NOT_GENERATED]
2727

2828

29+
def _comment_key(benchmark: BenchmarkCase, coverage: Coverage) -> str:
30+
# PR benchmark comments are upserted by this key, so every preset that runs a benchmark updates
31+
# one comment. Runs without regular Vortex (Vortex Compact plus Parquet controls) report
32+
# different formats, so they get their own comment instead of replacing the Vortex results.
33+
if any(target.format == Format.VORTEX for target in coverage.targets):
34+
return benchmark.id
35+
return f"{benchmark.id}-compact"
36+
37+
2938
def _matrix_entry(benchmark: BenchmarkCase, coverage: Coverage) -> dict[str, object]:
3039
entry: dict[str, object] = {
3140
"id": benchmark.id,
41+
"comment_key": _comment_key(benchmark, coverage),
3242
"subcommand": benchmark.subcommand,
3343
"name": benchmark.name,
3444
"targets": [target.to_dict() for target in coverage.targets],

‎bench-orchestrator/tests/test_matrix.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,20 @@ def test_pr_full_covers_pr() -> None:
125125
assert set(cast("list[str]", entry["data_formats"])) <= set(cast("list[str]", full_entry["data_formats"]))
126126

127127

128+
def test_comment_keys_share_pr_comments_by_format() -> None:
129+
keys: dict[str, set[str]] = {}
130+
for preset in ("pr", "pr-compact", "pr-all", "pr-full"):
131+
for entry in _entries(preset):
132+
formats = {file_format for _engine, file_format in _targets(entry)}
133+
benchmark_id = cast("str", entry["id"])
134+
expected = benchmark_id if "vortex" in formats else f"{benchmark_id}-compact"
135+
assert entry["comment_key"] == expected
136+
keys.setdefault(benchmark_id, set()).add(cast("str", entry["comment_key"]))
137+
138+
assert keys["tpch-nvme"] == {"tpch-nvme", "tpch-nvme-compact"}
139+
assert keys["polarsignals"] == {"polarsignals"}
140+
141+
128142
def test_resolver_rejects_empty_targets() -> None:
129143
benchmark = replace(
130144
CATALOG.benchmarks[0],

0 commit comments

Comments
 (0)