@@ -13,6 +13,7 @@ import {
1313 HUMAN_REVIEW_LABEL ,
1414 MANUAL_ONLY_LABEL ,
1515} from "./repair/exact-review-guard-labels.js" ;
16+ import type { AttachedLiveVerification } from "./live-proof/verification.js" ;
1617import type {
1718 FeatureShowcase ,
1819 FeatureShowcaseStatus ,
@@ -33,6 +34,7 @@ interface LabelPolicyDependencies {
3334 frontMatterValue : ( markdown : string , key : string ) => string | undefined ;
3435 isAutomationReportAuthor : ( author : string | undefined ) => boolean ;
3536 mergeRiskOptionsFromReport : ( markdown : string ) => MergeRiskOption [ ] ;
37+ reportAttachedLiveVerification : ( markdown : string ) => AttachedLiveVerification ;
3638 reportOverallCorrectness : ( markdown : string ) => OverallCorrectness ;
3739 reportRealBehaviorProof : ( markdown : string ) => RealBehaviorProof ;
3840 reportReviewFindings : ( markdown : string ) => ReviewFinding [ ] ;
@@ -46,6 +48,7 @@ export function createLabelPolicy({
4648 frontMatterValue,
4749 isAutomationReportAuthor,
4850 mergeRiskOptionsFromReport,
51+ reportAttachedLiveVerification,
4952 reportOverallCorrectness,
5053 reportRealBehaviorProof,
5154 reportReviewFindings,
@@ -124,12 +127,18 @@ export function createLabelPolicy({
124127 } ) ;
125128 }
126129
127- function proofNeedsContributorAction ( proof : Pick < RealBehaviorProof , "status" > ) : boolean {
130+ function proofIsUnresolved ( proof : Pick < RealBehaviorProof , "status" > ) : boolean {
128131 return (
129132 proof . status === "missing" || proof . status === "mock_only" || proof . status === "insufficient"
130133 ) ;
131134 }
132135
136+ function proofNeedsContributorAction (
137+ proof : Pick < RealBehaviorProof , "status" | "needsContributorAction" > ,
138+ ) : boolean {
139+ return proofIsUnresolved ( proof ) && proof . needsContributorAction ;
140+ }
141+
133142 function hasBlockingReviewFindings (
134143 findings : readonly Pick < ReviewFinding , "priority" > [ ] ,
135144 ) : boolean {
@@ -151,7 +160,7 @@ export function createLabelPolicy({
151160 }
152161
153162 function hasUnresolvedContributorWork ( options : {
154- realBehaviorProof : Pick < RealBehaviorProof , "status" > ;
163+ realBehaviorProof : Pick < RealBehaviorProof , "status" | "needsContributorAction" > ;
155164 reviewFindings : readonly Pick < ReviewFinding , "priority" > [ ] ;
156165 securityReview : Pick < SecurityReview , "status" > ;
157166 mergeRiskOptions : readonly Pick < MergeRiskOption , "category" | "recommended" > [ ] ;
@@ -166,7 +175,7 @@ export function createLabelPolicy({
166175 }
167176
168177 function isReadyForMaintainerLook ( options : {
169- realBehaviorProof : Pick < RealBehaviorProof , "status" > ;
178+ realBehaviorProof : Pick < RealBehaviorProof , "status" | "needsContributorAction" > ;
170179 reviewFindings : readonly Pick < ReviewFinding , "priority" > [ ] ;
171180 securityReview : Pick < SecurityReview , "status" > ;
172181 mergeRiskOptions : readonly Pick < MergeRiskOption , "category" | "recommended" > [ ] ;
@@ -183,7 +192,7 @@ export function createLabelPolicy({
183192 }
184193
185194 function prStatusLabelKind ( options : {
186- realBehaviorProof : Pick < RealBehaviorProof , "status" > ;
195+ realBehaviorProof : Pick < RealBehaviorProof , "status" | "needsContributorAction" > ;
187196 reviewFindings : readonly Pick < ReviewFinding , "priority" > [ ] ;
188197 securityReview : Pick < SecurityReview , "status" > ;
189198 mergeRiskOptions : readonly Pick < MergeRiskOption , "category" | "recommended" > [ ] ;
@@ -195,11 +204,12 @@ export function createLabelPolicy({
195204 } ) : PrStatusLabelKind | null {
196205 const unresolvedWork = hasUnresolvedContributorWork ( options ) ;
197206 if ( options . hasRepairLoopPauseLabel ) return null ;
198- if ( options . hasAutomergeLabel ) return "automerge_armed" ;
199207 if ( options . hasRecentReReviewRequest ) return "re_review_loop" ;
200208 if ( options . hasRecentAuthorActivity && unresolvedWork ) return "actively_grinding" ;
201209 if ( proofNeedsContributorAction ( options . realBehaviorProof ) ) return "needs_proof" ;
210+ if ( proofIsUnresolved ( options . realBehaviorProof ) ) return "needs_maintainer_proof_decision" ;
202211 if ( unresolvedWork ) return "waiting_on_author" ;
212+ if ( options . hasAutomergeLabel ) return "automerge_armed" ;
203213 if ( isReadyForMaintainerLook ( options ) ) return "ready_for_maintainer_look" ;
204214 return null ;
205215 }
@@ -298,8 +308,14 @@ export function createLabelPolicy({
298308 currentLabels : readonly string [ ] ,
299309 ) : PrStatusLabelKind | null {
300310 if ( frontMatterValue ( markdown , "type" ) !== "pull_request" ) return null ;
311+ const proof = reportRealBehaviorProof ( markdown ) ;
312+ const attached = reportAttachedLiveVerification ( markdown ) ;
313+ const statusProof =
314+ attached . status === "failed" && attached . result . failure ?. phase === "execution"
315+ ? { status : "insufficient" as const , needsContributorAction : false }
316+ : proof ;
301317 return prStatusLabelKind ( {
302- realBehaviorProof : reportRealBehaviorProof ( markdown ) ,
318+ realBehaviorProof : statusProof ,
303319 reviewFindings : reportReviewFindings ( markdown ) ,
304320 securityReview : reportSecurityReview ( markdown ) ,
305321 mergeRiskOptions : mergeRiskOptionsFromReport ( markdown ) ,
@@ -323,6 +339,7 @@ export function createLabelPolicy({
323339 isPullRequest ?: boolean ;
324340 nextSteps ?: readonly string [ ] ;
325341 proofStatus ?: string ;
342+ needsContributorAction ?: boolean ;
326343 findingPriorities ?: readonly number [ ] ;
327344 securityStatus ?: string ;
328345 mergeRiskOptions ?: readonly Pick < MergeRiskOption , "category" | "recommended" > [ ] ;
@@ -351,6 +368,9 @@ export function createLabelPolicy({
351368 status : REAL_BEHAVIOR_PROOF_STATUSES . has ( options . proofStatus as RealBehaviorProofStatus )
352369 ? ( options . proofStatus as RealBehaviorProofStatus )
353370 : "not_applicable" ,
371+ needsContributorAction :
372+ options . needsContributorAction ??
373+ [ "missing" , "mock_only" , "insufficient" ] . includes ( options . proofStatus ?? "" ) ,
354374 } ,
355375 reviewFindings : ( options . findingPriorities ?? [ ] )
356376 . filter ( ( priority ) : priority is 0 | 1 | 2 | 3 => [ 0 , 1 , 2 , 3 ] . includes ( priority ) )
0 commit comments