diff --git a/src/labels/paramount.rs b/src/labels/paramount.rs index 87d31d0..4ccfff3 100644 --- a/src/labels/paramount.rs +++ b/src/labels/paramount.rs @@ -359,11 +359,20 @@ mod tests { /// It also measured the wrong thing. Making the lookup O(1) bounded the /// QUERY, not the PARSE: the set was still built from every entry the /// disc declared, so a hostile playlist could still force an unbounded - /// allocation before any lookup happened. `MAX_COM_INDICES` bounds that, - /// and this test asserts the bound directly — an equality check with no - /// clock in it, which cannot flake under any load. + /// allocation before any lookup happened. `MAX_COM_INDICES` bounds that. + /// + /// What THIS test guards is that bounding did not change what a + /// legitimate playlist MEANS: it goes red if the bound is set too LOW + /// (verified at 2 — the real indices `0,2,4` stop resolving and the + /// purposes change). It does NOT go red if the bound is deleted + /// entirely, because the out-of-range filler is unobservable at the + /// label level and a `HashSet` collapses the repeats. Enforcement is + /// proven separately, by + /// `distinct_unaddressable_indices_are_refused_not_stored`, which reads + /// the set itself. Two tests, two properties; neither pretends to the + /// other's job. #[test] - fn a_hostile_commentary_index_list_is_bounded_not_merely_fast() { + fn bounding_the_parse_does_not_change_a_legitimate_playlist() { // Three real indices, then far more entries than can address a cell. const OVERSIZED: usize = MAX_COM_INDICES + 10_000; let mut feature = String::from(r#""#, + fn an_index_that_cannot_address_any_cell_is_not_retained() { + let set = com_indices(Some(format!( + "1,{},{}", MAX_COM_INDICES, MAX_COM_INDICES + 1 - ); - let labels = labels_from_feature(&feature); - assert_eq!(labels.len(), 2); - assert_eq!(labels[0].purpose, LabelPurpose::Normal); + ))); assert_eq!( - labels[1].purpose, - LabelPurpose::Commentary, - "the addressable index must still be honoured" + set.len(), + 1, + "only the addressable index belongs in the set, got {set:?}" ); + assert!(set.contains(&1)); } /// Headroom: the BD STN_table admits at most 32 PG streams per playlist,