Repository navigation
Delete all local data: an absent file behind a read-only mount is not a leftover - #246
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5327d3244d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Ok(metadata) if name == "plxnative-recordings" && metadata.is_dir() => fs::remove_dir_all(&path), | ||
| Ok(_) => fs::remove_file(&path), | ||
| // The erase sweep's one rule: a refused unlink of a name that is proven gone is done. | ||
| Ok(_) => crate::storage::remove_file_or_prove_absent(&path).map(|_| ()), |
There was a problem hiding this comment.
Keep the recorder independent of application storage
Move this shared unlink behavior behind a layer-neutral API or inject it from the app: ui/ is the generic UI library and may name only gfx, text, paths, and task, so this new dependency on crate::storage crosses the repository's layer boundary and prevents the recorder from remaining independently reusable with FixtureHost. The current ci/check-deps.sh still reports green because its layer check covers only screens/ → app, so it will not stop this dependency from spreading. rust-modules/src/ui/CLAUDE.mdL70-L81
Useful? React with 👍 / 👎.
… a leftover On webOS 4.10.2, Settings -> Privacy & data -> Delete all local data ended with "Some files could not be removed and may still be on this television", and the log named four files under /media/internal (the obsolete last place and the three telemetry files) with EROFS. None of them exists. The jail mounts /media/internal read-only, and Linux answers unlink with EROFS from the parent's mount before it looks the child up, so the sweep's bare remove_file read an absent file as a survivor and the user was told data might remain. The sweep now uses the rule the sign-out credential sweep and telemetry's legacy cleanup already use: storage::remove_file_or_prove_absent. A refused unlink whose no-follow lookup finds no entry is removed; a file that exists, or cannot be looked at, is still a leftover. The runtime-log sweep goes through the same helper, and so does the recording-artifact sweep: ui::rec may not name the storage layer (ui/CLAUDE.md §2.1), so erase_owned_artifacts takes the removal rule as an injected fn that app/ supplies (app::input::remove_or_prove_absent). A new zero-hit check-deps rule, uistorage, keeps ui/ from naming crate::storage. The file half of delete_all_local_data is factored into sweep_local_files so the host suite can drive it against a scratch tree with storage::UnlinkFaultForTest injecting the device's EROFS. Co-Authored-By: Claude Opus 5.5 <[email protected]>
5327d32 to
ae43376
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae4337642c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # `crate::{gfx,text,paths,task}`). A ui-owned sweep that needs the app's removal rule takes it as an | ||
| # injected `fn` (`ui::rec::erase_owned_artifacts`). Zero, no allowlist. The wider table is not a | ||
| # grep yet: ui/ still names other application modules, mostly from tests and dev instruments. | ||
| gate uistorage '(crate|super)::storage::' "$SRC/ui" |
There was a problem hiding this comment.
Reject imported storage modules in the new gate
When a UI file writes use crate::storage; or use crate::{storage, task}; and then calls storage::..., this pattern has no trailing :: after storage, so the gate reports no match and CI accepts exactly the dependency it claims to prohibit. These module-import forms are already common under ui/; extend the check to cover direct, aliased, and brace imports as well as fully qualified calls.
Useful? React with 👍 / 👎.
* v0.7.0 audit: fourth device pass verifies #245 and #246 The fourth device pass (2026-09-25, debug builds of 8dcb7f7 and 033746b, the maintainer's own account with only the Guest profile seated) verified both fixes for the read-only /media/internal mount: sign-out no longer retries an absent legacy candidate forever and a sign-in after it persists (#245), and Delete all local data no longer reports absent files as leftovers (#246). The audit records the pass as a by-hand evidence row, closes the third pass's "fix in flight" finding, drops the sign-out retry loop from Known issues, and adds #245 and #246 to the landed-after section. Neither changes a persisted format, which the diffs confirm: they change only when a file counts as removed and how often a failed clear is retried. The release note needed no change: neither defect shipped in a stable release, and nothing it says about Sign out or Delete all local data became false. Screenshots were regenerated with SHOT_CHECK=1; no figure changed beyond JPEG re-encode noise, so none are committed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * v0.7.0 audit: scope the #241 docs-only claim; the ledger's sign-out finding is fixed The host/static row's "every commit after b99e79f touches only docs" was true of the #241 branch it was written on, not of main, where #245 and #246 later changed shipped code; the row now says so and points at their own CI and the fourth pass. The forward-port ledger's third-pass row still called the sign-out retry loop a fix in flight; it now records #245 and the device verification. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
TV evidence (webOS 4.10.2, main 8dcb7f7)
Settings → Privacy & data → Delete all local data finishes but says "Signed out, and most local data deleted / Some files could not be removed and may still be on this television." The log:
None of the four files exists. As root,
ls -a /media/internalshows no plxnative entries.Root cause
The app's jail mounts
/media/internalread-only. Linux answersunlinkwith EROFS from the parent mount before it looks up the child. The sweep indelete_all_local_data(remove_local_file) used a barestd::fs::remove_fileand only treatedENOENTas success, so every absent candidate behind that mount was counted as a leftover. This is the same bug class #245 fixed for the sign-out credential sweep.Fix
remove_local_filenow uses the shared rule,storage::remove_file_or_prove_absent, which sign-out and telemetry's legacy cleanup already use. When an unlink is refused, a no-follow lookup runs. If it finds no entry, the file counts as removed. A file that exists, or that cannot be looked up, stays a leftover.erase_runtime_logs) already goes throughremove_local_file. The recording-artifact sweep (ui::rec::erase_owned_artifacts) follows the same rule, butui/may not name the storage layer (ui/CLAUDE.md, §2.1). So it now takes the removal as an injectedfn(&Path) -> io::Result<()>, andapp/passesapp::input::remove_or_prove_absent.ci/check-deps.shruleuistorage:ui/never namescrate::storage::. It has zero hits and no allowlist, and it would have caught this PR's first revision. The rest of the ui/ table is not enforced by a grep yet, because ui/ still names other app modules (mostly from tests and dev instruments).delete_all_local_datais split out intosweep_local_files(persistent, runtime_root). The host suite can then run it against a scratch tree, usingstorage::UnlinkFaultForTestto inject the device's EROFS.imgcache::clearandtelemetry::spool::purge_all_local. The first only walks entries that exist in a directory it has already probed as writable. The second rewrites the spool instead of unlinking it. Neither adds to the leftovers count.RED → GREEN
New tests in
app::input::delete_all_tests:absent_files_behind_a_read_only_mount_are_not_leftovers: the four device files, all absent, with EROFS injected. On main's rule this was RED and produced the device message verbatim (…debug-lastplace.json: Read-only file system (os error 30), and so on). It is now GREEN with 0 leftovers.present_files_behind_a_read_only_mount_are_still_leftovers: the counter-test. Files that exist behind the same EROFS refusal (the persistent candidates, a runtime log, a recording artifact) are all still reported, and all still exist.How RED was observed: main's
remove_filedoes not pass through the test fault seam. So the RED run used main's exact rule (unlink, with onlyENOENTtreated as success) routed throughstorage::unlink, which is the same call asstd::fs::remove_filein non-test builds.Gates (on the committed tree)
make check:test result: ok. 4415 passed; 0 failed; 2 ignored; 0 measured; 0 filtered outtest result: ok. 4471 passed; 0 failed; 2 ignored; 0 measured; 0 filtered outtest result: ok. 101 passed; 0 failed; 0 ignored; 0 measured; 0 filtered outcargo +nightly check --lib --no-default-features: cleanmake(ARM cross-build): passes🤖 Generated with Claude Code