Skip to content

feat(gong): upgrade SDK to 2.0.0, add pytest unit tests#282

Open
Shubhank-Jonnada wants to merge 1 commit intomasterfrom
worktree-agent-ad4c8c563794d8f40
Open

feat(gong): upgrade SDK to 2.0.0, add pytest unit tests#282
Shubhank-Jonnada wants to merge 1 commit intomasterfrom
worktree-agent-ad4c8c563794d8f40

Conversation

@Shubhank-Jonnada
Copy link
Copy Markdown
Contributor

Summary

  • Upgrades autohive-integrations-sdk from ~=1.0.2 to ~=2.0.0 in gong/requirements.txt
  • Updates GongAPIClient._make_request to return response.data (SDK 2.0.0 FetchResponse breaking change)
  • Converts all error returns from bare ActionResult(data={"error": ...}) to ActionError(message=...)
  • Moves GongAPIClient(context) instantiation inside try blocks so missing api_base_url is caught and returned as ActionError
  • Normalizes None field values to empty strings/ints to satisfy output schema validation
  • Bumps config.json version to 2.0.0
  • Adds gong/tests/conftest.py and gong/tests/test_gong_unit.py with 32 unit tests covering all 5 actions

Test plan

  • pip install -r gong/requirements.txt installs SDK 2.0.0
  • python -m pytest gong/ -v — all 32 unit tests pass
  • python autohive-integrations-tooling/scripts/validate_integration.py gong — passes
  • python autohive-integrations-tooling/scripts/check_code.py gong — passes
  • ruff check and ruff format — no issues

- Bump autohive-integrations-sdk to ~=2.0.0
- Update _make_request to return response.data (FetchResponse breaking change)
- Convert all error returns to ActionError(message=...)
- Move GongAPIClient instantiation inside try blocks for consistent error handling
- Normalize None field values to empty strings/defaults to satisfy output schema
- Bump config.json version to 2.0.0
- Add gong/tests/conftest.py and test_gong_unit.py with 32 unit tests covering
  all 5 actions: happy path, request verification, error paths, and edge cases
@github-actions
Copy link
Copy Markdown

🔍 Integration Validation Results

Commit: fd7140535ed31c3019a08ebb7e942036d0f6e750 · feat(gong): upgrade SDK to 2.0.0, add pytest unit tests
Updated: 2026-04-28T22:37:34Z

Changed directories: gong

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

============================================================
Integration: gong
============================================================
✅ 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: gong
----------------------------------------

📦 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...
   ⚠️  Action 'search_calls': parameter 'limit' defined in input_schema but never accessed in code
   ✅ Config-code sync OK

🔄 Checking fetch patterns...
   ✅ Fetch patterns OK

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

Integration   Tests  Coverage        Status
-------------------------------------------
gong     32/32       92%      ✅ Passed
-------------------------------------------
Total    32/32            ✅ All passed

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

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

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd7140535e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread gong/gong.py
else:
raise ValueError(f"Unsupported HTTP method: {method}")

return response.data
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Support dict fetch responses in _make_request

Treating every fetch result as a FetchResponse breaks existing Gong execution contexts that still return plain dictionaries (for example MockExecutionContext.fetch in gong/tests/test_gong_integration.py). In those cases response.data raises AttributeError, and all actions degrade into ActionError instead of returning valid payloads, which can fail the existing integration tests and any legacy runtime still using dict-style fetch responses.

Useful? React with 👍 / 👎.

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. Nice catch on moving GongAPIClient(context) inside the try so missing api_base_url returns a typed error instead of crashing. 32 unit tests pass.

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

tests/test_gong_integration.py already exists in master — please confirm in your test plan that you've re-run it against a real Gong account 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 gong/tests/test_gong_integration.py as a real e2e suite. On a closer look, it's a mocked unit test with a misleading filename — uses a homegrown MockExecutionContext, no pytest.mark.integration, no real network calls.

Approval still stands (the SDK 2.0.0 migration in this PR is shippable as-is and is now superseded for unit coverage by test_gong_unit.py), but a real live_context-based integration suite is still missing for gong.

Tracked in #299 — 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