@@ -163,7 +163,7 @@ class AIGuardInternalTests extends DDSpecification {
163163 return mockResponse(
164164 request,
165165 200 ,
166- [data : [attributes : [action : suite. action, reason : suite. reason, is_blocking_enabled : suite. blocking]]]
166+ [data : [attributes : [action : suite. action, reason : suite. reason, tags : suite . tags ?: [], is_blocking_enabled : suite. blocking]]]
167167 )
168168 }
169169 }
@@ -193,6 +193,11 @@ class AIGuardInternalTests extends DDSpecification {
193193 if (throwAbortError) {
194194 1 * span. addThrowable(_ as AIGuard.AIGuardAbortError )
195195 }
196+ if (suite. tags) {
197+ suite. tags. each {
198+ 1 * span. setTag(" ai_guard.tag.${ it} " , true )
199+ }
200+ }
196201
197202 assertRequest(request, suite. messages)
198203 if (throwAbortError) {
@@ -497,22 +502,28 @@ class AIGuardInternalTests extends DDSpecification {
497502 private static class TestSuite {
498503 private final AIGuard.Action action
499504 private final String reason
505+ private final List<String > tags
500506 private final boolean blocking
501507 private final String description
502508 private final String target
503509 private final List<AIGuard.Message > messages
504510
505- TestSuite (AIGuard.Action action , String reason , boolean blocking , String description , String target , List<AIGuard.Message > messages ) {
511+ TestSuite (AIGuard.Action action , String reason , List< String > tags , boolean blocking , String description , String target , List<AIGuard.Message > messages ) {
506512 this . action = action
507513 this . reason = reason
514+ this . tags = tags
508515 this . blocking = blocking
509516 this . description = description
510517 this . target = target
511518 this . messages = messages
512519 }
513520
514521 static List<TestSuite > build () {
515- def actionValues = [[ALLOW , ' Go ahead' ], [DENY , ' Nope' ], [ABORT , ' Kill it with fire' ]]
522+ def actionValues = [
523+ [ALLOW , ' Go ahead' , []],
524+ [DENY , ' Nope' , [' deny_everything' , ' test_deny' ]],
525+ [ABORT , ' Kill it with fire' , [' alarm_tag' , ' abort_everything' ]]
526+ ]
516527 def blockingValues = [true , false ]
517528 def suiteValues = [
518529 [' tool call' , ' tool' , TOOL_CALL ],
@@ -521,7 +532,7 @@ class AIGuardInternalTests extends DDSpecification {
521532 ]
522533 return combinations([actionValues, blockingValues, suiteValues] as Iterable )
523534 .collect { action , blocking , suite ->
524- new TestSuite (action[0 ], action[1 ], blocking, suite[0 ], suite[1 ], suite[2 ])
535+ new TestSuite (action[0 ], action[1 ], action[ 2 ], blocking, suite[0 ], suite[1 ], suite[2 ])
525536 }
526537 }
527538
0 commit comments