Repository navigation
refactor(platform): own the live image path behind the facade; delete the ledger regeneration hatch - #2112
Merged
Conversation
The daemon image-hash handler selected the running image with `#[cfg(target_os = "linux")]` / `#[cfg(not(target_os = "linux"))]` pairs in both its production path and its test, so host selection leaked into fbuild-daemon (fbuild#1315 phase 9/9, criterion "concrete modules confined to the authorized boundary"). Add `platform::executable::replace_proof_live_image()`: the concrete hosts own the handle (Linux `/proc/self/exe`, which keeps naming the loaded inode after the launch path is replaced, renamed, or unlinked; other hosts report `None`), and the facade exposes it without any caller-visible cfg. The daemon keeps its own policy: it falls back to the launch path and retains the mtime restart decision when the host has no replace-proof handle. Also delete the ledger regeneration escape hatch. `enforce_platform_boundary.py` could rewrite `ci/platform_boundary_ledger.tsv` and the Dylint baseline from whatever the tree currently contained, which turns a failing gate into a recording step. Both are reviewed artifacts: a delta must now be explained occurrence by occurrence. `--print-totals` (used by CI) is unchanged. Ledger 44 -> 40 rows, Dylint baseline 43 -> 39; the independent scanner agrees at 40/39, and the four health.rs rows left both files, so this is a migration rather than a re-baseline.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
8 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.
First landing of #1315 (platform refactor phase 9/9): one capability leaves the
transitional ledger by moving into the authorized boundary, and the ledger's
regeneration escape hatch is deleted.
1. The daemon's live image path moves behind the facade
handlers/health.rsselected the running image with#[cfg(target_os = "linux")]/#[cfg(not(target_os = "linux"))]pairs in theproduction handler and in its test — 4 ledger rows of host selection living
in
fbuild-daemon.New
platform::executable::replace_proof_live_image():crates/fbuild-core/src/platform/linux/mod.rs, an exempt concretezone) returns
/proc/self/exe, which keeps naming the loaded inode after thelaunch path is replaced, renamed, or unlinked.
None: they expose no handle that survivesreplacement, so the caller must judge the path it was given.
platform/executable.rsexposes the result with no cfg and nohost literal of its own.
The daemon keeps its own policy, unchanged: when the host has no replace-proof
handle it hashes the launch path, but only after re-checking
source_mtimeso areplaced pathname still retains the mtime restart decision.
2. The ledger regeneration escape hatch is gone
ci/enforce_platform_boundary.py --writerewroteplatform_boundary_ledger.tsvand
dylints/enforce_platform_boundary/src/baseline.txtfrom whatever the treecurrently contained, which converts a failing gate into a recording step. Both
files are reviewed artifacts (the research inventory already says a delta "must
explain every delta instead of regenerating a baseline to make CI pass"), so the
switch and the two
render*helpers that served it are deleted, along with thetest that asserted them.
--print-totals— the only mode CI uses — isunchanged. A regression test now asserts
--writeexits 2 and neither helperexists.
Ledger movement (a migration, not a re-baseline)
ci/platform_boundary_ledger.tsvdylints/enforce_platform_boundary/src/baseline.txtThe 4 removed rows are exactly
crates/fbuild-daemon/src/handlers/health.rsattr_cfgpairs (prod + test); the independent whole-tree scanner reportsrows=40; dylint_rows=39and keeps the Dylint projection in exact agreement.ci/platform_boundary_research.tsvwas regenerated for the moved line numbers(205 rows, unchanged kinds/capabilities).
RED proof
Reintroducing
#[cfg(unix)]inhealth.rsafter the commit:Reverted: exit 0,
rows=40; dylint_rows=39.Checks run
soldr cargo test -p fbuild-core --lib platform::— 74 passed, 0 failedsoldr cargo test -p fbuild-daemon --lib health— 9 passed, 0 failed(includes
hashes_loaded_image_only_for_loopback_callers)soldr cargo clippy -p fbuild-core -p fbuild-daemon --all-targets --no-deps -- -D warnings— exit 0SOLDR_VERDICTS=off soldr cargo fmt --check— exit 0uv run --no-project --with pyyaml python -m unittest ci.test_enforce_platform_boundary ci.test_platform_boundary_research— 30 tests OKci/platform_boundary_research.py --check --print-totals— exit 0Remaining cells of #1315 (not in this PR)
The ledger still carries 40 classified rows in 11 files (
fbuild-toolchainesp_qemu*,fbuild-pathsexecutable_hash/dev_daemon_namespace, thefbuild-daemonemulator test helpers,websockets_tests.rs, two test-onlyattr_cfgfiles, and onelibcentry infbuild-daemon/Cargo.toml). Eachneeds its own capability migration; the baseline can only be deleted once they
are all gone. Three-host validation and the per-criterion audit table are phase
9's closing steps.
#1315 stays open.