@@ -68,13 +68,20 @@ function withFakeClaudeEnv<A, E, R>(
6868 claudeConfig ?: Partial < ClaudeSettings > ;
6969 proxy ?: { readonly url : string ; readonly apiKey : string } ;
7070 } ,
71- effectFn : ( textGeneration : TextGeneration . TextGeneration [ "Service" ] ) => Effect . Effect < A , E , R > ,
71+ effectFn : (
72+ textGeneration : TextGeneration . TextGeneration [ "Service" ] ,
73+ tempDir : string ,
74+ ) => Effect . Effect < A , E , R > ,
7275) {
7376 return Effect . gen ( function * ( ) {
7477 const fs = yield * FileSystem . FileSystem ;
7578 const tempDir = yield * fs . makeTempDirectoryScoped ( { prefix : "t3code-claude-text-" } ) ;
7679 const binDir = yield * makeFakeClaudeBinary ( tempDir , input . lifecyclePort ) ;
7780 const pathDelimiter = ( yield * HostProcess . isWindows ) ? ";" : ":" ;
81+ const path = yield * Path . Path ;
82+ const platform = yield * HostProcess . Platform ;
83+ const previousSettingsExpected = process . env . T3_FAKE_CLAUDE_SETTINGS_EXPECTED ;
84+ const previousSettingsReceipt = process . env . T3_FAKE_CLAUDE_SETTINGS_RECEIPT ;
7885 const previousPath = process . env . PATH ;
7986 const previousOutput = process . env . T3_FAKE_CLAUDE_OUTPUT ;
8087 const previousExitCode = process . env . T3_FAKE_CLAUDE_EXIT_CODE ;
@@ -87,6 +94,16 @@ function withFakeClaudeEnv<A, E, R>(
8794
8895 yield * Effect . acquireRelease (
8996 Effect . sync ( ( ) => {
97+ if ( input . proxy === undefined ) {
98+ delete process . env . T3_FAKE_CLAUDE_SETTINGS_EXPECTED ;
99+ delete process . env . T3_FAKE_CLAUDE_SETTINGS_RECEIPT ;
100+ } else {
101+ process . env . T3_FAKE_CLAUDE_SETTINGS_EXPECTED = JSON . stringify ( {
102+ ...input . proxy ,
103+ platform,
104+ } ) ;
105+ process . env . T3_FAKE_CLAUDE_SETTINGS_RECEIPT = path . join ( tempDir , "settings-path.txt" ) ;
106+ }
90107 process . env . PATH = `${ binDir } ${ pathDelimiter } ${ previousPath ?? "" } ` ;
91108 process . env . T3_FAKE_CLAUDE_OUTPUT = input . output ;
92109
@@ -134,6 +151,12 @@ function withFakeClaudeEnv<A, E, R>(
134151 } ) ,
135152 ( ) =>
136153 Effect . sync ( ( ) => {
154+ if ( previousSettingsExpected === undefined )
155+ delete process . env . T3_FAKE_CLAUDE_SETTINGS_EXPECTED ;
156+ else process . env . T3_FAKE_CLAUDE_SETTINGS_EXPECTED = previousSettingsExpected ;
157+ if ( previousSettingsReceipt === undefined )
158+ delete process . env . T3_FAKE_CLAUDE_SETTINGS_RECEIPT ;
159+ else process . env . T3_FAKE_CLAUDE_SETTINGS_RECEIPT = previousSettingsReceipt ;
137160 process . env . PATH = previousPath ;
138161
139162 if ( previousOutput === undefined ) {
@@ -193,7 +216,7 @@ function withFakeClaudeEnv<A, E, R>(
193216 Effect . succeed ( SYNTHETIC_CLAUDE_MODEL_CATALOG ) ,
194217 input . proxy ,
195218 ) ;
196- return yield * effectFn ( textGeneration ) ;
219+ return yield * effectFn ( textGeneration , tempDir ) ;
197220 } ) . pipe ( Effect . scoped ) ;
198221}
199222
@@ -209,15 +232,16 @@ it.layer(layerClaudeTextGenerationTest)("ClaudeTextGeneration", (it) => {
209232 body : "Body" ,
210233 } ,
211234 } ) ,
235+ ...( proxied ? { argsMustNotContain : "proxy-test-key" } : { } ) ,
212236 argsMustContain : proxied
213- ? '"ANTHROPIC_BASE_URL":"http://proxy.test:8317"'
237+ ? "--effort max --settings"
214238 : `--model ${ SYNTHETIC_CLAUDE_CAPABLE_MODEL } [expanded] --effort max --settings {"disableAllHooks":true,"fastMode":true}` ,
215239 ...( proxied
216240 ? { proxy : { url : "http://proxy.test:8317" , apiKey : "proxy-test-key" } }
217241 : { } ) ,
218242 claudeConfig : { customModels : [ SYNTHETIC_CLAUDE_COLLIDING_ALIAS ] } ,
219243 } ,
220- ( textGeneration ) =>
244+ ( textGeneration , tempDir ) =>
221245 Effect . gen ( function * ( ) {
222246 const generated = yield * textGeneration . generatePrContent ( {
223247 cwd : process . cwd ( ) ,
@@ -239,6 +263,14 @@ it.layer(layerClaudeTextGenerationTest)("ClaudeTextGeneration", (it) => {
239263 } ) ;
240264
241265 expect ( generated . title ) . toBe ( "Improve orchestration flow" ) ;
266+ if ( proxied ) {
267+ const fs = yield * FileSystem . FileSystem ;
268+ const path = yield * Path . Path ;
269+ const settingsPath = yield * fs . readFileString (
270+ path . join ( tempDir , "settings-path.txt" ) ,
271+ ) ;
272+ expect ( yield * fs . exists ( settingsPath ) ) . toBe ( false ) ;
273+ }
242274 } ) ,
243275 ) ,
244276 ) ;
0 commit comments