zowe-explorer-vscode: ZE FileSystemProvider `stat` function throws the `FileNotFound` error for files that exist
Describe the bug
When attempting to retrieve the stats of a dataset member that is not listed in the Zowe Explorer (ZE) dataset tree, the FileNotFound error is returned, even though the file exists.
However, if the dataset is added to the tree and its members are listed, the stats are correctly retrieved.
To Reproduce
I’m using following function that I execute as a VSCode command to call the stat function of the ZE FS provider.
public async testFSProviderStat() {
const treeFileUri = vscode.Uri.parse(
"zowe-ds:/zosmf/WORK.ASMMAC/TEST",
);
try {
const treeFileStats = await vscode.workspace.fs.stat(treeFileUri);
debug(
`File stats ${treeFileUri.toString()} ${JSON.stringify(treeFileStats)}`,
);
} catch (err) {
debug(
`File stats error ${treeFileUri.toString()} ${JSON.stringify(err)}`,
);
}
const notInTreeFileUri = vscode.Uri.parse("zowe-ds:/zosmf/SYS1.MACLIB/ABEND");
try {
const notInTreeStats = await vscode.workspace.fs.stat(notInTreeFileUri);
debug(
`File stats ${notInTreeFileUri.toString()} ${JSON.stringify(notInTreeStats)}`,
);
} catch (err) {
debug(
`File stats error ${notInTreeFileUri.toString()} ${JSON.stringify(err)}`,
);
}
}
- Open VSCode with empty ZE dataset tree
- Run the sample code that executes
vscode.workspace.fs.statfunction FileNotFoundis thrown for both dataset members- Add the
WORK.ASMMACdataset to the ZE tree and list its members - Run the test command again
- It returns stats for the
WORK.ASMMAC/TESTmember, but still throwsFileNotFounderror forSYS1.MACLIB/ABEND - Add
SYS1.MACLIBto the ZE Tree - Run the command again
- Stats for both files are returned correctly.
Expected behavior
The stats for a dataset member should be retrievable even if the parent dataset is not listed in the ZE dataset tree. The FileNotFound error should not occur when querying existing files.
Screenshots
Desktop (please complete the following information):
- OS: MacOS
- Zowe Explorer Version: 3.1.2
- (Optional) Zowe CLI Version:
- (Optional) Are you using Secure Credential Store?
Additional context
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 15 (8 by maintainers)
To streamline the diagram
the other part discussed was that the pending zOSMF requests should be reused. Therefore:
Just to confirm that I understand the ask (regarding
?fetch=true), is the proposal to keep the current functionality but fetch the stats if they are not cached? i.e.,:I think this would be a breaking change, but I don’t see how this would negatively affect extenders who are already using
?fetch=truewhen they need updated stats. I’m not sure that anybody benefits from having an error to catch if the stats for a given URI aren’t cached.Based on a quick read through the code I don’t see any synchronization/queueing before issuing the MF requests. Multiple requests for the same resource result in independent backend requests even if there is one already in progress. I think that’s the core issue that should be addressed here.
Ah I see, my apologies. I was wondering how it was possible, but I see now that ZE extends vscode.FileSystemProvider to lookup the files on the mainframe if they don’t exist in vscode yet. Ignore my reply then 😅