Repository navigation
refactor(platform): migrate executable identity behind the facade - #2115
Merged
Merged
Conversation
Phase 9/9 of #1315: the executable hash memo and the two remaining direct `std::env::current_exe` call sites now go through `fbuild_core::platform`, so callers carry no host conditionals. - `platform::fs::executable_memo_supported()` states whether this host can key a short-lived executable hash memo (unix hosts: yes, from inode/ctime data; Windows: no, its metadata set cannot detect a replacement), asserted per concrete host. - `fbuild_paths::executable_hash` keeps ONE implementation: the memo path runs when the capability says the host supports it, otherwise the image is hashed directly — the same policy the old `#[cfg(unix)]`/`#[cfg(not(unix))]` pair encoded. - `dev_daemon_namespace::hash_current_exe` and the python facade test use `platform::executable::current_image()` instead of `std::env::current_exe`. Ledger 24 -> 15 rows, Dylint baseline 24 -> 15, research inventory regenerated, and the boundary unittest's explicit row count updated. Tests: new `a_written_memo_is_trusted_instead_of_rehashing` spoofs the stored digest so a rehash would fail it, proving the reuse path runs.
8 tasks
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
Phase 9/9 of #1315 — executable identity capability.
What changed
crates/fbuild-paths/src/executable_hash.rsselected its memo policy with a#[cfg(unix)]/#[cfg(not(unix))]pair, and two more sites still calledstd::env::current_exedirectly. All three now ask the platform facade:platform::fs::executable_memo_supported()—trueforLinux and macOS (inode + change-time data moves exactly when the image is
replaced),
falsefor Windows (its metadata set cannot distinguish areplacement), asserted per concrete host.
executable_hashkeeps ONE implementation. The existingunixbody isunchanged; it is entered only when the capability reports support, otherwise
the image is hashed directly — byte-for-byte the policy the cfg pair encoded.
MEMO_HEADER,file_identityandwrite_memolose their gates with it.dev_daemon_namespace::hash_current_exeand the python facade's fakedaemon spawn use
platform::executable::current_image()(the existingfacade function) instead of
std::env::current_exe.Ledger 24 -> 15 rows (
executable_hash7,dev_daemon_namespace1,python_facades1), Dylint baseline 24 -> 15, research inventoryregenerated with
--write, and the boundary unittest's explicit row countupdated to 15 so a re-baseline cannot pass silently.
Tests
soldr cargo test -p fbuild-paths --lib— 109 passed / 0 failed (1 ignored).a_written_memo_is_trusted_instead_of_rehashing: after the first call itspoofs the stored digest in the memo file; a second call must return the
spoiled hash, so the reuse path is proven to run rather than being a
values-only assertion (skipped where the capability says unsupported). The
existing invalidation test additionally asserts a supported host writes the
memo and an unsupported host writes none.
soldr cargo test -p fbuild-core --lib platform::fs— 10 passed / 0 failed.soldr cargo clippy -p fbuild-paths -p fbuild-core --all-targets --no-deps -- -D warnings— exit 0.soldr cargo check --workspace --all-targets --exclude fbuild-python— exit 0(
fbuild-pythoncannot link on this host: no sharedlibpython3.14;cargo check -p fbuild-python --testsis clean instead).soldr cargo fmt --check— clean.ci/enforce_platform_boundary.py --print-totals—rows=15; dylint_rows=15, exit 0.ci/platform_boundary_research.py --check— exit 0.python -m unittest ci.test_enforce_platform_boundary ci.test_platform_boundary_research— 30 tests OK.#1315 stays open (remaining cells:
esp_qemu6 +esp_qemu_runtime3 and theresidue in the emulator/toolchain tests, plus the phase-8 group and the
closing three-host audit table).