Skip to content

Commit 5b68ab1

Browse files
Update Component ID Logic
Some issues are not getting filed into the desired component of their code owners. This component is provided as a metadata. The current change aims at emphasising this metadata component by removing the automatic component. Please refer to b/438511288 for additional details.
1 parent 28e1d2a commit 5b68ab1

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/clusterfuzz/_internal/issue_management/issue_filer.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ def file_issue(testcase,
326326
is_security=testcase.security_flag, is_crash=is_crash)
327327

328328
issue = issue_tracker.new_issue()
329+
if issue_tracker.project == "google-buganizer":
330+
logs.info(f"New issue's default component id = {issue.component_id}")
329331
issue.title = data_handler.get_issue_summary(testcase)
330332
issue.body = data_handler.get_issue_description(
331333
testcase, reporter=user_email, show_reporter=True)
@@ -465,10 +467,19 @@ def file_issue(testcase,
465467
issue.labels.add(policy.substitution_mapping(label))
466468

467469
metadata_components = _get_from_metadata(testcase, 'issue_components')
470+
471+
if issue_tracker.project == "google-buganizer" and metadata_components:
472+
# Clear the automatic component to prioritize the metadata component.
473+
logs.info(
474+
"Removed the automatic component to emphasize the metadata component.")
475+
issue.components.clear()
476+
468477
for component in metadata_components:
469478
issue.components.add(component)
470479

471-
if testcase.one_time_crasher_flag and policy.unreproducible_component:
480+
if issue_tracker.project != "google-buganizer" and \
481+
testcase.one_time_crasher_flag and \
482+
policy.unreproducible_component:
472483
issue.components.add(policy.unreproducible_component)
473484

474485
issue.reporter = user_email
@@ -479,8 +490,16 @@ def file_issue(testcase,
479490

480491
recovered_exception = None
481492
try:
493+
if issue_tracker.project == "google-buganizer":
494+
logs.info("The values of Component IDs:")
495+
logs.info(f"1. Backing: {list(issue.components)}")
496+
logs.info(f"2. Removed: {list(issue.components.removed)}")
497+
logs.info(f"3. Added: {list(issue.components.added)}")
498+
logs.info("Primary attempt to the save the issue.")
482499
issue.save()
483500
except Exception as e:
501+
logs.info("Exception occurred while saving the issue.")
502+
logs.info(f"Error: {type(e).__name__}\nMessage: {e}")
484503
if policy.fallback_component:
485504
# If a fallback component is set, try clearing the existing components
486505
# and filing again.
@@ -493,6 +512,7 @@ def file_issue(testcase,
493512
message = policy.fallback_policy_message.replace(
494513
'%COMPONENTS%', ' '.join(metadata_components))
495514
issue.body += '\n\n' + message
515+
logs.info("Secondary attempt to the save the issue.")
496516
issue.save()
497517
else:
498518
raise

0 commit comments

Comments
 (0)