Skip to content

fix(front): upgrade to SDK 2.0.0, add unit tests#288

Open
Shubhank-Jonnada wants to merge 4 commits intomasterfrom
fix/front-sdk-upgrade-v2
Open

fix(front): upgrade to SDK 2.0.0, add unit tests#288
Shubhank-Jonnada wants to merge 4 commits intomasterfrom
fix/front-sdk-upgrade-v2

Conversation

@Shubhank-Jonnada
Copy link
Copy Markdown
Contributor

Summary

  • Upgrade SDK to 2.0.0: add .data access on all context.fetch() return values
  • Replace all error dict returns with ActionError(message=...) and success returns with ActionResult(data=...)
  • Remove legacy result and error fields from all output schemas in config.json
  • Bump integration version to 2.0.0
  • Add 77 pytest unit tests following Kai's writing-unit-tests skill (4–5 tests per action across all 20 actions)

Test plan

  • All 77 unit tests pass
  • validate_integration.py passes (0 errors, 1 expected warning for scopes)
  • ruff check/format clean

- Upgrade autohive-integrations-sdk to ~=2.0.0
- Access FetchResponse.data on all context.fetch() call sites
- Replace error dict returns with ActionError(message=...)
- Replace success dict returns with ActionResult(data=...)
- Remove legacy result/error fields from all output schemas in config.json
- Bump integration version to 2.0.0
- Add pytest unit tests (77 tests) following the writing-unit-tests skill
- Add front/tests/conftest.py
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

🔍 Integration Validation Results

Commit: 82a63c00fb7930e1c134b6d2ebd19235fbba1186 · fix(front): add integration test, update .env.example, apply ruff format
Updated: 2026-05-01T03:02:15Z

Changed directories: front

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

============================================================
Integration: front
============================================================

Warnings (1):
  ⚠️ Potentially unused scopes (please verify): Shared resources

============================================================
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: front
----------------------------------------

📦 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 issues found

   Fix: Run 'ruff format' to auto-format

🔒 Scanning for security issues with bandit...
   Run started:2026-05-01 03:02:35.087942+00:00
   Test results:
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:12:24
   11	        "auth_type": "PlatformOauth2",
   12	        "credentials": {"access_token": "mock_access_token"},
   13	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:32:24
   31	        "auth_type": "PlatformOauth2",
   32	        "credentials": {"access_token": "mock_access_token"},
   33	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:52:24
   51	        "auth_type": "PlatformOauth2",
   52	        "credentials": {"access_token": "mock_access_token"},
   53	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:74:24
   73	        "auth_type": "PlatformOauth2",
   74	        "credentials": {"access_token": "mock_access_token"},
   75	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:94:24
   93	        "auth_type": "PlatformOauth2",
   94	        "credentials": {"access_token": "mock_access_token"},
   95	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:116:24
   115	        "auth_type": "PlatformOauth2",
   116	        "credentials": {"access_token": "mock_access_token"},
   117	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:136:24
   135	        "auth_type": "PlatformOauth2",
   136	        "credentials": {"access_token": "mock_access_token"},
   137	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:158:24
   157	        "auth_type": "PlatformOauth2",
   158	        "credentials": {"access_token": "mock_access_token"},
   159	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:182:24
   181	        "auth_type": "PlatformOauth2",
   182	        "credentials": {"access_token": "mock_access_token"},
   183	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:208:24
   207	        "auth_type": "PlatformOauth2",
   208	        "credentials": {"access_token": "mock_access_token"},
   209	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:228:24
   227	        "auth_type": "PlatformOauth2",
   228	        "credentials": {"access_token": "mock_access_token"},
   229	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:248:24
   247	        "auth_type": "PlatformOauth2",
   248	        "credentials": {"access_token": "mock_access_token"},
   249	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:268:24
   267	        "auth_type": "PlatformOauth2",
   268	        "credentials": {"access_token": "mock_access_token"},
   269	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:290:24
   289	        "auth_type": "PlatformOauth2",
   290	        "credentials": {"access_token": "mock_access_token"},
   291	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:310:24
   309	        "auth_type": "PlatformOauth2",
   310	        "credentials": {"access_token": "mock_access_token"},
   311	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:334:24
   333	        "auth_type": "PlatformOauth2",
   334	        "credentials": {"access_token": "mock_access_token"},
   335	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:354:24
   353	        "auth_type": "PlatformOauth2",
   354	        "credentials": {"access_token": "mock_access_token"},
   355	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:374:24
   373	        "auth_type": "PlatformOauth2",
   374	        "credentials": {"access_token": "mock_access_token"},
   375	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:394:24
   393	        "auth_type": "PlatformOauth2",
   394	        "credentials": {"access_token": "mock_access_token"},
   395	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'mock_access_token'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front.py:414:24
   413	        "auth_type": "PlatformOauth2",
   414	        "credentials": {"access_token": "mock_access_token"},
   415	    }  # nosec B105
   --------------------------------------------------
   >> Issue: [B105:hardcoded_password_string] Possible hardcoded password: 'tok'
      Severity: Low   Confidence: Medium
      CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html)
      More Info: https://bandit.readthedocs.io/en/1.9.4/plugins/b105_hardcoded_password_string.html
      Location: front/tests/test_front_messages_unit.py:399:28
   398	            "auth_type": "PlatformOauth2",
   399	            "credentials": {"access_token": "tok"},
   400	        }  # nosec B105
   --------------------------------------------------
   Code scanned:
   	Total lines of code: 2565
   	Total lines skipped (#nosec): 0
   	Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 5
   Run metrics:
   	Total issues (by severity):
   		Undefined: 0
   		Low: 21
   		Medium: 0
   		High: 0
   	Total issues (by confidence):
   		Undefined: 0
   		Low: 0
   		Medium: 21
   		High: 0
   Files skipped (0):
   ❌ Security issues found

   Fix: Review flagged code for security risks
   Run locally: bandit -r <dir> -x .venv,venv,__pycache__,site-packages,dependencies -s B101

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

🔗 Checking config-code sync...
   ⚠️  Action 'create_message_reply': parameter 'file' accessed in code but not defined in input_schema
   ⚠️  Action 'create_message': parameter 'file' accessed in code but not defined in input_schema
   ⚠️  Action 'update_conversation': parameter 'assignee_id' is optional in schema but accessed with inputs["assignee_id"] (will raise KeyError if not provided)
   ⚠️  Action 'update_conversation': parameter 'custom_fields' is optional in schema but accessed with inputs["custom_fields"] (will raise KeyError if not provided)
   ⚠️  Action 'update_conversation': parameter 'status' is optional in schema but accessed with inputs["status"] (will raise KeyError if not provided)
   ⚠️  Action 'update_conversation': parameter 'tags' is optional in schema but accessed with inputs["tags"] (will raise KeyError if not provided)
   ⚠️  Action 'update_conversation': parameter 'status_id' is optional in schema but accessed with inputs["status_id"] (will raise KeyError if not provided)
   ⚠️  Action 'update_conversation': parameter 'inbox_id' is optional in schema but accessed with inputs["inbox_id"] (will raise KeyError if not provided)
   ⚠️  Action 'find_conversation': parameter 'limit' defined in input_schema but never accessed in code
   ✅ Config-code sync OK

🔄 Checking fetch patterns...
   ✅ Fetch patterns OK

========================================
❌ CODE CHECK FAILED
========================================
✅ Tests Check output

Integration   Tests  Coverage        Status
-------------------------------------------
front     98/98       69%      ✅ Passed
-------------------------------------------
Total     98/98            ✅ All passed

✅ Tests passed: front
✅ README Check output
========================================
✅ README CHECK PASSED
========================================
✅ Version Check output
✅ front: 1.2.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. 77 unit tests across all 20 actions.

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

Minor: send_message (line 404) and send_channel_message (line 689) use aiohttp directly for multipart uploads and the helpers return raw {"error": "..."} dicts on HTTP errors. Verified the calling action handlers correctly translate that into ActionError, so this is fine — but the contract is hidden. Worth a small refactor in a follow-up to either raise or return tuples so it's obvious to future readers.

Follow-up tracked in #296 — please add a test_front_integration.py in a follow-up PR, with specific coverage of the multipart-upload paths above. Not blocking this merge.

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

- Add test_front_integration.py with FRONT_API_TOKEN env var skip guard
- Add FRONT_API_TOKEN to .env.example
- Apply ruff format to all front test files and front.py
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