Repository navigation
fix(mirror): keep other tools' index entries when regenerating - #2056
Merged
Merged
Conversation
Behaviour-preserving: write_site builds the documents, prunes unlisted shards and writes the tree, so the write path can be tested without a bucket (#2040).
gen_mirror_manifest.py rebuilt the whole Index from the bucket, so a regeneration deleted shards/esp-toolchain.json and @esp-toolchain (written by publish_toolchain_slices.py), and either deleted @esp-libs (written by publish_esp_slices.py) or, via --prebuilt, rewrote it wholesale stamped with the registry shards' version (2026.11.04 -> 2026.10.31) and moved it ahead of @names-*. The generator now owns only the registry owners and @names-*. Every other @ entry is carried over verbatim after the generated entries in committed order, its shard is never pruned, and one whose shard is missing or no longer hashes to its descriptor raises ForeignShardError before anything is written. Foreign shards no longer feed load_existing (so --check no longer reports their components as removed bucket objects) or the shard version vote. --prebuilt is removed: it was a second writer for @esp-libs, never used for a committed shard. Part of #2040 (item 2).
Formatting only; no behaviour change (#2040).
|
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.
Part of #2040 (item 2). Items 1, 3 and 4 are untouched.
Root cause
site/mirror/has three writers. Only one of them knew about the others.@names-*shards/<id>.json,shards/names-*.jsonci/gen_mirror_manifest.py@esp-libsshards/esp-libs.json(version2026.11.04)ci/publish_esp_slices.py(upserts one component per run; 072ee66 ... 66c4e04, 2026-11-04)@esp-toolchainshards/esp-toolchain.json(version1)ci/publish_toolchain_slices.py(c5c7227 ... ff3cdf0, 2026-11-07/08)The generator rebuilt the whole Index from the bucket listing and the state DB, then deleted every shard file it had not written. So:
esp-toolchain.jsonand@esp-toolchainwere deleted.esp-libs.jsonwas either deleted or, with--prebuilt, rewritten wholesale. It was stamped with the generator's single shard version, the majority version of the 8040 registry shards (2026.10.31). That is the rewind from2026.11.04.@esp-libsbefore@names-*, but the publishers append after them. That is the reorder.The committed index is not newer data the generator failed to fetch. Two of its entries come from other tools that the generator never reads.
Fix: option (a), keep what it doesn't own
gen_mirror_manifest.pynow owns only the registry owners and@names-*. Every other@key belongs to another tool. That namespace is already reserved, because@is escaped in owner keys.manifest.jsonverbatim, after the generated entries, in committed order. Their shard files are never pruned or rewritten.ForeignShardErroris raised before any file is written. If a foreign key collides with a generated one, it also raises.load_existing. Before,--checkcounted their component ids (for exampletoolchain-xtensa-esp-elf/...) as removed bucket objects and always failed. They also no longer feed the shard-version vote.--prebuiltis removed. It was a second writer for@esp-libsthat replaced the shard wholesale (dropping components missing from FILE) and restamped its version. No committed shard was ever produced by it.Why not (b) or (c):
--allow-removalis passed, would make every routine regeneration need a flag to get past entries it was never meant to touch.Commits
refactor: extractwrite_sitefrommain. Behaviour-preserving; the existing tests stay green.fix: the behaviour change plus tests and docs.style:ruff formatof the two touched Python files. Formatting only; both were unformatted onmain.Tests (
ci/test_gen_mirror_manifest.py,TestCommittedIndex, tempdirs, no network)I ran these RED against commit 1, and they fail there for behavioural reasons:
esp-toolchainshard bytes and its@esp-toolchainentry.2026.10.31does not rewindesp-libs.jsonfrom2026.11.04.ForeignShardErrorand writes nothing.load_existing(used by--check) ignores foreign components.existing_versionignores foreign shards.Validation
uv run --with pyyaml --with zstandard --no-project python -m unittest ci.test_gen_mirror_manifest ci.test_publish_toolchain_slices ci.test_local_suites: 60 tests OK.site/mirror/back throughwrite_site, using its own shards as the hashed inputs and theirprovidesas systems. The result was 29300 objects, 8040 owner shards and 16 names shards, anddiff -ragainstsite/mirror/is identical, includingesp-libs.json,esp-toolchain.jsonand the Index order.publish_toolchain_slices.py --checkstill passes against the committed tree.ruff checkandci/check_python_complexity.py(C901 <= 10) pass.ci-workflow-drift.ymlandci/local_suites.py, and that module list is unchanged.