Skip to content

Commit 520432e

Browse files
committed
air: upload: try to report on individual patches
Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 79bb528 commit 520432e

File tree

1 file changed

+21
-31
lines changed

1 file changed

+21
-31
lines changed

nipa-air-upload.py

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -132,42 +132,21 @@ def get_review_details(self, review_id: str) -> Optional[Dict]:
132132
print(f"Error fetching review {review_id}: {e}")
133133
return None
134134

135-
def has_review_comments(self, review_data: Dict) -> bool:
136-
"""Check if review has any inline comments
137-
138-
Args:
139-
review_data: Review data with 'review' field
140-
141-
Returns:
142-
True if any patch has review comments
143-
"""
144-
reviews = review_data.get('review', [])
145-
for review in reviews:
146-
if review and review.strip():
147-
return True
148-
return False
149-
150135
def post_patchwork_check(self, series_id: int, review_id: str,
151-
has_comments: bool) -> bool:
136+
review_data: Dict) -> bool:
152137
"""Post check result to Patchwork
153138
154139
Args:
155140
series_id: Patchwork series ID
156141
review_id: AIR review ID
157-
has_comments: Whether review has comments
142+
review_data: Review data with 'review' field containing per-patch results
158143
159144
Returns:
160145
True if successful
161146
"""
162-
# Determine check status
163-
state = 'warning' if has_comments else 'success'
164-
165147
# Build check URL
166148
check_url = f"{self.air_server}/ai-review.html?id={review_id}"
167149

168-
# Build check description
169-
desc = 'AI review completed' if not has_comments else 'AI review found issues'
170-
171150
try:
172151
# Fetch series to get individual patches
173152
series = self.patchwork.get('series', series_id)
@@ -177,11 +156,26 @@ def post_patchwork_check(self, series_id: int, review_id: str,
177156
print(f" Warning: Series {series_id} has no patches")
178157
return False
179158

180-
print(f" Posting check to {len(patches)} patches in series {series_id}: {state}")
159+
# Get review results (one per patch)
160+
reviews = review_data.get('review', [])
161+
162+
print(f" Posting checks to {len(patches)} patches in series {series_id}")
181163

182164
# Post check to each patch in the series
183-
for patch in patches:
165+
for i, patch in enumerate(patches):
184166
patch_id = patch['id']
167+
168+
# Check if this patch has review comments
169+
patch_has_comments = False
170+
if i < len(reviews) and reviews[i] and reviews[i].strip():
171+
patch_has_comments = True
172+
173+
# Determine state and description for this patch
174+
state = 'warning' if patch_has_comments else 'success'
175+
desc = 'AI review found issues' if patch_has_comments else 'AI review completed'
176+
177+
print(f" Patch {i+1}/{len(patches)} (id={patch_id}): {state}")
178+
185179
self.patchwork.post_check(patch=patch_id, name=self.check_name,
186180
state=state, url=check_url, desc=desc)
187181

@@ -223,12 +217,8 @@ def process_review(self, review: Dict) -> bool:
223217

224218
print(f" Patchwork series ID: {pw_series_id}")
225219

226-
# Check if review has comments
227-
has_comments = self.has_review_comments(review_data)
228-
print(f" Has review comments: {has_comments}")
229-
230-
# Post check to Patchwork
231-
success = self.post_patchwork_check(pw_series_id, review_id, has_comments)
220+
# Post check to Patchwork (will check each patch individually)
221+
success = self.post_patchwork_check(pw_series_id, review_id, review_data)
232222

233223
if success:
234224
print(f" Successfully posted check to Patchwork")

0 commit comments

Comments
 (0)