@@ -1183,6 +1183,16 @@ export function createApplyDecisionWorkflow(dependencies: CreateApplyDecisionWor
11831183 state === "open" && item . kind === "pull_request"
11841184 ? stalePullRequestReviewHead ( markdown , currentItemContext ( ) )
11851185 : null ;
1186+ const guardedReviewAction = isGuardedApplyReviewAction ( action , isLiveRecheckGuardClose ) ;
1187+ const markReviewedSourceDrift = ( ) =>
1188+ markChangedSinceReview ( {
1189+ ...applyReviewedSourceDriftEvidence ( dependencies , {
1190+ currentItemContext,
1191+ item,
1192+ storedUpdatedAt,
1193+ } ) ,
1194+ preserveAction : guardedReviewAction ? action : undefined ,
1195+ } ) ;
11861196 let currentPrStatusKind : PrStatusLabelKind | null = null ;
11871197 let lockedMetadataOnly = false ;
11881198 if ( state === "open" ) {
@@ -1240,17 +1250,12 @@ export function createApplyDecisionWorkflow(dependencies: CreateApplyDecisionWor
12401250 continue ;
12411251 }
12421252 }
1243- if ( lockedIssueReason && isCloseProposal && ! reviewedSourceFresh ( ) ) {
1244- if (
1245- markChangedSinceReview (
1246- applyReviewedSourceDriftEvidence ( dependencies , {
1247- currentItemContext,
1248- item,
1249- storedUpdatedAt,
1250- } ) ,
1251- )
1252- )
1253- break ;
1253+ if (
1254+ lockedIssueReason &&
1255+ ( isCloseProposal || guardedReviewAction ) &&
1256+ ! reviewedSourceFresh ( )
1257+ ) {
1258+ if ( markReviewedSourceDrift ( ) ) break ;
12541259 continue ;
12551260 }
12561261 if ( needsLockedCommentMutation ) {
@@ -1263,7 +1268,8 @@ export function createApplyDecisionWorkflow(dependencies: CreateApplyDecisionWor
12631268 currentItemContext,
12641269 dryRun,
12651270 item,
1266- labelSyncFreshEnough,
1271+ labelSyncFreshEnough : ( ) =>
1272+ labelSyncFreshEnough ( ) && ( ! guardedReviewAction || reviewedSourceFresh ( ) ) ,
12671273 markdown,
12681274 number,
12691275 onMutation : recordMutation ,
@@ -1278,6 +1284,53 @@ export function createApplyDecisionWorkflow(dependencies: CreateApplyDecisionWor
12781284 if ( clawSweeperLabelsChanged && ! dryRun ) {
12791285 rememberSelfMutationUpdatedAt ( ) ;
12801286 }
1287+ if (
1288+ state === "open" &&
1289+ isCloseProposal &&
1290+ applyBlockingProtectedLabels ( item . labels , closeReason ) . length > 0
1291+ ) {
1292+ if (
1293+ markApplySkipped (
1294+ "skipped_protected_label" ,
1295+ applyProtectedLabelReason ( item . labels , closeReason ) ,
1296+ true ,
1297+ )
1298+ )
1299+ break ;
1300+ continue ;
1301+ }
1302+ const currentAuthorAssociation = normalizeAuthorAssociation ( item . authorAssociation ) ;
1303+ const reviewedAuthorAssociation = normalizeAuthorAssociation ( storedAuthorAssociation ) ;
1304+ if (
1305+ isCloseProposal &&
1306+ ! isVerifiedFixedCloseReason ( closeReason ) &&
1307+ ( isMaintainerAuthorAssociation ( currentAuthorAssociation ) ||
1308+ isMaintainerAuthorAssociation ( reviewedAuthorAssociation ) )
1309+ ) {
1310+ const authorAssociation = isMaintainerAuthorAssociation ( currentAuthorAssociation )
1311+ ? currentAuthorAssociation
1312+ : reviewedAuthorAssociation ;
1313+ markdown = replaceFrontMatterValue ( markdown , "author_association" , authorAssociation ) ;
1314+ markdown = replaceFrontMatterValue ( markdown , "action_taken" , "skipped_maintainer_authored" ) ;
1315+ if (
1316+ recordApplySkipped (
1317+ "skipped_maintainer_authored" ,
1318+ `author association is ${ authorAssociation } ` ,
1319+ true ,
1320+ )
1321+ )
1322+ break ;
1323+ continue ;
1324+ }
1325+ if (
1326+ state === "open" &&
1327+ ( isCloseProposal || guardedReviewAction ) &&
1328+ ! stalePrReviewHead &&
1329+ ! reviewedSourceFresh ( )
1330+ ) {
1331+ if ( markReviewedSourceDrift ( ) ) break ;
1332+ continue ;
1333+ }
12811334 const renderOptions : ReviewCommentRenderOptions = {
12821335 prStatusKind : currentPrStatusKind ,
12831336 previousLabels,
@@ -1304,36 +1357,6 @@ export function createApplyDecisionWorkflow(dependencies: CreateApplyDecisionWor
13041357 reviewComment = renderCurrentReviewComment ( ) ;
13051358 }
13061359 let markedReviewComment = markedReviewCommentForApply ( reviewComment ) ;
1307- const protectedApplyReason = applyProtectedLabelReason ( item . labels , closeReason ) ;
1308- if ( applyBlockingProtectedLabels ( item . labels , closeReason ) . length > 0 ) {
1309- if ( isCloseProposal ) {
1310- if ( markApplySkipped ( "skipped_protected_label" , protectedApplyReason , true ) ) break ;
1311- }
1312- if ( isCloseProposal ) continue ;
1313- }
1314- const currentAuthorAssociation = normalizeAuthorAssociation ( item . authorAssociation ) ;
1315- const reviewedAuthorAssociation = normalizeAuthorAssociation ( storedAuthorAssociation ) ;
1316- if (
1317- isCloseProposal &&
1318- ! isVerifiedFixedCloseReason ( closeReason ) &&
1319- ( isMaintainerAuthorAssociation ( currentAuthorAssociation ) ||
1320- isMaintainerAuthorAssociation ( reviewedAuthorAssociation ) )
1321- ) {
1322- const authorAssociation = isMaintainerAuthorAssociation ( currentAuthorAssociation )
1323- ? currentAuthorAssociation
1324- : reviewedAuthorAssociation ;
1325- markdown = replaceFrontMatterValue ( markdown , "author_association" , authorAssociation ) ;
1326- markdown = replaceFrontMatterValue ( markdown , "action_taken" , "skipped_maintainer_authored" ) ;
1327- if (
1328- recordApplySkipped (
1329- "skipped_maintainer_authored" ,
1330- `author association is ${ authorAssociation } ` ,
1331- true ,
1332- )
1333- )
1334- break ;
1335- continue ;
1336- }
13371360 const { postProofCoveringPrFreshnessBlock, postProofFreshnessBlock } =
13381361 createApplyProofFreshnessGuards ( {
13391362 ...dependencies ,
@@ -1407,19 +1430,6 @@ export function createApplyDecisionWorkflow(dependencies: CreateApplyDecisionWor
14071430 break ;
14081431 continue ;
14091432 }
1410- if ( isCloseProposal && ! reviewedSourceFresh ( ) ) {
1411- if (
1412- markChangedSinceReview (
1413- applyReviewedSourceDriftEvidence ( dependencies , {
1414- currentItemContext,
1415- item,
1416- storedUpdatedAt,
1417- } ) ,
1418- )
1419- )
1420- break ;
1421- continue ;
1422- }
14231433 const labelsCanSync = ! lockedMetadataOnly && ! stalePrReviewHead && labelSyncFreshEnough ( ) ;
14241434 const complete = frontMatterValue ( markdown , "review_status" ) === "complete" && labelsCanSync ;
14251435 const reportLabelSync = syncApplyReportLabels ( dependencies , {
@@ -1483,14 +1493,15 @@ export function createApplyDecisionWorkflow(dependencies: CreateApplyDecisionWor
14831493 / ^ (?: n o n e | u n k n o w n ) ? $ / . test ( frontMatterValue ( markdown , "review_comment_id" ) ?? "" ) ||
14841494 / ^ (?: n o n e | u n k n o w n ) ? $ / . test ( frontMatterValue ( markdown , "review_comment_url" ) ?? "" ) ;
14851495 const guarded =
1486- isGuardedApplyReviewAction ( action , isLiveRecheckGuardClose ) &&
1496+ guardedReviewAction &&
14871497 reviewedSourceFresh ( ) &&
14881498 ! stalePrReviewHead ;
14891499 let needsReviewCommentSync = shouldSyncReviewComment ( {
14901500 syncCommentsOnly,
14911501 isCloseProposal,
14921502 commentSyncMinAgeDays,
14931503 reviewCommentSyncedAt : frontMatterValue ( markdown , "review_comment_synced_at" ) ,
1504+ reviewCommentVerifiedAt : frontMatterValue ( markdown , "review_comment_checked_at" ) ,
14941505 reviewedAt : frontMatterValue ( markdown , "reviewed_at" ) ,
14951506 lastFullReviewAt : frontMatterValue ( markdown , "last_full_review_at" ) ,
14961507 guardedReviewedAt : guarded ? frontMatterValue ( markdown , "apply_checked_at" ) : undefined ,
0 commit comments