Decide when a summary agent should stay quiet
Your task
An agent writes a summary for every pull request. A fluent wrong summary is worse than none, because it steers reviewers away from the code, so the agent has to know when to hold back.
Write pr_summary_decision(files_changed, lines_changed, generated_files, distinct_areas, has_linked_ticket): the rule your agent follows for each pull request.
files_changed,lines_changed(int): the size of the diff.generated_files(int): how many of the changed files are generated (lockfiles, snapshots, build output).distinct_areas(int): how many unrelated parts of the codebase the change touches.has_linked_ticket(bool): the pull request links a ticket that explains why.
It returns one of the values in the rules below. Apply them in order. The first one that matches decides:
files_changedorlines_changedis 0 or less:"withhold-no-evidence".- More than 40 files, or more than 800 lines:
"withhold-oversized". - Half the files or more are generated (
generated_files * 2 >= files_changed):"withhold-generated". - 4 or more distinct areas:
"withhold-mixed". - A linked ticket, at most 1 area and at most 200 lines:
"post-high". - A linked ticket, or else both at most 2 areas and at most 400 lines:
"post-medium". - Otherwise:
"post-low".
Examples
pr_summary_decision(files_changed: int, lines_changed: int, generated_files: int, distinct_areas: int, has_linked_ticket: bool) -> strExample 1
Input
pr_summary_decision(3, 120, 0, 1, True)Output
"post-high"Example 2
Input
pr_summary_decision(12, 600, 0, 5, True)Output
"withhold-mixed"Example 3
Input
pr_summary_decision(30, 900, 0, 2, True)Output
"withhold-oversized"