fix(visual): only mark capture structurally-unobtainable on a proven, not a failed, read - #10129
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-31 08:31:04 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
… not a failed, read previewUnobtainable (JSONbored#9881) records a PROVEN fact — the deployments read succeeded, the check-run read succeeded and found no preview build at all, and the poll budget is spent — and the screenshot-table gate degrades its CLOSE to advisory on it. But getPreviewBuildState returns "absent" on ANY read failure (fail-safe), and getLatestDeploymentStatus reports a non-404 failure as { error: true }. So a transient GitHub read failure was recorded as "this repo has no preview pipeline", degrading the gate on evidence the bot never actually obtained. getPreviewBuildState now returns a distinct "unreadable" on a thrown read (still a value — the never-infinite-poll contract holds — but distinguishable from a genuine empty read). buildCapture treats "unreadable" exactly like "absent" for polling/previewFailed, tracks whether getLatestDeploymentStatus reported error:true (or threw), and sets previewUnobtainable only when the check-run read genuinely succeeded empty AND the deployments read succeeded. Poll budget, previewPending/previewFailed/renderFailed for the both-reads-succeeded cases, and the gate/repository writer are byte-identical. Closes JSONbored#10059
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10129 +/- ##
===========================================
- Coverage 91.95% 79.90% -12.05%
===========================================
Files 931 284 -647
Lines 113921 59105 -54816
Branches 27504 8829 -18675
===========================================
- Hits 104757 47230 -57527
- Misses 7863 11574 +3711
+ Partials 1301 301 -1000
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Summary
previewUnobtainable/visual_capture_unobtainable_sha(#9881) records a proven fact — its migration and both JSDoc contracts say so: "the deployments read succeeded, reported no deployment whatsoever (not a failed one, not an API error), and the poll budget is spent." The screenshot-table gate degrades its CLOSE to advisory on it. But the code never enforced that:getPreviewBuildStatereturns"absent"on any read failure (preview-url.ts:334, fail-safe: never infinite-poll), andgetLatestDeploymentStatusreports a non-404 failure (403 / rate-limit / 5xx) as{ error: true }, whichbuildCaptureignored.So a transient GitHub read failure was recorded as "this repo has no preview pipeline", degrading the gate on evidence the bot never actually obtained.
Fix
getPreviewBuildStatereturns a new"unreadable"union member on a thrown read (its outer catch) — still a value, so the never-infinite-poll contract is preserved, but distinguishable from"absent"(a read that succeeded and found no build, which stays"absent"). Doc updated.buildCapturetreats"unreadable"exactly like"absent"for polling /previewFailed(poll count unchanged), tracks whethergetLatestDeploymentStatusreportederror: true(or threw), and setspreviewUnobtainable = trueonly when the check-run read genuinely succeeded empty ("absent") and the deployments read succeeded.markPullRequestVisualCaptureUnobtainable, the gate evaluator, the poll budget, andpreviewPending/previewFailed/renderFailedfor every both-reads-succeeded case are byte-identical.Tests
Added to
test/unit/visual-capture.test.ts: a rejecting check-runs read at an exhausted budget →previewUnobtainable: false,previewPending: false; a succeeding-empty check-runs read at an exhausted budget →previewUnobtainable: true(#9881 pinned); a rejecting deployments read with a succeeding-empty check-runs read →previewUnobtainable: false; and a sustained read failure across the whole budget → nevertrue.test/unit/preview-url.test.ts: a later-page read failure now yields"unreadable", a completed empty read stays"absent".The read-failure cases fail against the current
"absent"-on-any-error code. Coverage of the changed lines is complete.Closes #10059