inblockio / mediawiki-extensions-Aqua

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.
GNU General Public License v3.0
6 stars 6 forks source link

[New API Endpoint] get_branch #375

Closed rhe3565 closed 1 month ago

rhe3565 commented 1 month ago

Aqua chains allow for forking. This means there can be multiple aqua chains originating from one genesis hash(getting an aqua chain from a genesis hash would therefore have to return all branches). getting an aqua-chain from its page_name is possible, but not ideal, as the name of a page can be changed arbitrarily. For this reason the best way of getting an aqua chain would be by its latest revision_hash. There is currently no such api-call. This api-call would return an aqua chain with all its revisions from its first revision to the latest revision(on the relevant branch).

Ideally this call would work exactly as get_page_all_revs does but take the last revision hash rather than the page title. (the return type would remain the same)

FantasticoFox commented 1 month ago

/data_accounting/get_branch/{verification_hash} return all hashes down to genesis

page_info: {
title, namespace: as integer }

image

it-spiderman commented 1 month ago

I have adapted get_page_all_revs to accept both title and verification hash (as both APIs are basically the same). Specifying either will now return proper chain, also for forked pages

https://github.com/inblockio/mediawiki-extensions-Aqua/commit/2a3e4071bf3161a9d388f1a24ddf90d1225f4e3d

FantasticoFox commented 1 month ago

In addition to the return we need:

page_info: { title, namespace: as integer }

for the impor context.

it-spiderman commented 1 month ago

Yes, this endpoint returns VerificationEntites which already contain this info. or do you need it in exactly this format?

FantasticoFox commented 1 month ago

I reviewed the code with one of my team members who was really upset about this solution. He was not happy that a page containing 128 characters would not be handled if inputted into the API. Additionally, he noted that the namespace is missing.

We would like to have a robust solution which includes a separate API endpoint that receives only the hash as an input. There is a draft for this here: https://github.com/inblockio/mediawiki-extensions-Aqua/pull/394, which is working according to my colleague.

Our tests are following this shema: IMG_9584

FantasticoFox commented 1 month ago

@it-spiderman we tested it and it works as we want it.