Residue S5 and S8: pin the leaf door's 64-byte bounds and NUL, name the harness's real path
The leaf's own door test, slug_validate_applies_the_dotted_grammar, checked the grammar but never pinned the 64-byte bound on the whole name, the 64-byte bound on a lone label, or NUL as a refused label byte. Extends it with a two-label 64/65-byte pair (each label far under 64, so only the whole-name check can be the one refusing 65), a direct Label check at 64/65 bytes (no whole-name wrapper to interfere), and a NUL case. Adds three matching mutation entries to tools/eureka-cut10-epiphany-mutations.psd1 that drop each check in turn; all three die under the extended test. The suite's own header still named the deleted repo-local harness path. Corrected to the Eureka skill's copy, GameCult/Eureka. Verified: cargo test -p epiphany-pipeline --lib, 35/35. Full mutation suite through the Eureka harness: 5/5 killed (G1, G1L, S5whole, S5label, S5nul), M0 green. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
104c0bf255
commit
b3ae787b7d
2 changed files with 65 additions and 2 deletions
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));'
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue