Content reconciliation

Delivering content without destroying it: that is the problem this mechanism solves. An update used to empty the pages and rewrite the sender's. Uuids survived, but everything the other side had created or changed disappeared. That was tolerable while only coordinated developers edited pages. It stops being tolerable with two developers on the same ERP pages — the most frequent and most conflictual case, weekly rather than yearly.

One mechanism, not two

The database does not care whether it is dev, preprod or production. It sees an update file, it plays it, and it produces another one. A publisher-to-client delivery and a developer-to-developer exchange are the same object, handled by the same code.

Consequence: every import produces its counter-import. A full round trip between machines brings them all to the same state.

The exchange file is a full snapshot

Never a delta. A complete dump converges whatever order the exchanges happen in; a difference file assumes you know what it differs from, which is precisely the problem being eliminated.

It carries:

  • the complete image of the web tables;
  • per-field timestamps, derived from BSPK_HISTORY (which works per field, where modifiedOn works per record);
  • the deleted records, with their timestamps;
  • in its header, its generation date and the sender's last import date.

The automatic main.json git dump is unchanged and unrelated: the update file is more expensive to produce, and it is generated on demand from an admin page.

One value per database

Each database keeps a single piece of state: the date of its last import, stored in the BSPK table next to currentVersion. No snapshot history is needed, which is what makes the mechanism affordable.

Arbitration is per block

When both sides touched the same thing, the conflict is presented block by block, with a preview of each side, and a person decides — not a rule that would silently pick a winner. Reconcile_FC renders that screen (renderConflicts, _diffValeurs, _apercuVisuel) at /bweb/reconcile.

Traps

  • ?pk= is reserved by the router. Do not use that parameter name for your own purposes on a reconciliation screen.
  • A pending delivery puts the site in a waiting state: check hasPending before assuming an import has already run.

See also