Problem
PR #6681 introduces Likelies as the container for metadata used by Source. Although Likelies inherits from AttrDict, its fields are fixed by get_most_common_tags() and callers do not need arbitrary keys.
Using a dictionary-backed object hides the supported schema, permits unsupported attributes, and adds attribute lookup behavior that this container does not need. This was identified in the PR review and deferred to keep the refactor focused.
Note we need to consider that currently these Likelies within Source behave the same as AlbumInfo and TrackInfo (fields can be accessed as attributes and as dictionary keys), therefore we need to make sure the behaviour is consistent going forward. See def distance in beets/autotag/distance.py, for example.
Expected behavior
Likelies should expose its supported metadata as explicit dataclass fields. Album and singleton Source construction, distance calculation, and importer behavior should remain unchanged.
Suggested fix
- Replace the
AttrDict subclass with a typed dataclass covering the existing fixed fields.
- Update
get_most_common_tags() and Source.from_item() to construct it explicitly.
- Preserve
ImportTask.chosen_info() returning a detached metadata dictionary.
- Add focused tests for album and singleton construction and dictionary conversion.
Problem
PR #6681 introduces
Likeliesas the container for metadata used bySource. AlthoughLikeliesinherits fromAttrDict, its fields are fixed byget_most_common_tags()and callers do not need arbitrary keys.Using a dictionary-backed object hides the supported schema, permits unsupported attributes, and adds attribute lookup behavior that this container does not need. This was identified in the PR review and deferred to keep the refactor focused.
Note we need to consider that currently these
LikelieswithinSourcebehave the same asAlbumInfoandTrackInfo(fields can be accessed as attributes and as dictionary keys), therefore we need to make sure the behaviour is consistent going forward. Seedef distanceinbeets/autotag/distance.py, for example.Expected behavior
Likeliesshould expose its supported metadata as explicit dataclass fields. Album and singletonSourceconstruction, distance calculation, and importer behavior should remain unchanged.Suggested fix
AttrDictsubclass with a typed dataclass covering the existing fixed fields.get_most_common_tags()andSource.from_item()to construct it explicitly.ImportTask.chosen_info()returning a detached metadata dictionary.