@@ -378,51 +378,6 @@ impl ConfirmationManager {
378378mod tests {
379379 use super :: * ;
380380
381- // ========================================================================
382- // ToolCategory Tests
383- // ========================================================================
384-
385- #[ test]
386- fn test_tool_category ( ) {
387- assert_eq ! ( ToolCategory :: from_tool_name( "read" ) , ToolCategory :: ReadOnly ) ;
388- assert_eq ! ( ToolCategory :: from_tool_name( "glob" ) , ToolCategory :: ReadOnly ) ;
389- assert_eq ! ( ToolCategory :: from_tool_name( "bash" ) , ToolCategory :: Mutating ) ;
390- assert_eq ! (
391- ToolCategory :: from_tool_name( "write" ) ,
392- ToolCategory :: Mutating
393- ) ;
394- assert_eq ! (
395- ToolCategory :: from_tool_name( "unknown" ) ,
396- ToolCategory :: Mutating
397- ) ;
398- }
399-
400- #[ test]
401- fn test_tool_category_all_readonly ( ) {
402- let readonly_tools = [ "read" , "glob" , "ls" , "grep" , "list_files" , "search" ] ;
403- for tool in readonly_tools {
404- assert_eq ! (
405- ToolCategory :: from_tool_name( tool) ,
406- ToolCategory :: ReadOnly ,
407- "Tool '{}' should be ReadOnly" ,
408- tool
409- ) ;
410- }
411- }
412-
413- #[ test]
414- fn test_tool_category_all_mutating ( ) {
415- let mutating_tools = [ "bash" , "write" , "edit" , "delete" , "move" , "copy" , "execute" ] ;
416- for tool in mutating_tools {
417- assert_eq ! (
418- ToolCategory :: from_tool_name( tool) ,
419- ToolCategory :: Mutating ,
420- "Tool '{}' should be Mutating" ,
421- tool
422- ) ;
423- }
424- }
425-
426381 // ========================================================================
427382 // SessionLane Tests
428383 // ========================================================================
@@ -497,7 +452,8 @@ mod tests {
497452 fn test_confirmation_policy_default ( ) {
498453 let policy = ConfirmationPolicy :: default ( ) ;
499454 assert ! ( !policy. enabled) ;
500- assert ! ( !policy. requires_confirmation( "bash" ) ) ; // HITL disabled
455+ // HITL disabled = everything is YOLO (no confirmation needed)
456+ assert ! ( !policy. requires_confirmation( "bash" ) ) ;
501457 assert ! ( !policy. requires_confirmation( "write" ) ) ;
502458 assert ! ( !policy. requires_confirmation( "read" ) ) ;
503459 }
@@ -506,10 +462,11 @@ mod tests {
506462 fn test_confirmation_policy_enabled ( ) {
507463 let policy = ConfirmationPolicy :: enabled ( ) ;
508464 assert ! ( policy. enabled) ;
509- assert ! ( policy. requires_confirmation( "bash" ) ) ; // Mutating tool
510- assert ! ( policy. requires_confirmation( "write" ) ) ; // Mutating tool
511- assert ! ( !policy. requires_confirmation( "read" ) ) ; // ReadOnly tool
512- assert ! ( !policy. requires_confirmation( "grep" ) ) ; // ReadOnly tool
465+ // All tools require confirmation when enabled with no YOLO lanes
466+ assert ! ( policy. requires_confirmation( "bash" ) ) ;
467+ assert ! ( policy. requires_confirmation( "write" ) ) ;
468+ assert ! ( policy. requires_confirmation( "read" ) ) ;
469+ assert ! ( policy. requires_confirmation( "grep" ) ) ;
513470 }
514471
515472 #[ test]
@@ -518,7 +475,7 @@ mod tests {
518475
519476 assert ! ( !policy. requires_confirmation( "bash" ) ) ; // Execute lane in YOLO mode
520477 assert ! ( !policy. requires_confirmation( "write" ) ) ; // Execute lane in YOLO mode
521- assert ! ( ! policy. requires_confirmation( "read" ) ) ; // ReadOnly
478+ assert ! ( policy. requires_confirmation( "read" ) ) ; // Query lane NOT in YOLO
522479 }
523480
524481 #[ test]
@@ -533,25 +490,20 @@ mod tests {
533490 }
534491
535492 #[ test]
536- fn test_confirmation_policy_explicit_lists ( ) {
537- let policy = ConfirmationPolicy :: enabled ( )
538- . with_auto_approve_tools ( [ "bash" . to_string ( ) ] )
539- . with_require_confirm_tools ( [ "read" . to_string ( ) ] ) ;
493+ fn test_confirmation_policy_is_yolo ( ) {
494+ let policy = ConfirmationPolicy :: enabled ( ) . with_yolo_lanes ( [ SessionLane :: Execute ] ) ;
540495
541- assert ! ( ! policy. requires_confirmation ( "bash" ) ) ; // Explicitly auto-approved
542- assert ! ( policy. requires_confirmation ( "read ") ) ; // Explicitly required
543- assert ! ( policy. requires_confirmation ( "write ") ) ; // Default for Mutating
496+ assert ! ( policy. is_yolo ( "bash" ) ) ; // Execute lane
497+ assert ! ( policy. is_yolo ( "write ") ) ; // Execute lane
498+ assert ! ( ! policy. is_yolo ( "read ") ) ; // Query lane, not YOLO
544499 }
545500
546501 #[ test]
547- fn test_confirmation_policy_explicit_overrides_yolo ( ) {
548- // require_confirm_tools should override YOLO mode
549- let policy = ConfirmationPolicy :: enabled ( )
550- . with_yolo_lanes ( [ SessionLane :: Execute ] )
551- . with_require_confirm_tools ( [ "bash" . to_string ( ) ] ) ;
552-
553- assert ! ( policy. requires_confirmation( "bash" ) ) ; // Explicitly required, overrides YOLO
554- assert ! ( !policy. requires_confirmation( "write" ) ) ; // Still in YOLO mode
502+ fn test_confirmation_policy_disabled_is_always_yolo ( ) {
503+ let policy = ConfirmationPolicy :: default ( ) ; // disabled
504+ assert ! ( policy. is_yolo( "bash" ) ) ;
505+ assert ! ( policy. is_yolo( "read" ) ) ;
506+ assert ! ( policy. is_yolo( "unknown_tool" ) ) ;
555507 }
556508
557509 #[ test]
@@ -579,8 +531,19 @@ mod tests {
579531 let ( event_tx, _) = broadcast:: channel ( 100 ) ;
580532 let manager = ConfirmationManager :: new ( ConfirmationPolicy :: enabled ( ) , event_tx) ;
581533
534+ // All tools require confirmation when HITL enabled with no YOLO lanes
582535 assert ! ( manager. requires_confirmation( "bash" ) . await ) ;
583- assert ! ( !manager. requires_confirmation( "read" ) . await ) ;
536+ assert ! ( manager. requires_confirmation( "read" ) . await ) ;
537+ }
538+
539+ #[ tokio:: test]
540+ async fn test_confirmation_manager_with_yolo ( ) {
541+ let ( event_tx, _) = broadcast:: channel ( 100 ) ;
542+ let policy = ConfirmationPolicy :: enabled ( ) . with_yolo_lanes ( [ SessionLane :: Query ] ) ;
543+ let manager = ConfirmationManager :: new ( policy, event_tx) ;
544+
545+ assert ! ( manager. requires_confirmation( "bash" ) . await ) ; // Execute lane, not YOLO
546+ assert ! ( !manager. requires_confirmation( "read" ) . await ) ; // Query lane, YOLO
584547 }
585548
586549 #[ tokio:: test]
0 commit comments