feat(supadata): upgrade SDK to 2.0.0, add pytest unit tests#280
feat(supadata): upgrade SDK to 2.0.0, add pytest unit tests#280Shubhank-Jonnada wants to merge 1 commit intomasterfrom
Conversation
- Bump autohive-integrations-sdk pin to ~=2.0.0 in requirements.txt - Convert bare dict returns to ActionResult(data=..., cost_usd=0.0) - Convert error raises to ActionError(message=...) for both SupadataError and generic exceptions - Fix context.auth access from nested credentials envelope to flat custom auth shape - Import ActionResult, ActionError from SDK - Bump config.json version to 2.0.0 - Add supadata/tests/conftest.py and supadata/tests/test_supadata_unit.py with 15 unit tests covering happy path, request verification, error paths, edge cases, and helper function tests
🔍 Integration Validation ResultsCommit: Changed directories:
✅ Structure Check output✅ Code Check output✅ Tests output✅ README Check output✅ Version Check output |
|
|
||
| _parent = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) | ||
| _deps = os.path.abspath(os.path.join(os.path.dirname(__file__), "../dependencies")) | ||
| _repo_root = os.path.abspath(os.path.join(_parent, "..")) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8976746daf
ℹ️ 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".
| async def execute(self, inputs: Dict[str, Any], context: ExecutionContext): | ||
| video_url = inputs["video_url"] | ||
| api_key = context.auth.get("credentials", {}).get("api_key", {}) | ||
| api_key = context.auth.get("api_key", "") |
There was a problem hiding this comment.
Read API key from credentials envelope
This change switches auth lookup to context.auth.get("api_key"), but the repo’s SDK v2 integrations and test conventions still pass custom auth under context.auth["credentials"]; in that common runtime shape, api_key becomes empty and every transcript request is sent unauthenticated, causing consistent API failures. To avoid breaking existing connections, read from the credentials envelope (or support both shapes) before constructing Supadata(api_key=...).
Useful? React with 👍 / 👎.
TheRealAgentK
left a comment
There was a problem hiding this comment.
SDK 2.0.0 migration looks clean (correctly fixes the context.auth envelope bug too) and the 15 unit tests cover the actions. Local CI verified: validate_integration ✅, check_code ✅, ruff ✅, pytest ✅.
Blocking on one thing: no tests/test_supadata_integration.py. Supadata uses a custom API-key auth, so adding e2e coverage is low-cost — just one env var (SUPADATA_API_KEY) and the live_context fixture per the writing-integration-tests skill. Please add at minimum a happy-path test against a real transcript before merge.
Also: branch name doesn't follow <type>/<issue#>/<desc> per AGENTS.md, and no linked issue.
Summary
autohive-integrations-sdkpin from~=1.0.2to~=2.0.0insupadata/requirements.txtActionResult(data=..., cost_usd=0.0)andActionError(message=...)for error pathscontext.authaccess — was incorrectly reading from a nestedcredentialsenvelope; now reads from the flat custom auth shape (context.auth.get("api_key"))config.jsonversion to2.0.0supadata/tests/test_supadata_unit.pycovering: happy path, SDK call verification (URL + params + auth),SupadataErrorand generic exception error paths, edge cases (empty chunks, string content, invalid format), and_ms_to_timestamphelper testsTest plan
python -m pytest supadata/ -v— all 15 unit tests passpython validate_integration.py supadata— no errorspython check_code.py supadata— all checks pass (lint, format, bandit, pip-audit, config-code sync, fetch patterns)