Repository navigation
fix(mw): follow continuation when a page batch is truncated - #19
Merged
Merged
Conversation
MediaWiki caps an API response at 8 MiB. When a batch of 50 pages goes over it, the response leaves some pages' revisions out and returns a "continue" value. FetchPages ignored it, so those pages were reported as "page does not exist" and the pull still exited 0. On Appropedia, the 50 pages from list=allpages&apminsize=200000: one request returned text for 30 of them, plus the truncation warning. wikisync 0.2.0 pulled 30 and called 20 missing. With this change it pulls all 50. fetchBatch now re-requests with the continuation until it runs out. A continued request that brings no new page text is an error rather than a loop.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
MediaWiki caps an API response at 8 MiB. When a batch of 50 pages goes over it,
the response omits some pages' revisions and returns
continue.FetchPagesignored that, so those pages came back as "page does not exist", and
pullstill exited 0. No local file was overwritten: missing pages are skipped.
fetchBatchnow re-requests with the continuation until there is none. Acontinued request that brings no new page text is an error, not a loop.
Evidence
The 50 Appropedia pages from
list=allpages&apminsize=200000:continue: {"rvcontinue": …}and "This result was truncated because it wouldotherwise be larger than the limit of 8,388,608 bytes."
wikisync pullwith the 0.2.0 release binary: exit 0, 30 pulled, 20"does not exist".
wikisync pullwith this branch: exit 0, 50 pulled, 0 "does not exist".Tests
TestFetchPagesFollowsTruncatedBatch: the first response leaves out twopages and continues; they must arrive on the second request. Fails on
main(Big B and Big C reported missing, 1 request).
TestFetchPagesStopsOnStalledContinuation: a continuation that neverdelivers the page must return an error within two requests.
guard, a later round's text-less page overwriting the earlier text) fails
its target test.