Skip to content

SDK getResource failOnNoData flag #205

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

Merged
merged 4 commits into from
Feb 10, 2025
Merged

Conversation

AndrewTwydell
Copy link
Contributor

@AndrewTwydell AndrewTwydell commented Jan 10, 2025

What It Does
Adds a failOnNodata flag, defaulting to true (which is the current behaviour), to dictate if CMCI sending a NODATA response should throw an error or not.

Review Checklist
I certify that I have:

Additional Comments

@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 42.38411% with 87 lines in your changes missing coverage. Please review.

Project coverage is 40.04%. Comparing base (f930e66) to head (a26121b).

Files with missing lines Patch % Lines
packages/vsce/src/utils/profileManagement.ts 24.10% 85 Missing ⚠️
packages/vsce/src/utils/expansionHandler.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
+ Coverage   39.91%   40.04%   +0.12%     
==========================================
  Files         147      148       +1     
  Lines        5003     5072      +69     
  Branches      873      891      +18     
==========================================
+ Hits         1997     2031      +34     
- Misses       3006     3041      +35     

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

@davenice
Copy link
Contributor

This looks good too - do we need it for use in VSCE somewhere?

failOnNoData is added, but is optional, right? Is there any way this could break existing callers?

@AndrewTwydell
Copy link
Contributor Author

Yeah the idea will be we implement this into the VSCE getResource calls so we don't have to handle NODATA CMCI errors. The fact it's optional means we're not breaking current users of the SDK as it's default behavior is not changing; only once you opt in to the new features using these optional flags will the behaviour change.

Currently a WIP, looking at an optional flag to change the error you can get out too which will offer more helpful CMCI info on failures (RESP, RESP2 etc)

@AndrewTwydell AndrewTwydell force-pushed the sdk-failonnodata-flag branch 2 times, most recently from b5a79d9 to c747d05 Compare January 21, 2025 16:51
@AndrewTwydell AndrewTwydell marked this pull request as ready for review January 30, 2025 11:38
@davenice
Copy link
Contributor

davenice commented Feb 7, 2025

The code looks good as far as I can see. I think we normally call it RESP/RESP2 rather than RESPONSE_1 and RESPONSE_2 - so we'd talk about "your RESP code" or "your RESP2 code" - but I don't think that's a big problem and it does disambiguate a bit!

I appreciate having a unit test that's identical other than asking for the old and new style of error response. That's useful. Are there any other kinds of errors we ought to drive that way? Is there anything other than "NODATA" we should prod?

I will sync the code and test it - but because this is and SDK change it would be valuable to have @zFernand0's input, or somebody that he delegates to!

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.

LGTM! 😋

Thanks for adding the cmci request options! 🙏
Seem like the failOnNoData is properly defaulted to true as not to break existing behavior on the CLI 🙏

Copy link
Contributor

@davenice davenice left a comment

Choose a reason for hiding this comment

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

Two minor wording tweaks and it's a yes from me

Signed-off-by: Andrew Twydell <andrew.twydell@ibm.com>
Signed-off-by: Andrew Twydell <andrew.twydell@ibm.com>
Signed-off-by: Andrew Twydell <andrew.twydell@ibm.com>
Signed-off-by: Andrew Twydell <andrew.twydell@ibm.com>
@AndrewTwydell AndrewTwydell merged commit d1fcf79 into main Feb 10, 2025
19 checks passed
@AndrewTwydell AndrewTwydell deleted the sdk-failonnodata-flag branch February 10, 2025 17:09
@AndrewTwydell AndrewTwydell added the release-current Indicates that there is no new functionality being delivered label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-current Indicates that there is no new functionality being delivered
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

4 participants