@@ -306,3 +306,44 @@ async def resolve_taxonomies(self, context, llm_request) -> list[str]:
306306 called_skills = mock_format .call_args [0 ][0 ]
307307 assert called_skills [0 ].frontmatter .name == "important"
308308 assert called_skills [1 ].frontmatter .name == "normal"
309+
310+
311+ @pytest .mark .asyncio
312+ async def test_taxonomy_variable_interpolation ():
313+ """Tests that DefaultSkillPolicy correctly interpolates taxonomy variables."""
314+ taxonomy_data = [
315+ {
316+ "id" : "urn:adk:domain:finance" ,
317+ "name" : "Strict Finance" ,
318+ "variables" : {
319+ "warning" : "[PII WARNING]" ,
320+ "guardrail" : "Mask SSN"
321+ }
322+ }
323+ ]
324+ registry = TaxonomyRegistry .from_flat_json (taxonomy_data )
325+ policy = DefaultSkillPolicy (registry )
326+
327+ skill = Skill (
328+ frontmatter = Frontmatter (
329+ name = "audit" ,
330+ description = "Read accounts. {taxonomy:warning}" ,
331+ taxonomy_binds = ["urn:adk:domain:finance" ]
332+ ),
333+ instructions = "Fetch logs.\n {taxonomy:guardrail}"
334+ )
335+
336+ context = mock .MagicMock ()
337+ context .state = {"_active_taxonomies" : ["urn:adk:domain:finance" ]}
338+
339+ # 1. Test shape_description
340+ desc = policy .shape_description (skill , context , skill .frontmatter .description )
341+ assert desc == "Read accounts. [PII WARNING]"
342+
343+ # 2. Test shape_instructions
344+ inst = policy .shape_instructions (skill , context , skill .instructions )
345+ assert inst == "Fetch logs.\n Mask SSN"
346+
347+ # 3. Test shape_system_instruction
348+ sys_inst = policy .shape_system_instruction (context , ["urn:adk:domain:finance" ], "Start. {taxonomy:warning}" )
349+ assert sys_inst == "Start. [PII WARNING]"
0 commit comments