Skip to content

feat(comment): name a query by its call site - #202

Merged
veksen merged 1 commit into
mainfrom
feat-carry-tags-into-comment
Jul 31, 2026
Merged

veksen merged 1 commit into
mainfrom
feat-carry-tags-into-comment

Conversation

@veksen

@veksen veksen commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Goal

A comment row should tell you which code to open. Follow-up to #201, which built the gates-first layout but could only identify a query by hash.

What

Before: 9e545998 plans at 1,230, or 346 with these indexes

After: CiRepository.findLatest, with apps/api/src/ci/ci.repository.ts:210:8 underneath.

Every query in a run already carries SQLCommenter tags: func_name, file, db_driver. GET /ci/runs/:id returns them for all 101 queries on a recent run. compareRuns narrowed each query to a shape that dropped them, so the surface where naming matters most was the one surface without a name.

How

Read compareRuns in src/reporters/site-api.ts first: RegressedQuery and ImprovedQuery gain tags, copied from the current run's payload. newQueries already kept the full payload, so it needed nothing.

callSite in github.ts turns those tags into a name and a file. The file tag arrives absolute from the runner (/home/runner/work/Site/Site/apps/...), so it is trimmed to a repo-relative path. A query with no func_name falls back to its file, and one with no tags falls back to the SQL preview, which is what the comment showed before.

Two limits worth knowing. func_name is not unique: CiRepository.findAll covered 8 hashes on the run I checked, so two rows can share a label and differ; the link disambiguates. About 8 of 101 queries carry no func_name at all.

Tests

site-api.test.ts covers a regressed and an improved query keeping their tags. github.test.ts covers callSite naming a query, falling back to the file, and returning nothing when a run carries no tags. Full suite: 385 passing, 39 files, typecheck clean.

@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: "019fb8ef-45ee-7606-9012-28e870912337" }) · 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 force-pushed the feat-carry-tags-into-comment branch from d600200 to 58a452c Compare July 31, 2026 14:55
@veksen
veksen changed the base branch from main to feat-gates-first-comment July 31, 2026 14:55
@veksen
veksen force-pushed the feat-gates-first-comment branch from 8faddc0 to c487582 Compare July 31, 2026 14:59
@veksen
veksen force-pushed the feat-carry-tags-into-comment branch from 58a452c to 1988f84 Compare July 31, 2026 15:06
@veksen
veksen force-pushed the feat-gates-first-comment branch from c487582 to ede76d2 Compare July 31, 2026 15:27
@veksen
veksen force-pushed the feat-carry-tags-into-comment branch from 1988f84 to a5f72e2 Compare July 31, 2026 15:28
@veksen
veksen force-pushed the feat-gates-first-comment branch from ede76d2 to 0326958 Compare July 31, 2026 15:52
@veksen
veksen force-pushed the feat-carry-tags-into-comment branch from a5f72e2 to 15d8a9f Compare July 31, 2026 15:53
compareRuns narrowed each query to a shape without tags, so the comment could
only identify a query by hash. The run payload has carried func_name and file
for every query all along.

Carry the tags through the comparison and render them: a row reads
CiRepository.findLatest with its file:line, not 9e545998.

Co-Authored-By: Claude <noreply@anthropic.com>
@veksen
veksen force-pushed the feat-carry-tags-into-comment branch from 15d8a9f to 349fec3 Compare July 31, 2026 16:07
@veksen
veksen changed the base branch from feat-gates-first-comment to main July 31, 2026 16:07
@veksen
veksen merged commit f27d148 into main Jul 31, 2026
6 checks passed
veksen added a commit that referenced this pull request Jul 31, 2026
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 added a commit that referenced this pull request Jul 31, 2026
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 added a commit that referenced this pull request Jul 31, 2026
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>
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