Skip to content

Revert replacehomedir#1976

Merged
esimkowitz merged 88 commits intomainfrom
evan/s3revert
Feb 15, 2025
Merged

Revert replacehomedir#1976
esimkowitz merged 88 commits intomainfrom
evan/s3revert

Conversation

@esimkowitz
Copy link
Contributor

No description provided.

esimkowitz and others added 22 commits February 13, 2025 13:22
This implementation of fileContentAtom seems incorrect but it prevents
the code editor from rerendering when the contents change. Because of
this, it makes sense to use it in the meantime.
This updates the test behavior to match its description
Prior to this change, copying a directory to a directory that did not
already exist resulted in the new directory containing the original
one. This updates that so the new directory is the same as the original
one but with a different name.
We previously only handle the case of copying the current directory to
an existing directory. This adds another case for when the target
directory does not exist.
A reworked implementation switched these to use fileInfo.dir to get the
parent directory; however, this does not work if the file is itself a
directory. The revision uses RemoteFileJoinCommand to get around that,
at least for the time being.
This reverts commit 477f6e5.
This reverts commit ad89824.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 15, 2025

Warning

Rate limit exceeded

@esimkowitz has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b951ca1 and cd552b2.

📒 Files selected for processing (2)
  • frontend/app/view/codeeditor/codeeditor.tsx (1 hunks)
  • frontend/app/view/preview/directorypreview.tsx (2 hunks)

Walkthrough

The pull request makes several updates across the project. In the frontend component, the creation of drag items has been modified so that the URI is now generated solely based on the file path without involving the connection variable. A new function, ReplaceHomeDir, has been added to the wavebase package to simplify the representation of home directory paths by replacing them with a "~" when applicable. Additionally, functions in a remote server module have been updated to process file paths using the new ReplaceHomeDir function, ensuring a consistent and user-friendly formatting of paths in both successful and error cases. Furthermore, the PreviewModel class has been updated to reference file paths more accurately by replacing fileInfo.dir with fileInfo.path across various functions. These modifications adjust path formatting across multiple areas without changing the core logic or public API declarations.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • 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. (Beta)
  • @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
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: 0

🧹 Nitpick comments (1)
pkg/wavebase/wavebase.go (1)

151-160: Enhance path handling robustness in ReplaceHomeDir.

The function could be improved to handle more edge cases:

Consider these enhancements:

 func ReplaceHomeDir(pathStr string) string {
+    // Handle empty or invalid paths
+    if pathStr == "" {
+        return pathStr
+    }
     homeDir := GetHomeDir()
+    // Handle GetHomeDir failure
+    if homeDir == "/" {
+        return pathStr
+    }
+    // Normalize paths for comparison
+    cleanPath := filepath.Clean(pathStr)
+    cleanHome := filepath.Clean(homeDir)
-    if pathStr == homeDir {
+    if cleanPath == cleanHome {
         return "~"
     }
-    if strings.HasPrefix(pathStr, homeDir+"/") {
-        return "~" + pathStr[len(homeDir):]
+    // Handle both forward and backward slashes
+    if strings.HasPrefix(cleanPath, cleanHome+string(os.PathSeparator)) {
+        return "~" + cleanPath[len(cleanHome):]
     }
     return pathStr
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6d7356f and 2191ca5.

📒 Files selected for processing (3)
  • frontend/app/view/preview/directorypreview.tsx (1 hunks)
  • pkg/wavebase/wavebase.go (1 hunks)
  • pkg/wshrpc/wshremote/wshremote.go (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
  • GitHub Check: Build for TestDriver.ai
🔇 Additional comments (3)
pkg/wshrpc/wshremote/wshremote.go (2)

589-589: LGTM! Path formatting enhancement.

The use of wavebase.ReplaceHomeDir improves path readability by consistently replacing home directory paths with ~.


647-647: LGTM! Consistent path formatting.

The use of wavebase.ReplaceHomeDir ensures consistent path formatting between found and not found files.

frontend/app/view/preview/directorypreview.tsx (1)

734-734:

Details

❓ Verification inconclusive

Verify drag-and-drop functionality with simplified URI generation.

The removal of connection information from URI generation might affect drag-and-drop operations between different connections.

Run this script to check if drag-and-drop operations use connection information elsewhere:


🏁 Script executed:

#!/bin/bash
# Search for drag-and-drop related code that uses connection information
rg -A 5 "type: \"FILE_ITEM\"" 
rg -A 5 "onDrop.*connection"

Length of output: 472


Verify drag-and-drop remains stable with the simplified URI generation.

The removal of the connection detail in the URI generation appears not to impact the drag-and-drop functionality according to our search—there’s no evidence that the drag-and-drop (FILE_ITEM) handling references a connection in its onDrop events. However, please manually verify that drag-and-drop operations (especially in multi-connection scenarios) continue to work as expected.

  • Confirm that drag-and-drop actions do not require connection info.
  • Test multi-connection use cases if applicable.

@esimkowitz esimkowitz merged commit 3c75d13 into main Feb 15, 2025
8 checks passed
@esimkowitz esimkowitz deleted the evan/s3revert branch February 15, 2025 02:28
xxyy2024 pushed a commit to xxyy2024/waveterm_aipy that referenced this pull request Jun 24, 2025
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: sawka <mike@commandline.dev>
Co-authored-by: Sylvia Crowe <software@oneirocosm.com>
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.

3 participants