@@ -71,6 +71,7 @@ import {
7171 usesSharedAutomergeStatus ,
7272} from "../../dist/repair/comment-router-core.js" ;
7373import { CLAWSWEEPER_CO_AUTHOR_TRAILER } from "../../dist/repair/co-author-credit.js" ;
74+ import { issueSourceRevisionSha256 } from "../../dist/repair/issue-source-guard.js" ;
7475import { parseSimpleYaml , validateJob } from "../../dist/repair/lib.js" ;
7576
7677test ( "planCommandAckConvergence scopes duplicate cleanup to the current status marker" , ( ) => {
@@ -1424,6 +1425,68 @@ test("trusted close gates block protected labels, source drift, and unsupported
14241425 } ;
14251426
14261427 assert . equal ( trustedCloseBlockReason ( base ) , null ) ;
1428+ const reviewedIssue = {
1429+ title : "Close duplicate PR" ,
1430+ body : "Superseded by the canonical fix." ,
1431+ labels : [ { name : "bug" } ] ,
1432+ } ;
1433+ const reviewedRevision = issueSourceRevisionSha256 ( reviewedIssue , [ ] ) ;
1434+ const advisoryLabelRevision = issueSourceRevisionSha256 (
1435+ {
1436+ ...reviewedIssue ,
1437+ labels : [
1438+ ...reviewedIssue . labels ,
1439+ { name : "status: ⏳ waiting on author" } ,
1440+ { name : "rating: 🧂 unranked krab" } ,
1441+ { name : "proof: sufficient" } ,
1442+ { name : "merge-risk: 🚨 automation" } ,
1443+ { name : "P1" } ,
1444+ ] ,
1445+ } ,
1446+ [ ] ,
1447+ ) ;
1448+ const userLabelRevision = issueSourceRevisionSha256 (
1449+ { ...reviewedIssue , labels : [ ...reviewedIssue . labels , { name : "needs-design" } ] } ,
1450+ [ ] ,
1451+ ) ;
1452+ assert . equal ( advisoryLabelRevision , reviewedRevision ) ;
1453+ assert . notEqual ( userLabelRevision , reviewedRevision ) ;
1454+ assert . equal (
1455+ trustedCloseBlockReason ( {
1456+ ...base ,
1457+ expectedSourceRevision : reviewedRevision ,
1458+ currentSourceRevision : advisoryLabelRevision ,
1459+ currentItemUpdatedAt : "2026-06-25T22:07:00Z" ,
1460+ sourceCommentId : "123" ,
1461+ comments : [
1462+ {
1463+ id : "123" ,
1464+ user : { login : "clawsweeper[bot]" } ,
1465+ created_at : "2026-06-25T22:05:00Z" ,
1466+ updated_at : "2026-06-25T22:07:00Z" ,
1467+ } ,
1468+ ] ,
1469+ } ) ,
1470+ null ,
1471+ ) ;
1472+ assert . match (
1473+ trustedCloseBlockReason ( {
1474+ ...base ,
1475+ expectedSourceRevision : reviewedRevision ,
1476+ currentSourceRevision : userLabelRevision ,
1477+ currentItemUpdatedAt : "2026-06-25T22:07:00Z" ,
1478+ sourceCommentId : "123" ,
1479+ comments : [
1480+ {
1481+ id : "123" ,
1482+ user : { login : "clawsweeper[bot]" } ,
1483+ created_at : "2026-06-25T22:05:00Z" ,
1484+ updated_at : "2026-06-25T22:07:00Z" ,
1485+ } ,
1486+ ] ,
1487+ } ) ,
1488+ / s o u r c e i s s u e \/ P R c h a n g e d s i n c e t r u s t e d c l o s e r e v i e w / ,
1489+ ) ;
14271490 assert . equal (
14281491 trustedCloseBlockReason ( { ...base , labels : [ "release-blocker" ] } ) ,
14291492 "protected label: release-blocker" ,
0 commit comments