fix(modify): parse typed values when selecting objects at the confirmation prompt#6782
fix(modify): parse typed values when selecting objects at the confirmation prompt#6782cycsmail wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f888ab4471
ℹ️ 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".
| f"Really modify{extra}", | ||
| changed, | ||
| lambda o: print_and_modify(o, mods, dels), | ||
| lambda o: print_and_modify(o, parse_mods(o), dels), |
There was a problem hiding this comment.
Reuse parsed modifications for select prompts
When the user chooses select after a templated modification such as beet modify 'title=${title} - append', changed contains the same objects that the preview loop already mutated. Calling parse_mods(o) here evaluates the template against that mutated value, so confirming an individual object applies the template a second time and stores Tracktitle - append - append instead of the single append shown by the initial preview/all path. The select callback should reuse the per-object values computed before the preview or evaluate against a fresh/original object.
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6782 +/- ##
==========================================
- Coverage 74.84% 74.84% -0.01%
==========================================
Files 163 163
Lines 20949 20948 -1
Branches 3300 3299 -1
==========================================
- Hits 15680 15679 -1
Misses 4511 4511
Partials 758 758
🚀 New features to boost your workflow:
|
Description
Fixes #4880.
When you modify a non-string field (e.g.
added) and chooseselectat the "Really modify" prompt, beets crashed. The select callback re-ranprint_and_modifywith the raw assignment strings (mods) instead of the per-object parsed values, so a date string was handed straight to a field expecting a timestamp.Pulled the parsing into a small
parse_mods(obj)helper and used it in both the main modify loop and the select callback, so values get parsed in both paths.Added a regression test that modifies
addedvia the select path and checks the stored timestamp.To Do
Documentation(bugfix, no doc change needed)