{"record":{"id":"3cdad35747dc1791","repo":"astrid-runtime/astrid","slug":"name-must-contain-only-ascii-letters-digits","errorCode":null,"errorMessage":"{name} must contain only ASCII letters, digits, '_' or '-'","messagePattern":"(.+?) must contain only ASCII letters, digits, '_' or '-'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-emit/src/lib.rs","lineNumber":105,"sourceCode":"\n/// Default wait for a policy hook that needs the broker to accept its frame.\n/// Observation hooks pass `0` to make the transport fire-and-forget.\npub const DEFAULT_POLICY_TIMEOUT_MS: u64 = 1_000;\n\n/// Validate a host/session/event segment before putting it in a bus topic.\n///\n/// These values originate in a host hook payload or command line. Keeping\n/// the check at this boundary prevents a caller from smuggling additional\n/// topic segments into the fixed hook route.\nfn validate_topic_segment(name: &str, value: &str) -> Result<()> {\n    if value.is_empty() || value.len() > 64 {\n        anyhow::bail!(\"{name} must be 1-64 ASCII characters\");\n    }\n    if !value\n        .bytes()\n        .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'_' | b'-'))\n    {\n        anyhow::bail!(\"{name} must contain only ASCII letters, digits, '_' or '-'\");\n    }\n    Ok(())\n}\n\n/// Derive the host hook topic used by the thin `astrid hook` command.\n///\n/// Every host route carries the session as a topic segment. Codex and the\n/// other host runners subscribe to their own `{host}.v1.hook.*.*` namespace;\n/// the envelope itself remains the six-field [`build_envelope`] contract.\n///\n/// # Errors\n/// Returns an error when any segment is empty, too long, or contains a topic\n/// separator/control character.\npub fn hook_topic(host: &str, session: &str, event: &str) -> Result<String> {\n    validate_topic_segment(\"host\", host)?;\n    validate_topic_segment(\"session\", session)?;\n    validate_topic_segment(\"event\", event)?;\n","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-emit/src/lib.rs#L87-L123","documentation":"Validation guard in validate_topic_segment: the segment contained characters outside ASCII letters, digits, '_' and '-'; this boundary check stops callers from smuggling extra topic segments into the fixed hook route.","triggerScenarios":"Thrown at crates/astrid-emit/src/lib.rs:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace disallowed characters (dots, slashes, spaces, non-ASCII) in the segment with letters, digits, '_' or '-'","Sanitize host/session/event values before emitting the hook","Use a slug or identifier derived from the value instead of raw user input"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}