fix(miner): add blocked_own_open_pr to the AttemptCliResult union (#9331) - #9384
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
runAttempt builds and casts a blocked_own_open_pr result (the JSONbored#8808 idempotency guard) but AttemptCliResult's union had no matching member, so loop-cli.ts's re-exported AttemptCliResult["outcome"] drifted from the real runtime outcome. Add the member with duplicateResult's exact shape (CommonAttemptResultFields + reason + existingPullRequestNumber). The as-AttemptCliResult cast stays: tsc confirms it is still required because the object literal's outcome widens to string, identical to every sibling result cast site (including in-union outcomes like dry_run). Adds a compile-time guard test asserting the outcome is assignable without a cast, so the .d.ts drift cannot silently return.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9384 +/- ##
==========================================
+ Coverage 75.38% 75.50% +0.12%
==========================================
Files 275 276 +1
Lines 58023 58314 +291
Branches 6181 6278 +97
==========================================
+ Hits 43739 44030 +291
Misses 14014 14014
Partials 270 270
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-27 15:35:38 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionPartially addressed 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.
|
Problem
Closes #9331.
runAttemptinpackages/loopover-miner/lib/attempt-cli.tsbuilds ablocked_own_open_prresult object (the #8808 crash-retry idempotency guard) and casts it toAttemptCliResult, but the exportedAttemptCliResultunion had noblocked_own_open_prmember. Sinceloop-cli.tsre-exposesAttemptCliResult["outcome"], this is real.d.tsdrift.Fix
Add a
blocked_own_open_prmember with the exact field shape of the realduplicateResultobject:CommonAttemptResultFields(already coveringrepoFullName,issueNumber,minerLogin,base,mode,attemptId) plusreason: stringandexistingPullRequestNumber: number.The
as AttemptCliResultcast at the call site is kept — verified viatsc: theconst duplicateResult = { outcome: "blocked_own_open_pr", … }object literal widensoutcometostring, which is not assignable without the cast. This is the uniform pattern at every sibling result site, including in-union outcomes likedry_run.Test
Adds a compile-time guard in
test/unit/miner-attempt-cli.test.ts: anAttemptCliResultvalue with the exactblocked_own_open_prshape is assignable without a cast, so removing the union member makes it a type error and the drift can't silently return.