Repository navigation
Mirror: incremental pass for new registry releases, fail fast on a 403, ETag-guarded state DB - #2066
Merged
Merged
Conversation
An incremental pass that adds one release used to face a choice: restamp all 8040 owner shards with a new version, or pass --version to keep the old one, so the changed shard's version said nothing. Now a shard whose components are unchanged keeps the text (and version) on disk, and a new or changed shard gets --version, default today's UTC date. Regenerating the committed site/mirror/ from its own data with a different stamp reproduces it byte for byte. The client ignores the field; only schema_version is checked. --check also compares the state DB with the bucket: an object without a done row, or a done row without an object, fails it. Before, --check passed against the bucket while a regeneration stopped with "objects have no system in the state db" (item 1). Part of #2040 (item 4)
…rites Incremental mode. `catalog` re-read versions only for packages it had never seen, so a new release of a known package (FastLED 3.10.9, #2034) was never queued. It now pages the registry search newest-updated first (`sort=updated`) down to a watermark kept in a new `meta` table, less a 6 h overlap, and re-reads the versions of every package updated since. A scan records a new watermark only if it covered everything since the old one; a DB from before the watermark needs `--since` once. ci/mirror/update.py runs that pass from one machine, with no droplet: download the bucket DB and its ETag, catalog (or `--package` for named packages only, watermark untouched), print the exact queue (`--dry-run` stops there), refuse a queue over `--max-bytes`, back up the DB server-side with CopySourceIfMatch, transfer, and upload the DB with If-Match. 403 fail-fast. Any 403 from the registry raises RegistryRefused: the download is not retried, the chunk's other downloads are cancelled so their rows stay queued, a `registry_refused` marker is written and the pass exits 3. `run` will not start while the marker exists, the droplet unit sets RestartPreventExitStatus=3, and rotate.py snapshots, destroys the droplet and exits 3 instead of rotating. ETag guard. rotate.py reads the bucket DB and its ETag in one GET and uploads snapshots with If-Match (If-None-Match when there was none); a 412 is a ManifestConflict. DO Spaces enforces it: a PUT with a wrong If-Match got 412 PreconditionFailed and left the object unchanged. To stay under C901 <= 10, `run`'s quota wait and catalog decision and rotate's flag handling moved into helpers without behaviour change. Part of #2040 (item 4)
Mirrored with `ci/mirror/update.py --package earlephilhower/library/ESP8266Audio --package xylopyrographer/library/LiteLED` after a dry run listed exactly these two files (6321283 bytes), both absent from the bucket. The state DB was backed up to _state/manifest.db.bak-20261117T214822Z first. The bucket DB now has 29305 rows (29302 done). Its dump differs from the previous copy only by the two rows and the new empty `meta` table. Regenerated with ci/gen_mirror_manifest.py: only the two owner shards and their Index descriptors changed, and only those shards were stamped 2026.11.17. `--check` passes, and both public objects re-download with the registry's sha256. Part of #2040 (item 4)
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
14 of 17 tasks
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.
Why
#2040 item 4: nothing picked up new registry releases.
mirror.py catalogre-read versions only for packages it had never seen. A new release of a known package, like FastLED 3.10.9, was never queued, so #2034 had to mirror it by hand.What changed
ci/mirror/mirror.py)sort=updated, checked against the live API).metatable, less a 6 h overlap.ci/mirror/update.pyruns the incremental pass from one machine, with no droplet. Steps:--package owner/type/name, refresh only the named packages and leave the watermark alone.--dry-runstops here.--max-bytes.CopySourceIfMatch), transfer the queue, and upload the DB withIf-Match.RegistryRefused. It is not retried.registry_refusedmarker is written and the pass exits 3.RestartPreventExitStatus=3, androtate.pystops instead of rotating.rotate.pyreads the DB and its ETag in one GET and uploads snapshots withIf-Match(orIf-None-Match: *when there was no DB).ManifestConflict.If-Matchreturned 412 and left the object unchanged.ci/gen_mirror_manifest.py)--version, which defaults to today's UTC date.gen_mirror_manifest.py --checknow also fails when the state DB and the bucket disagree.Data (third commit)
update.py --package earlephilhower/library/ESP8266Audio --package xylopyrographer/library/LiteLED_state/manifest.db.bak-20261117T214822Zhas the same sha256 as the previous DB (b3c91702…).metatable.--checkexits 0, and both public objects re-download with the registry's sha256.Testing
ci/test_mirror_tool.pyandci/test_gen_mirror_manifest.pyare both in the drift job; all 554 tests in that job pass locally. New tests cover:--package;runrefuses to start, unit flag);update.py's guards;--check.site/mirror/with a different stamp is byte-identical.Not in this PR (maintainer)
--since, e.g.update.py --since 2026-10-01 --dry-run. A 16 h window held 65 files (166 MB), so the backlog since 2026-10-30 is likely several GB, above what this task was allowed to upload.Part of #2040 (item 4)