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

Updating build toolchain and deps of Web App reporter #7952

Merged
merged 11 commits into from
Apr 16, 2024

Conversation

tsteenbe
Copy link
Member

This pull request contains a significant changes to how ORT's WebApp (template) is generated and upgrade all dependencies to the latest available versions.

After @mennaElnemr9 created #6598 and #6552 I reviewed the impact of updating dependencies which let me to find issue after issues. Several build toolchain and app dependencies have introduced breaking changes or are not longer maintained. After a lots of research I came to the conclusion major rewrite of the WebApp was needed. Especially use create-react-app (CRA) and rescripts was problematic since rescripts has been archived and updated CRA ORT WebApp builds showed me several deprecated dependencies errors and warnings.

My current plan (subject to change):
Step 1: Change build toolchain and update deps
Step 2: Refactor React component code to use React v18 ways of working e.g. replace component classes with functional components. Possible look into replacing dependency on react-syntax-highlighter
Step 3: Implement new features / bug fixes

Copy link

codecov bot commented Nov 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.93%. Comparing base (9707529) to head (e4e2a72).
Report is 15 commits behind head on main.

❗ Current head e4e2a72 differs from pull request most recent head b823a30. Consider uploading reports for the commit b823a30 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7952      +/-   ##
============================================
- Coverage     67.69%   66.93%   -0.77%     
- Complexity     1000     2049    +1049     
============================================
  Files           247      357     +110     
  Lines          7904    17081    +9177     
  Branches        876     2449    +1573     
============================================
+ Hits           5351    11434    +6083     
- Misses         2173     4625    +2452     
- Partials        380     1022     +642     
Flag Coverage Δ
funTest-docker 66.05% <ø> (+0.61%) ⬆️
funTest-non-docker 34.35% <ø> (-0.50%) ⬇️
test 36.30% <ø> (-1.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

heliocastro
heliocastro previously approved these changes Nov 30, 2023
Copy link
Contributor

@heliocastro heliocastro left a comment

Choose a reason for hiding this comment

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

Looks good to me
Maybe on a second pass you can extend eslint verifications, but for this upgrade no need now.

@sschuberth sschuberth dismissed heliocastro’s stale review November 30, 2023 07:32

This is a draft still.

@heliocastro heliocastro self-requested a review November 30, 2023 09:57
@tsteenbe tsteenbe force-pushed the webapp-reporter-v0.3 branch 6 times, most recently from a2c9736 to c27b11e Compare December 4, 2023 10:19
@tsteenbe tsteenbe marked this pull request as ready for review December 4, 2023 10:22
@tsteenbe tsteenbe requested a review from a team as a code owner December 4, 2023 10:22
@tsteenbe tsteenbe force-pushed the webapp-reporter-v0.3 branch 3 times, most recently from 65cb16f to e4e2a72 Compare December 4, 2023 10:30
@tsteenbe
Copy link
Member Author

tsteenbe commented Dec 4, 2023

Looks good to me Maybe on a second pass you can extend eslint verifications, but for this upgrade no need now.

@heliocastro Added an eslint config, was already working on it when you wrote your comment but took me a couple of days to get the various rules set up.

.ort.yml Show resolved Hide resolved
plugins/reporters/web-app-template/package.json Outdated Show resolved Hide resolved
@sschuberth sschuberth requested a review from a team February 12, 2024 09:15
@sschuberth
Copy link
Member

@tsteenbe can we please move forward with this? Or should some one take over?

@heliocastro
Copy link
Contributor

@tsteenbe if you still in the middle of the moving process for some time, i can take over these one.

@tsteenbe tsteenbe force-pushed the webapp-reporter-v0.3 branch 2 times, most recently from b823a30 to a4b8872 Compare April 9, 2024 19:57
heliocastro
heliocastro previously approved these changes Apr 15, 2024
Copy link
Contributor

@heliocastro heliocastro left a comment

Choose a reason for hiding this comment

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

Good to Go, even with recent changes

@fviernau
Copy link
Member

fviernau commented Apr 16, 2024

I've tested it as well by using two evaluation-result.json files and comparing old vs. new report.
I've used Firefox version 123 under Ubuntu.
I've found a couple of nice formatting improvements.

Besides these, I was not sure about these formatting changes :

  1. Margin between tab icon and text:
  • old: Screenshot from 2024-04-16 09-19-13
  • new: Screenshot from 2024-04-16 09-19-24
  1. Same here:
  • old: Screenshot from 2024-04-16 09-19-41
  • new: Screenshot from 2024-04-16 09-19-54
  1. Key of the key value pairs now gray:
  • old: Screenshot from 2024-04-16 09-23-22
  • new: Screenshot from 2024-04-16 09-23-27

Also I've found a bug with the filtering of findings in scan results. This can be reproduced in
multiple places where the scan result details are shown. E.g. in the tree tab, in the issues tab and so forth:

  • old: Screenshot from 2024-04-16 09-24-55
  • new: Screenshot from 2024-04-16 09-25-13

My suggestion would be to at minimum fix the bug, plus the changed margins. I'm not sure about the graying out of the key.

Update versions of Node and Yarn used in WebApp's build
scripts to the versions used in the official ORT Docker
image[1].

[1]: https://github.com/oss-review-toolkit/ort/blob/9707529/.versions

Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
Replace the create-react-app[1] and the rescripts[2] based build
toolchain with vite[3] and vite-plugin-singlefile[4] as:
- rescripts project has been archived.
- continue using create-react-app is not viable due
  to upcoming API and packages deprecations.
- vite has good community support, it builds faster
  and its toolchain comes out-of-the-box with almost everything
  we need.

[1]: https://github.com/facebook/create-react-app
[2]: https://github.com/harrysolovay/rescripts
[3]: https://vitejs.dev/
[4]: https://github.com/richardtallent/vite-plugin-singlefile

Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
Fix up formatting and indentation of JSON ORT result data to 4 spaces
so it's aligned with other WebApp code.

Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
Update all dependencies to latest available versions
except Ant Design (antd) whose latest version has breaking API changes.

Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
@sschuberth
Copy link
Member

I've tested it as well by using two evaluation-result.json files and comparing old vs. new report.

Thanks for the effort you've put into testing this!

@tsteenbe
Copy link
Member Author

tsteenbe commented Apr 16, 2024

@fviernau All your comments have been address. The filtering issue comes from a bug in upstream Ant Design (wrong input data is returned on setting of filters). I have now downgraded the version of Ant Design used to a version without the bug - will fill a bug report upstream.

Upgrade web app code to use Ant Design (antd) v5 and update
ORT WebApp code to migrate off deprecated antd APIs.

Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
Improve code linting by defining plugins and rules in
an eslint configuration file.

Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
Automatically resolve issues flagged by eslint by running `eslint . --fix`.

Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
Resolve warning from Vite compiler that `//` should be
replaced by `/* */`.

Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
Fix up check used to determine WebApp report is template
used string comparison which in some cases incorrectly
evaluated to true.

Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
Per MDN docs for the viewport meta tag [1] the default
for initial-scale is 1 so no needed to include it.

[1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag

Signed-off-by: Thomas Steenbergen <opensource@steenbe.nl>
@sschuberth
Copy link
Member

I debugged the filtering issue and it bug in upstream Ant Design

Could you please link the upstream issue (or create one if none exists yet) so we can upvote / subscribe to it?

@tsteenbe
Copy link
Member Author

Could you please link the upstream issue (or create one if none exists yet) so we can upvote / subscribe to it?

Will do. Did already a quick check of the Ant Design issues (which is easy as many reports are in Mandarin) issue doesn't seem to be reported. Which does not surprise me as I am struggling to reproduce the bug outside of ORT - bug with a small reproducable example usually get fixed fast by Ant Design maintainers.

@fviernau
Copy link
Member

I've tested again (similar as above) with latest updated (ba81082).
My previous findings are now all fixed.

Approving as it seems to work nicely, computes a bit faster and reports are smaller (without understanding every single JS detail).

Copy link
Contributor

@heliocastro heliocastro left a comment

Choose a reason for hiding this comment

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

Results are same as previous iteraction, so good to go.

@tsteenbe tsteenbe merged commit ed7fdbe into main Apr 16, 2024
21 checks passed
@tsteenbe tsteenbe deleted the webapp-reporter-v0.3 branch April 16, 2024 19:56
sschuberth added a commit that referenced this pull request Apr 29, 2024
As of [1] the web-app reporter build became much faster. The overhead to
set up a new job now is bigger than the actual build time in most of the
cases / for incremental builds, so include the web-app reporter build
into the regular build again to simplify the setup.

[1]: #7952

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
sschuberth added a commit that referenced this pull request Apr 29, 2024
As of [1] the web-app reporter build became much faster. The overhead to
set up a new job now is bigger than the actual build time in most of the
cases / for incremental builds, so include the web-app reporter build
into the regular build again to simplify the setup.

[1]: #7952

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
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