fix(core): waive untagged audio on main roots (#282)
ci / web (push) Successful in 42s
e2e / e2e (push) Successful in 2m6s
ci / rust (push) Successful in 2m50s
ci / image (push) Successful in 3m23s

This commit was merged in pull request #282.
This commit is contained in:
2026-11-15 13:22:29 +00:00
parent 5a18facc4f
commit 9adbca3acd
9 changed files with 69 additions and 29 deletions
+4
View File
@@ -422,6 +422,9 @@ pub enum Rule {
DubBlacklist(Language),
/// A Portuguese track whose pt-PT / pt-BR flavour no signal resolved.
PortugueseUnverified,
/// An audio track tagged `und` (or untagged) where none matched the
/// original language: probably the original, but nothing says so.
AudioLanguageUntagged,
DolbyVisionProfile(DolbyVisionProfile),
Resolution(Resolution),
Source(Source),
@@ -438,6 +441,7 @@ impl Rule {
Self::RequiredAudio => "required_audio".into(),
Self::DubBlacklist(_) => "dub_blacklist".into(),
Self::PortugueseUnverified => "portuguese_unverified".into(),
Self::AudioLanguageUntagged => "audio_language_untagged".into(),
Self::DolbyVisionProfile(_) => "dolby_vision_profile".into(),
Self::Resolution(_) => "resolution".into(),
Self::Source(_) => "source".into(),
+34
View File
@@ -470,6 +470,13 @@ impl PolicyRule for RequiredAudioRule {
if context.overrides.allow_english_audio && languages.contains(&english) {
return RuleEvaluation::SoftFail(Rule::RequiredAudio);
}
if matches!(
context.policy.required_audio,
RequiredAudio::OriginalLanguage
) && languages.contains(&Language::Other("und".to_owned()))
{
return RuleEvaluation::SoftFail(Rule::AudioLanguageUntagged);
}
Self::failure(context)
}
}
@@ -1242,6 +1249,33 @@ mod tests {
);
}
#[test]
fn main_untagged_audio_is_waived_not_rejected() {
let media = probed_audio(vec![track(Language::Other("und".to_owned()))]);
assert_eq!(
verdict_for(&policy(), &en(), Candidate::PostDownload(&media)),
Verdict::Waived(Rule::AudioLanguageUntagged)
);
}
#[test]
fn main_untagged_audio_beside_the_original_stays_eligible() {
let media = probed_audio(vec![track(en()), track(Language::Other("und".to_owned()))]);
assert_eq!(
verdict_for(&policy(), &en(), Candidate::PostDownload(&media)),
Verdict::Eligible
);
}
#[test]
fn kids_untagged_audio_keeps_the_required_audio_waiver() {
let media = probed_audio(vec![track(Language::Other("und".to_owned()))]);
assert_eq!(
verdict_for(&kids_policy(), &en(), Candidate::PostDownload(&media)),
Verdict::Waived(Rule::RequiredAudio)
);
}
// §5.2 truth table, `kids` root: require pt-PT, or the original language
// when that is already Portuguese; pt-BR never satisfies the requirement.