feat: render the unset-baseline callout on the PR comment#150
Merged
Conversation
When the Site API reports `metadata.baseline.unset` (no comparison branch configured, or it collapsed to a head-vs-head comparison), the PR comment now warns — even when a comparison was produced. That's the silent case the existing "no baseline found" copy misses: an unconfigured baseline falls back to head (or the PR base), so `hasComparison` is true and the comment renders counts with no warning, e.g. "0 new" on a PR full of new queries (Site #3292). The callout names the branch the comparison fell back to, distinguishes the acute head-vs-head case from a base-branch fallback, and surfaces the `get_repo_config` MCP call to inspect/fix it. Driven off the Site signal (`metadata.baseline`) rather than re-deriving the rule; the field is optional so an older Site API (deploy skew) and a degraded `null` read both render nothing. Renderer half of Site #3297; closes Site #3312. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Query Doctor Analysis
3 queries analyzed
0 regressed · 0 improved · 0 new · 0 removed
2 pre-existing issues
SELECT "guests"."id", "guests"."session_id", "guests"."username", "guests"."avatar_path", "guests"."color", "guests"."side", "guests"."audio_recording_path", "guests"."audio_recording_public", "gue...
indexassets(event_id, inserted_at desc)
cost 31,003,449 → 1,498 (100% reduction)SELECT * FROM guest_ip_addresses WHERE ip_address = '127.0.0.1';
indexguest_ip_addresses(ip_address)
cost 154,402 → 8 (100% reduction)
Using assumed statistics (10000000 rows/table). For better results, sync production stats.
More detail → get_ci_run({ runId: "019ed207-da2d-7965-9d92-72c58c082324" }) · view run · docs
7445384 to
2dfa6e8
Compare
Render the callout with GitHub's `> [!WARNING]` alert instead of a manual⚠️ blockquote, so it shows as the native styled warning box (and drops the hand-placed emoji). Content unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2dfa6e8 to
8a254cd
Compare
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.
Renderer half of Site #3297. Closes Site #3312. Part of the unset-baseline surfacing thread (Site #3292 follow-ups, epic Site #3106).
Problem
When a project has no comparison branch configured, the baseline silently falls back — to head on a re-push, or (since #147) the PR base. So
hasComparisonis true and the PR comment renders counts with no warning, e.g.0 regressed · 0 improved · 0 newon a PR full of new queries (Site #3292, d2armory-next PR #775). The existing "no baseline found / add apushtrigger" copy only fires when there's no baseline run at all — a different condition — so this misconfiguration shipped silently.Change
Site now emits
metadata.baselineonPOST /ci/runs(Site #3297, merged). This renders it:site-api.ts— type thebaselinefield onCiRunMetadata(optional → tolerates an older Site API and a degradednullread; both render nothing).success.md.j2— ahasComparison and runMetadata.baseline.unset. It names the fallback branch, distinguishes the acute head-vs-head case ("0 newon a PR full of new queries") from a base-branch fallback ("diverges from the dashboard / breaks on non-PR runs"), and surfaces theget_repo_configMCP call to inspect/fix it.Driven off the Site signal (defined once, Site #3302) rather than re-deriving the rule here.
Scope note
Gated to
hasComparison— it targets exactly the gap (a comparison was produced but the baseline is misconfigured). The no-comparison path keeps its existing "add a push trigger" guidance, so the two messages never stack.Tests
github.test.ts(+4): unset+head-vs-head renders the callout with branch +0 new+ MCP call; base-branch fallback frames the divergence/non-PR risk; configured → no callout; absent/nullbaseline → no callout. 55/55 reporter tests pass, existing snapshots unchanged,tsc --noEmitclean.Cross-repo
Producer: Site #3297 (merged) · shared detection Site #3302 · MCP sibling Site #3298 · dashboard sibling Site #3299.
🤖 Generated with Claude Code