-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Skip cloud files marked as not on disk during command discovery #18152
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
Skip cloud files marked as not on disk during command discovery #18152
Conversation
| // added to System.IO.FileAttributes yet. | ||
| private const int FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS = 0x400000; | ||
|
|
||
| private const int FILE_ATTRIBUTE_RECALL_ON_OPEN = 0x40000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not actually been able to produce a scenario where this attribute appears (despite checking from multiple win32 APIs in case it only appeared in certain structs). I kept it in incase there's a different cloud provider that uses it, or if OneDrive starts to use it at some point.
Documentation for FILE_ATTRIBUTE_RECALL_ON_OPEN reads:
This attribute only appears in directory enumeration classes (
FILE_DIRECTORY_INFORMATION,FILE_BOTH_DIR_INFORMATION, etc.). When this attribute is set, it means that the file or directory has no physical representation on the local system; the item is virtual. Opening the item will be more expensive than normal, e.g. it will cause at least some of it to be fetched from a remote store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can't even check it manually and even OneDrive doesn't use it, why is it PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept it in incase there's a different cloud provider that uses it, or if OneDrive starts to use it at some point. Basically, documentation tell us to look for it, so I lean towards looking for it. Even if it happens not to be present in the specific use case we're looking to solve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You won't be the first anyway. 😸
https://github.com/search?q=org%3Adotnet+FILE_ATTRIBUTE_RECALL_ON_OPEN&type=issues
|
This seems too uncompromising a decision. If we go this way, we rather need an option. Then the main difficulty will be to decide whether it should be opt-in or opt-out. |
With this change you already have the option to simply pin the modules folder. This change only excludes files that have not already been downloaded by OneDrive. The experience of module discovery attempting to import modules that have not yet been downloaded is quite bad (tab completion will wait until every module has been downloaded before returning). |
|
I still think it is not PowerShell problem. What if about TwoDrive? 😄 I believe One Drive must have folder/file exclusion option. |
I would guess most cloud providers have a way to say "I want this folder to always be available". Or at least a way to trigger the download. The changes in this PR are not actually |
|
@iSazonov FYI - We've had conversations with OneDrive team and it doesn't seem they will do anything specific for us. We've heard from many customers where they weren't aware MyDocuments is now in OneDrive and complain about PS perf. Perhaps we should put this as an experimental feature as a way to advertise the change and get feedback. |
If I were them, I would also answer because the question is unfortunate - too small a niche. If PowerShell does use a workaround, however, it could disrupt the familiar user environment. For example, I used to actively sync modules via OneDrive for a while. At the very least, we need an option to explicitly enable or disable it. I'd start with opt-in. |
|
Added experimental feature |
Both of these decisions are questionable. If there are users who are bothered by it, then there are also users who use it. |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
The attributes are for informing anything that does file based discovery that retrieving a particular file's content would be expensive. |
daxian-dbw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SeeminglyScience Please file a doc issue about this new behavior.
Also, please resolve the conflicts.
PS. I looked up the history and found the experimental-feature-xxx.json change was made by #16823, as a temporary workaround for cross compiled packages like ARM and Alpine. I think for CIs, we should continue to invoke pwsh to generate the list of experimental features, and only use those 2 files for release build. Those 2 files will be updated daily by GitHub actions, so it should be fine for release builds.
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
|
@SeeminglyScience FYI, PR #18484 was submitted to make those 2 JSON file build artifacts only. Please open doc issue and update the PR check list with the doc issue link. |
|
Yep! I'll be filing an issue in the docs repo. I need to fix something though, it seems like disabling the experimental feature isn't actually reverting behavior (though I could have sworn it was previously). Update: Manually removed it and it's working, so unrelated. I'll get that issue filed for docs and separately figure out what's up with Update 2: And now I can't even repro |
|
@daxian-dbw docs issue has been filed and PR description has been updated |
|
@SeeminglyScience Thanks! I will merge this PR. |
PR Summary
These changes make it so that command discovery (and subsequently tab completion) no longer trigger the download of files not yet on disk when cloud storage is present in
env:PSModulePath(e.g. backing upDocumentswith OneDrive).I believe this would technically be a breaking change,
though I'm unsure if we would need to put this behind an experimental change as the experience is pretty rough if you hit this currently. Happy to add that on request though.Experimental feature added asPSModuleAutoLoadSkipOfflineFilesPR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.PSModuleAutoLoadSkipOfflineFiles(which runs in a different PS Host).