@@ -1390,6 +1390,13 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
13901390 ) ;
13911391 assert . equal ( pull . status , "pulled" ) ;
13921392
1393+ const refreshedStatus = yield * Effect . scoped (
1394+ withWsRpcClient ( wsUrl , ( client ) =>
1395+ client [ WS_METHODS . gitRefreshStatus ] ( { cwd : "/tmp/repo" } ) ,
1396+ ) ,
1397+ ) ;
1398+ assert . equal ( refreshedStatus . isRepo , true ) ;
1399+
13931400 const stackedEvents = yield * Effect . scoped (
13941401 withWsRpcClient ( wsUrl , ( client ) =>
13951402 client [ WS_METHODS . gitRunStackedAction ] ( {
@@ -1492,11 +1499,35 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
14921499 cwd : "/tmp/repo" ,
14931500 detail : "upstream missing" ,
14941501 } ) ;
1502+ let invalidationCalls = 0 ;
1503+ let statusCalls = 0 ;
14951504 yield * buildAppUnderTest ( {
14961505 layers : {
14971506 gitCore : {
14981507 pullCurrentBranch : ( ) => Effect . fail ( gitError ) ,
14991508 } ,
1509+ gitManager : {
1510+ invalidateStatus : ( ) =>
1511+ Effect . sync ( ( ) => {
1512+ invalidationCalls += 1 ;
1513+ } ) ,
1514+ status : ( ) =>
1515+ Effect . sync ( ( ) => {
1516+ statusCalls += 1 ;
1517+ return {
1518+ isRepo : true ,
1519+ hasOriginRemote : true ,
1520+ isDefaultBranch : true ,
1521+ branch : "main" ,
1522+ hasWorkingTreeChanges : true ,
1523+ workingTree : { files : [ ] , insertions : 0 , deletions : 0 } ,
1524+ hasUpstream : true ,
1525+ aheadCount : 0 ,
1526+ behindCount : 0 ,
1527+ pr : null ,
1528+ } ;
1529+ } ) ,
1530+ } ,
15001531 } ,
15011532 } ) ;
15021533
@@ -1508,6 +1539,63 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
15081539 ) ;
15091540
15101541 assertFailure ( result , gitError ) ;
1542+ assert . equal ( invalidationCalls , 1 ) ;
1543+ assert . equal ( statusCalls , 1 ) ;
1544+ } ) . pipe ( Effect . provide ( NodeHttpServer . layerTest ) ) ,
1545+ ) ;
1546+
1547+ it . effect ( "routes websocket rpc git.runStackedAction errors after refreshing git status" , ( ) =>
1548+ Effect . gen ( function * ( ) {
1549+ const gitError = new GitCommandError ( {
1550+ operation : "commit" ,
1551+ command : "git commit" ,
1552+ cwd : "/tmp/repo" ,
1553+ detail : "nothing to commit" ,
1554+ } ) ;
1555+ let invalidationCalls = 0 ;
1556+ let statusCalls = 0 ;
1557+ yield * buildAppUnderTest ( {
1558+ layers : {
1559+ gitManager : {
1560+ invalidateStatus : ( ) =>
1561+ Effect . sync ( ( ) => {
1562+ invalidationCalls += 1 ;
1563+ } ) ,
1564+ status : ( ) =>
1565+ Effect . sync ( ( ) => {
1566+ statusCalls += 1 ;
1567+ return {
1568+ isRepo : true ,
1569+ hasOriginRemote : true ,
1570+ isDefaultBranch : false ,
1571+ branch : "feature/demo" ,
1572+ hasWorkingTreeChanges : true ,
1573+ workingTree : { files : [ ] , insertions : 0 , deletions : 0 } ,
1574+ hasUpstream : true ,
1575+ aheadCount : 0 ,
1576+ behindCount : 0 ,
1577+ pr : null ,
1578+ } ;
1579+ } ) ,
1580+ runStackedAction : ( ) => Effect . fail ( gitError ) ,
1581+ } ,
1582+ } ,
1583+ } ) ;
1584+
1585+ const wsUrl = yield * getWsServerUrl ( "/ws" ) ;
1586+ const result = yield * Effect . scoped (
1587+ withWsRpcClient ( wsUrl , ( client ) =>
1588+ client [ WS_METHODS . gitRunStackedAction ] ( {
1589+ actionId : "action-1" ,
1590+ cwd : "/tmp/repo" ,
1591+ action : "commit" ,
1592+ } ) . pipe ( Stream . runCollect , Effect . result ) ,
1593+ ) ,
1594+ ) ;
1595+
1596+ assertFailure ( result , gitError ) ;
1597+ assert . equal ( invalidationCalls , 1 ) ;
1598+ assert . equal ( statusCalls , 1 ) ;
15111599 } ) . pipe ( Effect . provide ( NodeHttpServer . layerTest ) ) ,
15121600 ) ;
15131601
0 commit comments