@@ -412,32 +412,47 @@ fn session_checks(project_root: &Path) -> Vec<Check> {
412412 let sessions_dir = project_root. join ( ".tracevault/sessions" ) ;
413413 if !sessions_dir. exists ( ) {
414414 return vec ! [ Check :: skip(
415- "Unpushed sessions " ,
415+ "Pending events " ,
416416 "no .tracevault/sessions/ yet (no captures recorded)" ,
417417 ) ] ;
418418 }
419419
420- let mut total = 0usize ;
421- let mut unpushed = 0usize ;
420+ let mut total_sessions = 0usize ;
421+ let mut sessions_with_pending = 0usize ;
422+ let mut pending_event_count = 0usize ;
423+
422424 if let Ok ( read) = fs:: read_dir ( & sessions_dir) {
423425 for entry in read. flatten ( ) {
424426 if !entry. file_type ( ) . map ( |ft| ft. is_dir ( ) ) . unwrap_or ( false ) {
425427 continue ;
426428 }
427- total += 1 ;
428- if !entry. path ( ) . join ( ".pushed" ) . exists ( ) {
429- unpushed += 1 ;
429+ total_sessions += 1 ;
430+ let pending_path = entry. path ( ) . join ( "pending.jsonl" ) ;
431+ if pending_path. exists ( ) {
432+ let count = fs:: read_to_string ( & pending_path)
433+ . unwrap_or_default ( )
434+ . lines ( )
435+ . filter ( |l| !l. trim ( ) . is_empty ( ) )
436+ . count ( ) ;
437+ if count > 0 {
438+ sessions_with_pending += 1 ;
439+ pending_event_count += count;
440+ }
430441 }
431442 }
432443 }
433444
434- let detail = format ! ( "{unpushed} pending / {total} total" ) ;
435- vec ! [ if unpushed == 0 {
436- Check :: ok( "Unpushed sessions" , detail)
445+ vec ! [ if sessions_with_pending == 0 {
446+ Check :: ok(
447+ "Pending events" ,
448+ format!( "{total_sessions} session(s), all synced" ) ,
449+ )
437450 } else {
438451 Check :: warn(
439- "Unpushed sessions" ,
440- format!( "{detail} — will be pushed on next `tracevault push` or pre-push hook" ) ,
452+ "Pending events" ,
453+ format!(
454+ "{pending_event_count} event(s) in {sessions_with_pending}/{total_sessions} session(s) — run `tracevault flush`"
455+ ) ,
441456 )
442457 } ]
443458}
0 commit comments