Skip to content

Conversation

@NiveditJain
Copy link
Member

  • Added methods to retrieve and upsert graphs in the StateManager class.
  • Implemented asynchronous functionality for graph retrieval and validation.
  • Updated dependencies in the Python SDK, including pytest and pytest-cov for testing.
  • Introduced new packages: colorama, coverage, pygments, and pytest-cov with their respective versions.
  • Improved documentation for new methods and their usage examples.

- Added methods to retrieve and upsert graphs in the StateManager class.
- Implemented asynchronous functionality for graph retrieval and validation.
- Updated dependencies in the Python SDK, including pytest and pytest-cov for testing.
- Introduced new packages: colorama, coverage, pygments, and pytest-cov with their respective versions.
- Improved documentation for new methods and their usage examples.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 17, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added graph management APIs to retrieve and upsert graphs.
    • Upserts now wait for server-side validation with automatic polling until success or timeout, with configurable intervals.
  • Improvements
    • Clearer error messages now include HTTP status codes and response details for easier troubleshooting.
  • Chores
    • Bumped Python SDK version to 0.0.7b7.

Walkthrough

Bumps SDK version and adds two async StateManager methods: get_graph and upsert_graph. upsert_graph performs a PUT then polls the graph GET endpoint until validation completes or a timeout occurs, raising descriptive errors on failure.

Changes

Cohort / File(s) Summary of Changes
Version bump
python-sdk/exospherehost/_version.py
Updated public version string from 0.0.7b6 to 0.0.7b7.
StateManager — graph operations
python-sdk/exospherehost/statemanager.py
Added internal endpoint builders and two async methods: get_graph(graph_name) (GET /graphs/{name}) and upsert_graph(graph_name, graph_nodes, secrets, validation_timeout=60, polling_interval=1) (PUT then poll GET until validation_status != "PENDING" or timeout). Improved error messages including HTTP status and response text; uses time.monotonic() and asyncio.sleep() for timeout/polling logic.

Sequence Diagram(s)

sequenceDiagram
  actor Caller
  participant SM as StateManager
  participant API as ExosphereHost API

  Caller->>SM: upsert_graph(name, nodes, secrets, timeout, interval)
  SM->>API: PUT /graphs/{name} {nodes,secrets}
  API-->>SM: 200/201 + graph JSON (includes validation_status)

  loop while validation_status == "PENDING" and not timed out
    SM->>API: GET /graphs/{name}
    API-->>SM: 200 {validation_status,...}
    SM->>SM: await asyncio.sleep(polling_interval)
  end

  alt validation_status == "VALID"
    SM-->>Caller: return final graph JSON
  else timeout or invalid
    SM-->>Caller: raise Exception (status/errors/timeout)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • nk-ag

Poem

I hop and hum, a tiny dev rabbit,
I bump a version and poll the habit.
PUT the nodes, then I watch the sky,
Waiting for VALID — blink an eye.
When green it glows, I thump with glee 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bbbc155 and b454385.

📒 Files selected for processing (1)
  • python-sdk/exospherehost/statemanager.py (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @NiveditJain, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Python SDK's StateManager by introducing comprehensive graph management capabilities. It adds asynchronous functions to retrieve and upsert graphs, complete with built-in validation polling. These changes streamline graph interaction and ensure data consistency within the system, alongside updating core development dependencies for improved testing and code quality.

Highlights

  • StateManager Enhancements: The StateManager class now includes new asynchronous methods: get_graph for retrieving graph configurations and upsert_graph for creating or updating graphs.
  • Asynchronous Graph Validation: The upsert_graph method incorporates robust validation by asynchronously polling the state manager until the graph's validation status is 'VALID' or a timeout occurs, ensuring graph integrity.
  • Dependency Updates and New Tools: The project's dependency lock file (uv.lock) has been updated to include new development tools like pytest and pytest-cov for testing, along with colorama, coverage, and pygments. Existing dependencies like multidict and ruff have also been updated to their latest versions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@NiveditJain
Copy link
Member Author

@cursoragent review

@NiveditJain
Copy link
Member Author

@cursoragent generate tests for the new functionality in PR

@gemini-code-assist
Copy link
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@NiveditJain
Copy link
Member Author

/gemini review

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5b7076d and bbbc155.

⛔ Files ignored due to path filters (1)
  • python-sdk/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • python-sdk/exospherehost/_version.py (1 hunks)
  • python-sdk/exospherehost/statemanager.py (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
python-sdk/exospherehost/statemanager.py (5)
state-manager/app/controller/upsert_graph_template.py (1)
  • upsert_graph_template (12-62)
state-manager/tests/unit/controller/test_upsert_graph_template.py (3)
  • test_upsert_graph_template_update_existing (81-123)
  • test_upsert_graph_template_with_validation_errors (250-289)
  • test_upsert_graph_template_with_empty_nodes (202-246)
state-manager/app/tasks/verify_graph.py (1)
  • verify_graph (234-265)
state-manager/tests/integration/peinding_test_full_workflow_integration.py (1)
  • test_upsert_graph_template (144-170)
state-manager/app/routes.py (1)
  • upsert_graph_template (152-161)
🔇 Additional comments (1)
python-sdk/exospherehost/_version.py (1)

1-1: Version bump looks good.

The version update to 0.0.7b7 aligns with the new features added in this PR.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the StateManager class by adding get_graph and upsert_graph methods, along with updating dependencies for testing. The new functionality is a good addition. My review focuses on improving the implementation of these new methods. I've identified a potential correctness issue with the status code handling in the upsert logic, and significant performance concerns related to aiohttp.ClientSession management, especially within the new polling mechanism. Additionally, there are opportunities to improve maintainability by reducing code duplication and using more specific exception types. Addressing these points will make the SDK more robust, efficient, and easier to use.

@NiveditJain NiveditJain merged commit fc94542 into exospherehost:main Aug 17, 2025
3 of 4 checks passed
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.

1 participant