Skip to content

refactor(platform): own the live image path behind the facade; delete the ledger regeneration hatch - #2112

Merged
zackees merged 1 commit into
mainfrom
agent/platform-live-image
Nov 20, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/platform-live-image

Conversation

@zackees

@zackees zackees commented Nov 20, 2026

Copy link
Copy Markdown
Member

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.rs selected the running image with
#[cfg(target_os = "linux")] / #[cfg(not(target_os = "linux"))] pairs in the
production handler and in its test — 4 ledger rows of host selection living
in fbuild-daemon.

New platform::executable::replace_proof_live_image():

  • Linux (crates/fbuild-core/src/platform/linux/mod.rs, an exempt concrete
    zone) returns /proc/self/exe, which keeps naming the loaded inode after the
    launch path is replaced, renamed, or unlinked.
  • Windows and macOS return None: they expose no handle that survives
    replacement, so the caller must judge the path it was given.
  • The facade in platform/executable.rs exposes the result with no cfg and no
    host 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_mtime so a
replaced pathname still retains the mtime restart decision.

2. The ledger regeneration escape hatch is gone

ci/enforce_platform_boundary.py --write rewrote platform_boundary_ledger.tsv
and dylints/enforce_platform_boundary/src/baseline.txt from whatever the tree
currently 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 the
test that asserted them. --print-totals — the only mode CI uses — is
unchanged. A regression test now asserts --write exits 2 and neither helper
exists.

Ledger movement (a migration, not a re-baseline)

file before after
ci/platform_boundary_ledger.tsv 44 rows 40 rows
dylints/enforce_platform_boundary/src/baseline.txt 43 rows 39 rows

The 4 removed rows are exactly crates/fbuild-daemon/src/handlers/health.rs
attr_cfg pairs (prod + test); the independent whole-tree scanner reports
rows=40; dylint_rows=39 and keeps the Dylint projection in exact agreement.
ci/platform_boundary_research.tsv was regenerated for the moved line numbers
(205 rows, unchanged kinds/capabilities).

RED proof

Reintroducing #[cfg(unix)] in health.rs after the commit:

$ uv run --no-project python ci/enforce_platform_boundary.py --print-totals
platform-boundary: new occurrence: crates/fbuild-daemon/src/handlers/health.rs	attr_cfg	#[cfg(unix)]	0	host	host_mechanic
platform-boundary: Dylint baseline and independent scanner disagree
rows=40; dylint_rows=39
exit=1

Reverted: exit 0, rows=40; dylint_rows=39.

Checks run

  • soldr cargo test -p fbuild-core --lib platform:: — 74 passed, 0 failed
  • soldr 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 0
  • SOLDR_VERDICTS=off soldr cargo fmt --check — exit 0
  • uv run --no-project --with pyyaml python -m unittest ci.test_enforce_platform_boundary ci.test_platform_boundary_research — 30 tests OK
  • ci/platform_boundary_research.py --check --print-totals — exit 0

Remaining cells of #1315 (not in this PR)

The ledger still carries 40 classified rows in 11 files (fbuild-toolchain
esp_qemu*, fbuild-paths executable_hash/dev_daemon_namespace, the
fbuild-daemon emulator test helpers, websockets_tests.rs, two test-only
attr_cfg files, and one libc entry in fbuild-daemon/Cargo.toml). Each
needs 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.

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

coderabbitai Bot commented Nov 20, 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
  • 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 20, 2026
Merged via the queue into main with commit 9c5df75 Nov 20, 2026
32 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 21, 2026
@zackees
zackees deleted the agent/platform-live-image branch November 24, 2026 21:36
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