Skip to content

fix(archive): pin deterministic ar output; fix the #2203 parity test's unit↔object pairing - #2204

Merged
zackees merged 1 commit into
mainfrom
agent/2203-archive-determinism
Nov 28, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/2203-archive-determinism

Conversation

@zackees

@zackees zackees commented Nov 28, 2026

Copy link
Copy Markdown
Member

Why main is red

Post-merge push run 46120703055 (b47e4cf3), job glibc 2.17 floor / Check (ubuntu-latest) = 140904430000:

esp32::orchestrator::prebuilt_core::tests::a_served_tree_and_a_source_build_archive_to_identical_bytes
assertion `left == right` failed: a served build and a from-source build of one cell must hash the same archive
  left:  1457351ae392f347c9764dfe49d6cc965f446b81d7fcd3bb213c8659bffc62b0
 right:  ef6b7e40cfafc4763e69ede347d56ff6d772f253ebf86e83861517f56b8fefca

The same test passed in that commit's own merge group (job 140897516020, ... ok, 284 passed / 0 failed at 07:10Z) — same workflow, same ubuntu-latest pool label. Not a lane difference: the test itself was flaky.

Root cause (in the test added by #2203, not in the product)

prebuilt_core_tests.rs wrote one object per framework unit into the fresh core build dir, collected fresh_objects, sort()ed the paths, and then built the publisher manifest with units.iter().zip(&names) — pairing the sorted object list back against the unsorted unit list. CompilerBase::object_path names objects from a hash of the source path, so whenever the hash order differed from the unit order the manifest mapped a unit to the other unit's object: the served arm then archived swapped bytes.

Reproduced locally at 2 of 3 full-suite runs. The first version of the new assertion made the cause explicit:

left:  [Member { name: "unit_4425.cpp.o", ... body: "compiled object 1" }, Member { name: "unit_f4a8.cpp.o", ... body: "compiled object 0" }]
right: [Member { name: "unit_4425.cpp.o", ... body: "compiled object 0" }, Member { name: "unit_f4a8.cpp.o", ... body: "compiled object 1" }]

Fix: build (unit, object) pairs, sort the pairs together, and derive both the archive member list and the manifest from that one sorted vector. (Also fixed while diagnosing: the member parser now skips the 8-byte !<arch>\n global header — without it it returned empty lists and the comparison was vacuous.)

Second half: make the claim host-independent

#2196's acceptance sentence is "a served tree and a from-source build archive to identical bytes". fbuild_core::archive::create inherited whatever determinism default the host ar was built with; D makes it explicit (uid/gid/mtime written as zero), so the archive bytes are a property of fbuild rather than of the distro's binutils configuration. An archiver that rejects D falls back to plain rcs once — losing byte parity must never lose a build. Failure classification (disk-full vs archiver error, #1750 item 4) is unchanged and now lives in archiver_failure.

Tests (real output)

  • soldr cargo test -p fbuild-core --lib archive → 15 passed; 0 failed (6 new archive tests + 9 filtered-in by name).
  • soldr cargo test -p fbuild-build-esp --lib prebuilt_core → 12 passed; 0 failed.
  • Full fbuild-build-esp lib suite, 30 consecutive runs: 284 passed; 0 failed; 7 ignored every time. Pre-fix the same loop failed 2 of 3.
  • RED proofs: MODIFIERS reverted to "rcs" → the_archiver_is_asked_for_deterministic_output FAILED (6 passed; 1 failed, exit 101); fallback branch deleted → an_archiver_that_rejects_d_still_archives FAILED (6 passed; 1 failed, exit 101). Both restored (touch, suite green).
  • soldr cargo fmt --check -p fbuild-core -p fbuild-build-esp exit 0; ci/enforce_platform_boundary.py --print-totals → rows=0; dylint_rows=0.

Local clippy/dylint were not obtainable this hour (build-lease); CI's Dylint Full is the gate.

#2196 stays open (its cold/warm bench hook is untouched).

…iring

main is red at b47e4cf: prebuilt_core::tests::
a_served_tree_and_a_source_build_archive_to_identical_bytes failed on the
post-merge push run (job 140904430000) while passing in its own merge group
(job 140897516020, same workflow and runner label).

Root cause was in the test added by #2203, not in the product: it wrote one
object per framework unit, then sorted the object PATHS and zipped that
sorted list against the UNSORTED unit list. The publisher manifest therefore
mapped a unit to the other unit's object whenever the object-hash order
differed from the unit order, so the served arm archived swapped bytes.
Reproduced locally at 2/3 full-suite runs; the new member-level assertion
named it (unit_4425.cpp.o carried "compiled object 1" in one arm and
"compiled object 0" in the other). Pairs are now sorted together, and the
suite is 30/30 green (284 passed, 0 failed).

The parity claim also needs the archive bytes to be a property of fbuild
rather than of the host archiver's build options, so fbuild_core::archive::
create now passes `D` (uid/gid/mtime zeroed) and falls back once to plain
`rcs` for an archiver that rejects the modifier (cctools/older vendor ar).
The test now compares the full member table (name, mode, uid, gid, mtime,
payload) before the digest, so a future failure names the diverging field
instead of printing two hashes.

#2196 stays open.
@zackees
zackees added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 84748b5 Nov 28, 2026
34 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 29, 2026
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