@@ -115,6 +115,30 @@ def test_generated_repo_maintenance_validation_uses_repo_self_dir(self) -> None:
115115 self .assertEqual (proc .returncode , 0 , proc .stderr or proc .stdout )
116116 self .assertIn ("Repo-maintenance validation completed successfully." , proc .stdout )
117117
118+ def test_rerunning_sync_preserves_repo_maintenance_root_resolution (self ) -> None :
119+ with tempfile .TemporaryDirectory () as tmpdir :
120+ repo_root = Path (tmpdir ).resolve ()
121+ (repo_root / "Package.swift" ).write_text ("// swift-tools-version: 6.0\n " , encoding = "utf-8" )
122+
123+ first_code , first_payload = self .run_script ("--repo-root" , str (repo_root ))
124+ self .assertEqual (first_code , 0 )
125+ self .assertEqual (first_payload ["status" ], "success" )
126+
127+ second_code , second_payload = self .run_script ("--repo-root" , str (repo_root ))
128+ self .assertEqual (second_code , 0 )
129+ self .assertEqual (second_payload ["status" ], "success" )
130+
131+ subprocess .run (["git" , "init" ], cwd = repo_root , check = True , capture_output = True , text = True )
132+ proc = subprocess .run (
133+ ["sh" , "scripts/repo-maintenance/validate-all.sh" ],
134+ cwd = repo_root ,
135+ capture_output = True ,
136+ text = True ,
137+ check = False ,
138+ )
139+ self .assertEqual (proc .returncode , 0 , proc .stderr or proc .stdout )
140+ self .assertIn ("Repo-maintenance validation completed successfully." , proc .stdout )
141+
118142 def test_sync_appends_section_to_existing_agents (self ) -> None :
119143 with tempfile .TemporaryDirectory () as tmpdir :
120144 Path (tmpdir , "Package.swift" ).write_text ("// swift-tools-version: 6.0\n " , encoding = "utf-8" )
0 commit comments