fix(gate): block untested-data-access via the shared policy engine#183
Open
veksen wants to merge 1 commit into
Open
fix(gate): block untested-data-access via the shared policy engine#183veksen wants to merge 1 commit into
veksen wants to merge 1 commit into
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: "019f6e83-7bd6-77c5-aa11-6176a13ed686" }) · view run · docs
The test-presence gate flagged an unverified data-access change with a "Warning" callout while the check stayed green. A warning beside a green check is invisible to downstream reviewers — human or agent — who key on the check status, so the finding got silently dropped (Site#3541). Adopt the failure taxonomy (#3498) and policy engine (#3500) from @query-doctor/core instead of a local severity: resolveVerdict maps the verdict through conclusionForVerdict + policyFor, so untested-data-access concludes failure by default and fails the check. A repo can soften it to a non-blocking neutral (warn) or suppress it (off) via conditionPolicies, threaded from the repo config once Site sends it. The comment block drops the [!WARNING] heading: a blocking conclusion renders [!CAUTION], a softened one [!NOTE], framed as "could not verify", never "your query is broken". Rerun after a real-DB test is added or the queries are triaged still goes green, unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
veksen
force-pushed
the
fix-untested-data-access-gate
branch
from
July 17, 2026 05:18
a7436a0 to
57a8f00
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
The CI⇄MCP verdict loop (Query-Doctor/Site epic #3493) wants each condition's pass/fail to come from the shared taxonomy and policy, not each surface's own severity. This PR makes the analyzer's test-presence gate stop deciding its own severity and adopt
@query-doctor/core's taxonomy + policy engine. Closes Query-Doctor/Site#3541.What
Before: a PR that changed data-access code with no related real-DB test got a "Warning" callout and a green check. A warning beside a passing check is invisible to downstream reviewers — human or agent — who key on the check status, so the finding was silently dropped (documented on a live PR in the issue thread).
After: the same PR gets a failing check by default. The comment block loses its "Warning" heading — it renders
[!CAUTION]when blocking, framed as "could not verify", never "your query is broken". A repo can soften the gate to non-blocking (warn→[!NOTE], neutral) or suppress it (off); those are config, not the default. Adding a real-DB test or triaging the flagged queries and re-running still goes green, unchanged.How
Read in this order:
src/gate/policy.ts(new) —resolveVerdictmaps a gate verdict to its CI conclusion via core'sconclusionForVerdict(taxonomy #3498) +policyFor(policy #3500).uncertain-conservative-flagconcludesfailure;warncaps that at a surfaced-but-non-blockingneutral;offreports the condition as unsurfaced.src/main.ts— resolves the verdict before posting the report (sooffalso drops the comment block and the comment can render the right framing), then carries the conclusion into the check:core.setFailedonfailure,core.warningonneutral. Replaces the old always-core.warningpath.src/reporters/github/success.md.j2— drops[!WARNING]; an inline conditional picks[!CAUTION](blocking) or[!NOTE](softened) from the resolved conclusion, kept on one line so the GitHub callout stays contiguous.src/config.ts/src/reporters/reporter.ts—AnalyzerConfig.conditionPolicies(optional) carries per-repo overrides;ReportContext.testPresenceConclusiondrives the comment framing.Note:
conditionPoliciesis read from the repo config ("conditionPolicies" in config) and is empty until Site adds it toRepoConfig/getRepoConfig— an additive, non-breaking follow-up. Until then every repo gets the safe default (fail); the gate honours an override the moment it arrives.Scope note: this keeps the analyzer's inline
TestPresenceVerdict(a precursor to the fullCiVerdictcontract #3497) rather than migrating to it, so the change stays surgical. It uses the two functions the issue names directly rather thanevaluateRun, which would require the full contract.Tests
src/gate/policy.test.ts(new) —resolveVerdict: blocks by default (fail→failure), softens underwarn(→neutral, surfaced), suppresses underoff(unsurfaced), and keeps apassverdict green even underfail(proving the taxonomy, not a blanket fail, drives it).src/reporters/github/github.test.ts— the block renders[!CAUTION]for a blocking verdict and[!NOTE]for a softened one, and never[!WARNING].