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

[Console] Enhance support for JSON with long numerals #5130

Merged

Conversation

AMoo-Miki
Copy link
Collaborator

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

Description

Enhance support for JSON with long numerals: Followup to #4562

  • Improve testing of clients with long numerals support
  • Work around serializer inheritance in the JS client

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

* Improve testing of clients with long numerals support
* Work around serializer inheritance in the JS client

Signed-off-by: Miki <miki@amazon.com>
@AMoo-Miki AMoo-Miki added Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry do not backport labels Sep 27, 2023
AMoo-Miki added a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Sep 27, 2023
…#4562)(opensearch-project#5130)

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

Signed-off-by: Miki <miki@amazon.com>
@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Merging #5130 (71e9f6b) into main (46d7c2d) will increase coverage by 0.00%.
Report is 1 commits behind head on main.
The diff coverage is 83.33%.

@@           Coverage Diff           @@
##             main    #5130   +/-   ##
=======================================
  Coverage   66.50%   66.50%           
=======================================
  Files        3403     3403           
  Lines       65026    65030    +4     
  Branches    10401    10403    +2     
=======================================
+ Hits        43243    43246    +3     
- Misses      19214    19294   +80     
+ Partials     2569     2490   -79     
Flag Coverage Δ
Linux_1 34.82% <ø> (ø)
Linux_2 55.31% <83.33%> (+<0.01%) ⬆️
Linux_3 44.60% <41.66%> (-0.01%) ⬇️
Linux_4 34.88% <25.00%> (-0.01%) ⬇️
Windows_1 34.83% <ø> (ø)
Windows_2 55.28% <83.33%> (+<0.01%) ⬆️
Windows_3 44.60% <41.66%> (-0.01%) ⬇️
Windows_4 34.88% <25.00%> (-0.01%) ⬇️

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

Files Coverage Δ
...rc/core/server/opensearch/client/cluster_client.ts 86.36% <100.00%> (+0.64%) ⬆️
src/core/server/opensearch/client/mocks.ts 98.24% <100.00%> (+0.03%) ⬆️
.../core/server/opensearch/client/configure_client.ts 81.48% <33.33%> (-2.52%) ⬇️

... and 19 files with indirect coverage changes

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.

@AMoo-Miki I don't have enough expertise to really evaluate, but it seems fine.

However, the increased complexity of supporting all these mixed modes seems like it might be worth going back to first principles to see if there's a way we can simplify our JSON handling overall.

@joshuarrrr
Copy link
Member

Work around serializer inheritance in the JS client

Can you elaborate on why we can't fix this in the JS client instead? Is it semver related?

@AMoo-Miki
Copy link
Collaborator Author

However, the increased complexity of supporting all these mixed modes seems like it might be worth going back to first principles to see if there's a way we can simplify our JSON handling overall.

That was exactly what I was thinking when I added the serialization and deserialization to @osd/std in #4562, that we will gradually change everything we do to use those methods.

@AMoo-Miki
Copy link
Collaborator Author

Can you elaborate on why we can't fix this in the JS client instead? Is it semver related?

We create instances of Client at the root and serve child clients of them when asScoped() is called by whoever wants to communicate with OpenSearch.

A child client is simply a new Client that is instantiated using the same parameters that the parent was instantiated with. The JS client has a few such inherited props and changing how those work on the JS client would mean an architectural change for them which constitutes a breaking change.

On the other hand, If I was the JS client and I was asked to change the inheritance, I would reply that a Client is just a holder of options and any action is triggered only by calling the request method. Hence, creating numerous instances of Client don't add any burden and anyone who doesn't want inheritance can choose to create an instance of the Client.

joshuarrrr pushed a commit that referenced this pull request Oct 2, 2023
Also:
* Add support for parsing and stringifying JSON with long numerals into `@osd/std`
* Upgrade to `@opensearch/opensearch-next@2.3.1` which supports long numerals
* Add support for long numerals to `http/fetch`
* Improve testing of clients with long numerals support

Signed-off-by: Miki <miki@amazon.com>
@joshuarrrr joshuarrrr merged commit 588efcd into opensearch-project:main Oct 3, 2023
82 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-5130-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 588efcd887f5917e5aca6593ffae1a8e10629d35
# Push it to GitHub
git push --set-upstream origin backport/backport-5130-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-5130-to-2.x.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-5130-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 588efcd887f5917e5aca6593ffae1a8e10629d35
# Push it to GitHub
git push --set-upstream origin backport/backport-5130-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-5130-to-2.x.

@joshuarrrr
Copy link
Member

should not be backported

Leo7Deng pushed a commit to Leo7Deng/OpenSearch-Dashboards that referenced this pull request Oct 4, 2023
…ject#5130)

* Improve testing of clients with long numerals support
* Work around serializer inheritance in the JS client

Signed-off-by: Miki <miki@amazon.com>
Signed-off-by: Leo Deng <leo7deng@gmail.com>
willie-hung pushed a commit to willie-hung/OpenSearch-Dashboards that referenced this pull request Oct 5, 2023
…ject#5130)

* Improve testing of clients with long numerals support
* Work around serializer inheritance in the JS client

Signed-off-by: Miki <miki@amazon.com>
Signed-off-by: Willie Hung <willie880201044@gmail.com>
SuZhou-Joe pushed a commit to SuZhou-Joe/OpenSearch-Dashboards that referenced this pull request Oct 7, 2023
…ject#5130)

* Improve testing of clients with long numerals support
* Work around serializer inheritance in the JS client

Signed-off-by: Miki <miki@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distinguished-contributor do not backport Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry v3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants