feat(gate): block PRs with schema changes (gate the API's signal)#188
Merged
Conversation
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: "019f8f6b-6523-7348-b789-375ea1764520" }) · view run · docs
veksen
force-pushed
the
feat-schema-change-gate
branch
from
July 22, 2026 19:51
1d1e3a1 to
051d8b9
Compare
veksen
force-pushed
the
feat-schema-change-gate
branch
from
July 22, 2026 20:08
051d8b9 to
9bedb01
Compare
veksen
added a commit
that referenced
this pull request
Jul 22, 2026
Cost-regression already blocks a PR, but through the analyzer's old inline path, so a repo couldn't set it to warn/off the way it can for untested-data-access (#183) and schema-drift (#188). Route the regression arm through resolveVerdict/policyFor, matching those two conditions. regression-beyond-threshold is a finding in the shared taxonomy and defaults to fail, so a repo that sets nothing blocks exactly as before. warn caps it at a surfaced, non-blocking neutral; off suppresses it. The new-query gate is left on its inline setFailed: its default policy is warn, so routing it through resolveVerdict would silently stop it blocking — a behavior change that needs a separate human sign-off. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The API already computes the real schema diff (runMetadata.schemaChange) and the comment renders it; nothing gated on it. gateSchemaChange reads that signal and routes schema-drift through resolveVerdict (taxonomy #3498 + policy #3500): fail by default so a person validates the migration, warn/off to soften. No detection here — the API owns it. Addresses Query-Doctor/Site#3289.
veksen
force-pushed
the
feat-schema-change-gate
branch
from
July 23, 2026 14:39
9bedb01 to
de49e66
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.
Goal
External dogfooding feedback (Query-Doctor/Site#3289): a migration should force a human eyeball before merge. This adds the gate — the only missing piece. The analyzer already gets the real schema diff from the API (
runMetadata.schemaChange) and renders it in the comment; nothing acted on it. Now a schema change blocks the check by default. Addresses Query-Doctor/Site#3289.What
Before → after for a PR that changes the schema:
warn(shown, non-blocking) oroffvia theschema-driftpolicy, which already exists in the condition catalog.How
src/gate/schema-change.ts(new) —gateSchemaChange(schemaChange, policy)takes the API's existingrunMetadata.schemaChangeand routes{ condition: "schema-drift", verdictClass: "finding" }through the sharedresolveVerdict(taxonomy #3498 + policy #3500). Returnsfailure(block),neutral(soften), ornull(no change /off). No detection — the API owns that.src/main.ts— readsreportContext.runMetadata?.schemaChange, calls the gate, thencore.setFailed/core.warning, alongside the test-presence gate.Tests
src/gate/schema-change.test.ts— blocks by default, softens underwarn, drops underoff, passes when the run has no change or the API sent no signal.Full suite green except one pre-existing
site-api.test.tsfailure (a local core-version skew, present onmainwithout this change).