You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor ContextFilter tests for determinism and logging
Updated ContextFilter-related tests to use -WhatIf mode and PSFramework message inspection for deterministic validation, replacing API-dependent checks. Added verification of deduplication and warning messages, and improved test clarity by focusing on internal logic rather than external tool responses.
#Ask Claude to list the context files it can see - the English original should be included
220
-
$result=Invoke-AITool-Path $frFile-Prompt "List ALL the filenames you can see in this prompt, including any context files. Just list the filenames, one per line."-Tool Claude -ContextFilter { $_-replace'\.fr\.md$','.md' }
221
-
222
-
$result| Should -Not-BeNullOrEmpty
223
-
$result.Success| Should -Be $true
224
-
$result.Tool| Should -Be 'Claude'
225
-
# Claude should mention the English original file in its response
226
-
$result.Result| Should -Match'alligator-eggs\.md'
221
+
#Clear previous messages and run with -WhatIf to avoid API call
222
+
Get-PSFMessage|Out-Null
223
+
$null=Invoke-AITool-Path $frFile-Prompt "test"-Tool Claude -ContextFilter { $_-replace'\.fr\.md$','.md' } -WhatIf
224
+
225
+
# Check debug messages to verify context file was found
# Ask Claude what files it sees - should include the English original from ContextFilterBase
232
-
$result=Invoke-AITool-Path $frCaFile-Prompt "What filenames can you see? List them all."-Tool Claude -ContextFilter { [System.IO.Path]::GetFileName($_) -replace'\.fr-ca\.md$','.md' } -ContextFilterBase $script:recipesPath
233
-
234
-
$result| Should -Not-BeNullOrEmpty
235
-
$result.Success| Should -Be $true
236
-
# Should see the English original
237
-
$result.Result| Should -Match'alligator-eggs\.md'
233
+
Get-PSFMessage|Out-Null
234
+
$null=Invoke-AITool-Path $frCaFile-Prompt "test"-Tool Claude `
# Ask Claude what context files it can see in the batch
243
-
$result=$frFiles|Invoke-AITool-Prompt "List ALL filenames you can see. Include both the files to process and any context files."-Tool Claude -ContextFilter { $_-replace'\.fr(-ca)?\.md$','.md' } -BatchSize 3
244
-
245
-
$result| Should -Not-BeNullOrEmpty
246
-
$result.Success| Should -Be $true
247
-
# Should see the English original as dynamic context
248
-
$result.Result| Should -Match'alligator-eggs\.md'
247
+
Get-PSFMessage|Out-Null
248
+
$null=$frFiles|Invoke-AITool-Prompt "test"-Tool Claude `
# With deduplication, the English original should only appear once even though two files derive it
266
-
$result=$frFiles|Invoke-AITool-Prompt "How many times does 'alligator-eggs.md' appear as a context file? Answer with just a number."-Tool Claude -ContextFilter { $_-replace'\.fr(-ca)?\.md$','.md' } -BatchSize 3
269
+
It 'Should work end-to-end with ContextFilter (integration)' {
# One real API call to verify the whole flow works
272
+
$result=Invoke-AITool-Path $frFile-Prompt "List ALL the filenames visible in this prompt. Output ONLY the filenames, one per line, nothing else."-Tool Claude -ContextFilter { $_-replace'\.fr\.md$','.md' }
267
273
268
274
$result| Should -Not-BeNullOrEmpty
269
275
$result.Success| Should -Be $true
270
-
# Should only see the context file once due to deduplication
271
-
$result.Result| Should -Match'1'
276
+
$result.Tool| Should -Be 'Claude'
277
+
# Claude should see and mention both files
278
+
$result.Result| Should -Match'alligator-eggs'
272
279
}
273
280
274
-
It 'Should work with null ContextFilter (no-op, existing behavior unchanged)' {
281
+
It 'Should work with null ContextFilter (no-op)' {
0 commit comments