Repository navigation
feat(prebuilt): one stamp per component, verified over the entries it contributed (#1882) - #2167
Merged
Merged
Conversation
…tries (#1882) Component identity stamps were one file per directory, but the SDK variant and the MCU skeleton of a chip install into the same tools/esp32-arduino-libs/<mcu>/, so the second writer overwrote the first. The skeleton was then re-verified by whole-tree equality, which on ESP32-C2 can never hold: the core archive ships a partial tree of that same directory (it lacks FreeRTOS - that is why ensure_mcu_libs exists), so the merge always withdrew the stamp, on exactly the MCUs skeletons exist for. - component_id: stamp_file_name()/is_stamp_file(), per-component read_stamp/remove_stamp(root, component), has_stamp(root), and entries_survived(staged, installed, excluded) which re-hashes the staged tree's entries at the same paths on the installed side; content_id excludes every component's stamp, and the per-entry recipe is shared via hash_entry. - libs: keep_stamp_if(installed, survived, staged, label) - the SDK variant keeps whole-tree equality, the skeleton uses entries_survived; patch_unless_stamped asks has_stamp (whichever component owns the tree, its bytes are final). Decision 8a, docs/design/artifact-serving-decisions.md. #1882 stays open.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This was referenced Nov 24, 2026
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.
Component identity stamps are now one file per component, and a component
merged into a directory another one already populated is verified over the
entries it contributed, not over the whole merged tree.
Why
Two defects in the stamp half of decision 8a (
docs/design/artifact-serving-decisions.md)as landed in #2162 / #2164 / #2166:
same chip both install into
tools/esp32-arduino-libs/<mcu>/, so the secondcomponent's
component-identity.jsonoverwrote the first's. A directorycannot express two identities that way, and
read_stamphad no way to ask for"the SDK variant
"vs "the MCU skeleton" of the same tree.never hold: the Arduino core archive ships a partial
tools/esp32-arduino-libs/esp32c2/(it lacks FreeRTOS, which is whyensure_mcu_libsexists at all), so the merged directory is always a supersetof the skeleton's staging tree. The skeleton's stamp was therefore always
withdrawn — on exactly the MCUs skeletons exist for (C2, C61) — and the merge
silently destroyed whatever identity was there.
Change
fbuild-packages-fetch::component_idstamp_file_name(component)→component-identity.<component>.json;is_stamp_filerecognises a stamp only at a component root (a nested filethat happens to carry the prefix is content).
content_idexcludes everycomponent's stamp, so a co-located component's stamp never changes this one's id.
read_stamp(root, component)/remove_stamp(root, component)are percomponent; a stamp filed under another component's name is not an identity.
has_stamp(root)— "some component owns this tree", used by the in-placepatch guard.
entries_survived(staged_root, installed_root, excluded)— re-hashes thestaged tree's entries at the same relative paths on the installed side; a
missing entry, changed byte, flipped exec bit or different link target
reports
false. Supersets (another component's files) are invisible by design.hash_entry, socontent_idand
entries_survivedcannot drift apart.esp32_framework::libs—keep_stamp_if(installed, survived, staged, label)replaces
reconcile_stamp; the SDK variant still uses whole-tree equality(it owns its directory), the skeleton uses
entries_survived; the skeletoninstall keeps the staged root so the verification can run after the merge.
patch_unless_stampedaskshas_stamp: whichever component stamped the tree,its bytes are final and the tree is not patched in place.
Tests (RED first)
Proved by temporarily restoring the pre-fix behaviour and watching the new tests
fail:
skeleton_identity_survives_a_preexisting_partial_tree_at_the_destination—FAILED (0/1) under whole-tree equality, passes now. This is the ESP32-C2 case.
a_skeleton_merge_keeps_the_sdk_variant_identity_that_shares_its_directory—FAILED (0/1) with the single
component-identity.jsonname, passes now.two_components_share_one_directory_without_clobbering_each_other— FAILED(0/1) with the single name; also proves withdrawing one component leaves the
other's identity.
entries_survivedaccepts a superset / reports a changedbyte / a missing entry / a missing root, ignores the staged component's own
stamp;
has_stamp; a stamp filed under another component is no identity; acomponent name cannot escape its stamp file name.
a_component_stamp_is_withdrawn_when_its_entries_did_not_survivecovers thewithdrawal wiring at
keep_stamp_if.Green:
soldr cargo test -p fbuild-packages-fetch --lib component_id26 passed /0 failed;
soldr cargo test -p fbuild-library --lib esp32_framework60 passed /0 failed;
soldr cargo clippy -p fbuild-packages-fetch -p fbuild-library --all-targets -- -D warningsexit 0. LOC: libs.rs 968, tests.rs 966 (gate 1000).Nothing here consumes a stamp yet: the planner half is the next unit, and this is
its prerequisite — a component id has to be addressable per component before an
assembler can read one. #1882 stays open (remaining cells: the hidden
--prebuilt-core/FBUILD_PREBUILT_COREopt-in, the 8b ladder, and any publish,which is a maintainer action under 8c).