@@ -97,6 +97,51 @@ test("plan-cluster hydrates the repository default branch instead of hard-coding
9797 } ) ;
9898} ) ;
9999
100+ test ( "plan-cluster offline mode does not pretend the default branch is main" , ( ) => {
101+ const tmp = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "clawsweeper-plan-offline-default-" ) ) ;
102+ const jobPath = path . join ( tmp , "job.md" ) ;
103+ const runDir = path . join ( tmp , "run" ) ;
104+
105+ fs . writeFileSync (
106+ jobPath ,
107+ [
108+ "---" ,
109+ "repo: openclaw/openclaw" ,
110+ "cluster_id: issue-implementation-openclaw-openclaw-74134" ,
111+ "mode: autonomous" ,
112+ "allowed_actions:" ,
113+ " - comment" ,
114+ "canonical:" ,
115+ " - #74134" ,
116+ "candidates:" ,
117+ " - #74134" ,
118+ "allow_fix_pr: false" ,
119+ "security_policy: central_security_only" ,
120+ "security_sensitive: false" ,
121+ "---" ,
122+ "Plan this item." ,
123+ "" ,
124+ ] . join ( "\n" ) ,
125+ ) ;
126+
127+ execFileSync (
128+ process . execPath ,
129+ [ "dist/repair/plan-cluster.js" , jobPath , "--run-dir" , runDir , "--offline" ] ,
130+ {
131+ cwd : process . cwd ( ) ,
132+ stdio : "pipe" ,
133+ } ,
134+ ) ;
135+
136+ const clusterPlan = JSON . parse ( fs . readFileSync ( path . join ( runDir , "cluster-plan.json" ) , "utf8" ) ) ;
137+ assert . deepEqual ( clusterPlan . main , {
138+ name : "unknown" ,
139+ sha : null ,
140+ url : "https://github.com/openclaw/openclaw" ,
141+ note : "offline mode did not fetch current default branch" ,
142+ } ) ;
143+ } ) ;
144+
100145test ( "plan-cluster allows security repair for adopted PR autofix jobs" , ( ) => {
101146 const tmp = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "clawsweeper-plan-security-autofix-" ) ) ;
102147 const jobPath = path . join ( tmp , "job.md" ) ;
0 commit comments