Skip to content

ci(perf): PR-level BDN regression gate with delta comment (#192) - #272

Merged
Chris-Wolfgang merged 1 commit into
vNextfrom
tier2/192-pr-benchmarks
Jul 17, 2026
Merged

ci(perf): PR-level BDN regression gate with delta comment (#192)#272
Chris-Wolfgang merged 1 commit into
vNextfrom
tier2/192-pr-benchmarks

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Closes #192.

Summary

New .github/workflows/pr-benchmarks.yaml: runs BDN on PR HEAD + PR base, diffs mean-time + allocations per benchmark, posts an upserted delta comment (marker: <!-- pr-benchmarks-report -->), fails the PR when any regression exceeds threshold AND perf-impact-acknowledged label is absent.

Thresholds (env-configurable)

  • TIME_REGRESSION_PCT: 20
  • ALLOC_REGRESSION_PCT: 50

Comment table always shows all deltas; only regressions past the threshold trigger the gate.

Design points

  • Comment upsert via gh api (find-by-marker → PATCH; else POST). No third-party action dependency for the comment step.
  • Concurrency group per PR with cancel-in-progress — mid-run pushes abort the stale run so the final comment reflects HEAD.
  • Base run is || true-guarded so a PR that ADDS benchmarks where base has none surfaces as "new benchmark" rather than hard fail.

Stacked-PR base

Base = vNext. Tenth of the 11-PR batch (all workflow additions; #259 investigation next).

Protected-file guard

New workflow → protected. Expected admin-bypass at merge.

Test plan

  • First PR that touches src/** or benchmarks/** on vNext runs the workflow
  • Delta comment posts (should show near-zero drift on an idempotent PR)
  • Adding perf-impact-acknowledged label overrides the gate on a regressing PR

Closes #192.

New pr-benchmarks.yaml: runs BenchmarkDotNet on the PR's HEAD and on
its base's tip, diffs mean-time and allocations per benchmark, posts
an upsert-style delta comment on the PR (found by marker string
`<!-- pr-benchmarks-report -->`, edited in place on push), and fails
the workflow when any regression exceeds the threshold AND the PR
does not carry the `perf-impact-acknowledged` label.

Complements benchmarks.yaml (post-merge trend chart to gh-pages).
That workflow is backward-looking; this is forward-looking, catching
regressions before merge.

Design:

  - Trigger: pull_request against main/vNext, paths src/,
    benchmarks/, workflow itself.
  - Thresholds via env: time > +20%, allocations > +50% (adjust in
    the workflow env block; comment table always shows all deltas).
  - Comment upsert via marker string using `gh api` — no third-party
    action dependency for the comment step.
  - Base BDN run is `|| true`-guarded so a PR that ADDS benchmarks
    where the base branch has none surfaces as "new benchmark"
    rather than a hard fail.
  - Concurrency group per PR with cancel-in-progress: a mid-run
    push cancels the older invocation so the final comment
    reflects HEAD, not a stale interim commit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 16, 2026 00:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

PR benchmarks vs base (6b7444b)

Thresholds: time > +20% or allocations > +50% trigger a gate failure (label perf-impact-acknowledged overrides).

Benchmark Δ time Δ alloc
Action_Success +0.0% 0 (new)
Action_WithException +2.3% +0.0%
RunAsync_Action_Success -10.4% +0.0%
RunAsync_Action_WithException -6.5% +0.0%
RunAsync_Func_Success -2.8% +0.0%
RunAsync_Func_WithException -0.7% +0.0%
Run_Func_Success -0.9% +0.0%
Run_Func_WithException +0.6% +0.0%

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.

2 participants