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

Prevent relative require completion from failing on permissions #3151

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Feb 7, 2025

Motivation

We have some cases in our telemetry where the user typed in a relative require pointing to a directory that the editor doesn't have permission to read.

This will cause an Errno::EPERM and currently makes completion crash.

Implementation

Started rescuing the error. If we can't read the directory, we can't list files.

Automated Tests

I tried writing a test for this, but for some reason removing all permissions with FileUtils.chmod doesn't reproduce. Glob just returns an empty array instead.

Not sure if the behaviour is platform specific, but rather than spending a disproportionate amount of effort writing this one test, I think it's safe to just rescue.

@vinistock vinistock added server This pull request should be included in the server gem's release notes bugfix This PR will fix an existing bug labels Feb 7, 2025 — with Graphite App
Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock self-assigned this Feb 7, 2025
@vinistock vinistock requested review from andyw8 and st0012 February 7, 2025 22:32
@vinistock vinistock marked this pull request as ready for review February 7, 2025 22:35
@vinistock vinistock requested a review from a team as a code owner February 7, 2025 22:35
Copy link

graphite-app bot commented Feb 7, 2025

Merge activity

### Motivation

We have some cases in our telemetry where the user typed in a relative require pointing to a directory that the editor doesn't have permission to read.

This will cause an `Errno::EPERM` and currently makes completion crash.

### Implementation

Started rescuing the error. If we can't read the directory, we can't list files.

### Automated Tests

I tried writing a test for this, but for some reason removing all permissions with `FileUtils.chmod` doesn't reproduce. Glob just returns an empty array instead.

Not sure if the behaviour is platform specific, but rather than spending a disproportionate amount of effort writing this one test, I think it's safe to just rescue.
@graphite-app graphite-app bot force-pushed the 02-07-prevent_relative_require_completion_from_failing_on_permissions branch from c1ceb26 to 1a38cbc Compare February 7, 2025 22:59
@graphite-app graphite-app bot merged commit 1a38cbc into main Feb 7, 2025
42 checks passed
@graphite-app graphite-app bot deleted the 02-07-prevent_relative_require_completion_from_failing_on_permissions branch February 7, 2025 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants