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: middleware crashes when manifest.json is missing or not where it was expected #1054

Merged
merged 17 commits into from
Jun 12, 2023

Conversation

tobiasqueck
Copy link
Contributor

@tobiasqueck tobiasqueck commented Jun 1, 2023

Fix for #1051

@changeset-bot
Copy link

changeset-bot bot commented Jun 1, 2023

🦋 Changeset detected

Latest commit: 2f9db7f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sap-ux/ui5-proxy-middleware Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tobiasqueck tobiasqueck changed the title Fix for #1051 Fix: middleware crashes when manifest.json is missing or not where it was expected Jun 2, 2023
@tobiasqueck tobiasqueck marked this pull request as ready for review June 2, 2023 11:32
@tobiasqueck tobiasqueck requested a review from a team as a code owner June 2, 2023 11:32
Copy link
Contributor

@ullasholla ullasholla left a comment

Choose a reason for hiding this comment

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

@tobiasqueck, thanks for the PR.

  • patch changeset looks correct
  • the code is readable and clean
  • tests cover most of the changes

I had a few minor comments, could you please take a look when you can? Cheers.

@tobiasqueck
Copy link
Contributor Author

@ullasholla please re-review, I believe, I have addressed all your concerns
@zdravko-georgiev would you be available for the 2nd review?

ullasholla
ullasholla previously approved these changes Jun 5, 2023
Copy link
Contributor

@ullasholla ullasholla left a comment

Choose a reason for hiding this comment

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

@tobiasqueck, thanks for addressing all the review comments.

@tobiasqueck
Copy link
Contributor Author

@Klaus-Keller thanks for your direct message. I have enhanced the test/test-input folder with a test setup for local testing. Just go to test/test-input/easy-ui5-app and then run npm i && npm start.
With this fix it will work as expected, without the fix the middleware will crash.

Copy link
Contributor

@Klaus-Keller Klaus-Keller left a comment

Choose a reason for hiding this comment

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

Hi @tobiasqueck,
I like the approach to use resources to look up manifest.json, but would then remove the code in utils.ts that reads the manifest. See my comments.

packages/ui5-proxy-middleware/src/base/utils.ts Outdated Show resolved Hide resolved
packages/ui5-proxy-middleware/src/base/utils.ts Outdated Show resolved Hide resolved
packages/ui5-proxy-middleware/src/base/utils.ts Outdated Show resolved Hide resolved
@tobiasqueck
Copy link
Contributor Author

but would then remove the code in utils.ts that reads the manifest.

We tried to keep a clean separation of code specific to running this middleware in the ui5 tooling compared to code independent of the UI5 tooling. This new function is specific to the ui5 tooling therefore it should not move to the utils.
We use this separation in all our middlewares.

Copy link
Contributor

@Klaus-Keller Klaus-Keller left a comment

Choose a reason for hiding this comment

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

  • code changes to fix the wrong lookup of manifest.json look good and are easy to understand
  • build and tested locally
  • code coverage looks great
  • thanks for adding types definitions

Approved from my side

Copy link
Contributor

@815are 815are left a comment

Choose a reason for hiding this comment

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

Checked:

  1. Code is easy to understand - I did not notice issue;
  2. Tests are maintained - scenarios listed in bug are covered

I did not test locally.

@sonarcloud
Copy link

sonarcloud bot commented Jun 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

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

97.4% 97.4% Coverage
0.0% 0.0% Duplication

@tobiasqueck tobiasqueck merged commit 7f1971c into main Jun 12, 2023
15 checks passed
@tobiasqueck tobiasqueck deleted the fix/1051/manifest branch June 12, 2023 07:58
@cianmSAP cianmSAP mentioned this pull request Aug 8, 2023
6 tasks
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.

None yet

4 participants