beetbox / beetbox/beets

lastgenre: Sanity check whitelist/canonical setting and throw UserError

Open
#5,994 0 comments 0 reactions 0 assignees View on GitHub
lastgenre
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

Since years `lastgenre` has settings' `whitelist/canonical` fallback to default/built-in files when `""` or `''` is set (empty string)

This was introduced way back for whatever reason, see https://github.com/beetbox/beets/commit/233f71a4574b5a10d1182a3a63ce5cd23c4268f4.

I suggest we sanity check for "", None and then throw a `UserError` - in case of the whitelist setting something like this:

`Invalid whitelist setting - True, False or path to custom file allowed`

This would fail gracefully - not silent - and give the user a chance to update with clear instructions.

Original comment by @JOJ0 here: https://github.com/beetbox/beets/pull/5979#discussion_r2335671784

Contributor guide

Open the contributing guide

Research direction

Start at the lastgenre settings handling and trace how whitelist and canonical values of "" or None currently fall back to built-in files. Check the existing UserError conventions, then add coverage for invalid values and verify that the resulting error clearly identifies the allowed settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.