From b48e1321193f70d8e4389e4e8afd1e75c5a5e88e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 1 Oct 2026 11:12:24 +0200 Subject: [PATCH] epiphany-pipeline: tests build 111-byte locals from dotted labels The previous commit (34099183) does not pass its own tests: two of them built a wide local as one label, which is itself bounded at 64. This commit builds them as dotted parts. The commit before it builds; two of its tests fail. Co-Authored-By: Claude Sonnet 5.5 --- epiphany-pipeline/src/lib.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/epiphany-pipeline/src/lib.rs b/epiphany-pipeline/src/lib.rs index b4915e92..c29146ec 100644 --- a/epiphany-pipeline/src/lib.rs +++ b/epiphany-pipeline/src/lib.rs @@ -2263,6 +2263,15 @@ mod tests { } } + /// A legal dotted local of exactly `length` bytes (`a.a.a`, each part a + /// label), for bounds wider than one label. + fn dotted_local(length: usize) -> String { + match length % 2 { + 1 => format!("{}a", "a.".repeat(length / 2)), + _ => format!("{}aa", "a.".repeat(length / 2 - 1)), + } + } + /// A resolution of `subject`, at `sequence`, keyed. fn resolved_at(kind: PipelineKind, subject: &str, sequence: u32) -> Result { let mut resolution = resolution_sample(); @@ -2315,7 +2324,7 @@ mod tests { #[test] fn an_id_local_is_bounded_by_its_kind() { let at = |kind: PipelineKind, length: usize| { - pipeline_id("probe", &format!("{CAMPAIGN}:{}:{}", kind.name(), "a".repeat(length)), kind).map(|_| ()) + pipeline_id("probe", &format!("{CAMPAIGN}:{}:{}", kind.name(), dotted_local(length)), kind).map(|_| ()) }; assert_eq!(at(PipelineKind::Question, SUBJECT_LOCAL_MAX), Ok(())); assert!(at(PipelineKind::Question, SUBJECT_LOCAL_MAX + 1).is_err()); @@ -2444,7 +2453,7 @@ mod tests { #[test] fn a_composed_resolution_local_is_bounded_whole() { let overhead = "resolution.".len() + ".n1".len(); - let subject = |length: usize| format!("{CAMPAIGN}:resolution:{}", "a".repeat(length)); + let subject = |length: usize| format!("{CAMPAIGN}:resolution:{}", dotted_local(length)); let at_max = resolved_at(PipelineKind::Resolution, &subject(RESOLUTION_LOCAL_MAX - overhead), 1) .expect("a 111-byte resolution local keys"); assert_eq!(at_max.split(':').nth(2).map(str::len), Some(RESOLUTION_LOCAL_MAX));