fix: update DIFC test assertions to match new notice format#2552
Conversation
Tests expected old '[DIFC]' prefix and 'DIFC policy violation' error string, but commits b1cb2a7 and 8ecdf2c changed these to '[Filtered]' and 'DIFC Violation:' respectively. - Phase2 write block: 'DIFC policy violation' → 'DIFC Violation:' - Phase5 filter notice: add 'Filtered' (capital F) to search terms Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates DIFC-related test assertions in the unified server test suite to align with recently changed DIFC error/notice message formats, unblocking CI failures after upstream formatting changes.
Changes:
- Adjust Phase 2 write-block test to expect the current DIFC violation error prefix (
"DIFC Violation:"). - Relax/update Phase 5 filter-mode notice detection to match the new notice capitalization/prefix.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // At least one content item should mention DIFC filtering notice. | ||
| var foundNotice bool | ||
| for _, c := range result.Content { | ||
| if tc, ok := c.(*sdk.TextContent); ok { | ||
| if strings.Contains(tc.Text, "DIFC") || strings.Contains(tc.Text, "filtered") { | ||
| if strings.Contains(tc.Text, "Filtered") || strings.Contains(tc.Text, "DIFC") || strings.Contains(tc.Text, "filtered") { | ||
| foundNotice = true |
There was a problem hiding this comment.
The filter-notice assertion is quite permissive (it matches any content containing "DIFC" or lowercase "filtered"), which can let the test pass even if the specific notice format regresses. Since buildDIFCFilteredNotice currently prefixes notices with "[Filtered]", consider asserting on that exact prefix (and update the nearby comment that says the notice should mention "DIFC", since the current notice text may not include "DIFC" at all).
See below for a potential fix:
// At least one content item should contain the DIFC filtering notice prefix.
var foundNotice bool
for _, c := range result.Content {
if tc, ok := c.(*sdk.TextContent); ok {
if strings.HasPrefix(tc.Text, "[Filtered]") {
Fixes 2 test failures in
call_backend_tool_difc_test.gocaused by notice format changes that landed on main:"DIFC policy violation"but evaluator now emits"DIFC Violation:"(changed in b1cb2a7)"DIFC"or"filtered"(lowercase) but notice now says"[Filtered]"(capital F, changed in 8ecdf2c)Minimal fix — updates the assertion strings to match the current code.