zowe / zowe-explorer-vscode

Visual Studio Code Extension for Zowe, which lets users interact with z/OS Data Sets, Unix System Services, and Jobs on a remote mainframe instance. Powered by Zowe SDKs.
Eclipse Public License 2.0
159 stars 89 forks source link

Fix inconsistent implementation of `getSessionNode` across tree views #2962

Open t1m0thyj opened 1 week ago

t1m0thyj commented 1 week ago

In vNext the getSessionNode method is implemented inconsistently across the 3 tree node classes.

In v2 this was replaced with a common implementation: https://github.com/zowe/zowe-explorer-vscode/blob/f56fa8d765b08fa0901523390b5c10267fba7782/packages/zowe-explorer/src/uss/ZoweUSSNode.ts#L123-L126

This works most of the time but could have undesired behavior when the session property is defined outside of profile nodes.

Discussed with @traeok and the following may be a better implementation: return SharedContext.isSession(this) ? this : (this.getParent()?.getSessionNode() as IZoweUSSTreeNode);

This would ensure that the session property is defined on a node whose context value matches a profile node.

However this change would break lots of unit tests (~200) which expect the session property to be defined on orphan nodes.

github-actions[bot] commented 1 week ago

Thank you for creating a bug report. We will investigate the bug and evaluate its impact on the product. If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.