Skip to content

fix(github): expand the cost-regression gate - #204

Merged
veksen merged 1 commit into
mainfrom
fix-expand-cost-regression
Jul 31, 2026
Merged

veksen merged 1 commit into
mainfrom
fix-expand-cost-regression

Conversation

@veksen

@veksen veksen commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Goal

A gate that blocks the check should show what it blocked on. Follow-up to #201.

What

Before. The first live run of the new comment blocked on 9 regressions and listed none of them:

x Cost regression — 9 queries got more expensive
  Untested data access — No changed data-access file without a test
  New query — No new queries

After. Each regressed query gets a row with its call site, both costs, and the percentage:

x Cost regression — 9 queries got more expensive
      ProjectQueriesRepository.findByProject
      apps/api/src/projects/project-queries.repository.ts:269:8 · 397,498 on the baseline, 718,215 here (+81%)

      DashboardRepository.findFunnelCounts
      apps/api/src/dashboard/dashboard.repository.ts:143:8 · 20,965 on the baseline, 37,205 here (+77%)

  Untested data access — No changed data-access file without a test

Those figures are the real ones from run 019fb8fd, not illustrations.

How

Two changes.

success.md.j2 gains a regression-beyond-threshold block, matching the shape the other two gates already use. It reads displayRegressed, which the view model has always built.

addRegressionPreviews in github.ts now attaches site. #202 added the call site to the recommendation previews and missed this builder, so regression rows would have rendered SELECT … instead of the function name. Rendering the template is what surfaced it; no test covered it.

Tests

github.test.ts asserts a fired regression gate renders both costs, and that a row names the function rather than the SQL preview. Full suite: 387 passing, 39 files, typecheck clean.

Not in this PR

The gate line says "9 queries got more expensive" without naming the rule. It is 9 because 25 queries rose, 13 rose past this repo's 10% threshold, and 9 of those are also above the 100 cost floor. The run page reports 25, so the two surfaces disagree without either being wrong. Naming the threshold in the copy is a separate change.

@veksen
veksen force-pushed the fix-expand-cost-regression branch from 97c4184 to 4d26ba0 Compare July 31, 2026 16:42
The gate roster expanded new-query-index and schema-drift but not
regression-beyond-threshold, so a run blocked by regressions reported the count
and none of the queries. The first live run hit exactly that: 9 queries got more
expensive, nine rows missing.

Regression rows also went through a preview builder that never attached the call
site added in #202, so they would have named the SQL instead of the function.

Co-Authored-By: Claude <noreply@anthropic.com>
@veksen
veksen force-pushed the fix-expand-cost-regression branch from 4d26ba0 to 5f16156 Compare July 31, 2026 16:47

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

6 successful checks

 Cost regression — No query got more expensive than the threshold allows
 Untested data access — No changed data-access file without a test
 New query — No new queries
 New query with index recommendation — No new query ships an index recommendation
 Schema drift — No schema changes
 High-value nudge — No index or rewrite past the threshold


More details via MCP → get_ci_run({ runId: "019fb914-335d-7694-bba5-d77f22ecb4d1" }) · view run · docs
3 queries read against main on assumed statistics of 10,000,000 rows per table. Sync production stats for costs measured against your real data.

@veksen
veksen merged commit 7a88fe4 into main Jul 31, 2026
6 checks passed
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