Skip to content

rank_table_for silently returns music quality ranks for unknown media types #406

Description

@forkwright

Finding

rank_table_for maps a media_type: &str to a quality-rank table name via a match whose catch-all arm returns "music_quality_ranks". score_for_format and list_ranks both call this function and build their SQL FROM {table} dynamically from the result. A caller passing an unrecognized media type (e.g. "news", "comic", or any future value) is silently routed to the music rank table.

Evidence

crates/apotheke/src/repo/quality.rs:173

_ => "music_quality_ranks",

score_for_format(&pool, "news", "MP3_320_CBR") queries music_quality_ranks and returns Some(70) instead of None or an error.

Why this matters

The acquisition engine uses quality scores to decide whether to download or upgrade a release. A score drawn from the wrong table means the engine accepts or rejects podcast/news/comic releases against music criteria, silently making wrong download decisions for every media type without a dedicated rank table.

Desired correction

Return an explicit Err(DbError::Query { … }) (or an explicit None) when the media type has no known rank table, rather than falling through to music_quality_ranks. Done when: passing an unrecognized media type to score_for_format or list_ranks yields an error or Ok(None) rather than a valid music score.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions