Route every removal path through the batch interface #21
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
wokoman/ironpod!21
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/one-removal-path"
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?
Every way of removing tracks —
ironpod rm,ironpod dedupe, and pressingdin the browser — now goes through the batch interface, and the single-track primitive is private so the guarantee cannot be bypassed. This is what closes #2 properly: the earlier fix made the two command-line paths behave, this removes the reason they could diverge in the first place. One implementation, no call site re-implementing "loop, then write once".One change to the interface pinned in #4, which is worth your eye.
before_each(done, total)could not express the database write, and #5 asks for no visible regression in the browser — which draws aWriting the iPod database…frame there today. Leaving it out would mean the browser blocks on the write with a stale "Deleting 5 of 5" on screen, andSPEC.mdrecords that a blocking step drawing nothing is a bug, not a detail. The callback is nowon_step(RemoveStep), eitherDeleting { done, total }orWriting— the same shape #8 introduced for copy plans, so the two batch operations report progress the same way. Both constraints came from the same design session and they conflict; I resolved it towards the user-visible behaviour.Two consequences worth naming.
RemoveFailed'sDisplayalready reads "removed 1 of 3: ", so neither front end prepends its own count any more — the browser's status line is that string, and the command line lets the error carry it rather than printing a count and then an error that repeats it. And the regression test I added for #2 is deleted, not lost: its subject moved intoremove_all, wherea_failure_partway_stops_there_and_keeps_the_restalready asserts the same thing against the same forced failure. Keeping both would have been one test in two places.The integration tests move over too — removing one track is now expressed as a batch of one, with no surviving special case.
Verified on the device (
iTunesDB,iTunesDB.extandSysInfobacked up first, and only throwaway tracks touched — nothing from the existing 6307-track library):ironpod rm, one removed in the browser, and the last removed withrmagain.expectat a real terminal size: confirmation popup,Deleting 1 of 1 track…, thenWriting the iPod database…— the write frame is intact, which is what the interface change was for.ironpod dedupe --dry-runruns clean against the real library.Not verified: that the device plays what remains. That needs unplugging and using it, which is yours to do — the database and the files agree, and nothing is listed that has no file.
67 unit tests pass,
cargo clippy --all-targetsclean.Closes #5. Closes #2.