feat(powerbi): upgrade SDK to 2.0.0, add pytest unit tests#286
feat(powerbi): upgrade SDK to 2.0.0, add pytest unit tests#286Shubhank-Jonnada wants to merge 4 commits into
Conversation
- Bump autohive-integrations-sdk to ~=2.0.0 - Add .data accessor to all context.fetch() return values - Convert all error paths to ActionError(message=...) - Convert all success paths to ActionResult(data=..., cost_usd=0.0) - Remove "result" and "error" fields from all output schemas - Make nullable API fields accept ["string", "null"] in config.json - Bump config.json version to 2.0.0 - Add 68 unit tests covering happy path, request verification, error paths, and edge cases
🔍 Integration Validation ResultsCommit: Changed directories:
|
TheRealAgentK
left a comment
There was a problem hiding this comment.
LGTM. SDK 2.0.0 migration is clean — context.fetch().data, ActionError(message=...) everywhere, schema envelope fields removed, version bumped. Sensible call to make nullable Power BI fields accept ["string", "null"] in the output schema. 68 new unit tests on top of existing coverage (82 total).
Local CI verified: validate_integration ✅, check_code ✅, ruff ✅, pytest ✅.
tests/test_powerbi_integration.py already exists in master — please confirm in your test plan that you've re-run it against a real Power BI workspace on this branch to verify the v2 changes don't regress live behaviour.
Process nit: branch worktree-agent-* doesn't follow <type>/<issue#>/<desc> per AGENTS.md and no linked issue. Please follow the convention next time.
|
Correction to my earlier review: I misread the existing Approval still stands (the SDK 2.0.0 migration in this PR is shippable as-is and is now superseded for unit coverage by the new Tracked in #300 — please address in a follow-up PR. |
TheRealAgentK
left a comment
There was a problem hiding this comment.
Self-approved to remove the block, needs 3rd party review and then e-2-e test runs.
TheRealAgentK
left a comment
There was a problem hiding this comment.
Self-approved to remove the block, needs 3rd party review and then e-2-e test runs.
Summary
autohive-integrations-sdkfrom~=1.0.2to~=2.0.0context.fetch()return values now access.datafor the response bodyActionError(message=...)ActionResult(data=..., cost_usd=0.0)"result"boolean and"error"fields from output schemas inconfig.json["string", "null"]types in output schemasconfig.jsonversion to2.0.0test_powerbi_integration.pywith a real livepytest.mark.integrationsuite usingenv_credentials,make_context,FetchResponse, and platform OAuth-stylePOWERBI_ACCESS_TOKENpowerbi/tests/context.pyPOWERBI_ACCESS_TOKENto.env.exampleAuth/test alignment
Power BI is configured as platform OAuth in
config.json:{"type": "platform", "provider": "Power BI"}The live tests now match that shape:
POWERBI_ACCESS_TOKENAuthorization: Bearer <token>{"auth_type": "PlatformOauth2", "credentials": {"access_token": token}}Closes #300
Integration test coverage
The live read-only suite covers the requested domains:
list_workspaces, plusget_workspacewhen a workspace existslist_datasetslist_reportslist_dashboardsexecute_querieswhen a dataset existsSafe read-only command:
pytest powerbi/tests/test_powerbi_integration.py -m "integration and not destructive"Test plan
.venv/bin/python -m pytest powerbi/tests -m unit -q— 82 passed.venv/bin/python -m pytest powerbi/tests/test_powerbi_integration.py -m "integration and not destructive" -q— 6 skipped without live Power BI creds.venv/bin/python -m pytest powerbi/ -q— 82 passed; integration file not collected by default.venv/bin/python ../autohive-integrations-tooling/scripts/validate_integration.py powerbi— passed with one existing scope warning (offline_access,Content.Create,Tenant.ReadWrite.All).venv/bin/python ../autohive-integrations-tooling/scripts/check_code.py powerbi— passed