@@ -126,27 +126,41 @@ def export_csv_report(results: List[Dict[str, Any]], output_filepath: str = "cat
126126def process_single_family (item ):
127127 filepath , meta , pipeline , max_prs , pr_counter , base_branch = item
128128
129- should_create_pr = False
130- if max_prs > 0 :
131- with pr_lock :
132- if pr_counter [0 ] < max_prs :
133- pr_counter [0 ] += 1
134- should_create_pr = True
135-
136129 try :
137- res = pipeline .process_family (filepath , create_pr = should_create_pr , base_branch = base_branch )
138-
139- # If we pre-allocated PR slot but family had no update or PR creation failed, release slot
140- if should_create_pr :
141- pr_created = res .get ("has_update" ) and res .get ("pr_info" ) and res ["pr_info" ].get ("created" )
142- if not pr_created :
143- with pr_lock :
144- pr_counter [0 ] = max (0 , pr_counter [0 ] - 1 )
130+ # Step 1: Run standard pipeline check in-memory without disk mutations
131+ res = pipeline .process_family (filepath , create_pr = False , base_branch = base_branch )
132+
133+ # Step 2: If an update is available, claim PR slot if under max_prs limit
134+ if res .get ("has_update" ) and max_prs > 0 :
135+ should_create_pr = False
136+ with pr_lock :
137+ if pr_counter [0 ] < max_prs :
138+ pr_counter [0 ] += 1
139+ should_create_pr = True
140+
141+ if should_create_pr :
142+ version_str = res .get ("upstream_version" ) or (res .get ("upstream_commit" )[:7 ] if res .get ("upstream_commit" ) else "update" )
143+ pr_title = f"🤖 Update upstream font: { meta .name } v{ version_str } "
144+ pr_info = pipeline .pr_creator .create_pull_request (
145+ family_name = meta .name ,
146+ metadata_filepath = filepath ,
147+ updated_pb_content = res .get ("updated_pb_content" , "" ),
148+ pr_title = pr_title ,
149+ pr_body = res .get ("pr_body" , "" ),
150+ upstream_version = res .get ("upstream_version" ),
151+ upstream_commit = res .get ("upstream_commit" ),
152+ base_branch = base_branch ,
153+ )
154+ res ["pr_info" ] = pr_info
155+ if pr_info and pr_info .get ("created" ):
156+ res ["status" ] = "PR_CREATED"
157+ else :
158+ # Release slot if PR creation failed so another family can try
159+ with pr_lock :
160+ pr_counter [0 ] = max (0 , pr_counter [0 ] - 1 )
161+
145162 return res
146163 except Exception as e :
147- if should_create_pr :
148- with pr_lock :
149- pr_counter [0 ] = max (0 , pr_counter [0 ] - 1 )
150164 return {
151165 "family_name" : meta .name if meta else Path (filepath ).parent .name ,
152166 "has_update" : False ,
@@ -156,6 +170,7 @@ def process_single_family(item):
156170
157171
158172
173+
159174def run_full_catalog_audit (
160175 fonts_repo_path : str = "." ,
161176 max_families : int = 2000 ,
0 commit comments