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

[2.x][Console] Add support for JSON with long numerals (#4562) #5095

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

AMoo-Miki
Copy link
Collaborator

@AMoo-Miki AMoo-Miki commented Sep 22, 2023

Backport 0709333 from #4562

Note: This is not just a simple cherry-pick; the logic had to be modified a lot to accommodate simultaneous use of the 2 versions of the JS client.


[Console] Add support for JSON with long numerals (#4562)
Also:

  • Add support for parsing and stringifying JSON with long numerals into @osd/std
  • Upgrade to @opensearch/[email protected] which supports long numerals
  • Add support for long numerals to http/fetch

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Merging #5095 (5ba4587) into 2.x (7ae32d6) will increase coverage by 0.06%.
The diff coverage is 91.33%.

@@            Coverage Diff             @@
##              2.x    #5095      +/-   ##
==========================================
+ Coverage   66.48%   66.54%   +0.06%     
==========================================
  Files        3402     3403       +1     
  Lines       64982    65084     +102     
  Branches    10374    10402      +28     
==========================================
+ Hits        43201    43310     +109     
+ Misses      19218    19207      -11     
- Partials     2563     2567       +4     
Flag Coverage Δ
Linux_1 34.82% <15.46%> (-0.05%) ⬇️
Linux_2 55.34% <91.22%> (+0.14%) ⬆️
Linux_3 44.61% <65.35%> (+0.22%) ⬆️
Linux_4 35.02% <30.17%> (-0.03%) ⬇️
Windows_1 34.84% <15.46%> (-0.05%) ⬇️
Windows_2 55.30% <91.22%> (+0.14%) ⬆️
Windows_3 44.61% <65.35%> (+0.22%) ⬆️
Windows_4 35.02% <30.17%> (-0.03%) ⬇️

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

Files Coverage Δ
packages/osd-std/src/index.ts 100.00% <100.00%> (ø)
src/core/public/http/fetch.ts 96.05% <100.00%> (ø)
...rc/core/server/opensearch/client/cluster_client.ts 86.36% <100.00%> (+2.15%) ⬆️
src/core/server/opensearch/client/mocks.ts 98.21% <100.00%> (ø)
...equest_to_opensearch/send_request_to_opensearch.ts 70.49% <100.00%> (ø)
...lugins/console/public/lib/opensearch/opensearch.ts 75.00% <ø> (ø)
src/plugins/console/public/lib/utils/index.ts 86.04% <100.00%> (+27.90%) ⬆️
...port__/xjson/json_xjson_translation_tools/index.ts 90.90% <100.00%> (+9.09%) ⬆️
.../core/server/opensearch/client/configure_client.ts 80.76% <66.66%> (-3.24%) ⬇️
src/plugins/console/public/services/storage.ts 0.00% <0.00%> (ø)
... and 2 more

@AMoo-Miki AMoo-Miki force-pushed the backport/4562 branch 2 times, most recently from a15fd54 to b2debc6 Compare September 22, 2023 21:31
@AMoo-Miki AMoo-Miki marked this pull request as draft September 25, 2023 16:52
@AMoo-Miki AMoo-Miki force-pushed the backport/4562 branch 4 times, most recently from 396d2c8 to 8ee7ff5 Compare September 26, 2023 21:27
@AMoo-Miki AMoo-Miki marked this pull request as ready for review September 26, 2023 21:27
@AMoo-Miki AMoo-Miki changed the title [Console] Add support for JSON with long numerals (#4562) [2.x][Console] Add support for JSON with long numerals (#4562) Sep 26, 2023
…#4562)(opensearch-project#5130)

Also:
* Add support for parsing and stringifying JSON with long numerals into `@osd/std`
* Upgrade to `@opensearch/[email protected]` which supports long numerals
* Add support for long numerals to `http/fetch`
* Improve testing of clients with long numerals support

Signed-off-by: Miki <[email protected]>
Copy link
Member

@kavilla kavilla left a comment

Choose a reason for hiding this comment

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

Getting harder to support dependency management BWC 😢. But thanks Miki!

Trying to think of a way to handle this in the future without doing it like this but every way seems like over engineering.

@kavilla
Copy link
Member

kavilla commented Sep 28, 2023

Added the 2.11 label

Copy link
Member

@joshuarrrr joshuarrrr left a comment

Choose a reason for hiding this comment

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

I have no objections, but just trying to wrap my head around our usage of both client and client next.

Comment on lines +56 to +57
? new ClientNext({ ...clientOptions, enableLongNumeralSupport: true } as ClientOptionsNext)
: new Client(clientOptions as ClientOptions);
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to avoid ClientNext by default? Is there a breaking change failure case that's supported but incompatible with long numeral support?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The simplest breaking change is introduced by differing typing as a result of changes to ClientOptions. It is the same reason that we couldn't replace the JS client v1 with v2 in 2.x earlier.

@AMoo-Miki
Copy link
Collaborator Author

Trying to think of a way to handle this in the future without doing it like this but every way seems like over engineering.

I propose more often major bumps; not every other month kind of thing but perhaps a once yearly one to allow us to introduce potentially breaking changes that are needed to provide users a better piece of software.

@joshuarrrr joshuarrrr merged commit bc9e6fd into opensearch-project:2.x Oct 2, 2023
56 checks passed
kavilla pushed a commit to opensearch-project/opensearch-dashboards-functional-test that referenced this pull request Oct 19, 2023
Because of opensearch-project/OpenSearch-Dashboards#5095, the URL parsing is handled differently on main branch and 2.x branch. Therefore, this cypress test on 2.x branch needs to be modified.

Signed-off-by: Qingyang(Abby) Hu <[email protected]>
opensearch-trigger-bot bot pushed a commit to opensearch-project/opensearch-dashboards-functional-test that referenced this pull request Oct 19, 2023
Because of opensearch-project/OpenSearch-Dashboards#5095, the URL parsing is handled differently on main branch and 2.x branch. Therefore, this cypress test on 2.x branch needs to be modified.

Signed-off-by: Qingyang(Abby) Hu <[email protected]>
(cherry picked from commit 518ce68)
kavilla pushed a commit to opensearch-project/opensearch-dashboards-functional-test that referenced this pull request Oct 19, 2023
Because of opensearch-project/OpenSearch-Dashboards#5095, the URL parsing is handled differently on main branch and 2.x branch. Therefore, this cypress test on 2.x branch needs to be modified.

Signed-off-by: Qingyang(Abby) Hu <[email protected]>
(cherry picked from commit 518ce68)

Co-authored-by: Qingyang(Abby) Hu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants