From a531dc37dc211629dfd991358db46533ddd5d53e Mon Sep 17 00:00:00 2001 From: altair823 Date: Tue, 19 May 2026 17:17:36 +0000 Subject: [PATCH] feat(p10-1a-2): route .rs files to MediaType::Code(rust) Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/kebab-source-fs/src/media.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/kebab-source-fs/src/media.rs b/crates/kebab-source-fs/src/media.rs index b2d8663..68db875 100644 --- a/crates/kebab-source-fs/src/media.rs +++ b/crates/kebab-source-fs/src/media.rs @@ -34,6 +34,10 @@ pub(crate) fn media_type_for(path: &Path) -> MediaType { "flac" => MediaType::Audio(AudioType::Flac), "ogg" => MediaType::Audio(AudioType::Ogg), + // p10-1A-2: Rust is the only code lang activated in 1A. Other + // recognized code langs stay Other until their phase (1B+). + "rs" => MediaType::Code("rust".to_string()), + // Empty string (no extension) and any other extension: bucket as // Other and let downstream extractors decide if they support it. _ => MediaType::Other(ext), @@ -71,6 +75,17 @@ mod tests { ); } + #[test] + fn rust_files_map_to_media_code_rust() { + assert_eq!( + media_type_for(Path::new("crates/kebab-core/src/lib.rs")), + MediaType::Code("rust".to_string()) + ); + // non-Rust code extensions stay Other in 1A + assert_eq!(media_type_for(Path::new("a/b.py")), MediaType::Other("py".to_string())); + assert_eq!(media_type_for(Path::new("Cargo.toml")), MediaType::Other("toml".to_string())); + } + #[test] fn unknown_and_missing_extension() { assert_eq!(