Repository navigation
feat(github): lead the PR comment with the gate roster - #201
Merged
Merged
Conversation
There was a problem hiding this comment.
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: "019fb8e1-840d-7de7-bb2c-0655effdd9a4" }) · 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
force-pushed
the
feat-gates-first-comment
branch
3 times, most recently
from
July 31, 2026 15:27
c487582 to
ede76d2
Compare
The comment reported findings by type: improvements, regressions, new queries, pre-existing recommendations. It never said whether the check passed, because gating ran after the report and the template had no access to its own result. A run whose gates all passed still printed a whole-repo dump. Resolve every condition before rendering and lead with that roster. A condition that found nothing is one line. A condition that fired expands beneath its own line with the queries and the CREATE INDEX that clears it. The check annotations read the same array, so the heading and the check cannot disagree. Supersedes ADR-0003 on per-query rows. Co-Authored-By: Claude <noreply@anthropic.com>
veksen
force-pushed
the
feat-gates-first-comment
branch
from
July 31, 2026 15:52
ede76d2 to
0326958
Compare
This was referenced Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
The PR comment should tell a developer whether Query Doctor is blocking their merge, and what to do about it. Today it cannot: gating runs after the comment renders, so the template has no access to its own check result.
This is the first of two PRs. The follow-up (#202) carries SQLCommenter tags through
compareRuns, so rows can readProjectQueriesRepository.findByHashinstead of a hash.What
Before: the comment listed findings by type (improvements, regressions, new queries, pre-existing recommendations) with no verdict anywhere. A run whose gates all passed still printed dozens of rows.
After: it leads with the gate roster.
A condition that found nothing is one line. A condition that fired expands beneath its own line. A clean run is six lines and a footer.
How
Read
src/gate/evaluate.tsfirst.evaluateGatesreturns one outcome per condition, including the ones that found nothing, which the existing gates cannot express because they returnnull.summarizeGatesderives the heading counts from that same array, andmain.tsdrives its check annotations from it, so the heading and the check cannot disagree.success.md.j2loses the per-finding sections. The baseline-state guidance stays: it explains why a comparison is missing, which the roster does not replace.Two things to know. Gate labels are duplicated from
CI_CONDITIONSin@query-doctor/types, which the analyzer cannot depend on; the code marks the drift risk and says to collapse them when this repo merges into Site. Status glyphs are committed underassets/gate/and fetched over HTTP, because GitHub strips inline<svg>— they resolve once this is onmain.Supersedes ADR-0003 on per-query rows (Query-Doctor/Site#3775). Its staleness argument still applies, bounded: only a firing condition renders rows, and triaging a query is what stops it firing.
Tests
src/gate/evaluate.test.tscovers the roster on a clean run, each condition firing from its own fact,offdropping a condition entirely,warncapping at neutral, the labels, the copy, and the roll-up.github.test.tscovers the heading, the condition lines, and detail appearing only for a gate that fired.Tests asserting the removed sections were deleted rather than adjusted, since the behaviour is gone by design. Full suite: 380 passing, 39 files, typecheck clean.