Credit closeout to the pull request that delivered the item, not one that only mentioned it

Merged
UN
2d ago
+245-103

The closeout provenance defect in pm-ado#33 credited gap-reporting PR 16 instead of delivery PR 19. Closeout now requires an explicit delivery declaration and selects the latest qualifying merged PR, keeping its completion fields and close history consistent.

Delivers pm-github-uqjf.

Behavior

EvidenceResult
Closing keyword before a canonical item link, or whole-line keyword plus exact IDDelivery declaration
Standalone PM item: link/ID or pm-github: IDDelivery declaration
Undeclared canonical body link, including a follow-up list, for an otherwise eligible itemnot_delivery: Mentioned, not delivered
Tracker PR URL metadata with no body reference or declarationNo row
Closing keyword for a longer ID sharing the item's prefixNo match for the shorter ID
Several merged declarations with complete merge evidence and passing checksLatest merge wins; higher PR number breaks equal timestamps
No qualifying deliveryItem stays open

Plan the complete selection before SDK writes. One selected closure supplies completed_at, resolution, actual_result, close_reason and the appended close history with the same merge time, merge SHA, head SHA and checks. Earlier qualifying claims become duplicate selections. Existing required-check, child, epic, skip, terminal and strict-close safeguards remain.

Before: structured primary-item attribution could be missed and competing claims were refused. After: the real-shaped PR 16/19 fixture selects PR 19; multiple declarations choose the latest passing merge. Structured item lines followed by prose saying the item remains open are still mentions. Real SDK fixtures use plain trackers without a git executable.

Review round

Thread PRRT_kwDOTbN4pM6ub0vv correctly identified a documentation error. README and the attribution table now distinguish eligible undeclared body-reference rows from metadata-only input, which produces no row. Added a real non-git metadata-only regression and a contract check for each document. Full PR self-review found no further instances of this reporting error. Latest CodeRabbit review 5588689349 contained no outside-diff findings. No review threads were replied to or resolved.

Revert proof

  • Restoring README alone from 9c08fc2 fails its new documentation check with ERR_ASSERTION, exit 1. Restoring only the attribution document fails its corresponding check the same way.
  • Restoring only runCloseout from main at review start (4e18c93) fails the new metadata-only regression: one item closes instead of zero (ERR_ASSERTION, exit 1).
  • Earlier PR regressions restore only runCloseout from defective predecessor dc86e83: wrong gap PR selected, mention-only closed, and shared-prefix mention closed. The latest-selection, prefix-boundary and structured-follow-up controls also have recorded failing reversions.

Every reversion was restored. No test-load failure counts as proof. Evidence is recorded on the pm item.

Validation

Verified at code/test head 2fa4571247b5f86b984c588f32b494538a2f89ee, sequentially with isolated git identity:

  • npm run release:check: exit 0, 963/963 tests, zero failures/skips/cancellations.

  • bun run release:check: exit 0, 963/963 tests, zero failures/skips/cancellations.

  • Both: exact 100/100/100/100 across all 16 authored modules; lines/statements 11037/11037, functions 299/299, branches 3510/3510. All remaining release stages passed. Final receipt changes contain only documentation and append-only pm evidence; runtime source and tests remain identical to this head.

  • node_modules/.bin/pm test pm-github-uqjf --run --progress --timeout 600: attribution 12/12 and compact control 1/1 passed, zero failures/skips/cancellations. The unchanged attribution suite passed in 276 seconds after its default 120-second allowance expired under host load.

  • Restored documentation checks: 2/2 passed.

  • npm run changelog:full and npm run changelog:check: passed after final pm writes.

Dependency pins, source inventory, exclusions and all four coverage thresholds are unchanged. This repository ignores generated dist; build runs in both release gates. Project policy disables linked-result storage, so pm comments preserve the receipts.

The item remains in progress with its claim released for orchestrator verification. No pm-ado record was edited. No merge or package release was performed.