test: add Microsoft Agent Framework VCR coverage - #259
Conversation
|
This PR has conflicts with the git fetch origin
git checkout test/maf-vcr-contract
git rebase origin/main
# resolve conflicts, then:
git push --force-with-leaseThis is a one-time reminder. Feel free to @mention me for a re-review after conflicts are resolved. Automated notification by github-manager-bot |
ralf0131
left a comment
There was a problem hiding this comment.
Summary
This PR adds comprehensive VCR-based integration tests for the Microsoft Agent Framework instrumentation, covering 8 scenarios (non-streaming, streaming, tools, errors, concurrency, content modes). It also includes a clean backwards-compatibility fix for MAF 1.0 by using inspect.signature() to conditionally pass the force parameter to enable_instrumentation().
The code is well-structured, test coverage is thorough, and the compatibility fix is minimal and safe. LGTM.
Findings
- [Info]
conftest.py—record_mode: "none"is the right default for CI safety. Contributors re-recording cassettes locally will need to explicitly setrecord_mode="once"— consider adding a brief comment in the file header for discoverability. - [Info]
test_integration_vcr.py— The_assert_closed_maf_tracehelper is a solid abstraction. It correctly verifies root span kind, child span count, and that all spans are ended. Consider also assertingstatus_code != StatusCode.UNSETfor error-path tests to catch accidental status regressions. - [Info]
__init__.py— Theinspect.signature()approach withtry/except (TypeError, ValueError)fallback is robust. Clean fix for MAF 1.0 compatibility.
Automated review by github-manager-bot
Description
This PR adds a test-first, replay-only VCR contract for the Microsoft Agent Framework instrumentation and fixes an oldest-supported-version compatibility gap.
record_mode=none, fake credentials, strict request matching, and sanitized cassette headers/identifiers;enable_instrumentation(force=True)only when the installed MAF version exposes theforceparameter.The framework/client packages are test-only dependencies; runtime package metadata is unchanged. Commercial probe packaging and Robin-only behavior are outside this PR.
Fixes # (N/A)
Type of change
How Has This Been Tested?
tox -e precommituvx --from 'tox>=4,<5' tox -e generate-workflowsuvx --from 'tox>=4,<5' tox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-microsoft-agent-framework-oldest,py312-test-loongsuite-instrumentation-microsoft-agent-framework-latest -- --vcr-record=none -qDoes This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.
Validation Evidence
Spec and Scope
Local Checks
check_loongsuite_pr_readiness.py --repo . --base origin/main --committed-onlytox -e precommitwith a fresh hook cacheuvx --from 'tox>=4,<5' tox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-microsoft-agent-framework-oldest,py312-test-loongsuite-instrumentation-microsoft-agent-framework-latest -- --vcr-record=none -qfd2cd94^--vcr-record=noneBusiness Isolation
Real E2E Matrix
Telemetry and Weaver
loongsuite-genaiadvice profileCI