Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update base toolset testcases #1206

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

abhishekpatil4
Copy link
Contributor

@abhishekpatil4 abhishekpatil4 commented Jan 17, 2025

Important

Add new Python agents and setup scripts for Solana and Coinbase cryptocurrency operations, including wallet management and automated rewards.

  • New Features:
    • Add coinbase_agent.mdx, community_reward_agent.mdx, github_contributor_reward_agent.mdx for Coinbase and community reward agents.
    • Implement Solana-based agents in solana_kit.py for balance checks, token transfers, and transaction status.
    • Add crypto_assistant.py, coder_reward_agent.py, community_reward_agent.py for automated reward distribution.
  • Setup and Configuration:
    • Add setup.sh scripts for environment setup in Coinbase and Solana examples.
    • Update README.md for Solana agents with installation and usage instructions.
  • Workflow Changes:
    • Modify GitHub Actions in examples_js.yml and run_examples_js.yml to include new API keys and paths.
  • Miscellaneous:
    • Update package.json dependencies for JavaScript examples.
    • Add new documentation pages in docs/cryptokit/ for tools and agents.

This description was created by Ellipsis for 7fe5dc7. It will automatically update as commits are pushed.

Copy link

vercel bot commented Jan 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
composio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 20, 2025 10:59am

Comment on lines +213 to +218
const res = await executeRequest({
endpoint: `/user/starred/${inputParams.owner}/${inputParams.repo}`,
method: "PUT",
parameters: [],
});
return res;

Choose a reason for hiding this comment

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

Lack of error handling for non-200 responses may lead to silent failures. Implement error handling for robustness.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
const res = await executeRequest({
endpoint: `/user/starred/${inputParams.owner}/${inputParams.repo}`,
method: "PUT",
parameters: [],
});
return res;
const res = await executeRequest({
endpoint: `/user/starred/${inputParams.owner}/${inputParams.repo}`,
method: "PUT",
parameters: [],
});
if (!res.ok) {
throw new Error(`Failed to star repository: ${res.status} ${res.statusText}`);
}
return res;

Comment on lines 290 to 296
const appId = "01e22f33-dc3f-46ae-b58d-050e4d2d1909";
const integration = await toolset.integrations.create({
name: "testIntegration",
authScheme: "OAUTH2",
appId: appId,
useComposioAuth: true
});

Choose a reason for hiding this comment

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

Hard-coded app ID reduces maintainability. Move to config or constants for better management.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
const appId = "01e22f33-dc3f-46ae-b58d-050e4d2d1909";
const integration = await toolset.integrations.create({
name: "testIntegration",
authScheme: "OAUTH2",
appId: appId,
useComposioAuth: true
});
const appId = process.env.APP_ID || require('../config/constants').APP_ID;
const integration = await toolset.integrations.create({
name: "testIntegration",
authScheme: "OAUTH2",
appId: appId,
useComposioAuth: true
});

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 59e7483 in 48 seconds

More details
  • Looked at 225 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. js/src/sdk/base.toolset.spec.ts:243
  • Draft comment:
    Typo: The property successfull is misspelled. It should be successful. This typo is present in multiple places (lines 184, 243).
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.

Workflow ID: wflow_Ap09DIJWxi1WIZuZ


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

github-actions bot commented Jan 17, 2025

This comment was generated by github-actions[bot]!

JS SDK Coverage Report

📊 Coverage report for JS SDK can be found at the following URL:
https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/coverage-12866520798/coverage/index.html

📁 Test report folder can be found at the following URL:
https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/html-report-12866520798/html-report/report.html

).toBeDefined();
const imageResponse = await fetch("https://composio.dev/wp-content/uploads/2024/07/Composio-Logo.webp");
const arrayBuffer = await imageResponse.arrayBuffer();
const base64Image = Buffer.from(arrayBuffer).toString('base64');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider adding error handling for the fetch and arrayBuffer operations. If the image fetch fails or the buffer conversion fails, the test will fail without a clear error message. Consider wrapping this in a try-catch block with appropriate error handling.


it("should setup a trigger", async () => {
const trigger = await toolset.triggers.setup({
connectedAccountId: "d7bb2a05-22c2-41d7-bf3c-b4c4e7c6c46e",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider moving hardcoded IDs like this to a test constants file. This would make the tests more maintainable and easier to update if these IDs change.

it("should throw error if connected account id is invalid in get method", async () => {
await expect(toolset.connectedAccounts.get({
connectedAccountId: "invalid-id"
})).rejects.toThrow();
Copy link
Collaborator

Choose a reason for hiding this comment

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

The error handling here could be more specific. Instead of just expecting any error to be thrown, consider checking for a specific error type or message that would be thrown for an invalid account ID. This would make the test more robust against unintended errors.

// Integration tests
let createdIntegrationId: string;

it("should create an integration", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider adding a timeout to this test case. Integration tests that involve external services should have reasonable timeouts to prevent the test suite from hanging if the service is slow or unresponsive.

@shreysingla11
Copy link
Collaborator

Code Review Summary

Overall, this is a solid PR that significantly improves the test coverage of the codebase. The changes are well-structured and add important test cases for core functionality.

Strengths:

  • Comprehensive test coverage for custom actions, connections, integrations, and triggers
  • Good test organization and clear assertions
  • Improved file upload handling with base64 encoding
  • Good cleanup handling in afterAll block

Areas for Improvement:

  1. Error Handling:

    • Add error handling for image fetch/conversion operations
    • Make error expectations more specific in error test cases
    • Consider adding timeouts to integration tests
  2. Test Maintainability:

    • Move hardcoded IDs and constants to a test constants file
    • Consider adding more descriptive error messages in assertions
    • Add more documentation for complex test setups
  3. Test Coverage:

    • Consider adding more negative test cases
    • Add tests for edge cases in file handling
    • Consider adding performance/timeout tests

The changes represent a significant improvement in test coverage and quality. With the suggested improvements implemented, this would be an excellent addition to the codebase.

Rating: 8/10 - Strong improvements with minor enhancements needed.

@plxity
Copy link
Contributor

plxity commented Jan 17, 2025

@abhishekpatil4 Some of the tests are failing. Please check that

Comment on lines +172 to +173
// recipient_email: "[email protected]",
// subject: "Test email from himanshu",

Choose a reason for hiding this comment

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

Hardcoded email addresses in test cases pose a security risk and could lead to spam/abuse. Should use test email domains or environment variables.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
// recipient_email: "[email protected]",
// subject: "Test email from himanshu",
recipient_email: "[email protected]"

Comment on lines +207 to +208
// "https://composio.dev/wp-content/uploads/2024/07/Composio-Logo.webp",
"/Users/abhishek/Desktop/randomimage.png",

Choose a reason for hiding this comment

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

Using local file path in tests makes them environment-dependent and likely to fail on other systems. Should use a test fixture or mock file.

Comment on lines 380 to 381
owner: "abhishekpatil4",
repo: "tweetify",

Choose a reason for hiding this comment

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

Hardcoded repository owner/name in trigger test makes it brittle. Should use test config values or environment variables.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
owner: "abhishekpatil4",
repo: "tweetify",
owner: process.env.GITHUB_OWNER || "abhishekpatil4",
repo: process.env.GITHUB_REPO || "tweetify"

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 8e8a521 in 42 seconds

More details
  • Looked at 255 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. js/src/sdk/base.toolset.spec.ts:2
  • Draft comment:
    Duplicate import of 'zod'. Remove the redundant import statement.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
2. js/src/sdk/base.toolset.spec.ts:160
  • Draft comment:
    Typo in property name 'successfull'. It should be 'successful'. This issue is also present on lines 218 and 277.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.

Workflow ID: wflow_U9njrn2IXPZ4tIN3


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on c63357e in 52 seconds

More details
  • Looked at 86 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. js/src/sdk/base.toolset.spec.ts:417
  • Draft comment:
    Ensure that the correct parameter 'triggerInstanceId' is used instead of 'triggerId' if required by the method.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_sPM6akt4zqusDVBj


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on fce27db in 53 seconds

More details
  • Looked at 56 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. js/src/sdk/base.toolset.spec.ts:443
  • Draft comment:
    Consider logging the error before rethrowing it for better debugging.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of throw error in the catch blocks is not ideal for logging purposes. It would be better to log the error before rethrowing it.
2. js/src/sdk/base.toolset.spec.ts:446
  • Draft comment:
    Consider logging the error before rethrowing it for better debugging.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of throw error in the catch blocks is not ideal for logging purposes. It would be better to log the error before rethrowing it.
3. js/src/sdk/base.toolset.spec.ts:454
  • Draft comment:
    Consider logging the error before rethrowing it for better debugging.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of throw error in the catch blocks is not ideal for logging purposes. It would be better to log the error before rethrowing it.

Workflow ID: wflow_S1u3TaSjqgK7QlQy


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 7fe5dc7 in 2 minutes and 42 seconds

More details
  • Looked at 55 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. js/config/getTestConfig.ts:1
  • Draft comment:
    Changing the default environment from "staging" to "prod" can have significant implications. Ensure this change is intentional and that all tests are safe to run in a production environment.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. js/src/sdk/base.toolset.spec.ts:438
  • Draft comment:
    Consider logging the error in the catch block to aid in debugging.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    This is a test cleanup section where errors are intentionally ignored for individual items. The code continues trying to clean up other resources even if one fails. There's a second catch block that will throw any other errors. The empty catch is a deliberate pattern here, not an oversight. Adding logging would just create noise in test output.
    The comment could be valid if this was production code where we'd want visibility into failures. Test cleanup is a special case.
    While logging errors is generally good practice, in test cleanup code it's common and acceptable to silently ignore certain failures since they don't affect the test results.
    The comment should be deleted. The empty catch block is intentional in test cleanup code and adding error logging would not improve anything.

Workflow ID: wflow_XkND2UKeCc39Gu6M


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

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.

6 participants