@@ -1609,6 +1609,43 @@ mod tests {
16091609 assert_eq ! ( nats. published_messages( ) , vec![ "_INBOX.reply" ] ) ;
16101610 }
16111611
1612+ #[ tokio:: test]
1613+ async fn dispatch_client_method_terminal_wait_for_exit_failing_client_write_text_file_covers_stubs ( )
1614+ {
1615+ let nats = MockNatsClient :: new ( ) ;
1616+ let client = TerminalWaitForExitFailingClient ;
1617+ let envelope = Request {
1618+ id : RequestId :: Number ( 1 ) ,
1619+ method : std:: sync:: Arc :: from ( "fs/write_text_file" ) ,
1620+ params : Some ( WriteTextFileRequest :: new (
1621+ agent_client_protocol:: SessionId :: from ( "sess-1" ) ,
1622+ "/tmp/foo.txt" . to_string ( ) ,
1623+ "content" . to_string ( ) ,
1624+ ) ) ,
1625+ } ;
1626+ let payload = bytes:: Bytes :: from ( serde_json:: to_vec ( & envelope) . unwrap ( ) ) ;
1627+ let parsed = crate :: nats:: ParsedClientSubject {
1628+ session_id : AcpSessionId :: new ( "sess-1" ) . unwrap ( ) ,
1629+ method : ClientMethod :: FsWriteTextFile ,
1630+ } ;
1631+ let bridge = make_bridge ( nats. clone ( ) ) ;
1632+ let ctx = DispatchContext {
1633+ nats : & nats,
1634+ client : & client,
1635+ bridge : & bridge,
1636+ serializer : & StdJsonSerialize ,
1637+ } ;
1638+ dispatch_client_method (
1639+ "acp.sess-1.client.fs.write_text_file" ,
1640+ parsed,
1641+ payload,
1642+ Some ( "_INBOX.reply" . to_string ( ) ) ,
1643+ & ctx,
1644+ )
1645+ . await ;
1646+ assert_eq ! ( nats. published_messages( ) , vec![ "_INBOX.reply" ] ) ;
1647+ }
1648+
16121649 #[ tokio:: test]
16131650 async fn dispatch_client_method_terminal_wait_for_exit_timeout_client_read_text_file_covers_stubs ( )
16141651 {
@@ -1777,6 +1814,116 @@ mod tests {
17771814 assert_eq ! ( nats. published_messages( ) , vec![ "_INBOX.reply" ] ) ;
17781815 }
17791816
1817+ #[ tokio:: test]
1818+ async fn dispatch_client_method_terminal_wait_for_exit_timeout_client_write_text_file_covers_stubs ( )
1819+ {
1820+ let nats = MockNatsClient :: new ( ) ;
1821+ let client = TerminalWaitForExitTimeoutClient ;
1822+ let envelope = Request {
1823+ id : RequestId :: Number ( 1 ) ,
1824+ method : std:: sync:: Arc :: from ( "fs/write_text_file" ) ,
1825+ params : Some ( WriteTextFileRequest :: new (
1826+ agent_client_protocol:: SessionId :: from ( "sess-1" ) ,
1827+ "/tmp/foo.txt" . to_string ( ) ,
1828+ "content" . to_string ( ) ,
1829+ ) ) ,
1830+ } ;
1831+ let payload = bytes:: Bytes :: from ( serde_json:: to_vec ( & envelope) . unwrap ( ) ) ;
1832+ let parsed = crate :: nats:: ParsedClientSubject {
1833+ session_id : AcpSessionId :: new ( "sess-1" ) . unwrap ( ) ,
1834+ method : ClientMethod :: FsWriteTextFile ,
1835+ } ;
1836+ let bridge = make_bridge ( nats. clone ( ) ) ;
1837+ let ctx = DispatchContext {
1838+ nats : & nats,
1839+ client : & client,
1840+ bridge : & bridge,
1841+ serializer : & StdJsonSerialize ,
1842+ } ;
1843+ dispatch_client_method (
1844+ "acp.sess-1.client.fs.write_text_file" ,
1845+ parsed,
1846+ payload,
1847+ Some ( "_INBOX.reply" . to_string ( ) ) ,
1848+ & ctx,
1849+ )
1850+ . await ;
1851+ assert_eq ! ( nats. published_messages( ) , vec![ "_INBOX.reply" ] ) ;
1852+ }
1853+
1854+ #[ tokio:: test]
1855+ async fn dispatch_client_method_terminal_kill_failing_client_write_text_file_covers_stubs ( ) {
1856+ let nats = MockNatsClient :: new ( ) ;
1857+ let client = TerminalKillFailingClient ;
1858+ let envelope = Request {
1859+ id : RequestId :: Number ( 1 ) ,
1860+ method : std:: sync:: Arc :: from ( "fs/write_text_file" ) ,
1861+ params : Some ( WriteTextFileRequest :: new (
1862+ agent_client_protocol:: SessionId :: from ( "sess-1" ) ,
1863+ "/tmp/foo.txt" . to_string ( ) ,
1864+ "content" . to_string ( ) ,
1865+ ) ) ,
1866+ } ;
1867+ let payload = bytes:: Bytes :: from ( serde_json:: to_vec ( & envelope) . unwrap ( ) ) ;
1868+ let parsed = crate :: nats:: ParsedClientSubject {
1869+ session_id : AcpSessionId :: new ( "sess-1" ) . unwrap ( ) ,
1870+ method : ClientMethod :: FsWriteTextFile ,
1871+ } ;
1872+ let bridge = make_bridge ( nats. clone ( ) ) ;
1873+ let ctx = DispatchContext {
1874+ nats : & nats,
1875+ client : & client,
1876+ bridge : & bridge,
1877+ serializer : & StdJsonSerialize ,
1878+ } ;
1879+ dispatch_client_method (
1880+ "acp.sess-1.client.fs.write_text_file" ,
1881+ parsed,
1882+ payload,
1883+ Some ( "_INBOX.reply" . to_string ( ) ) ,
1884+ & ctx,
1885+ )
1886+ . await ;
1887+ assert_eq ! ( nats. published_messages( ) , vec![ "_INBOX.reply" ] ) ;
1888+ }
1889+
1890+ #[ tokio:: test]
1891+ async fn dispatch_client_method_terminal_release_failing_client_write_text_file_covers_stubs ( )
1892+ {
1893+ let nats = MockNatsClient :: new ( ) ;
1894+ let client = TerminalReleaseFailingClient ;
1895+ let envelope = Request {
1896+ id : RequestId :: Number ( 1 ) ,
1897+ method : std:: sync:: Arc :: from ( "fs/write_text_file" ) ,
1898+ params : Some ( WriteTextFileRequest :: new (
1899+ agent_client_protocol:: SessionId :: from ( "sess-1" ) ,
1900+ "/tmp/foo.txt" . to_string ( ) ,
1901+ "content" . to_string ( ) ,
1902+ ) ) ,
1903+ } ;
1904+ let payload = bytes:: Bytes :: from ( serde_json:: to_vec ( & envelope) . unwrap ( ) ) ;
1905+ let parsed = crate :: nats:: ParsedClientSubject {
1906+ session_id : AcpSessionId :: new ( "sess-1" ) . unwrap ( ) ,
1907+ method : ClientMethod :: FsWriteTextFile ,
1908+ } ;
1909+ let bridge = make_bridge ( nats. clone ( ) ) ;
1910+ let ctx = DispatchContext {
1911+ nats : & nats,
1912+ client : & client,
1913+ bridge : & bridge,
1914+ serializer : & StdJsonSerialize ,
1915+ } ;
1916+ dispatch_client_method (
1917+ "acp.sess-1.client.fs.write_text_file" ,
1918+ parsed,
1919+ payload,
1920+ Some ( "_INBOX.reply" . to_string ( ) ) ,
1921+ & ctx,
1922+ )
1923+ . await ;
1924+ assert_eq ! ( nats. published_messages( ) , vec![ "_INBOX.reply" ] ) ;
1925+ }
1926+
17801927 #[ tokio:: test]
17811928 async fn dispatch_client_method_dispatches_terminal_release_session_id_mismatch_publishes_error_reply ( )
17821929 {
@@ -3406,6 +3553,42 @@ mod tests {
34063553 assert_eq ! ( nats. published_messages( ) , vec![ "_INBOX.reply" ] ) ;
34073554 }
34083555
3556+ #[ tokio:: test]
3557+ async fn dispatch_client_method_rpc_mock_client_write_text_file_covers_stubs ( ) {
3558+ let nats = MockNatsClient :: new ( ) ;
3559+ let client = RpcMockClient ;
3560+ let envelope = Request {
3561+ id : RequestId :: Number ( 1 ) ,
3562+ method : std:: sync:: Arc :: from ( "fs/write_text_file" ) ,
3563+ params : Some ( WriteTextFileRequest :: new (
3564+ agent_client_protocol:: SessionId :: from ( "sess-1" ) ,
3565+ "/tmp/foo.txt" . to_string ( ) ,
3566+ "content" . to_string ( ) ,
3567+ ) ) ,
3568+ } ;
3569+ let payload = bytes:: Bytes :: from ( serde_json:: to_vec ( & envelope) . unwrap ( ) ) ;
3570+ let parsed = crate :: nats:: ParsedClientSubject {
3571+ session_id : AcpSessionId :: new ( "sess-1" ) . unwrap ( ) ,
3572+ method : ClientMethod :: FsWriteTextFile ,
3573+ } ;
3574+ let bridge = make_bridge ( nats. clone ( ) ) ;
3575+ let ctx = DispatchContext {
3576+ nats : & nats,
3577+ client : & client,
3578+ bridge : & bridge,
3579+ serializer : & StdJsonSerialize ,
3580+ } ;
3581+ dispatch_client_method (
3582+ "acp.sess-1.client.fs.write_text_file" ,
3583+ parsed,
3584+ payload,
3585+ Some ( "_INBOX.reply" . to_string ( ) ) ,
3586+ & ctx,
3587+ )
3588+ . await ;
3589+ assert_eq ! ( nats. published_messages( ) , vec![ "_INBOX.reply" ] ) ;
3590+ }
3591+
34093592 #[ tokio:: test]
34103593 async fn dispatch_client_method_dispatches_request_permission_client_error_publishes_error_reply ( )
34113594 {
0 commit comments