Repository navigation
Conversation
… a claims client scripts/articles/contrib_transport.py talks to the Worker's token-gated index downloads and claims API over a fixed path allowlist, never follows a redirect and keeps the token out of every error. A download resumes with Range and If-Range and lands only once its size and sha256 match; fetch-bundle fills a cache from a bundle's MANIFEST.json, reading only the manifest without --execute.
Deicyde
marked this pull request as ready for review
November 13, 2026 20:01
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.
The client side of #195 (token-gated index downloads) and #196 (the claims API): one standard-library module,
scripts/articles/contrib_transport.py, besidesubmission_transport.py. It needs neither PR to merge, since its tests run against a loopback stand-in server, but it does nothing useful until they ship.What it does.
call()makes one JSON request to a path on a fixed allowlist (the package, claim and bundle routes and the intake body route; no query strings). It carries the token in a header, never follows a redirect, and keeps the token out of every error. A refusal raisesRefusalwith the server's status andcode. A 429 is waited out only whenRetry-Afteris at most 300 s, and at most three times; a daily quota is not slept on.download()fetches one file of known size and sha256. It resumes a cut transfer from<file>.partwithRangeandIf-Range(64 MiB a request), re-hashes an existing part first, starts again if the server sends the whole file, and refuses more bytes than expected. The file is moved into place only once its size and sha256 match: staging hard-links index files into every task directory, so a file truncated in place would corrupt them all.fetch_bundle()andcontrib_transport.py fetch-bundle <manifest sha256> [--cache] [--skip names/] [--execute]read the bundle'sMANIFEST.json, check it hashes to the name it was asked for and lists only plain paths, then download what the cache lacks.MANIFEST.jsonis written last, so its presence means the bundle is whole. Without--executeonly the manifest is read, and the answer says what would download and which libraries restrict use.WIKILEAN_AGENT_TOKEN, never argv.Not here.
run_package.py --claims,publish_package.py --apiandcollect_results.py --apibuild on this in the next PR. A loopback test against the real Worker routes comes with them, once #195 and #196 are on main.Release. Release-neutral (
scripts/).Checks. Worker, Python and browser CI green at the head commit: https://github.com/Deicyde/WikiLean/actions/runs/43474668219 (
scripts/articles/test_contrib_transport.py, 14 tests, inscripts/ci-python.sh).