slack status without the slack status.zzstoatzz.io/
quickslice

Fix emoji sync on redeploy and CI rustfmt issue

- Change emoji seeding to sync new files on every deploy
- Only copy if destination doesn't exist (preserves manual uploads)
- Fix CI workflow by adding rustfmt component to toolchain

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Changed files
+23 -16
.github
workflows
src
+2
.github/workflows/ci.yml
··· 16 16 steps: 17 17 - uses: actions/checkout@v4 18 18 - uses: dtolnay/rust-toolchain@stable 19 + with: 20 + components: rustfmt, clippy 19 21 - uses: Swatinem/rust-cache@v2 20 22 21 23 - name: Check formatting
+21 -16
src/emoji.rs
··· 3 3 4 4 use crate::config::Config; 5 5 6 - /// Ensure the runtime emoji directory exists, and seed it from the bundled 7 - /// `static/emojis` on first run if the runtime directory is empty. 6 + /// Ensure the runtime emoji directory exists, and sync new emojis from the bundled 7 + /// `static/emojis` directory. Only copies files that don't already exist in the runtime dir, 8 + /// preserving manual uploads and deletions. 8 9 pub fn init_runtime_dir(config: &Config) { 9 10 let runtime_emoji_dir = &config.emoji_dir; 10 11 let bundled_emoji_dir = "static/emojis"; ··· 18 19 return; 19 20 } 20 21 21 - let should_seed = runtime_emoji_dir != bundled_emoji_dir 22 - && fs::read_dir(runtime_emoji_dir) 23 - .map(|mut it| it.next().is_none()) 24 - .unwrap_or(false); 25 - 26 - if !should_seed { 22 + // Skip sync if runtime dir is the same as bundled (local dev) 23 + if runtime_emoji_dir == bundled_emoji_dir { 27 24 return; 28 25 } 29 26 ··· 33 30 34 31 match fs::read_dir(bundled_emoji_dir) { 35 32 Ok(entries) => { 33 + let mut copied = 0; 36 34 for entry in entries.flatten() { 37 35 let path = entry.path(); 38 36 if let Some(name) = path.file_name() { 39 37 let dest = Path::new(runtime_emoji_dir).join(name); 40 - if path.is_file() { 41 - if let Err(err) = fs::copy(&path, &dest) { 42 - log::warn!("Failed to seed emoji {:?} -> {:?}: {}", path, dest, err); 38 + // Only copy if destination doesn't exist (preserves manual changes) 39 + if path.is_file() && !dest.exists() { 40 + match fs::copy(&path, &dest) { 41 + Ok(_) => copied += 1, 42 + Err(err) => { 43 + log::warn!("Failed to sync emoji {:?} -> {:?}: {}", path, dest, err) 44 + } 43 45 } 44 46 } 45 47 } 46 48 } 47 - log::info!( 48 - "Seeded emoji directory {} from {}", 49 - runtime_emoji_dir, 50 - bundled_emoji_dir 51 - ); 49 + if copied > 0 { 50 + log::info!( 51 + "Synced {} new emoji(s) from {} to {}", 52 + copied, 53 + bundled_emoji_dir, 54 + runtime_emoji_dir 55 + ); 56 + } 52 57 } 53 58 Err(err) => log::warn!( 54 59 "Failed to read bundled emoji directory {}: {}",