Skip to content

feat(harvest): upgrade SDK to 2.0.0, add pytest unit tests#276

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

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

Conversation

@Shubhank-Jonnada
Copy link
Copy Markdown
Contributor

Summary

  • Upgrades autohive-integrations-sdk pin from ~=1.0.2 to ~=2.0.0
  • Updates all context.fetch() call sites to access .data on the returned FetchResponse
  • Converts all error returns from bare dicts to ActionError(message=...)
  • Converts all success returns to ActionResult(data={...}, cost_usd=0.0)
  • Removes "error" and "success" fields from all output schemas in config.json
  • Bumps config.json version to 2.0.0
  • Adds 42 pytest unit tests covering all 10 actions across happy path, request verification, error paths, and edge cases

Actions covered

create_time_entry, stop_time_entry, list_time_entries, update_time_entry, delete_time_entry, list_projects, get_project, list_clients, list_tasks, list_users

Test plan

  • validate_integration.py harvest — 0 errors, 0 warnings
  • check_code.py harvest — CODE CHECK PASSED
  • pytest harvest/ -v — 42 passed
  • ruff check and ruff format — all clean

- Bump autohive-integrations-sdk pin to ~=2.0.0
- Update all context.fetch() return values to access .data
- Convert all error returns from bare dicts to ActionError(message=...)
- Convert all success returns to ActionResult(data={...}, cost_usd=0.0)
- Import ActionResult, ActionError from SDK
- Remove 'error' and 'success' fields from output schemas in config.json
- Bump config.json version to 2.0.0
- Add harvest/tests/conftest.py, __init__.py, test_harvest_unit.py
- 42 unit tests covering all 10 actions (happy path, request verification, error paths, edge cases)
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

🔍 Integration Validation Results

Commit: 819080dfe0d6601b121670ca3ccc1ad6f8b281cc · fix(harvest): fix optional params to use .get(), add pytest tests, integration tests
Updated: 2026-05-01T02:04:11Z

Changed directories: harvest

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

============================================================
Integration: harvest
============================================================
✅ All checks passed!

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

✅ All validations passed!
✅ 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: harvest
----------------------------------------

📦 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 Check output

Integration   Tests  Coverage        Status
-------------------------------------------
harvest     42/42       84%      ✅ Passed
-------------------------------------------
Total       42/42            ✅ All passed

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

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

TheRealAgentK
TheRealAgentK previously approved these changes Apr 29, 2026
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. 42 unit tests across all 10 actions.

Local CI verified: validate_integration ✅, check_code ✅, ruff ✅, pytest ✅.

Follow-up tracked in #294 — please add a test_harvest_integration.py in a follow-up PR. Not blocking this merge because the SDK upgrade is shippable as-is.

Process nit: branch worktree-agent-* doesn't follow <type>/<issue#>/<desc> per AGENTS.md. Please follow the convention next time.

…tegration tests

- Replace all optional inputs["param"] bracket access with inputs.get("param")
  to prevent KeyError when optional params are not provided (fixes 43 warnings)
- Add harvest/tests/test_harvest_integration.py with real HTTP tests for
  list_time_entries, list_projects, list_clients, list_tasks, list_users
- Delete old manual-run test_harvest.py (replaced by unit + integration tests)
- Update conftest.py to insert parent dir into sys.path
- Add HARVEST_ACCESS_TOKEN and HARVEST_ACCOUNT_ID to .env.example
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