Skip to content

chore(aws): migrate to autohive-integrations-sdk 2.0.0#360

Merged
TheRealAgentK merged 16 commits into
masterfrom
sj/aws-migration-2.0.0
Jun 19, 2026
Merged

chore(aws): migrate to autohive-integrations-sdk 2.0.0#360
TheRealAgentK merged 16 commits into
masterfrom
sj/aws-migration-2.0.0

Conversation

@Shubhank-Jonnada

Copy link
Copy Markdown
Contributor

Summary

  • Bump autohive-integrations-sdk to ~=2.0.0 in requirements.txt
  • Fix auth: flat context.auth.get() instead of nested credentials dict
  • Update helpers.py: error_result() now returns ActionError dataclass; success_result() drops result:True and adds cost_usd=0.0
  • Bump config.json version to 2.0.0; remove result/error/error_code fields from all 20 output schemas
  • Replace legacy tests/context.py + tests/test_aws.py with conftest.py + test_aws_unit.py + test_aws_integration.py

Test plan

  • 25 unit tests, all 20 actions covered: pytest aws/tests/test_aws_unit.py
  • validate_integration.py autohive-integrations/aws - 0 errors, 0 warnings
  • check_code.py autohive-integrations/aws - all checks passed
  • Live integration tests require AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)

- Bump SDK to ~=2.0.0 in requirements.txt
- Bump config.json version to 2.0.0
- Fix auth: flat context.auth.get() instead of nested credentials dict
- Update helpers.py: error_result() now returns ActionError (not ActionResult)
- Remove result/error/error_code fields from all 20 output schemas
- Replace context.py + test_aws.py with conftest.py + unit + integration tests
- All 20 actions covered by unit tests (25 tests, 25 passing)
- Add AWS env vars to root .env.example
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

🔍 Integration Validation Results

Commit: 479b6ab9bd8bd9dad6dc1c7b8fb14886986fb510 · fix(.env.example): rebuild from current master + own section only
Updated: 2026-06-17T19:13:50Z

Changed directories: aws

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

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

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

✅ All validations passed!
✅ Code Check output
----------------------------------------
Checking: aws
----------------------------------------

📦 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
-------------------------------------------
aws     25/25       79%      ✅ Passed
-------------------------------------------
Total   25/25            ✅ All passed

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

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

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

Copy link
Copy Markdown

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: f85b63da69

ℹ️ 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 aws/helpers.py Outdated
@Shubhank-Jonnada

Copy link
Copy Markdown
Contributor Author

All unit tests performed and passing. Live integration tests not yet run — AWS credentials required.

@TheRealAgentK TheRealAgentK left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Requesting changes for the AWS integration test blockers.

Comment thread aws/tests/test_aws_integration.py Outdated
Comment thread aws/tests/test_aws_integration.py Outdated
Comment thread aws/tests/test_aws_integration.py Outdated
@TheRealAgentK

Copy link
Copy Markdown
Collaborator

Before approval or merge, we need a real integration test run with valid credentials, using the SDK 2 request path. The live tests must fail on ACTION_ERROR or VALIDATION_ERROR instead of accepting them as passing outcomes.

@TheRealAgentK TheRealAgentK left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Added a coverage follow-up.

Comment thread aws/tests/test_aws_integration.py Outdated
In production SDK 2 contexts, custom auth fields land under
context.auth['credentials']. Fall back to the flat context.auth dict
so existing unit-test mocks that pass auth keys at the top level
continue to work.
- Add pytest.mark.integration to pytestmark
- Replace ResultType.SUCCESS (doesn't exist in SDK 2) with ResultType.ACTION
- Assert result.type == ResultType.ACTION on all live-path tests
- Add tests for all 13 previously missing actions:
  Security Hub: get_finding_details, get_insights, update_finding_workflow
  GuardDuty: list_guardduty_findings, get_guardduty_finding_details, archive_findings
  CloudWatch: get_metric_data, get_alarm_history, set_alarm_state
  CloudWatch Logs: filter_log_events, get_log_events
  CloudTrail: get_trail_status, get_event_selectors
- Gate service-specific tests on env vars or chain from list actions
- Mark destructive tests (update_finding_workflow, archive_findings, set_alarm_state)
- Add AWS_ALARM_NAME and AWS_FINDING_ARN to .env.example
@Shubhank-Jonnada

Copy link
Copy Markdown
Contributor Author

@TheRealAgentK

Live tests:

image

@TheRealAgentK TheRealAgentK left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the AWS follow-up work — this is much closer now. The integration test suite has been expanded to cover all 20 actions, destructive tests are marked, and the live-path assertions now fail on non-action results.

I left a few small comments before I’d call this fully clean: one CloudTrail live-test assertion checks the wrong output key, AWS_SESSION_TOKEN should be documented if tests support it, and session tokens should ideally come from context.auth rather than ambient process env.

Comment thread aws/tests/test_aws_integration.py Outdated
Comment thread aws/helpers.py Outdated
secret_key = creds.get("aws_secret_access_key")
if not access_key or not secret_key:
raise ValueError("AWS credentials are missing: aws_access_key_id and aws_secret_access_key are required")
session_token = creds.get("aws_session_token") or os.environ.get("AWS_SESSION_TOKEN")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we avoid falling back to the process environment here? Pulling AWS_SESSION_TOKEN from ambient env can mix a user’s configured access key/secret with an unrelated runtime token. It would be cleaner and safer to make aws_session_token an optional auth field in config.json and only pass it to boto3 when it comes from context.auth.

@Shubhank-Jonnada Shubhank-Jonnada Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 38b8f48 - removed the os.environ.get("AWS_SESSION_TOKEN") fallback. Session token now comes exclusively from context.auth.get("aws_session_token"), and the import os was removed from helpers.py since it's no longer needed.

Comment thread .env.example Outdated
@TheRealAgentK

Copy link
Copy Markdown
Collaborator

Follow-up from re-review: aws/helpers.py now reads aws_session_token from context.auth, and .env.example documents AWS_SESSION_TOKEN for live tests, but aws/config.json does not expose aws_session_token as an optional custom-auth field. If temporary AWS credentials are intended to be supported in production, please add aws_session_token to the custom auth schema as an optional password/text field. Otherwise the integration tests can inject it, but connected users cannot configure it through the integration auth UI.

@Shubhank-Jonnada

Copy link
Copy Markdown
Contributor Author

live test results:
Tested again; all read-only actions passed. Some actions require additional subscriptions to test so skipped them

@TheRealAgentK TheRealAgentK merged commit 99b7c24 into master Jun 19, 2026
3 checks passed
@TheRealAgentK TheRealAgentK deleted the sj/aws-migration-2.0.0 branch June 19, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants