Problem
MDI records source paths and hashes during import/export, but it does not expose a backend-neutral three-way reconciliation contract. Supporting file-primary content over SQLite and MySQL requires deterministic planning when files, WordPress rows, or both have changed since their last common state.
This is a child of #57 and builds on the extracted canonical persistence layer.
Desired Contract
Add one reconciliation service shared by CLI, abilities, backend adapters, and external trigger surfaces. It compares:
- current canonical file identity/hash;
- current normalized WordPress resource identity/hash;
- last common baseline identity/hash.
The plan reports at least:
created;
updated_from_file;
written_from_wordpress;
deleted_from_file;
deleted_from_wordpress;
moved;
unchanged;
conflicts.
Conflicts produce no mutation by default. MDI reports evidence; GitSync or another caller owns remote merge and publication policy.
Public Surface
Expose the same service through:
wp markdown-db reconcile --dry-run
wp markdown-db reconcile
markdown-db/reconcile ability
Inputs cover direction, managed scope, deletion policy, conflict policy, bounded batch size, and continuation identity. Apply requires a plan/source identity that still matches current state.
Acceptance Criteria
- File-only, WordPress-only, identical, moved, deleted, and divergent changes produce deterministic plans.
- Dry-run performs no database or filesystem mutation.
- Apply refuses stale plans and concurrent ownership.
- Deletion is opt-in and limited to resources previously managed by the selected canonical root.
- Repeated apply is idempotent and does not duplicate posts or rewrite unchanged files.
- Interrupted bounded reconciliation resumes without replaying completed mutations.
- The contract runs against both SQLite and MySQL content backends.
- Conflict reports contain resolvable source paths, resource IDs, and all compared identities without leaking secrets.
Related Work
AI Assistance
OpenAI GPT-5.6 Sol via OpenCode was used to inspect current import/export source metadata and synchronization behavior and draft this issue. Chris Huber directed the architecture and remains responsible for the reconciliation contract.
Problem
MDI records source paths and hashes during import/export, but it does not expose a backend-neutral three-way reconciliation contract. Supporting file-primary content over SQLite and MySQL requires deterministic planning when files, WordPress rows, or both have changed since their last common state.
This is a child of #57 and builds on the extracted canonical persistence layer.
Desired Contract
Add one reconciliation service shared by CLI, abilities, backend adapters, and external trigger surfaces. It compares:
The plan reports at least:
created;updated_from_file;written_from_wordpress;deleted_from_file;deleted_from_wordpress;moved;unchanged;conflicts.Conflicts produce no mutation by default. MDI reports evidence; GitSync or another caller owns remote merge and publication policy.
Public Surface
Expose the same service through:
Inputs cover direction, managed scope, deletion policy, conflict policy, bounded batch size, and continuation identity. Apply requires a plan/source identity that still matches current state.
Acceptance Criteria
Related Work
AI Assistance
OpenAI GPT-5.6 Sol via OpenCode was used to inspect current import/export source metadata and synchronization behavior and draft this issue. Chris Huber directed the architecture and remains responsible for the reconciliation contract.