huskies: merge 619_story_service_common_consolidation_sweep

This commit is contained in:
dave
2026-04-24 21:32:39 +00:00
parent c16d9e471d
commit e1bfbf4232
5 changed files with 86 additions and 56 deletions
+3 -20
View File
@@ -3,26 +3,9 @@
//! These functions reason about story IDs and dependencies without performing
//! any I/O. They inform routing decisions in `mod.rs` and the MCP adapter.
#[allow(dead_code)]
/// Extract the numeric prefix from a story ID (e.g. `"42"` from `"42_story_foo"`).
///
/// Returns `None` if the ID has no leading digit sequence.
pub fn story_number(story_id: &str) -> Option<&str> {
let num = story_id.split('_').next()?;
if num.is_empty() || !num.chars().all(|c| c.is_ascii_digit()) {
return None;
}
Some(num)
}
#[allow(dead_code)]
/// Return `true` if `story_id` has a valid `{digits}_` prefix format.
///
/// Valid: `"42_story_foo"`, `"1_bug_bar"`.
/// Invalid: `"story_without_number"`, `""`, `"abc_story"`.
pub fn has_valid_id_prefix(story_id: &str) -> bool {
story_number(story_id).is_some()
}
pub use crate::service::common::item_id::{
extract_item_number as story_number, has_valid_id_prefix,
};
// ── Tests ─────────────────────────────────────────────────────────────────────