Skip to content

Commit 8105719

Browse files
committed
fix(services): log JoinSet task panics in concurrent file fetch
The JoinSet loop in `fetch_file_contents` previously used `if let Ok(..)` to unpack the join result, silently discarding the `Err(JoinError)` variant emitted when a spawned git-show task panics or is cancelled. Panics under the async runtime were therefore invisible to operators even in `--verbose` / `COMMITBEE_LOG=debug` runs, making root-cause analysis of missing diff context nearly impossible. Switch to a full `match` arm and emit `tracing::warn!` with the JoinError context when a task fails to join. The returned HashMap shape is unchanged — panicked tasks are still omitted from the maps, matching the previous fallback behaviour — so no caller logic has to change. Closes audit entry F-008 from #3.
1 parent 7163ef7 commit 8105719

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/services/git.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::path::{Path, PathBuf};
77
use std::sync::Arc;
88

99
use tokio::process::Command;
10+
use tracing::warn;
1011

1112
use crate::domain::{ChangeStatus, DiffStats, FileCategory, FileChange, StagedChanges};
1213
use crate::error::{Error, Result};
@@ -247,12 +248,19 @@ impl GitService {
247248
let mut head_map = HashMap::new();
248249

249250
while let Some(result) = set.join_next().await {
250-
if let Ok((path, staged, head)) = result {
251-
if let Some(content) = staged {
252-
staged_map.insert(path.clone(), content);
251+
match result {
252+
Ok((path, staged, head)) => {
253+
if let Some(content) = staged {
254+
staged_map.insert(path.clone(), content);
255+
}
256+
if let Some(content) = head {
257+
head_map.insert(path, content);
258+
}
253259
}
254-
if let Some(content) = head {
255-
head_map.insert(path, content);
260+
Err(join_err) => {
261+
// Task panicked or was cancelled — log and omit from results
262+
// (callers handle missing entries as "content unavailable").
263+
warn!(error = %join_err, "git-show task failed to join");
256264
}
257265
}
258266
}

0 commit comments

Comments
 (0)