-
Notifications
You must be signed in to change notification settings - Fork 42
Enhance StateManager with Upsert and Get Graph functions #215
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
Enhance StateManager with Upsert and Get Graph functions #215
Conversation
NiveditJain
commented
Aug 17, 2025
- 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.
|
Note Other AI code review bot(s) detectedCodeRabbit 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 failedThe pull request is closed. 📝 WalkthroughSummary by CodeRabbit
WalkthroughBumps SDK version and adds two async StateManager methods: Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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_graphfor retrieving graph configurations andupsert_graphfor creating or updating graphs. - Asynchronous Graph Validation: The
upsert_graphmethod 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 likepytestandpytest-covfor testing, along withcolorama,coverage, andpygments. Existing dependencies likemultidictandruffhave 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
-
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. ↩
|
@cursoragent review |
|
@cursoragent generate tests for the new functionality in PR |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
There was a problem hiding this 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.
⛔ Files ignored due to path filters (1)
python-sdk/uv.lockis 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.
There was a problem hiding this 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.