Skip to content

[unic-pr-review] Advisory Notice for Work Items mentioned in the PR title but not linked #253

Description

@orioltf

Summary

When a PR title references Work Item ids that are not linked to the PR via pullrequestworkitems, surface them to the Reviewer (and to PR owners, via the posted Review Summary) as an advisory Notice, so the owner can decide whether to link the missing Work Item(s) and re-review for intent coverage.

Spun out of #252. In that repro (PR #5647), the title was [42602] [42611] [42612] TravelData v2 Import... but only 42602, 42610, 42611 were linked — so 42612 is mentioned-but-unlinked. Nothing surfaces that today.

Why this is not a relaxation of the no-scraping doctrine

The ADR-0001 amendment forbids regex-scraping the title/description for intent discovery — i.e. scraped ids must never be treated as authoritative Work Items or fed to the Intent Checker. This feature is advisory only: it flags a possible missing link for a human. Scraped ids are never gathered as intent.

Design (pinned, AFK-ready)

  • Detection pattern (conservative, low-noise): match [NNNN] and AB#NNNN tokens in the PR title → capture the integer ids → compare against the linked workItemRefs ids.
  • One-directional: warn only about title-mentioned ids that are not linked. Never warn about linked-but-not-in-title (linking is authoritative).
  • Surface as a Notice at the top of the Review Summary (rides the existing Notice rail; appears in the terminal preview and, in --post, in the posted General Comment Thread so PR owners see it).
  • Never feeds intent gathering — purely informational.
  • Empty case (all title-mentioned ids are linked, or none found) → no Notice.

Likely touch-points

  • commands/review-pr.md — compute the title-vs-linked diff after Work Item discovery; add titleUnlinkedWorkItems (or similar) to the NoticesContext.
  • scripts/render-summary.mjs / the notices renderer — render the advisory Notice.
  • A small pure helper + unit test for the title-id extraction + set-diff (deterministic, [CI]-testable).

Acceptance criteria (draft)

  • [CI] Pure helper extracts [NNNN] and AB#NNNN ids from a title and returns the set difference against linked ids (covered by unit tests, incl. empty/no-match cases).
  • [doc-review] Review Summary shows a Notice listing title-mentioned-but-unlinked Work Item ids when the difference is non-empty; nothing when empty.
  • [doc-review] The Notice text invites the PR owner to link the missing Work Item(s) and re-review; the ids are never used for intent gathering.

Dependencies

Best landed after #252 (which moves workItemRefs to a top-level Fetcher field and reworks Step 1.5).

Metadata

Metadata

Assignees

No one assigned

    Labels

    app:unic-pr-reviewArea: apps/claude-code/unic-pr-reviewfeatureNew capabilityneeds-specsEnough info from reporter; ready to write a spec

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions