Skip to content

Commit 246760a

Browse files
ve62cacodex
andcommitted
fix(ci): fail zsh benchmark on red thresholds
- Add a zsh-bench threshold check that matches the dashboard red status rules - Stop using github-action-benchmark relative alerts as the CI failure condition - Apply the same red-threshold check to main and PR benchmark workflows Co-authored-by: Codex GPT-5.5 <noreply@openai.com>
1 parent 9e60dbd commit 246760a

3 files changed

Lines changed: 62 additions & 7 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
# Fail CI only when a zsh-bench metric reaches the dashboard red state.
3+
set -euo pipefail
4+
5+
input="${1:-benchmark-result.json}"
6+
7+
if [[ ! -r "$input" ]]; then
8+
echo "::error::Benchmark result file not found: $input"
9+
exit 1
10+
fi
11+
12+
failures="$(
13+
jq -r '
14+
def targets:
15+
{
16+
"first prompt lag": 50,
17+
"first command lag": 150,
18+
"command lag": 10,
19+
"input lag": 20
20+
};
21+
22+
.[]
23+
| select((targets[.name] // null) != null)
24+
| . as $metric
25+
| (targets[$metric.name]) as $target
26+
| ($target * 2) as $red_threshold
27+
| select(($metric.value | tonumber) > $red_threshold)
28+
| [
29+
$metric.name,
30+
(($metric.value | tostring) + " " + ($metric.unit // "ms")),
31+
(($target | tostring) + " ms"),
32+
("> " + ($red_threshold | tostring) + " ms")
33+
]
34+
| @tsv
35+
' "$input"
36+
)"
37+
38+
if [[ -z "$failures" ]]; then
39+
echo "All thresholded zsh-bench metrics are below dashboard red status."
40+
exit 0
41+
fi
42+
43+
echo "Red zsh-bench metric(s) detected. Dashboard red status fails CI."
44+
echo "metric | value | target | red threshold"
45+
echo "--- | --- | --- | ---"
46+
47+
while IFS=$'\t' read -r metric value target red_threshold; do
48+
echo "${metric} | ${value} | ${target} | ${red_threshold}"
49+
echo "::error title=Zsh bench red metric::${metric} is ${value}; red threshold is ${red_threshold}."
50+
done <<< "$failures"
51+
52+
exit 1

.github/workflows/benchmark-pr.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ jobs:
3737
github-token: ${{ secrets.GITHUB_TOKEN }}
3838
auto-push: false
3939
save-data-file: false
40-
alert-threshold: "150%"
41-
comment-on-alert: true
4240
comment-always: true
43-
fail-on-alert: true
41+
fail-on-alert: false
4442
summary-always: true
4543

44+
- name: Fail on red zsh-bench metrics
45+
shell: bash
46+
run: bash .github/scripts/check-zsh-bench-thresholds.sh benchmark-result.json
47+
4648
- name: Clean benchmark temporary files
4749
if: always()
4850
shell: bash

.github/workflows/benchmark.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ jobs:
5858
benchmark-data-dir-path: .
5959
github-token: ${{ secrets.GITHUB_TOKEN }}
6060
auto-push: true
61-
alert-threshold: "150%"
62-
comment-on-alert: true
6361
comment-always: true
64-
fail-on-alert: true
62+
fail-on-alert: false
6563
summary-always: true
66-
alert-comment-cc-users: "@lemtoc"
64+
65+
- name: Fail on red zsh-bench metrics
66+
shell: bash
67+
run: bash .github/scripts/check-zsh-bench-thresholds.sh benchmark-result.json
6768

6869
- name: Clean benchmark temporary files
6970
if: always()

0 commit comments

Comments
 (0)