@@ -213,21 +213,30 @@ def process_all_collections(self) -> Dict[str, List[Dict]]:
213
213
overall_status = "error" if any_collection_failed else "success"
214
214
overall_message = "Some collections failed to process" if any_collection_failed else "All collections processed successfully"
215
215
216
- # Add the overall status to each collection's results
216
+ # Add the overall status only to collections that actually failed
217
217
for collection_name in results .keys ():
218
- results [collection_name ].append ({
219
- "operation" : "overall_status" ,
220
- "message" : overall_message ,
221
- "details_type" : "overall" ,
222
- "details" : {
223
- "collections_processed" : len (self .collection_configs ),
224
- "collections_failed" : sum (1 for result in results .values ()
225
- if any (isinstance (op , dict ) and op .get ("status" ) == "error"
226
- and op .get ("operation" ) != "overall_status"
227
- for op in result ))
228
- },
229
- "status" : overall_status
230
- })
218
+ # Check if this collection had any errors (excluding overall_status operations)
219
+ collection_has_errors = any (
220
+ isinstance (op , dict ) and op .get ("status" ) == "error"
221
+ and op .get ("operation" ) != "overall_status"
222
+ for op in results [collection_name ]
223
+ )
224
+
225
+ # Only add overall_status to collections that failed
226
+ if collection_has_errors :
227
+ results [collection_name ].append ({
228
+ "operation" : "overall_status" ,
229
+ "message" : overall_message ,
230
+ "details_type" : "overall" ,
231
+ "details" : {
232
+ "collections_processed" : len (self .collection_configs ),
233
+ "collections_failed" : sum (1 for result in results .values ()
234
+ if any (isinstance (op , dict ) and op .get ("status" ) == "error"
235
+ and op .get ("operation" ) != "overall_status"
236
+ for op in result ))
237
+ },
238
+ "status" : overall_status
239
+ })
231
240
232
241
return results
233
242
0 commit comments