Skip to content

feat(prebuilt): one stamp per component, verified over the entries it contributed (#1882) - #2167

Merged
zackees merged 1 commit into
mainfrom
agent/1882-component-stamp-files
Nov 24, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/1882-component-stamp-files

Conversation

@zackees

@zackees zackees commented Nov 24, 2026

Copy link
Copy Markdown
Member

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:

  1. One stamp file per directory. The SDK variant and the MCU skeleton of the
    same chip both install into tools/esp32-arduino-libs/<mcu>/, so the second
    component's component-identity.json overwrote the first's. A directory
    cannot express two identities that way, and read_stamp had no way to ask for
    "the SDK variant" vs "the MCU skeleton" of the same tree.
  2. The skeleton was verified by whole-tree equality, which on ESP32-C2 can
    never hold: the Arduino core archive ships a partial
    tools/esp32-arduino-libs/esp32c2/ (it lacks FreeRTOS, which is why
    ensure_mcu_libs exists at all), so the merged directory is always a superset
    of 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_id
    • stamp_file_name(component) → component-identity.<component>.json;
      is_stamp_file recognises a stamp only at a component root (a nested file
      that happens to carry the prefix is content). content_id excludes every
      component's stamp, so a co-located component's stamp never changes this one's id.
    • read_stamp(root, component) / remove_stamp(root, component) are per
      component; a stamp filed under another component's name is not an identity.
    • has_stamp(root) — "some component owns this tree", used by the in-place
      patch guard.
    • entries_survived(staged_root, installed_root, excluded) — re-hashes the
      staged 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.
    • The per-entry hashing recipe is factored into hash_entry, so content_id
      and entries_survived cannot 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 skeleton
    install keeps the staged root so the verification can run after the merge.
    patch_unless_stamped asks has_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.json name, 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.
  • New unit coverage: entries_survived accepts a superset / reports a changed
    byte / a missing entry / a missing root, ignores the staged component's own
    stamp; has_stamp; a stamp filed under another component is no identity; a
    component name cannot escape its stamp file name.
  • a_component_stamp_is_withdrawn_when_its_entries_did_not_survive covers the
    withdrawal wiring at keep_stamp_if.

Green: soldr cargo test -p fbuild-packages-fetch --lib component_id 26 passed /
0 failed; soldr cargo test -p fbuild-library --lib esp32_framework 60 passed /
0 failed; soldr cargo clippy -p fbuild-packages-fetch -p fbuild-library --all-targets -- -D warnings exit 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_CORE opt-in, the 8b ladder, and any publish,
which is a maintainer action under 8c).

…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.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "enabled" at "reviews.pre_merge_checks"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zackees
zackees added this pull request to the merge queue Nov 24, 2026
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 24, 2026
Merged via the queue into main with commit d64af8a Nov 24, 2026
34 checks passed
@zackees
zackees deleted the agent/1882-component-stamp-files branch November 24, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant