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.
Finding
rank_table_formaps amedia_type: &strto a quality-rank table name via amatchwhose catch-all arm returns"music_quality_ranks".score_for_formatandlist_ranksboth call this function and build their SQLFROM {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:173score_for_format(&pool, "news", "MP3_320_CBR")queriesmusic_quality_ranksand returnsSome(70)instead ofNoneor 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 explicitNone) when the media type has no known rank table, rather than falling through tomusic_quality_ranks. Done when: passing an unrecognized media type toscore_for_formatorlist_ranksyields an error orOk(None)rather than a valid music score.