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

Fix undefined node error on save #2801

Merged
merged 4 commits into from
Apr 2, 2024
Merged

Conversation

t1m0thyj
Copy link
Member

@t1m0thyj t1m0thyj commented Mar 25, 2024

Proposed changes

This PR addresses several issues that can cause the undefined node error:

  • Fixes documents being removed from open files map prematurely, before they are actually closed. The event onDidCloseTextDocument is misleadingly named - it fires whenever a document's language is changed.
  • Fixes creation of new node in createMember action so that member name is converted to uppercase. Also the new member's etag is now stored in a child node of the tree instead of an orphan node.
  • Fixes logic to find favorited nodes in the tree when saving data sets and USS files. Also updates tests to verify that favorite nodes are found and etags are handled correctly, instead of mocking functions that find the node.

Release Notes

Milestone: 2.15.2

Changelog: Fixed issue where saving changes to favorited data set or USS file could fail

Types of changes

What types of changes does your code introduce to Zowe Explorer?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Updates to Documentation or Tests (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This checklist will be used as reference for both the contributor and the reviewer

  • I have read the CONTRIBUTOR GUIDANCE wiki
  • PR title follows Conventional Commits Guidelines
  • PR Description is included
  • gif or screenshot is included if visual changes are made
  • yarn workspace vscode-extension-for-zowe vscode:prepublish has been executed
  • All checks have passed (DCO, Jenkins and Code Coverage)
  • I have added unit test and it is passing
  • I have added integration test and it is passing
  • There is coverage for the code that I have added
  • I have tested it manually and there are no regressions found
  • I have added necessary documentation (if appropriate)
  • Any PR dependencies have been merged and published (if appropriate)

Further comments

Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 93.29%. Comparing base (039036a) to head (eb126ff).

Files Patch % Lines
packages/zowe-explorer/src/dataset/actions.ts 90.00% 1 Missing ⚠️
packages/zowe-explorer/src/uss/actions.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           maintenance    #2801      +/-   ##
===============================================
+ Coverage        88.20%   93.29%   +5.09%     
===============================================
  Files              103      103              
  Lines            10679    10653      -26     
  Branches          2223     2320      +97     
===============================================
+ Hits              9419     9939     +520     
+ Misses            1259      713     -546     
  Partials             1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

zFernand0
zFernand0 previously approved these changes Mar 26, 2024
Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

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

Changes LGTM! 😋

@t1m0thyj t1m0thyj marked this pull request as draft March 26, 2024 22:37
@JillieBeanSim JillieBeanSim added this to the v2.15.2 milestone Mar 27, 2024
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
t1m0thyj added 2 commits April 1, 2024 09:34
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Copy link

sonarqubecloud bot commented Apr 1, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
22.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@t1m0thyj t1m0thyj changed the title Fix premature triggering of document close event Fix undefined node error on save Apr 1, 2024
@t1m0thyj t1m0thyj marked this pull request as ready for review April 1, 2024 21:26
@t1m0thyj t1m0thyj requested a review from zFernand0 April 1, 2024 21:26
?.children.find((child) => child.label.toString().trim() === dataSetName)
?.children.find((child) => child.label.toString().trim() === memberName) as api.IZoweDatasetTreeNode
)?.getEtag();
// TODO Handle case where same data set is open as both favorite and non-favorite to prevent desync between equivalent nodes
Copy link
Member Author

Choose a reason for hiding this comment

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

Having the same data set open both as a favorite and non-favorite is probably enough of an edge case that we can wait to address it in v3. Discussed with @traeok and we believe the FileSystemProvider should fix the desync since it stores data per URI rather than per node 😋

@@ -117,21 +117,6 @@ export async function refreshDirectory(node: IZoweUSSTreeNode, ussFileProvider:
}
}

export async function createUSSNodeDialog(node: IZoweUSSTreeNode, ussFileProvider: IZoweTree<IZoweUSSTreeNode>): Promise<void> {
Copy link
Member Author

@t1m0thyj t1m0thyj Apr 1, 2024

Choose a reason for hiding this comment

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

Removed this because it's dead code that's not called anywhere and it's not a public API

Copy link
Member

@traeok traeok left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @t1m0thyj for the fix and for cleaning up the save tests!

Copy link
Contributor

@JillieBeanSim JillieBeanSim left a comment

Choose a reason for hiding this comment

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

LGTM! thanks @t1m0thyj

@JillieBeanSim JillieBeanSim merged commit 143f5d1 into maintenance Apr 2, 2024
17 of 18 checks passed
@JillieBeanSim JillieBeanSim deleted the fix/doc-close-event branch April 2, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants