feat(visual-review): worker scaffold + webhook/queue + D1/R2 - #757
feat(visual-review): worker scaffold + webhook/queue + D1/R2#757Helios531 wants to merge 8 commits into
Conversation
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
gittensory · advisory review Reviewed 12 changed file(s) — two independent AI reviewers. Changed files (12)
Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Suggestions
Worth double-checking
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
@JSONbored Could you plz review my PR? Thanks! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #757 +/- ##
==========================================
- Coverage 96.58% 96.58% -0.01%
==========================================
Files 98 102 +4
Lines 14196 14273 +77
Branches 5172 5196 +24
==========================================
+ Hits 13711 13785 +74
- Misses 105 107 +2
- Partials 380 381 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JSONbored
left a comment
There was a problem hiding this comment.
PR #757 — feat(visual-review): worker scaffold + webhook/queue + D1/R2
Verdict: REQUEST CHANGES
Resolves issue #578: FULLY
CI: All required checks green (validate, test 1/2, workers, mcp, ui, lint, security, codecov patch+project).
Highlights:
- Faithfully mirrors the submission-gate pattern: webhook intake records a queued D1 target on opted-in repos and enqueues a job; queue consumer drives queued->capturing with an optional R2 intake audit; per-repo opt-in (absence == disabled).
- Migration 0037 + schema match exactly (visual_review_targets with unique(repo,pr,head_sha) idempotency index; visual_review_settings). REVIEW_MARKER defined for the downstream comment writer.
- Correct fail-safety: webhook intake swallows+audits errors so it can never break submission-gate processing; pipeline transitions to failed and rethrows on real errors so existing queue/DLQ retries. R2 binding optional, degrades gracefully.
- "No screenshots yet" honored — parks at capturing with an audited capture-pending note. 19 strong unit tests (enablement, idempotent upsert, webhook gating, lifecycle, R2 write/failure/no-bucket).
Concerns / required changes:
- Lockfile/dep scope creep: package.json adds a ws override; package-lock.json churns ~3.9k lines — should be isolated.
- Minor: upsertVisualReviewTarget stores base ref into the baseSha column — harmless now but the name implies a SHA; align before the #582 diff step consumes it.
- Migration numbering collides with previous PRs - fix
Completeness vs issue: Fully satisfies #578 — opted-in visual-change PR detected, target recorded in D1 (queued->capturing->posted|failed), enqueued with DLQ, R2 bound for audit, REVIEW_MARKER defined, no screenshots yet. Only the dependency churn detracts.
Signed-off-by: Alexander Laurent <57456290+Helios531@users.noreply.github.com>
|
Just realized these are owner assigned - the overnight reviews should've flagged these and closed them, they're issues I'm personally working on. Closing this PR. |
Summary
Stands up the visual-review Worker skeleton for owner-led visual-change PR auto-review, mirroring the
submission-gatepattern: GitHub App webhook intake → enqueue → queue consumer, with D1 for review-target state and R2 for the intake audit log. Closes #578 (epic #577, roadmap #525).This lands the state plumbing only — no screenshots yet, per the acceptance criteria. Detection, render/capture, diff, and the managed comment ship in the child issues (#579–#584).
What's included:
src/visual/webhook.ts): on an opted-in repo, a non-draft PRopened/synchronize/reopenedevent records aqueuedtarget in D1 and enqueues avisual-reviewjob. Fully fail-safe — any error is swallowed + audited so it can never break submission-gate webhook processing.src/visual/pipeline.ts): drivesqueued → capturing, writes an R2 intake audit log (optional binding, degrades gracefully), and transitions tofailed+rethrows on a real error so the existing queue/DLQ retries instead of silently dropping.migrations/0037_visual_review_targets.sql,src/db/schema.ts,src/visual/targets.ts):visual_review_targets(one row per repo/PR/head SHA, lifecyclequeued → capturing → posted | failed, idempotent upsert) and per-repo opt-invisual_review_settings(absence of row == disabled).VISUAL_REVIEW_BUCKET(wrangler.jsonc,src/env.d.ts).REVIEW_MARKERmanaged-comment constant for the downstream comment writer (owner-led(visual-agent): R2 image hosting + managed PR comment #583).visual-reviewJobMessagetype and dispatch case (src/types.ts,src/queue/processors.ts).Related Issue
Closes: #578
Change Type
Real behavior proof
All commands run locally on this branch:
tsc --noEmit→ clean, no errors.vitest run test/unit/visual-review.test.ts→ 19/19 passed (enablement, target state, idempotency, webhook gating, fail-safe, pipeline lifecycle, R2 audit, marker).vitest run test/unit→ 1815/1815 passed, 126 files — no regressions from theprocessors.tsintegration.vitest run --config vitest.workers.config.ts→ 1/1 passed.wrangler d1 migrations apply gittensory --local→0037_visual_review_targets.sql✅, 6 commands executed successfully (migration is sequential and valid).wrangler deploy --dry-run→ Worker builds;env.VISUAL_REVIEW_BUCKET (gittensory-visual-review)R2 binding confirmed alongsideJOBSandDB.Validation
git diff --checknpm run actionlint(not run — no workflow files changed)npm run typechecknpm run test:coverage(rantest/unit+test:workers; full coverage gate is CI's job)npm run test:workers