Skip to content

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

Open
cycsmail wants to merge 3 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 3 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.93%. Comparing base (e700135) to head (22059fd).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6782   +/-   ##
=======================================
  Coverage   74.92%   74.93%           
=======================================
  Files         163      163           
  Lines       21148    21150    +2     
  Branches     3337     3337           
=======================================
+ Hits        15846    15848    +2     
  Misses       4539     4539           
  Partials      763      763           
Files with missing lines Coverage Δ
beets/ui/commands/modify.py 95.87% <100.00%> (+0.08%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cycsmail
cycsmail force-pushed the fix-modify-select-typed branch 2 times, most recently from 84e8334 to 9f36c17 Compare July 13, 2026 03:46
@cycsmail
cycsmail force-pushed the fix-modify-select-typed branch from 9f36c17 to 22059fd Compare July 14, 2026 08:26
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