Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Aug 2, 2025

This PR fixes issue #6583 where the Roo extension crashes with a RangeError when RooProtectedController encounters paths outside the current working directory.

Problem

The ignore library expects paths to be relative to the project root and throws a RangeError when it receives paths that go outside the cwd (e.g., "../../.roo/rules"). This was causing the extension to crash.

Solution

  • Added a check in isWriteProtected() to detect paths that start with ".." (indicating they go outside the cwd)
  • Return false (not protected) for such paths before passing them to the ignore library
  • This approach is consistent with how RooIgnoreController handles similar cases

Testing

  • Added test cases to verify paths outside cwd are handled gracefully
  • All existing tests continue to pass
  • No regression in functionality

Fixes #6583


Important

Fixes RangeError in RooProtectedController by handling paths outside cwd in isWriteProtected() and adds tests to ensure stability.

  • Behavior:
    • Fixes RangeError in RooProtectedController by handling paths outside cwd in isWriteProtected().
    • Returns false for paths starting with ".." to prevent crash.
  • Testing:
    • Adds test cases in RooProtectedController.spec.ts to verify paths outside cwd are not protected and do not throw errors.
    • Ensures all existing tests pass without regression.

This description was created by Ellipsis for 1267d6f. You can customize this summary. It will automatically update as commits are pushed.

…ngeError

- Add check for paths starting with ".." before calling ignore library
- Return false (not protected) for paths outside the cwd
- Add test cases to verify paths outside cwd are handled gracefully
- Fixes #6583
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 2, 2025 04:56
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Aug 2, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

I reviewed my own code and found it surprisingly coherent. The machines are learning.

The fix correctly addresses the RangeError by checking for paths that start with ".." before passing them to the ignore library. This is consistent with how RooIgnoreController handles similar cases.

A couple of minor suggestions for consideration:

  • The catch block comment at line 54 mentions paths outside cwd causing errors, but this scenario is now handled by the new check. Consider updating the comment to reflect what other errors might still be caught.
  • Consider adding a test case for Windows-style paths that go outside cwd (e.g., ..\..\outside\path) to ensure cross-platform compatibility.

Overall, solid fix with good test coverage.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 2, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 2, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Aug 2, 2025
@daniel-lxs
Copy link
Member

This doesn't seem to fix the issue, the issue needs scoping

@daniel-lxs daniel-lxs closed this Aug 5, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Aug 5, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PR - Needs Preliminary Review size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Roo Extension Crash After VS Code Update - navigator and path.relative Error

4 participants