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

[v2] Port fix for credentials not refreshed in ds tree and other misc profile fixes #3349

Open
wants to merge 6 commits into
base: v2-lts
Choose a base branch
from

Conversation

t1m0thyj
Copy link
Member

@t1m0thyj t1m0thyj commented Dec 6, 2024

Proposed changes

Ports #3111 and #3248 from main branch to v2-lts branch. Original PR description below:

This PR resolves several issues related to profile management in V3:

How to Test
Test that profile changes are propagated:

  • Update credentials (user/password)
  • Login/logout with base profile
  • Login/logout with regular profile
  • All the above when autoStore=false

Release Notes

Milestone: 2.18.1

Changelog:
Zowe Explorer

  • Fixed issue where Search operation did not prompt for credentials if profile contains expired token. #2259
  • Fixed issue where inactive status was not displayed for profiles loaded from Global Config. #3134

Zowe Explorer API

  • Deprecated the method ProfilesCache.updateProfilesArrays. Use ProfilesCache.updateCachedProfile instead, which handles updating credentials cached in memory when autoStore is false. #3120

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds or improves functionality)
  • Breaking change (a change that would cause existing functionality to not work as expected)
  • Documentation (Markdown, README updates)
  • Other (please specify above in "Proposed changes" section)

Checklist

General

  • I have read the CONTRIBUTOR GUIDANCE wiki
  • All PR dependencies have been merged and published (if applicable)
  • A GIF or screenshot is included in the PR for visual changes
  • The pre-publish command has been executed:
    • v2 and below: yarn workspace vscode-extension-for-zowe vscode:prepublish
    • v3: pnpm --filter vscode-extension-for-zowe vscode:prepublish

Code coverage

  • There is coverage for the code that I have added
  • I have added new test cases and they are passing
  • I have manually tested the changes

Deployment

  • I have added developer documentation (if applicable)
  • Documentation should be added to Zowe Docs
    • If you're an outside contributor, please post in the #zowe-doc Slack channel to coordinate documentation.
    • Otherwise, please check with the rest of the squad about any needed documentation before merging.
  • These changes may need ported to the appropriate branches (list here):

Further comments

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

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

Project coverage is 93.45%. Comparing base (cf55928) to head (21eaae3).

Files with missing lines Patch % Lines
packages/zowe-explorer/src/Profiles.ts 88.88% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           v2-lts    #3349      +/-   ##
==========================================
+ Coverage   93.41%   93.45%   +0.04%     
==========================================
  Files         105      105              
  Lines       11161    11154       -7     
  Branches     2367     2465      +98     
==========================================
- Hits        10426    10424       -2     
+ Misses        734      729       -5     
  Partials        1        1              

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

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.

Hey @t1m0thyj thanks for porting these bugfixes. I did leave a comment below

packages/zowe-explorer-api/src/profiles/ProfilesCache.ts Outdated Show resolved Hide resolved
zFernand0
zFernand0 previously approved these changes Dec 13, 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.

The port LGTM as-is! 🙏

Billie has a good point about adding a new API in a maintenance branch.

I'm not opposed to adding it, but also shared a theoretical alternative solution if we decide not to add it 🙏


We can wait for Timothy's input before we proceed with the PR though

packages/zowe-explorer-api/src/profiles/ProfilesCache.ts Outdated Show resolved Hide resolved
Signed-off-by: Timothy Johnson <[email protected]>
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
7.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

Thanks for porting these Timothy, the fixes LGTM!

Comment on lines +20 to +21
- Fixed issue where Search operation did not prompt for credentials if profile contains expired token. [#2259](https://github.com/zowe/zowe-explorer-vscode/issues/2259)
- Fixed issue where inactive status was not displayed for profiles loaded from Global Config. [#3134](https://github.com/zowe/zowe-explorer-vscode/issues/3134)
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: We'll probably want to move these entries to the bottom of this section as the existing entries are sorted chronologically

await cache.updateBaseProfileFileLogout(serviceProfile);
}
await cache.updateBaseProfileFileLogout(connOk ? baseProfile : serviceProfile);
serviceProfile.profile = { ...serviceProfile.profile, tokenType: undefined, tokenValue: undefined };
Copy link
Member

Choose a reason for hiding this comment

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

I noticed serviceProfile.profile is reassigned as a new object - since this is in v2, I don't think this has any major side effects. However, it does make me wonder if we have similar logic in v3 and whether that logic works well with other parts of Zowe Explorer that keep profile references (such as tree nodes, filesystem) 🤔

No request for changes here, it's merely an observation 😋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Review/QA
Development

Successfully merging this pull request may close these issues.

4 participants