Route terminal CSV row imports through pm close for pm-cli 2026.8.3

Merged
UN
3mo ago
+451-50

pm-cli 2026.8.3 enforces governance.require_close_reason on every programmatic transition into closed. Both pm create --status closed and pm update <id> --status closed are now hard close_reason_required errors — the 2026.7.29 bypass that invented the reason "Closed via pm update" is gone. Only pm close --reason may close an item.

What changed

A CSV row whose status is closed is now created open and immediately transitioned through pm close --reason.

The reason text matters here. The CSV import format carries no close-reason or resolution column, so there is no genuine closure evidence to forward. Rather than invent an outcome the source never recorded (e.g. "completed"), the reason states the import provenance factually:

Imported from <source> (source status: closed)

canceled is not gated by that policy and is still applied directly at create time, unchanged.

What deliberately did not change

The transaction-marker semantics are untouched: presence of the csv-tx/csv-txrow row marker — not item status — remains the applied signal. A legitimately closed imported row is still recognised on resume and never re-imported, and a compensated create still has its markers stripped before closing, so it is correctly not recognised.

Verification

typecheck, build, test and release:check (coverage gate, prod audit, pack dry-run, changelog:check) all pass against 2026.8.3. Pin moved to ^2026.8.3 with the lockfile refreshed.

pm items

  • pm-csv-mmi3 — Route terminal-status CSV imports through pm close for pm-cli 2026.8.3

Tracked fleet-wide under the absorption epic pm-cli-website-uqzw, which lives in the maintainer private companion tracker and is therefore not linkable from here.

Summary by Sourcery

Route terminal-status CSV imports through pm-cli’s pm close --reason with provenance-aware close reasons to comply with governance.require_close_reason in pm-cli 2026.8.3.

New Features:

  • Introduce provenance-based close reason generation for terminal CSV statuses via a shared helper used by create and update flows.

Bug Fixes:

  • Ensure CSV rows with status closed are created as open and then closed via pm close --reason, avoiding reason-less terminal transitions rejected by pm-cli 2026.8.3.

Enhancements:

  • Standardize terminal status handling for imported items by always applying closed/canceled via pm close --reason with factual import provenance instead of invented outcomes.

Build:

  • Bump pm-cli peer and dev dependency constraints to 2026.8.3 to align with new close-reason enforcement.

Chores:

  • Add PM agent history and issue tracking files for the pm-csv-mmi3 change.

Summary by cubic

Route terminal CSV imports through pm close --reason to comply with @unbrained/pm-cli 2026.8.3, and harden the non-atomic create‑then‑close path by compensating failures and only claiming success when closure is verified; also remove a dead JSON parse fallback to prevent silent open orphans.

  • Bug Fixes

    • Closed CSV rows: create as open, then close via pm close --reason using "Imported from (source status: closed)"; update flow now uses the same provenance reason (including canceled).
    • Make create‑then‑close all‑or‑nothing: if pm close fails, compensate the orphan (close) with --validate-close off; only treat as compensated when status is verified closed; if verification fails, report "could not be verified" with the created id; if compensation fails, include the id and state it was left open; if the create id can’t be recovered, hard‑fail the row.
    • Remove the parsed.item?.id fallback; only parse the flat {id,...} from pm create --json to avoid masking failures.
  • Dependencies

    • Bump @unbrained/pm-cli to ^2026.8.3 (peer >=2026.8.3).