@@ -181,6 +181,41 @@ it.layer(NodeServices.layer)("server settings", (it) => {
181181 ) . pipe ( TestClock . withLive , Effect . provide ( makeServerSettingsLayer ( ) ) ) ,
182182 ) ;
183183
184+ it . effect ( "follows a settings link that is repointed to another directory" , ( ) =>
185+ Effect . scoped (
186+ Effect . gen ( function * ( ) {
187+ const config = yield * ServerConfig . ServerConfig ;
188+ const fs = yield * FileSystem . FileSystem ;
189+ const path = yield * Path . Path ;
190+ const service = yield * ServerSettingsModule . ServerSettingsService ;
191+ const dotfiles = yield * fs . makeTempDirectoryScoped ( { prefix : "t3-settings-dotfiles-" } ) ;
192+ const firstSettingsPath = path . join ( dotfiles , "first" , "settings.json" ) ;
193+ const secondSettingsPath = path . join ( dotfiles , "second" , "settings.json" ) ;
194+ yield * fs . makeDirectory ( path . dirname ( firstSettingsPath ) , { recursive : true } ) ;
195+ yield * fs . makeDirectory ( path . dirname ( secondSettingsPath ) , { recursive : true } ) ;
196+ yield * fs . writeFileString ( firstSettingsPath , `{ "responseStreamingMode": "turn" }` ) ;
197+ yield * fs . writeFileString ( secondSettingsPath , `{ "responseStreamingMode": "paragraph" }` ) ;
198+ yield * fs . remove ( config . settingsPath , { force : true } ) ;
199+ yield * fs . symlink ( firstSettingsPath , config . settingsPath ) ;
200+ yield * service . start ;
201+
202+ const repointChanges = yield * service . subscribeChanges ;
203+ yield * fs . remove ( config . settingsPath ) ;
204+ yield * fs . symlink ( secondSettingsPath , config . settingsPath ) ;
205+ const repointed = yield * repointChanges . pipe ( Stream . runHead , Effect . timeout ( "2 seconds" ) ) ;
206+ assert . equal ( Option . getOrUndefined ( repointed ) ?. responseStreamingMode , "paragraph" ) ;
207+
208+ const editChanges = yield * service . subscribeChanges ;
209+ yield * writeFileStringAtomically ( {
210+ filePath : secondSettingsPath ,
211+ contents : `{ "responseStreamingMode": "turn" }` ,
212+ } ) ;
213+ const edited = yield * editChanges . pipe ( Stream . runHead , Effect . timeout ( "2 seconds" ) ) ;
214+ assert . equal ( Option . getOrUndefined ( edited ) ?. responseStreamingMode , "turn" ) ;
215+ } ) ,
216+ ) . pipe ( TestClock . withLive , Effect . provide ( makeServerSettingsLayer ( ) ) ) ,
217+ ) ;
218+
184219 it . effect ( "reloads when a dangling settings link gets its destination" , ( ) =>
185220 Effect . scoped (
186221 Effect . gen ( function * ( ) {
0 commit comments