@@ -2077,14 +2077,18 @@ test("apply workflow isolates proof Codex and keeps mutation free of Git recover
20772077 assert . match ( applyJob , / q u e u e : m a x / ) ;
20782078} ) ;
20792079
2080- test ( "comment-only proof preparation never scans the full target repository" , ( ) => {
2080+ test ( "comment-only apply preparation never scans the full target repository" , ( ) => {
20812081 const workflow = YAML . parse ( readText ( ".github/workflows/sweep.yml" ) ) as {
20822082 jobs : Record < string , { steps : Array < { name ?: string ; if ?: string ; run ?: string } > } > ;
20832083 } ;
20842084 const steps = workflow . jobs [ "apply-proof" ] ! . steps ;
20852085 const reconcile = steps . find ( ( step ) => step . name === "Reconcile read-only proof inputs" ) ;
2086+ const applyReconcile = workflow . jobs [ "apply-existing" ] ! . steps . find (
2087+ ( step ) => step . name === "Reconcile before apply preselect" ,
2088+ ) ;
20862089 const select = steps . find ( ( step ) => step . name === "Select bounded coverage proof work" ) ;
20872090 assert . ok ( reconcile ?. if , "proof reconciliation must explicitly exclude comment-only runs" ) ;
2091+ assert . equal ( applyReconcile ?. if , reconcile . if , "apply preselect must use the same skip gate" ) ;
20882092 assert . ok ( select ?. run , "proof selection must recognize scheduled comment-only maintenance" ) ;
20892093
20902094 const expression = reconcile . if . replace ( / ^ \$ \{ \{ \s * | \s * \} \} $ / g, "" ) ;
@@ -2114,6 +2118,38 @@ test("comment-only proof preparation never scans the full target repository", ()
21142118 assert . match ( select . run , / s y n c _ c o m m e n t s _ o n l y = " t r u e " / ) ;
21152119} ) ;
21162120
2121+ test ( "comment-only apply reconciliation scopes only selected items" , ( ) => {
2122+ const reconcileArgs = ( itemNumbers : string , syncCommentsOnly : boolean ) =>
2123+ execFileSync (
2124+ "bash" ,
2125+ [
2126+ "-lc" ,
2127+ [
2128+ "source scripts/apply-workflow-helpers.sh" ,
2129+ 'TARGET_REPO="openclaw/openclaw"' ,
2130+ `item_numbers="${ itemNumbers } "` ,
2131+ `sync_comments_only=${ syncCommentsOnly } ` ,
2132+ "sync_open_pr_batch=false" ,
2133+ "prepare_apply_reconciliation_args" ,
2134+ 'printf "%s\\n" "${reconcile_args[@]}"' ,
2135+ ] . join ( "\n" ) ,
2136+ ] ,
2137+ { encoding : "utf8" } ,
2138+ )
2139+ . trimEnd ( )
2140+ . split ( "\n" ) ;
2141+ const baseArgs = [ "--target-repo" , "openclaw/openclaw" , "--skip-closed-at" ] ;
2142+
2143+ assert . deepEqual ( reconcileArgs ( "119890" , true ) , [
2144+ ...baseArgs ,
2145+ "--item-numbers" ,
2146+ "119890" ,
2147+ "--only-item-numbers" ,
2148+ ] ) ;
2149+ assert . deepEqual ( reconcileArgs ( "119890" , false ) , [ ...baseArgs , "--item-numbers" , "119890" ] ) ;
2150+ assert . deepEqual ( reconcileArgs ( "" , true ) , baseArgs ) ;
2151+ } ) ;
2152+
21172153test ( "apply workflow scopes cursor reconciliation and publishes close reconciliation before idle" , ( ) => {
21182154 const workflow = readText ( ".github/workflows/sweep.yml" ) ;
21192155 const applyJob = workflow . slice ( workflow . indexOf ( "\n apply-existing:" ) ) ;
@@ -4942,12 +4978,14 @@ test("sweep workflow coalesces durable issue and PR comment sync batches", () =>
49424978 assert . doesNotMatch ( backgroundSync , / - f a p p l y _ i t e m _ n u m b e r s = " \$ i t e m _ n u m b e r s " / ) ;
49434979 assert . match (
49444980 cursorPreselect ,
4945- / i f \[ " \$ i t e m _ n u m b e r s " = " _ _ c u r s o r _ _ " \] ; t h e n \s + i f \[ " \$ \ {\{ g i t h u b \. e v e n t \. i n p u t s \. a p p l y _ s y n c _ c o m m e n t s _ o n l y \| \| ' f a l s e ' \} \} " = " t r u e " \] ; t h e n \s + e c h o " D e f e r r i n g r e c o n c i l i a t i o n u n t i l t h e b o u n d e d c o m m e n t - s y n c c u r s o r i s s e l e c t e d \. " \s + e x i t 0 / ,
4981+ / i f : \$ \ {\{ . * g i t h u b \. e v e n t \. i n p u t s \. a p p l y _ s y n c _ c o m m e n t s _ o n l y = = ' t r u e ' \| \| g i t h u b \. e v e n t \. i n p u t s \. a p p l y _ i t e m _ n u m b e r s = = ' _ _ c u r s o r _ _ ' . * \} \} / ,
49464982 ) ;
4947- assert . match (
4948- cursorPreselect ,
4949- / i f \[ " \$ \{ \{ g i t h u b \. e v e n t _ n a m e = = ' s c h e d u l e ' & & g i t h u b \. e v e n t \. s c h e d u l e = = ' 6 , 2 1 , 3 6 , 5 1 \* \* \* \* ' & & ' t r u e ' \| \| ' f a l s e ' \} \} " = " t r u e " \] ; t h e n \s + e c h o " D e f e r r i n g r e c o n c i l i a t i o n u n t i l t h e b o u n d e d c o m m e n t - s y n c c u r s o r i s s e l e c t e d \. " \s + e x i t 0 / ,
4950- "scheduled comment maintenance must never scan or reconcile the entire repository before selecting its batch" ,
4983+ assert . doesNotMatch ( cursorPreselect , / D e f e r r i n g r e c o n c i l i a t i o n / ) ;
4984+ assert . ok (
4985+ cursorExecution . indexOf (
4986+ `sync_comments_only="\${{ github.event_name == 'workflow_dispatch' && github.event.inputs.apply_sync_comments_only || 'false' }}"` ,
4987+ ) < cursorExecution . indexOf ( "prepare_apply_reconciliation_args" ) ,
4988+ "comment-only mode must be known before execution reconciliation is prepared" ,
49514989 ) ;
49524990 assert . ok (
49534991 cursorExecution . indexOf ( 'echo "Selected cursor-based comment sync batch: $item_numbers"' ) <
@@ -4957,8 +4995,8 @@ test("sweep workflow coalesces durable issue and PR comment sync batches", () =>
49574995 assert . match ( cursorExecution , / p r e p a r e _ a p p l y _ r e c o n c i l i a t i o n _ a r g s / ) ;
49584996 assert . match (
49594997 readText ( "scripts/apply-workflow-helpers.sh" ) ,
4960- / i f \[ " \$ \{ s y n c _ c o m m e n t s _ o n l y : - f a l s e \} " = " t r u e " \] & & \s + \[ " \$ \{ s y n c _ o p e n _ p r _ b a t c h : - f a l s e \} " = " t r u e " \] ; t h e n \s + r e c o n c i l e _ a r g s \+ = \( - - o n l y - i t e m - n u m b e r s \) / ,
4961- "cursor reconciliation must not archive or rewrite unrelated durable records" ,
4998+ / i f \[ " \$ \{ s y n c _ c o m m e n t s _ o n l y : - f a l s e \} " = " t r u e " \] ; t h e n \s + r e c o n c i l e _ a r g s \+ = \( - - o n l y - i t e m - n u m b e r s \) / ,
4999+ "comment-only reconciliation must not archive or rewrite unrelated durable records" ,
49625000 ) ;
49635001} ) ;
49645002
0 commit comments