This MediaWiki extension includes the Aqua implementation. Turning MediaWiki into a powerful versioned notary service with API's for import and export of Data in JSON format.
When we import over the special page, we have all data already available, so we can check collisions once per page, and if we delete existing page, we are sure that will import a page with a longer chain (since all revision data is already available).
This is very different in API import. API imports one revision at the time, so we dont have just a single collision check per page, but one on every revision. Of course, this wont work.
As i see, we have several options:
Passing additional param when making request for the first revision to import, so that collisions are only resolved on that first call => very fast, but extremely hacky
Passing all revision data at once => safe, but will run into POST size limits pretty soon, and is generally a bad practice
Having transactions => First you send context to the API, it starts a transcation, returned the tx ID, which is used to subsequently import all revisions, one by one => most work, but most reliable. Also, it has issue with broken transactions, if you start transaction it will arleady delete the page (if shorter), but then there is no guarantee that you will actually send all promised revisions
Another approach is to check collision per revision. If revision with the same verification hash exists, skip it, otherwise import. This will import only the difference between two pages. However, this will completely merge two pages with the same name created on different domains, as verification hash will be different even if everything else is the same
When we import over the special page, we have all data already available, so we can check collisions once per page, and if we delete existing page, we are sure that will import a page with a longer chain (since all revision data is already available). This is very different in API import. API imports one revision at the time, so we dont have just a single collision check per page, but one on every revision. Of course, this wont work. As i see, we have several options:
Another approach is to check collision per revision. If revision with the same verification hash exists, skip it, otherwise import. This will import only the difference between two pages. However, this will completely merge two pages with the same name created on different domains, as verification hash will be different even if everything else is the same