Skip to content

Conversation

@definitelynotchirag
Copy link
Contributor

@definitelynotchirag definitelynotchirag commented Mar 6, 2025

Fixes #112

Changes :

  • Added "workspaces_dir" key in the settings.json(default: false)
  • for local mode if workspace_dir is specified in the settings, this directory will be used to store workspaces

Summary by CodeRabbit

  • New Features
    • Introduced a configurable workspace directory setting, allowing users to specify a custom storage path.
  • Documentation
    • Updated the user guide to include details on customizing the workspace directory in local mode.

@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces a new configuration option in the settings. A new key "workspaces_dir" with a value of ".." is added to settings.json. Additionally, the functions page_setup and render_sidebar in src/common/common.py now check if st.session_state.settings["workspaces_dir"] is defined and if st.session_state.location is "local". Based on this condition, they set the workspace directory from the setting or revert to the original default path. The user guide is updated to reflect these changes.

Changes

File Change Summary
settings.json Added new key "workspaces_dir": "..", expanding available configurations without altering existing functionality.
src/common/common.py Updated page_setup and render_sidebar to conditionally set workspaces_dir based on st.session_state.settings["workspaces_dir"] and st.session_state.location.
docs/user_guide.md Added information about specifying the workspace directory in settings.json, clarifying its usage in local mode.

Possibly related PRs

Poem

I'm a rabbit with a joyful pace,
Hopping through code with a smiling face.
A new key in settings lights up my way,
Guiding workspaces where I can play.
With conditional hops and paths so neat,
My bunny heart skips a beat!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ed8abcd and 84c6e29.

📒 Files selected for processing (2)
  • docs/user_guide.md (1 hunks)
  • src/common/common.py (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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

@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: 0

🧹 Nitpick comments (2)
src/common/common.py (2)

211-214: Flexible workspace directory configuration added

The new logic correctly checks for a custom workspace directory configuration. This implementation allows users to specify their own workspace location which is a good usability improvement.

Two suggestions for improvement:

  1. Consider adding validation to ensure the provided path exists and is writable
  2. Document the expected value type in a comment (e.g., "Path string or false")
 # Define the directory where all workspaces will be stored
 if st.session_state.settings["workspaces_dir"] and st.session_state.location == "local":
-    workspaces_dir = Path(st.session_state.settings["workspaces_dir"])
+    workspaces_dir_path = st.session_state.settings["workspaces_dir"]
+    workspaces_dir = Path(workspaces_dir_path)
+    # Validate the path exists and is writable
+    if not workspaces_dir.exists():
+        st.warning(f"Configured workspace directory '{workspaces_dir_path}' doesn't exist. Creating it.")
+        workspaces_dir.mkdir(parents=True, exist_ok=True)
 else:
     workspaces_dir = Path("..", "workspaces-" + st.session_state.settings["repository-name"])

286-289: Code duplication with page_setup function

This logic is duplicated from the page_setup function. Consider extracting this functionality into a helper function to avoid maintenance issues in the future.

You could create a utility function:

def get_workspaces_dir():
    """Return the configured workspaces directory or the default one."""
    if st.session_state.settings["workspaces_dir"] and st.session_state.location == "local":
        return Path(st.session_state.settings["workspaces_dir"])
    else:
        return Path("..", "workspaces-" + st.session_state.settings["repository-name"])

Then call this function in both places. This would ensure consistent behavior and make future updates easier.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d65c9c9 and 397e361.

📒 Files selected for processing (2)
  • settings.json (1 hunks)
  • src/common/common.py (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build-simple-app
  • GitHub Check: build-openms
  • GitHub Check: build-full-app
🔇 Additional comments (1)
settings.json (1)

18-18: New workspace directory configuration added

Good addition! This new setting allows users to specify a custom workspace directory path. The default value of false is logical as it will fall back to the default path when not configured.

Copy link
Member

@t0mdavid-m t0mdavid-m left a comment

Choose a reason for hiding this comment

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

Thank you for contribution! Could you also add documentation (in the docs folder) about the workspaces_dir parameter and specifically about the behavior that it is ignored in online mode?

Copy link

@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: 0

🧹 Nitpick comments (1)
docs/user_guide.md (1)

26-26: Clarify the Default Workspace Directory Setting

The documentation indicates that in local mode, the workspace directory "Defaults to ..". Please double-check that this default value is consistent with the actual behavior in settings.json. Notably, the PR objectives mention a default value of false, whereas the AI summary and the documentation imply a default of ... It would be beneficial to clarify which default is correct so that users have consistent guidance.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 397e361 and 7189314.

📒 Files selected for processing (3)
  • docs/user_guide.md (1 hunks)
  • settings.json (1 hunks)
  • src/common/common.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • settings.json
  • src/common/common.py
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build-openms
  • GitHub Check: build-simple-app
  • GitHub Check: build-full-app

@t0mdavid-m t0mdavid-m merged commit c78b10e into OpenMS:main Mar 12, 2025
4 of 5 checks passed
@t0mdavid-m
Copy link
Member

Thanks for your contribution!

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.

Question: Workspaces

2 participants