fix: route closed-issue imports through pm close for pm-cli 2026.8.3
Summary
pm-cli 2026.8.3 enforces governance.require_close_reason: pm create --status closed and pm update --status closed are now hard close_reason_required errors. The old 2026.7.29 bypass that silently auto-routed these and defaulted a close reason is gone. This package relied on that bypass in one path.
Root cause
runImport (non-atomic create path) created new closed GitHub issues with pm create --status closed, so importing a not-yet-known closed issue failed under the enforced policy. The atomic path and the re-import reconciliation path were already correct (they route closure through pm close --reason); only the plain create path used the now-broken invocation.
Changes
index.ts— the create path now creates a closed upstream issue asopen, then closes it viapm close --reason "GitHub issue #N closed", mirroring the atomic and reconciliation paths.- Provenance timestamps — thread GitHub
closed_atthroughGhIssue→PreparedGithubImport→ every close site (create path, reconciliation, and the atomicclosemutation) as--completed-at/completedAt, so imported items keep their real completion time instead of the import time. The reason stays factual provenance; no outcome is fabricated. test/handler-failures.test.ts— thecreateLinkedItemfixture used the samepm create --status closedpattern to build a closed linked item; switched to create-then-close so the fixture is still a genuinely closed item under the enforced policy, without changing what the tests assert.- Pins
@unbrained/pm-cliat^2026.8.3(peer>=2026.8.3).
pm item
Gates
| gate | result |
|---|---|
npm run typecheck | pass |
npm run build | pass |
npm test | 239/239 pass (incl. the two previously-failing tests) |
npm run coverage | pass — index.ts 88.83% lines / 80.15% branches / 89.94% functions (thresholds 88/79/89) |
npm run changelog:check | up to date |
No governance policy, lint rule, or coverage threshold was weakened.
Summary by Sourcery
Route imports of closed GitHub issues through explicit pm close operations and preserve source completion timestamps under the updated pm-cli governance policy.
Bug Fixes:
- Fix non-atomic GitHub issue imports that previously tried to create items born closed, which now violate pm-cli close-reason governance constraints.
Enhancements:
- Thread GitHub closed_at into PreparedGithubImport and pm close mutations so imported items retain their original completion time instead of the import time.
Build:
- Update peer and dev dependency pins to require pm-cli 2026.8.3 in line with the new close-reason enforcement.
Tests:
- Adjust linked-item test fixtures to create items open and then close them via pm close so closed-status tests remain valid under the new governance rules.
Chores:
- Record the pm governance item history and spec files related to this change in the repository.
Summary by cubic
Fixes imports of closed GitHub issues and project items under @unbrained/pm-cli 2026.8.3 by creating items open, then closing via pm close --reason with --completed-at. Also fixes id parsing so create‑then‑close reliably closes the new item.
-
Bug Fixes
- Route all closures through
pm close --reason; pass GitHubclosed_atas--completed-at. - Project import: omit
--status closedon create/update; close after with a provenance reason. parseCreatedItemIdnow reads the flat{ id }frompm create --json(drops the unused{ item.id }shape).- Create path: if the new id can’t be parsed, count as skipped and don’t report a successful import; share a single close-argv builder to keep reason and timestamp consistent.
- Tests: switch fixtures to create‑then‑close; add a contract test for the real
pm create --jsonenvelope and an end‑to‑end closed‑issue import that asserts the item lands closed.
- Route all closures through
-
Dependencies
- Pin
@unbrained/pm-clito^2026.8.3(peer>=2026.8.3).
- Pin