fix(version): strip punctuation when scanning minimum semver

Treat trailing sentence punctuation as non-semver noise when extracting the minimum wire-compat version from announcement_tip.toml.

Refs #539
This commit is contained in:
James Peter
2026-02-08 08:51:57 +10:00
parent e52d821290
commit 5644559869
+7 -1
View File
@@ -40,7 +40,7 @@ fn extract_max_semver(input: &'static str) -> Option<&'static str> {
for token in input.split_whitespace() {
let candidate = token.trim_matches(|ch: char| {
!(ch.is_ascii_alphanumeric() || matches!(ch, '.' | '-' | '+' | 'v'))
!(ch.is_ascii_alphanumeric() || matches!(ch, '-' | '+' | 'v'))
});
if candidate.is_empty() {
continue;
@@ -128,6 +128,12 @@ mod tests {
assert_eq!(extract_max_semver(input), Some("0.102.1"));
}
#[test]
fn extract_max_semver_strips_sentence_punctuation() {
let input = "Upgrade to 0.99.0. Then 0.98.1.";
assert_eq!(extract_max_semver(input), Some("0.99.0"));
}
#[test]
fn configured_minimum_defaults_to_semver() {
assert!(parse_semver_triplet(min_wire_compat_version()).is_some());