Skip to content

fix(modify): parse typed values when selecting objects at the confirmation prompt#6782

Open
cycsmail wants to merge 2 commits into
beetbox:masterfrom
cycsmail:fix-modify-select-typed
Open

fix(modify): parse typed values when selecting objects at the confirmation prompt#6782
cycsmail wants to merge 2 commits into
beetbox:masterfrom
cycsmail:fix-modify-select-typed

Conversation

@cycsmail

Copy link
Copy Markdown
Contributor

Description

Fixes #4880.

When you modify a non-string field (e.g. added) and choose select at the "Really modify" prompt, beets crashed. The select callback re-ran print_and_modify with 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 added via the select path and checks the stored timestamp.

To Do

  • Documentation (bugfix, no doc change needed)
  • Changelog
  • Tests

@cycsmail cycsmail requested a review from a team as a code owner June 27, 2026 07:44

@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: 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),

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 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

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.84%. Comparing base (bf879d5) to head (417fbe5).
⚠️ Report is 7 commits behind head on master.
✅ All tests successful. No failed tests found.

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              
Files with missing lines Coverage Δ
beets/ui/commands/modify.py 94.11% <100.00%> (+0.08%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Crash in print_and_modify when trying to modify "added" and choosing "select"

1 participant