fix: skip the legacy mount-source pass when no root it walks exists - #8898
Conversation
The pre-#6268 residue pass proved bind coverage from /proc BEFORE checking whether the one root it may walk is present. /run/user/$UID is a logind construct, so on macOS and Windows that root never exists and /proc cannot be read: the coverage claim was unprovable on every tick, and the pass reported a held-back walk at WARNING every few minutes for a root it was never going to touch. Every desktop install saw it at the default log level. Check the roots first and return before the pin scan when none is present. The marker is not stamped there: the branch found nowhere to look, which is not the same as finding nothing left, so the pass stays armed at the cost of one stat per tick. Linux behaviour with a present root is unchanged.
Design Review (Fable 5) — ✅ PASSDesign-level review of The change is a small, well-scoped reordering in Design-Verdict: PASS A cheap existence check now correctly precedes the expensive coverage proof; Linux behavior, fences, and the not-stamped marker semantics are all preserved. [DESIGN-REVIEWED] a643379 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsThe candidate list is empty ("No candidates"), so there is nothing to falsify in Step 1. The diff is a small, self-consistent defensive change: it filters No findings. [OPUS-REVIEWED] a643379 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of All claims verified against the repository: the caller First-Principles-Verdict: PASS A per-tick false WARNING on every non-Linux install is removed by checking root presence before the /proc proof; nothing rides along. What this change shipsIntent: stop a spurious once-per-sweep WARNING (and a wasted
Counts: [FIRST-PRINCIPLES-REVIEWED] a643379 |
chenmingwei23
left a comment
There was a problem hiding this comment.
Approved: readiness: passed, all eligible checks green, no merge conflict.
Problem / Motivation
Every macOS and Windows install logs this at the default log level, once per
sweep tick (~10 minutes), forever:
Nothing is wrong on those hosts, and there is nothing for the pass to reclaim.
Why it matters
The message is a real diagnostic — on a Linux host it means the legacy reclaim
pass is inert and the inode pile is not shrinking — so a warning that fires
unconditionally off Linux is worse than noise: it trains the reader to ignore
the line that matters. It also costs a full
/procwalk per tick on hosts wherethe walk can never succeed.
What changed (motivation → approach → change)
_cleanup_legacy_mount_source_residueproved bind coverage from/procBEFORElooking at whether the one root it may walk is present.
_launcher_tmpfs_roots()returns/run/user/$UID, a logind construct: offLinux that path never exists, and
/proccannot be read either, socompleteandcoverage.coveredare both false on every tick and the passreports a held-back walk for a root it was never going to touch.
The fix is ordering. Filter the roots to those actually present and return
before the pin scan when none is — there is nowhere for an entry of this class
to be, so no coverage claim is needed to justify removing nothing.
The one-shot marker is deliberately not stamped on that path. The branch
found nowhere to look, which is not the same as finding nothing left, so the
pass stays armed; a repeat now costs one
statinstead of a/procwalk. Aroot appearing later is therefore still swept.
Linux behaviour with a present root is unchanged: same roots, same pin scan,
same fences, same stamping rules.
Tests
test_an_absent_root_skips_the_pin_scan_without_a_warning(inTestLegacyResidueSweep) points the roots at a non-existent path and assertsthree things: the pin scan is never called, no held-back WARNING is emitted, and
the pass is not retired — a subsequent call with a real root still reclaims.
Verified non-vacuous: reverting the guard to the old ordering
(
roots = _launcher_tmpfs_roots()/if False:) turns this test red, and onlythis test.
Manual verification
N/A — the observed symptom is a log line on a code path unit coverage reaches
directly, and the branch is selected by the presence of a directory, which the
test controls.
Related Issues
Follow-up to #8559, which introduced this pass. No open issue tracks the
off-Linux noise.
Pattern harvest
Rule candidate: review-prompt
Pattern: an expensive precondition proof runs before the cheap check that
decides whether the work is possible at all — so on a platform where the proof
can never succeed, the failure is reported instead of the work being skipped.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)