test(T16): Bedrock + Vertex parser tests — fixtures + round-trips#20
Merged
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes T16 from BACKLOG.md.
What's added
tests/test_bedrock_parser.py (57 tests)
bedrock-agent.jsonfixture: name, description, instruction, foundation model, agent/alias IDscloudformation.yamlfixture (CFN-only directory): name, instruction, knowledge sources, tools from ActionGroupsguardrail-config.json→ governance guardrails from topicPolicyConfigdo not,neverpatterns)AgentIR → bedrock emit → bedrock parse(instruction, MCP tools, guardrails, sections, long instruction truncation)tests/test_vertex_parser.py (48 tests)
agent.jsonfixture: name, description, system prompt, language, timestamps, extensionstools.jsonfunctionDeclarations → IR tools with parametersdatastoreSpec→ KnowledgeSourceopenApiFunctionDeclarations→ openapi kind tool with endpointRestrictions:sectionAgentIR → vertex emit → vertex parse(prompt, tools, guardrails, sections, display_name)agent.json, invalid JSON, empty tools, resource path inline tools,parse_agent_json()helperFixture files added
tests/fixtures/bedrock/{bedrock-agent.json,cloudformation.yaml,openapi.json,guardrail-config.json}tests/fixtures/vertex/{agent.json,tools.json}Test results
python -m pytest tests/ -q→ 887 passed