feat(review): wire a live AI-vision caller for confirmed visual regressions - #4141
Merged
Conversation
…ssions Wires the deliberately-deferred #4111 follow-up: a route the pixel-diff pipeline already flagged changed now gets one more look from a real vision-capable BYOK model (Anthropic/OpenAI), publishing an advisory "visual_regression_finding" when it spots a genuine layout break. Strictly advisory -- can never become a gate blocker. Mirrors runAiReviewForAdvisory's own resolve-gate-call-parse shape as a new exported runVisualVisionForAdvisory function so it's directly unit-testable without driving the full webhook pipeline.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4141 +/- ##
=======================================
Coverage 93.71% 93.72%
=======================================
Files 385 385
Lines 36209 36240 +31
Branches 13266 13281 +15
=======================================
+ Hits 33934 33965 +31
Misses 1618 1618
Partials 657 657
🚀 New features to boost your workflow:
|
Contributor
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 Gittensory is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
16 tasks
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.
Summary
src/review/visual/visual-findings.tsalready shipped the gating/prompt/parse logic but explicitly deferred a live caller — this PR is that caller.runVisualVisionForAdvisoryinsrc/queue/processors.ts, called right after the visual-capture block (independent try/catch, so a vision failure can never affect the "Visual preview" section that block already rendered): resolves submitter reputation + the maintainer's BYOK provider key (mirrorsrunAiReviewForAdvisory's own resolution, same re-resolve-per-caller convention), runsevaluateVisualVisionGate, fetches the before/after PNGs for the routes it selects, and calls the real BYOK vision provider (Anthropic/OpenAI). A parsed finding becomes an advisoryvisual_regression_finding— strictly advisory, can never become a gate blocker (see the file's own header).fetchShotContentBlockinsrc/review/visual/capture.ts— fetches an already-captured shot URL and returns it as anAiContentBlock, degrading toundefinedon any failure so one broken image never sinks the call.base64Encodehelper fromsrc/utils/crypto.tsfor reuse rather than duplicating byte→base64 logic.maybePublishPrPublicSurface) specifically so it's directly unit-testable without driving the full webhook pipeline — see the newtest/unit/visual-vision-wiring.test.ts.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coverage— 100% branch/line on every changed hunk in all 3 touchedsrc/**files (verified via scoped--coverage.includeruns before and after adding tests)npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderate— 0 vulnerabilitiesnpm run test:ci) green end-to-end: 11,920 tests passed, 0 failed.Safety
Notes
shot.ts's own#4109comment already explicitly considered and rejected widening to a 3rd viewport by default (50% render-cost increase for every repo, every review), in favor of a future per-repo opt-in if ever needed. Out of scope here.