Skip to content

Delete all local data: an absent file behind a read-only mount is not a leftover - #246

Merged
GLinnik21 merged 1 commit into
mainfrom
fix/local-data-sweep-absent-behind-erofs
Sep 25, 2026
Merged

GLinnik21 merged 1 commit into
mainfrom
fix/local-data-sweep-absent-behind-erofs

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

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:

privacy: local data erased; 4 file(s) could not be removed: /media/internal/.com.beb.plxnative.debug-lastplace.json: Read-only file system (os error 30); ...-telemetry.json: (os error 30); ...-telemetry-spool.bin: (os error 30); ...-telemetry-crashmark.json: (os error 30)

None of the four files exists. As root, ls -a /media/internal shows no plxnative entries.

Root cause

The app's jail mounts /media/internal read-only. Linux answers unlink with EROFS from the parent mount before it looks up the child. The sweep in delete_all_local_data (remove_local_file) used a bare std::fs::remove_file and only treated ENOENT as 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_file now 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.
  • The runtime-log sweep (erase_runtime_logs) already goes through remove_local_file. The recording-artifact sweep (ui::rec::erase_owned_artifacts) follows the same rule, but ui/ may not name the storage layer (ui/CLAUDE.md, §2.1). So it now takes the removal as an injected fn(&Path) -> io::Result<()>, and app/ passes app::input::remove_or_prove_absent.
  • New ci/check-deps.sh rule uistorage: ui/ never names crate::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).
  • The file half of delete_all_local_data is split out into sweep_local_files(persistent, runtime_root). The host suite can then run it against a scratch tree, using storage::UnlinkFaultForTest to inject the device's EROFS.
  • Not changed: imgcache::clear and telemetry::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_file does not pass through the test fault seam. So the RED run used main's exact rule (unlink, with only ENOENT treated as success) routed through storage::unlink, which is the same call as std::fs::remove_file in non-test builds.

Gates (on the committed tree)

  • make check:
    • test result: ok. 4415 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out
    • test result: ok. 4471 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out
    • test result: ok. 101 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
  • cargo +nightly check --lib --no-default-features: clean
  • make (ARM cross-build): passes
  • Adversarial review: approve, no findings

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T12:12:58.498866Z ae43376 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread rust-modules/src/ui/rec.rs Outdated
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(|_| ()),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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]>
@GLinnik21
GLinnik21 force-pushed the fix/local-data-sweep-absent-behind-erofs branch from 5327d32 to ae43376 Compare September 25, 2026 12:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread ci/check-deps.sh
# `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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@GLinnik21
GLinnik21 merged commit 033746b into main Sep 25, 2026
5 checks passed
@GLinnik21
GLinnik21 deleted the fix/local-data-sweep-absent-behind-erofs branch September 25, 2026 12:33
GLinnik21 added a commit that referenced this pull request Sep 25, 2026
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant