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

create observer tables #1351

Closed
wants to merge 1 commit into from
Closed

create observer tables #1351

wants to merge 1 commit into from

Conversation

wintonzheng
Copy link
Contributor

@wintonzheng wintonzheng commented Dec 8, 2024

Important

Add observer_cruises and observer_thoughts tables, modify artifacts table, and refactor related code for improved database schema and codebase organization.

  • Database Schema:
    • Create observer_cruises table with columns observer_cruise_id, status, organization_id, workflow_run_id, workflow_id.
    • Create observer_thoughts table with columns observer_thought_id, organization_id, observer_cruise_id, workflow_run_id, workflow_run_block_id, workflow_id, user_input, observation, thought, answer.
    • Modify artifacts table by adding columns workflow_run_id, workflow_run_block_id, observer_cruise_id, observer_thought_id.
    • Add indexes org_workflow_run_index, org_observer_cruise_index to artifacts table.
    • Add foreign key constraints to artifacts table for new columns.
  • Code Refactoring:
    • Remove unused imports and functions related to ObserverThought and ObserverCruise in manager.py, base.py, local.py, s3.py.
    • Simplify create_artifact and update_artifact_data methods in manager.py by removing unnecessary parameters.
    • Update Artifact model in models.py to include new fields and descriptions.
  • Misc:
    • Update downgrade() function to drop observer_thoughts and observer_cruises tables and remove new columns and constraints from artifacts.

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

<!-- ELLIPSIS_HIDDEN -->

> [!IMPORTANT]
> Add `observer_cruises` and `observer_thoughts` tables, modify `artifacts` table with new columns, indexes, and constraints.
>
>   - **Database Schema**:
>     - Create `observer_cruises` table with columns `observer_cruise_id`, `status`, `organization_id`, `workflow_run_id`, `workflow_id` and foreign keys.
>     - Create `observer_thoughts` table with columns `observer_thought_id`, `organization_id`, `observer_cruise_id`, `workflow_run_id`, `workflow_run_block_id`, `workflow_id`, `user_input`, `observation`, `thought`, `answer` and foreign keys.
>   - **Artifacts Table**:
>     - Add columns `workflow_run_id`, `workflow_run_block_id`, `observer_cruise_id`, `observer_thought_id` to `artifacts` table.
>     - Add `org_workflow_run_index` and `org_observer_cruise_index` indexes to `artifacts` table.
>     - Add foreign key constraints to `artifacts` table for new columns.
>   - **Downgrade Function**:
>     - Update `downgrade()` to drop `observer_thoughts` and `observer_cruises` tables and remove new columns and constraints from `artifacts`.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral)<sup> for a0b4c18459c7824c8084933697e948151cad8776. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
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 db58708 in 27 seconds

More details
  • Looked at 443 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. skyvern/forge/sdk/artifact/manager.py:11
  • Draft comment:
    The import of ObserverThought has been removed, but ensure that all related functionality and references are also removed or refactored accordingly.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The removal of the ObserverThought import in manager.py is correct since the related functionality has been removed. However, the ObserverThought class is still present in the codebase, which might indicate incomplete removal or refactoring.
2. skyvern/forge/sdk/artifact/manager.py:19
  • Draft comment:
    The _create_artifact method has been removed and its logic consolidated into create_artifact. Ensure that all previous use cases and parameters are still covered by the new implementation.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The create_artifact method in manager.py has been refactored to remove the _create_artifact method and consolidate the logic. This is a good change for simplicity, but ensure that all previous use cases are still covered.
3. skyvern/forge/sdk/artifact/manager.py:62
  • Draft comment:
    The primary_key parameter has been removed from update_artifact_data. Ensure that task_id is always available and used correctly, as observer_thought_id handling has been removed.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The update_artifact_data method in manager.py has been simplified by removing the primary_key parameter. This change assumes that task_id is always available, which might not be the case if observer_thought_id was previously used. Verify that this assumption holds true.
4. skyvern/forge/sdk/db/models.py:170
  • Draft comment:
    Foreign key constraints for workflow_run_id, workflow_run_block_id, observer_cruise_id, and observer_thought_id have been removed. Ensure that this does not lead to data integrity issues if these fields are still used elsewhere.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The ArtifactModel in models.py has removed foreign key constraints for workflow_run_id, workflow_run_block_id, observer_cruise_id, and observer_thought_id. This could lead to data integrity issues if these fields are still used elsewhere.
5. skyvern/forge/sdk/db/models.py:510
  • Draft comment:
    ObserverCruiseModel and ObserverThoughtModel have been renamed to ObserverCruise and ObserverThought. Ensure all references to these models are updated accordingly.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The ObserverCruiseModel and ObserverThoughtModel have been renamed to ObserverCruise and ObserverThought respectively in models.py. This change should be reflected in all references to these models.

Workflow ID: wflow_MKxhpGsYLqbwD5bQ


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.

❌ Changes requested. Reviewed everything up to db58708 in 44 seconds

More details
  • Looked at 445 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. skyvern/forge/sdk/artifact/manager.py:11
  • Draft comment:
    The removal of the ObserverThought import is consistent with the removal of related methods and is a good cleanup step.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The removal of the ObserverThought import from manager.py and base.py files is consistent with the removal of the create_observer_thought_artifact method and related methods. This is a good cleanup step.
2. skyvern/forge/sdk/artifact/manager.py:19
  • Draft comment:
    The refactoring of create_artifact to remove the _create_artifact helper method simplifies the code and reduces redundancy.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The create_artifact method in manager.py has been refactored to remove the _create_artifact helper method. This simplifies the code and reduces redundancy, which is a positive change.
3. skyvern/forge/sdk/artifact/manager.py:62
  • Draft comment:
    The simplification of update_artifact_data by removing the primary_key parameter and related logic makes the method more straightforward and easier to maintain.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The update_artifact_data method in manager.py has been simplified by removing the primary_key parameter and related logic. This change makes the method more straightforward and easier to maintain.
4. skyvern/forge/sdk/artifact/models.py:62
  • Draft comment:
    The addition of detailed field descriptions and examples in the Artifact model improves documentation and usability.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The Artifact model in models.py has been updated to include detailed field descriptions and examples. This improves the documentation and usability of the model.
5. skyvern/forge/sdk/artifact/storage/base.py:6
  • Draft comment:
    Consider moving FILE_EXTENTSION_MAP to be part of the ArtifactType model for better organization.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The FILE_EXTENTSION_MAP in base.py is a dictionary mapping ArtifactType to file extensions. The comment suggests it should be part of the ArtifactType model, which would be a more organized approach.
6. skyvern/forge/sdk/db/client.py:183
  • Draft comment:
    The removal of unused parameters in create_artifact reduces complexity and potential confusion.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The create_artifact method in client.py has been updated to remove unused parameters. This is a good practice as it reduces complexity and potential confusion.

Workflow ID: wflow_fxx4gK9akTE3YBPv


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

workflow_run_block_id = Column(String, ForeignKey("workflow_run_blocks.workflow_run_block_id"))
observer_cruise_id = Column(String, ForeignKey("observer_cruises.observer_cruise_id"))
observer_thought_id = Column(String, ForeignKey("observer_thoughts.observer_thought_id"))
workflow_run_id = Column(String)
Copy link
Contributor

Choose a reason for hiding this comment

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

The workflow_run_id, workflow_run_block_id, observer_cruise_id, and observer_thought_id columns should have foreign key constraints to ensure data integrity, as mentioned in the PR description.

@wintonzheng wintonzheng closed this Dec 8, 2024
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.

1 participant