Sort merged pull requests into release note sections

Agent buildEasy10 min

Your task

Every release, someone spends an afternoon turning merged pull requests into release notes. An agent drafts them now, and it must never oversell: a dry, accurate note is fine, an invented feature is not.

Write route_release_note_entries(pr_records): the rule your agent follows to place each merged pull request.

  • pr_records (list of str): one merged pull request each, written label|citation|summary, for example "feature|PR-101|adds dark mode toggle to settings". The citation names the pull request the entry came from.
  • Return one section per record, in input order: "customer" (the customer-facing notes), "internal" (the internal changelog) or "unsorted" (left for a person).

Rules, for each record:

  1. Split on |. If there are not exactly 3 fields: "unsorted".
  2. Trim whitespace from both ends of all 3 fields. Lowercase the label and the summary.
  3. An empty citation: "unsorted".
  4. A label of chore, refactor, test, ci, build, deps or internal: "internal".
  5. Any label other than feature, fix, perf or ui: "unsorted".
  6. A summary that contains blazing, revolutionary, seamless, best-in-class, game-changing or world-class anywhere, even inside a longer word: "unsorted".
  7. Otherwise: "customer".

Examples

route_release_note_entries(pr_records: list[str]) -> list[str]
Example 1
Inputroute_release_note_entries(["feature|PR-101|adds dark mode toggle to settings", "chore|PR-102|bump lockfile deps", "feature||new export button"])
Output["customer", "internal", "unsorted"]
Example 2
Inputroute_release_note_entries(["fix|PR-110|Blazing fast search fix"])
Output["unsorted"]
Example 3
Inputroute_release_note_entries([" perf | PR-7 | reduces page load time "])
Output["customer"]