Skip to content

test(T16): Bedrock + Vertex parser tests — fixtures + round-trips#20

Merged
ogkranthi merged 1 commit into
mainfrom
agent/tester/T16
Mar 31, 2026
Merged

test(T16): Bedrock + Vertex parser tests — fixtures + round-trips#20
ogkranthi merged 1 commit into
mainfrom
agent/tester/T16

Conversation

@ogkranthi
Copy link
Copy Markdown
Owner

Summary

Closes T16 from BACKLOG.md.

What's added

tests/test_bedrock_parser.py (57 tests)

  • Parse from bedrock-agent.json fixture: name, description, instruction, foundation model, agent/alias IDs
  • Parse from cloudformation.yaml fixture (CFN-only directory): name, instruction, knowledge sources, tools from ActionGroups
  • OpenAPI action groups → tools: multiple tools, parameters, auth variants (api_key, bearer, oauth2)
  • guardrail-config.json → governance guardrails from topicPolicyConfig
  • L1 heuristic guardrail extraction from instruction text (do not, never patterns)
  • Round-trip: AgentIR → bedrock emit → bedrock parse (instruction, MCP tools, guardrails, sections, long instruction truncation)
  • Edge cases: missing dirs, empty ActionGroups, truncation notice stripping, precedence rules

tests/test_vertex_parser.py (48 tests)

  • Parse from agent.json fixture: name, description, system prompt, language, timestamps, extensions
  • tools.json functionDeclarations → IR tools with parameters
  • datastoreSpec → KnowledgeSource
  • openApiFunctionDeclarations → openapi kind tool with endpoint
  • Auth parsing: api_key, oauth2, bearer (service account)
  • Guardrail heuristic extraction from instructions + Restrictions: section
  • Round-trip: AgentIR → vertex emit → vertex parse (prompt, tools, guardrails, sections, display_name)
  • Edge cases: missing agent.json, invalid JSON, empty tools, resource path inline tools, parse_agent_json() helper

Fixture files added

  • tests/fixtures/bedrock/{bedrock-agent.json,cloudformation.yaml,openapi.json,guardrail-config.json}
  • tests/fixtures/vertex/{agent.json,tools.json}

Test results

  • 887 tests passing (was 782 → +105 new tests)
  • Full suite: python -m pytest tests/ -q → 887 passed

- Add tests/test_bedrock_parser.py: 57 tests covering BedrockParser
  - Parse from bedrock-agent.json fixture
  - Parse from cloudformation.yaml fixture (CFN-only directory)
  - OpenAPI action groups → tools extraction + auth variants
  - guardrail-config.json → governance guardrails
  - L1 heuristic guardrail extraction from instruction text
  - Round-trip: AgentIR → bedrock emit → bedrock parse
  - Edge cases: missing dirs, empty ActionGroups, truncation stripping
- Add tests/test_vertex_parser.py: 48 tests covering VertexParser
  - Parse from agent.json fixture
  - tools.json functionDeclarations, datastoreSpec, openApiFunctionDeclarations
  - Auth parsing: api_key, oauth2, bearer (service account)
  - Guardrail heuristic extraction from instructions + Restrictions: section
  - Round-trip: AgentIR → vertex emit → vertex parse
  - Edge cases: missing agent.json, invalid JSON, empty tools, resource paths
- Add fixture files:
  - tests/fixtures/bedrock/{bedrock-agent.json,cloudformation.yaml,openapi.json,guardrail-config.json}
  - tests/fixtures/vertex/{agent.json,tools.json}
- Total: 887 tests (was 782) — 105 new tests, all passing
@ogkranthi ogkranthi merged commit 1494fa1 into main Mar 31, 2026
6 of 7 checks passed
@ogkranthi ogkranthi deleted the agent/tester/T16 branch March 31, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant