Strengthen merge decision integrity and legacy recovery

Merged
UN
2mo ago
+3148-614

Summary

  • make item scalar merge decisions converge by document recency while exposing the exact retained side and decision basis through the public SDK
  • persist bounded non-sensitive durable decision previews for fresh-clone review, with strict policy, identity, hash, and availability validation
  • add an audited force-only compatibility path for exact pre-durable clone-local receipt references without rewriting history
  • harden packed npx and bunx smoke execution, refresh compatible Node types, and regenerate the canonical changelog with pm-changelog 2026.9.2

PM lineage

Closes #1184
Closes #1185
Closes #1186

Verification

  • full source coverage: 100% statements, branches, functions, and lines across 60,000+ source lines
  • pnpm quality:static
  • pnpm quality:package-artifact
  • pnpm security:scan
  • pnpm audit
  • pnpm changelog:pm:check
  • pnpm smoke:npx: all 13 packed packages passed through npx and bunx
  • pm validate --check-resolution --check-history-drift: 2,625 histories checked with zero drift
  • pm health --check-only --full --skip-vectors --skip-drift
  • manual temporary Git repository: conflict merge, later-update selection, durable sidecar, fresh-clone evidence, dry-run and forced reconciliation, and strict health proof
  • independent security diff scan: no findings

Summary by Sourcery

Strengthen merge decision integrity by making scalar conflict resolution recency-aware, preserving reviewable evidence safely, and enabling narrowly audited recovery of legacy receipt references.

New Features:

  • Expose recency-based scalar merge outcomes, retained sides, and resolution evidence through the public SDK and receipts.
  • Persist bounded, policy-validated scalar previews in durable merge evidence for fresh-clone review.
  • Add an audited force-only recovery path for unrecoverable pre-durable clone-local receipt references.

Bug Fixes:

  • Make conflicting item scalar merges converge on the latest document update, using stable ordering only for equal timestamps.
  • Improve merge receipt validation diagnostics by distinguishing schema failures from identity failures and reporting bounded validation reasons.
  • Prevent valid slow dependency reification from failing packed npx and bunx smoke tests.

Enhancements:

  • Harden merge health and reconciliation so missing receipt evidence remains blocking unless an exact, historically eligible audited disposition is recorded.

Build:

  • Refresh the compatible @types/node dependency and lockfile.

Documentation:

  • Update merge safety, SDK evidence contracts, and the canonical changelog for the strengthened merge decision and recovery behavior.

Tests:

  • Expand merge direction, receipt policy, receipt integrity, reconciliation, legacy recovery, and smoke timeout coverage.

Chores:

  • Regenerate PM tracking artifacts and associated history records.

Summary by cubic

Converges item scalar merge conflicts by document recency instead of lexicographic value order, persists bounded non-sensitive decision evidence for fresh-clone review, and adds an audited force-only reconciliation for legacy clone-local-only receipt references.

Bug Fixes

  • Same-field scalar conflicts now retain the latest document update in both directions, with the retained side and resolution basis exposed through the SDK; --prefer ours|theirs is recorded but no longer applied to item scalars. Missing scalar decisions use a reserved absence marker, kept distinct from absent values, and are hashed through collision-free public SDK primitives domain-separated from present values.
  • Merge receipts now persist bounded non-sensitive decision previews under strict policy, identity, hash, and availability validation, so fresh clones can review discarded values; receipt validation distinguishes schema from identity failures and accepts legacy version-one hashes during exact snapshot verification.
  • Remediation for merge_receipt_history_reference_missing now starts with non-mutating pm merge reconcile --dry-run; --force appends an audited disposition for exact pre-durable clone-local references without rewriting history, accepts only exact legacy evidence and trusted receipts, and fails closed on bounded missing-receipt batches. The repeated-pass termination condition references only public result fields and is locked by a negative regression.
  • Packed npx and bunx smoke runs no longer reject valid slow installs: the subprocess timeout rose from 120 to 600 seconds and the tarball is installed once for multi-command consumers.

Dependencies

  • Updates @types/node to 26.4.1, lowers the ESLint suppression ceiling, and regenerates the changelog with pm-changelog 2026.9.2.