WORK-498
ID:WORK-498Status:done

refrakt plan migrate pr-attrs — git backfill of PR references

Backfill the pr attribute on legacy done work / fixed bug items from git merge-commit history, so plan status rollups are rich from day one rather than skeletal (only ~2 of 177 items carry a PR today).

Priority:mediumComplexity:complexMilestone:v0.28.0Source:SPEC-049
claude/milestone-v0-28-0-llvtfa View source

Criteria completion

Criteria completion: 6 of 6 (100%) checked; tracking started on Jul 9, no incremental history yet0%25%50%75%100%Jul 9Jul 11

Tracking started Jul 9 — check back for trends.

Branches 2
claude/milestone-v0-28-0-llvtfa current done
claude/plan-runes-status-vocab-jcq1tx draftmain draft
History 2
  1. 74979c1
    Created (done)by bjornolofandersson
  2. 9a519fd
    Content editedby Claude
    plan: add v0.28.0 plan-model-hardening milestone and work breakdown

Acceptance Criteria

  • refrakt plan migrate pr-attrs (CLI + MCP) walks git history, dry-run by default with --apply / --git
  • For each done work / fixed bug lacking pr, finds the status-flip commit, walks forward to the first reachable merge commit, and captures Merge pull request #NNN (repo slug from origin)
  • Writes resolved pr="<org>/<repo>#<num>" back to the work item file on --apply
  • Emits a report: resolved, skipped (multiple plausible merge commits), unresolved (direct-to-main / lost history) — unresolved items are listed, not modified
  • Modeled on the existing migrate filenames command structure
  • Tests cover resolution, the skip-on-ambiguity path, and the report shape (against a fixture repo or mocked git)

Dependencies

  • WORK-496 — the pr attribute this backfills

References

  • SPEC-049 — spec (Migration, Open Questions: migration false positives)

Resolution

Completed: 2026-07-09

Branch: claude/milestone-v0-28-0-llvtfa PR: refrakt-md/refrakt#565

What was done

  • refrakt plan migrate pr-attrs (CLI + MCP), dry-run default, --apply/--git. Resolves a done/fixed flip to the PR whose topic branch introduced the commit (reachable from second parent, not first), skips ambiguous multi-PR histories, reports unresolved untouched.
  • Tests use a real git fixture (resolution, apply, direct-to-main unresolved, ambiguous skip, no-remote).

Notes

  • Not run with --apply on the corpus: this environment is a shallow clone, so most items' introducing merge is beyond the graft boundary. Run on a full clone before the release.