feat(nfc): Delete all on the NFC page, asked first with how many go #239
No reviewers
Labels
No labels
area/build
area/install
area/saves
area/tooling
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!239
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/LongshotLauncher:feat/nfc-delete-all"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A player with hundreds of NFC dumps (the game lists only 256 of them) has to tick every row to clear the NFC page. This adds Delete all, which asks once before deleting the tags the list shows, keeping files that changed before the deletion check or could not be checked or deleted.
Summary
The button. It's under Delete selected on the NFC page, in the same style. It's off when the list is empty and while files are being added, like Delete selected.
Asked first. It opens the same dialog as the row's bin and Delete selected (
NfcDeleteView). The dialog lists the first 8 names and how many more. For Delete all it says:What it deletes. It snapshots the files the list showed when it asked and deletes only those whose identity and contents can still be verified:
.binand.nfcfiles directly in the NFC folder;key_file, another kind of file, a folder under it, the folder itself, or anything outside it;The row's bin and Delete selected use the same identity and contents checks. Afterwards the list, the count and the "only 256 of N" note update, a toast says how many went and how many were kept, and kept files are reported.
Recycle Bin. The launcher has no Recycle Bin code, so the delete is permanent, like the existing deletes, and the dialog says it can't be undone. Adding the bin would change all three delete paths, so it isn't done here.
Text. The NFC page's text isn't in the translation catalogs yet: none of its strings go through
Tr. The new strings follow the page, andscripts/translations.pyreports nothing new.Other changes:
docs/nfc.md's Deleting and Tests sections, and the README's NFC paragraph and scene list, describe it.tools/screenshotshas three new scenes over 300 fake tags:nfc,nfc-delete-allandnfc-deleted-all.test_launcher_core.py's--strictline names the new app-level check.Other PRs. #202 (the redesign) changes
NfcView.axaml,NfcViewModel.csanddocs/nfc.md, but not the Delete button's lines. It's already not mergeable against main, so whichever lands second needs a small merge.Testing
tests/launcher_app/Program.cs,NfcDeleteAll. It runs over fake tags in a temp folder, throughLONGSHOT_NFC_DIR; no real dump is used. The folder holds 257 tags, one.nfcthat isn't a dump, akey_file, a.txt, a subfolder with a.bin, and a.binbeside the folder. It checks:key_file, the.txt, the subfolder's file, the file outside and the folder itself;Rows,Count,TooManyandTooManyTextare raised, and the command'sCanExecuteChangedfires;DeleteAllCommand, so the check doesn't compile there. On this branch it passes.dotnet build LongshotLauncher.slnx -c Release: 0 warnings, 0 errors.python -I tests/test_launcher_core.pyon Windows 11 stops atSavesChecks' "A link whose shared save folder is gone" (a Windows symlink case), the same way on unchanged main. This PR doesn't touchtests/launcher_core/.--strict --longshotat the pinned commit stops earlier, onShaderCaches.cs' names against the pinneddev_packs.py, also the same on main. CI's Linux run covers both.LAUNCHER=$PWD python -I ../Tooling/tests/test_release.py: 3 failures,test_the_bump,test_the_next_stableandtest_check_tag_against_the_published_releases. They fail the same way on unchanged main (#236 saw the same).python -I scripts/translations.py: the same report as main, with the same texts missing from the catalogs and none new.tools/screenshots, Windows 11, headless): 300 fake tags made in each scene's own temporary NFC folder. The scenes use the real window, view model and dialog, andnfc-deleted-allactually deletes the 300 files. The folder path on Open the folder is blurred. They're in the first comment: the page on main, the page with Delete all, the question, and the page after.Not tested:
Platform.Linuxlauncher the app checks already use.🤖 Generated with Claude Code
A player with hundreds of dumps (the game lists only 256) had to tick every row to clear the page. Delete all, under Delete selected, asks first ("Delete all 300 NFC tags?", can't be undone, a scanned tag is kept only here), then deletes the .bin and .nfc files the list showed, nothing else in or outside the NFC folder. Off with an empty list and while files are being added. tests/launcher_app checks it over fake tags; tools/screenshots gains the nfc scenes. Co-Authored-By: Claude Opus 5.5 <[email protected]>Screenshots from
tools/screenshots(Windows 11, headless), over 300 fake tags in each scene's own temporary NFC folder. The folder path on Open the folder is blurred.Before (main), scene

nfc: only Delete selected.After,

nfc: Delete all under Delete selected.nfc-delete-all: the question, with how many go.nfc-deleted-all: after Delete all. The list is empty, the 256 note is gone, and both delete buttons are off.WIP: feat(nfc): Delete all on the NFC page, asked first with how many goto feat(nfc): Delete all on the NFC page, asked first with how many go@review
Recommendation: Request changes. Delete all can permanently delete a replacement file that was added after confirmation opened. Its single-file confirmation also omits the promised warning that deletion is permanent and a scanned tag may have no other copy.
The button clears the displayed NFC files in one operation and updates the page afterward. It reuses the existing deletion path, but that path identifies files only by name, so the confirmation does not reliably protect files added later.
@fixwill do (2)App/ViewModels/NfcViewModel.cs:351: The snapshot retains names, but deletion later resolves those names again. (more on the line)App/ViewModels/NfcViewModel.cs:393: Setting All to false for one file also selects the old subtitle, which omits both the permanent-deletion warning and the warning that a scanned tag may exist only here. (more on the line)More: does it help, other systems, switches, what was read
Does it help: Yes. The reported Windows headless run and app-level check demonstrate deleting 258 listed fake files and refreshing the page; Linux and live mouse interaction were not tested.
Other systems: The deletion path is shared by Windows and Linux. A concurrent game, scan, file manager, or other program can replace a listed name while the confirmation is open; the existing test covers only a newly added name. Screenshot scenes use isolated temporary folders.
Switches: None added, changed, or removed.
Reviewed:
74302780ffagainstd79fbcb0a5: Read the repository rules, commit and complete diff, NFC view model, deletion dialog, NFC core deletion path, app check and NFC documentation. Skimmed the remaining screenshot tool, test harness, README and related modal and drop handling. No review checklist or pull request template was found.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed, as requested. The pull request reports a successful Windows build and app check; its other reported failures also occur on the base.
Overlaps and merge order: #202 also changes the NFC view, view model and documentation; whichever lands second will need conflict resolution.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -344,2 +349,3 @@public void AskDelete(IReadOnlyList<NfcRowViewModel> rows, bool all = false){if (rows.Count > 0) Main.Modal = new NfcDeleteViewModel(this, rows.Select(r => r.File).ToList());if (rows.Count > 0) Main.Modal = new NfcDeleteViewModel(this, rows.Select(r => r.File).ToList(), all);L1: The snapshot retains names, but deletion later resolves those names again. If a listed tag is removed and another tag is saved under the same name while the question is open, confirming deletes the new file even though it was not the file shown when asked. Preserve and verify file identity or contents before deletion, skipping changed entries and reporting them; add a replacement-under-the-same-name test.
@ -385,2 +390,4 @@public NfcDeleteViewModel(NfcViewModel page, IReadOnlyList<NfcTagFile> files, bool all = false){Files = files;All = all && files.Count > 1;L2: Setting All to false for one file also selects the old subtitle, which omits both the permanent-deletion warning and the warning that a scanned tag may exist only here. A player using Delete all on their last scanned tag can therefore permanently lose its only copy without the warning promised for this action. Keep the single-file title and labels while retaining the Delete all safety text, and cover that case in the test.
@fix
Recommendation: Request changes. An unconfirmed replacement with identical contents can still be deleted, and a changed replacement can become inaccessible in a hidden directory on Linux. Both cases can lose a player's NFC file.
What
@fixchangedI changed this pull request: the new head is
ef43f25d6a. I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
The launcher adds a confirmed Delete all action and reports files it could not delete. The identity and restoration protection remains incomplete for all three NFC deletion paths.
@fixwill do (1)Core/NfcTags.cs:348: Preserve the confirmed file's identity as well as its contents, and ensure an unconfirmed replacement remains accessible if its original name is taken during restoration. (more on the line)Checks: they run again on this head; a failure shows on the pull request.
Also noticed (5; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Unproven: the reported Windows check predates the current fix commits, and CI has not run on this head. This is not a performance change.
Other systems: The snapshot deletion code also changes row and Delete selected behavior on Windows and Linux. Linux uses a private directory to isolate files; Windows verifies and deletes through one handle. Neither preserves the identity captured when the question opened.
Switches: No switches added, changed or removed.
Reviewed:
ef43f25d6aagainstd79fbcb0a5: Read AGENTS.md, CONTRIBUTING.md, the diff, NFC core and view-model code, views and app check; skimmed documentation, screenshot tooling and test-runner changes. The full screenshot tool, test runner and README were not read.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run. CI has not run on this head; the description reports earlier Windows runs and screenshots.
Overlaps and merge order: #202 also changes the NFC view, view model and documentation; the pull request says whichever lands second will need a merge.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@ -316,0 +333,4 @@[DllImport("kernel32.dll", SetLastError = true)][return: MarshalAs(UnmanagedType.Bool)]static extern bool GetFileInformationByHandleEx(SafeFileHandle file, int infoClass, out FileAttributeTagInfo info, uint size);L3: The contents check and path-based deletion are separate operations. If another process replaces a tag after Same returns but before Delete removes the path, confirmation deletes the replacement, potentially its only copy. Make verification and deletion safe against replacement, for example using suitable platform-specific handle or identity operations.
@ -316,0 +345,4 @@static extern int mkdir(string path, uint mode);// Move the directory entry into a private directory on the same filesystem before checking it. A replacement at the// original name cannot then be deleted by this operation. If it changed, put it back without overwriting a new entry.L4: The non-Windows guard makes every confirmed NFC deletion fail on Linux, including the previously working row and Delete selected actions. A Steam Deck player cannot remove even one tag through the launcher. Restore safe deletion on Linux while retaining protection against replacing the confirmed file.
@fix
Recommendation: Request changes. On Linux, a file can be modified after its contents are checked but before it is deleted, losing changes the confirmation promises to keep.
What
@fixchangedI changed this pull request: the new head is
5392e73a6e. I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
Delete all adds a confirmation and clears listed NFC files in one action. The identity checks also change the existing row and selected-file delete paths; on Linux, concurrent writes can still be lost.
@fixwill do (1)Core/NfcTags.cs:449: On Linux, moving the file into quarantine does not prevent another process from writing through a handle it already opened. (more on the line)Checks: they run again on this head; a failure shows on the pull request.
Also noticed (8; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Unproven: the submitted Windows run predates the identity fix, and CI has not run on this head. The test covers confirmation, replacements and list updates, but not concurrent writes during deletion.
Other systems: Windows uses a handle that denies write and delete sharing during verification and deletion. Linux and Steam Deck use the quarantine path, which does not prevent writes through an already open handle. All three NFC delete paths use these checks.
Switches: None.
Reviewed:
5392e73a6eagainstd79fbcb0a5: Read the repository rules, commit list and diff; read Core/NfcTags.cs, the NFC view model and views, and the app-level test. Skimmed MainViewModel.cs, documentation, screenshot and Python test changes, and callers of the deletion code. The remaining changed files were not read in full.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run code were executed. The author reports Windows tests and screenshots from before the latest fix; CI has not yet run on this head.
Overlaps and merge order: PR #202 also changes the NFC view, view model and documentation; the second PR to land will need a merge.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@ -316,0 +446,4 @@File.Move(path, held);moved = true;using var stream = OpenSnapshotFile(held);if (stream == null || !SameIdentity(snapshot.Stream.SafeFileHandle, stream.SafeFileHandle) || !SameContents(stream, snapshot.Bytes)) return false;L5: On Linux, moving the file into quarantine does not prevent another process from writing through a handle it already opened. If it writes after SameContents returns and before File.Delete, the changed file is deleted despite the promise to keep it. Preserve the file when concurrent modification cannot be ruled out, or use a deletion approach that protects the checked contents through deletion.
@fix
Recommendation: Approve. Delete all has a confirmation and keeps files that fail its identity or content checks. The remaining Linux concurrent-write risk is disclosed in the confirmation. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
58d5f1597c. I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
Players can clear the NFC list in one operation instead of selecting each row. The change adds platform-specific deletion checks and reports files it keeps.
Checks: they run again on this head; a failure shows on the pull request.
Also noticed (12; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. The reported Windows app check and screenshots show deletion of fake tags and the resulting list update; Linux execution on this head remains unverified.
Other systems: The row and selected-file delete paths share the new checks. Linux uses an isolated directory entry and warns about writes through open handles; Windows uses a handle that denies write and delete sharing. The description reports Windows testing, but no Linux run.
Switches: None.
Reviewed:
58d5f1597cagainstd79fbcb0a5: Read the repository rules, full diff, NFC core and app test, and the relevant view-model and view code. Skimmed the remaining changed documentation, screenshot tooling, test runner and recorded results; the combined output for some larger files was truncated. No pull request template or review checklist was present at the named paths.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed. CI has not yet run on this head; the description reports a Windows build and app check, with other reported failures also present on main.
Overlaps and merge order: #202 overlaps the NFC view, view model and documentation; the description says whichever lands second will need a small merge.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@ -316,0 +435,4 @@// already open handle can still change it after the check; the confirmation warns about that on Linux.static bool DeleteSnapshotLinux(string folder, string name, DeletionSnapshot snapshot, out string? recovery){recovery = null;L6: The unconditional non-Windows return makes all three NFC delete actions fail on Linux, even for an unchanged file with no writer. Restore a usable Linux deletion flow that preserves files when concurrent modification cannot be ruled out, or provide an explicitly confirmed alternative that lets players delete them.
Tidied the NFC page (
dc2393f): the header is one short line, the "only 256 of 300" paragraph above the list is now a chip by the count (the full explanation is its tooltip), and the footer note that cut into the list moved under Open the folder, so the list runs to the bottom. The two delete buttons sit under a DELETE label.Updated screenshots (
tools/screenshots, Linux, headless, 300 fake tags; these replace the ones in the first comment):python -I tests/test_launcher_core.py: 2656 checks passed.tests/launcher_app(withNfcDeleteAll): passes.024597744: the tag list now scrolls inside its card, so the card ends with its own rounded edge instead of being cut off mid-row at the bottom, and the add buttons grow to fit a two-line hint (Scan a tag…'s hint overflowed its fixed 56px height). Screenshots replace the ones above:test_launcher_core.py: 2656 checks passed;tests/launcher_app: passes.4391c72f3: Scan a tag…'s hint when scanning is off ("Windows only, with a controller over USB") now fits on one line, so the button no longer looks cramped at the bottom. Updated page: