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

VSC Compare function, not working with Favorites from Zowe Explorer #2549

Merged
merged 14 commits into from
Nov 8, 2023

Conversation

SanthoshiBoyina
Copy link
Contributor

Proposed changes

The feature of Visual Studio Code to compare 2 files, if the file on the mainframe has changed in the meantime, doesn't work if you open a Member under Favorites. It overrides the file automatically. In this bug fix, we are able to trigger Compare function when ETAGs are mismatched.

Release Notes

Milestone:

Changelog:

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

@SanthoshiBoyina SanthoshiBoyina changed the base branch from main to maintenance November 7, 2023 14:55
Signed-off-by: Santhoshi Boyina <[email protected]>
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Attention: 26 lines in your changes are missing coverage. Please review.

Files Coverage Δ
packages/zowe-explorer/src/dataset/actions.ts 93.96% <94.73%> (-0.23%) ⬇️
packages/zowe-explorer/src/shared/utils.ts 86.52% <81.25%> (-10.79%) ⬇️
packages/zowe-explorer/src/uss/actions.ts 94.75% <86.95%> (+1.22%) ⬆️
packages/zowe-explorer/src/shared/actions.ts 77.64% <20.83%> (-9.52%) ⬇️

📢 Thoughts on this report? Let us know!

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.

Hi @SanthoshiBoyina, thanks for working on resolving conflict management - looks great so far.

After a discussion w/ @t1m0thyj, I do have a concern regarding the Data Set tree. On line 523 in the openPS function (dataset/actions.ts), I noticed that we set the e-tag regardless of its value in the response:

const response = await responsePromise;
node.setEtag(response?.apiResponse?.etag);
statusMsg.dispose();

If a response does not return an e-tag, it will set the e-tag to null, which will cause the first save to bypass the e-tag mismatch on the mainframe.

To avoid this, we'll need to add a check to see if response?.apiResponse?.etag is a valid value before calling node.setEtag.

Copy link
Member

@t1m0thyj t1m0thyj left a comment

Choose a reason for hiding this comment

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

Agree with @traeok's comment, here are steps for how I reproduced the issue:

  1. Open a data set in preview mode by single-clicking on it in the tree
  2. Make changes to the data set on the mainframe
  3. Make changes to the data set locally in ZE
    This will switch the editor from preview mode (title italicized) to edit mode 👍
    It will also reset the etag for the current node to null which we don't want 😢
  4. Save the changes and notice that no conflict is detected

IMO we should fix this before 2.12.1 to avoid risk of data loss, potentially in this PR since its related to compare functionality? I also don't mind opening a separate PR to fix it if preferred 🙂

@rudyflores rudyflores added this to the v2.12.1 milestone Nov 7, 2023
@t1m0thyj
Copy link
Member

t1m0thyj commented Nov 7, 2023

Based on discussion at standup, I'll open another PR against this one with the fix for etag being set to null 🙂

Edit: Opened #2551

JillieBeanSim
JillieBeanSim previously approved these changes Nov 8, 2023
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 for the fix

rudyflores
rudyflores previously approved these changes Nov 8, 2023
Copy link
Contributor

@rudyflores rudyflores left a comment

Choose a reason for hiding this comment

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

Thanks @SanthoshiBoyina !

Only thing I see is some code coverage missing but not sure if this will be an issue since I know we want to get the release out?

@JillieBeanSim JillieBeanSim dismissed stale reviews from rudyflores and themself via 9c78cd4 November 8, 2023 15:39
Signed-off-by: Billie Simmons <[email protected]>
Copy link

sonarcloud bot commented Nov 8, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
22.3% 22.3% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Copy link
Member

@t1m0thyj t1m0thyj 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 @SanthoshiBoyina and @JillieBeanSim!

Copy link
Contributor

@rudyflores rudyflores left a comment

Choose a reason for hiding this comment

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

Nice catch @t1m0thyj !

@JillieBeanSim JillieBeanSim merged commit 9e5b0d4 into maintenance Nov 8, 2023
19 of 21 checks passed
@JillieBeanSim JillieBeanSim deleted the etag-mismatch-not-triggering-compare branch November 8, 2023 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

VSC Compare function, not working with Favorites from Zowe Explorer
6 participants