Skip to content

feat(powerbi): upgrade SDK to 2.0.0, add pytest unit tests#286

Open
Shubhank-Jonnada wants to merge 2 commits intomasterfrom
worktree-agent-a2238685871d724a3
Open

feat(powerbi): upgrade SDK to 2.0.0, add pytest unit tests#286
Shubhank-Jonnada wants to merge 2 commits intomasterfrom
worktree-agent-a2238685871d724a3

Conversation

@Shubhank-Jonnada
Copy link
Copy Markdown
Contributor

Summary

  • Upgrades autohive-integrations-sdk from ~=1.0.2 to ~=2.0.0
  • All context.fetch() return values now access .data for the response body
  • All error paths converted from bare dicts to ActionError(message=...)
  • All success paths converted from bare dicts to ActionResult(data=..., cost_usd=0.0)
  • Removed "result" (boolean) and "error" fields from all output schemas in config.json
  • Made nullable API fields accept ["string", "null"] types in output schemas
  • Bumped config.json version to 2.0.0
  • Added powerbi/tests/conftest.py and powerbi/tests/test_powerbi_unit.py with 68 unit tests

Test plan

  • All 68 unit tests pass: python -m pytest powerbi/ -v
  • Structure validation passes: python autohive-integrations-tooling/scripts/validate_integration.py powerbi
  • Code quality checks pass: python autohive-integrations-tooling/scripts/check_code.py powerbi
  • Ruff lint and format pass with tooling config

- 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
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

🔍 Integration Validation Results

Commit: a5acf906f70b588ca21a9ec79521269e111e846d · refactor(powerbi): split unit tests into domain files per writing-unit-tests skill
Updated: 2026-04-28T23:31:17Z

Changed directories: powerbi

Check Result
Structure ⚠️ Passed with warnings
Code ✅ Passed
Tests ✅ Passed
README ✅ Passed
Version ✅ Passed
⚠️ Structure Check output
Validating 1 integration(s)...

============================================================
Integration: powerbi
============================================================

Warnings (1):
  ⚠️ Potentially unused scopes (please verify): offline_access, Content.Create, Tenant.ReadWrite.All

============================================================
SUMMARY
============================================================
Integrations validated: 1
Total errors: 0
Total warnings: 1

⚠️ Validation passed with warnings - please review
✅ Code Check output

[notice] A new release of pip is available: 26.0.1 -> 26.1
[notice] To update, run: pip install --upgrade pip
----------------------------------------
Checking: powerbi
----------------------------------------

📦 Installing dependencies...

🐍 Checking Python syntax...
   ✅ Syntax OK

📥 Checking imports...
   ✅ Imports OK

📄 Checking JSON files...
   ✅ JSON files OK

🔍 Linting with ruff...
   ✅ Lint OK

🎨 Checking formatting with ruff...
   ✅ Formatting OK

🔒 Scanning for security issues with bandit...
   ✅ Security OK

🛡️ Checking dependencies for vulnerabilities with pip-audit...
   ✅ Dependencies OK

🔗 Checking config-code sync...
   ✅ Config-code sync OK

🔄 Checking fetch patterns...
   ✅ Fetch patterns OK

========================================
✅ CODE CHECK PASSED
========================================
✅ Tests output

Integration   Tests  Coverage        Status
-------------------------------------------
powerbi     82/82       96%      ✅ Passed
-------------------------------------------
Total       82/82            ✅ All passed

✅ Tests passed: powerbi
✅ README Check output
========================================
✅ README CHECK PASSED
========================================
✅ Version Check output
✅ powerbi: 1.0.0 → 2.0.0 (major bump)

========================================
✅ VERSION CHECK PASSED
========================================

Copy link
Copy Markdown
Collaborator

@TheRealAgentK TheRealAgentK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@TheRealAgentK
Copy link
Copy Markdown
Collaborator

Correction to my earlier review: I misread the existing powerbi/tests/test_powerbi_integration.py as a real e2e suite. On a closer look, it's a unittest.TestCase using AsyncMock/Mock for ExecutionContext — its own docstring says "without making actual API calls to Power BI". The filename is misleading.

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 test_powerbi_*_unit.py files), but a real live_context-based integration suite is still missing for Power BI.

Tracked in #300 — please address in a follow-up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants