diff --git a/epiphany-pipeline/src/lib.rs b/epiphany-pipeline/src/lib.rs index b0d64c64..c4d28f20 100644 --- a/epiphany-pipeline/src/lib.rs +++ b/epiphany-pipeline/src/lib.rs @@ -2484,5 +2484,37 @@ mod tests { refused("", "the empty string has no label"); refused("outer..inner", "an empty label between two dots is refused"); refused(".", "a single dot is one empty label"); + + // S5: the 64-byte whole-name bound, pinned with a two-label name + // whose parts sit far under 64 bytes each (31 and 32, then 32 and + // 32), so only `dotted_text`'s own `value.len() > 64` check -- not + // `label_text`'s per-part one -- can be the check that refuses 65. + let filler = |n: usize| "a".repeat(n); + let at_64 = format!("{}.{}", filler(31), filler(32)); + let at_65 = format!("{}.{}", filler(32), filler(32)); + assert_eq!(at_64.len(), 64, "a 64-byte whole name, two labels well under 64 each"); + assert_eq!(at_65.len(), 65, "one byte past the whole-name bound, same two-label shape"); + assert_eq!(slug(&at_64).validate_slug(), Ok(())); + refused(&at_65, "65 bytes overall is refused, even though neither label alone reaches 64"); + + // S5: the 64-byte per-label bound, pinned directly against `Label` + // (the type `label_text` guards on its own, with no separate + // whole-name wrapper), and with a lone label carrying no dot, so only + // `label_text`'s own length check can be the one refusing 65. + let label_at_64 = Label::from(filler(64).as_str()); + let label_at_65 = Label::from(filler(65).as_str()); + assert_eq!(label_at_64.validate("label"), Ok(())); + assert!( + matches!( + label_at_65.validate("label"), + Err(PipelineRefusal::InvalidFormat { ref field, .. }) if field == "label" + ), + "a 65-byte label was not refused, got {:?}", + label_at_65.validate("label") + ); + + // S5: NUL is refused as a label byte, not merely as one more + // non-alphanumeric character that happens to be caught by coincidence. + refused("a\u{0}b", "NUL is not a label byte"); } } diff --git a/tools/eureka-cut10-epiphany-mutations.psd1 b/tools/eureka-cut10-epiphany-mutations.psd1 index 4f19345f..6cbef6b6 100644 --- a/tools/eureka-cut10-epiphany-mutations.psd1 +++ b/tools/eureka-cut10-epiphany-mutations.psd1 @@ -1,8 +1,12 @@ # Eureka Cut 10 mutation suite, the Epiphany half: the public slug door, # `Slug::validate_slug`, filled into its owner by Self's ruling on the F6 -# fork. Entries only; the harness is tools/eureka-mutations.ps1. +# fork. Entries only; the harness moved out of this repo, 2026-09-17, to +# `C:\Users\Meta\.claude\skills\eureka\tools\eureka-mutations.ps1` +# (`GameCult/Eureka`), so one copy serves every campaign. It takes `-Repo` +# when run from outside that checkout. # -# powershell -File tools/eureka-mutations.ps1 ` +# powershell -File C:\Users\Meta\.claude\skills\eureka\tools\eureka-mutations.ps1 ` +# -Repo F:\Projects\Epiphany ` # -Entries tools/eureka-cut10-epiphany-mutations.psd1 ` # -Target epiphany-pipeline/src/lib.rs ` # -Test 'cargo test -p epiphany-pipeline --lib' @@ -33,6 +37,33 @@ Test = 'tests::slug_validate_applies_the_dotted_grammar' Old = ' .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b''_'' | b''-''));' New = ' .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b''_'' | b''-'' | b''\\''));' + }, + @{ + Id = 'S5whole' + Rule = 'The whole-name bound is 64 bytes: `dotted_text` refuses a value one byte past it, even when every individual label sits far under 64.' + Test = 'tests::slug_validate_applies_the_dotted_grammar' + Old = 'fn dotted_text(field: &str, value: &str) -> Result<(), PipelineRefusal> { + if value.is_empty() || value.len() > 64 { + return Err(format_error(field, value)); + }' + New = 'fn dotted_text(field: &str, value: &str) -> Result<(), PipelineRefusal> { + if value.is_empty() { + return Err(format_error(field, value)); + }' + }, + @{ + Id = 'S5label' + Rule = 'The per-label bound is 64 bytes too, the same check `Label` is held to on its own: a lone label carrying no dot is refused one byte past it.' + Test = 'tests::slug_validate_applies_the_dotted_grammar' + Old = ' if !valid || value.is_empty() || value.len() > 64 {' + New = ' if !valid || value.is_empty() {' + }, + @{ + Id = 'S5nul' + Rule = 'NUL is refused as a label byte, not merely as one more character `is_ascii_alphanumeric` happens to reject.' + Test = 'tests::slug_validate_applies_the_dotted_grammar' + Old = ' .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b''_'' | b''-''));' + New = ' .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b''_'' | b''-'' | 0u8));' } ) }