test: fix vacuous built-ins SDK tests (#5662) - #5921
Conversation
|
@panshularora is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe tests now parse fenced JSON to detect nested builtin tool entries and validate coerced builtin configurations before resolver execution. ChangesBuiltin tool validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d270915a-4c73-493d-8499-822c0a897b73
📒 Files selected for processing (2)
sdks/python/oss/tests/pytest/unit/agents/test_agenta_builtins_reference_files.pysdks/python/oss/tests/pytest/unit/agents/tools/test_resolver.py
Summary
Fixes two SDK unit tests that currently pass without exercising what they claim to check (follow-up from #5651 review / #5662).
1. Vacuous resolver test (
test_a_bare_tool_name_string_is_ignored_too)coerce_tool_configs([\"read\"])returns a pydanticToolConfigParseResult, not a sequence of tool configs. Passing the parse result intoToolResolver().resolve()meant iteration never saw the coercedBuiltinToolConfig, so the empty-spec assertion could pass for the wrong reason.Change: assert the parse result contains a single
BuiltinToolConfig, then passparsed.tool_configsintoresolve().2. Substring-only JSON check (
test_no_json_example_writes_a_builtin_tool_entry)The old check looked for the literal substring
"type": "builtin", so whitespace variants like"type":"builtin"could slip through.Change: parse each fenced JSON block and recursively reject any object with
type == "builtin".Test plan
sdks/python/oss/tests/pytest/unit/agents/Closes #5662