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

Replace JSON serializer with JSON Hex Tag (User module) #31359

Conversation

lbajsarowicz
Copy link
Contributor

@lbajsarowicz lbajsarowicz commented Dec 18, 2020

Description (*)

The serializer injected into the View Model is being used to serialize data for the Store views.
When trying to use the data serialized with a regular Serializer, it ends up on crash when you have unescaped elements in your contents. That is why JsonHexTag class was introduced.

The goal of this PR is to replace the JSON serializer with the more useful/accurate one.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes magento/magento2#<issue_number>

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] Replace JSON serializer with JSON Hex Tag (User module) #31377: Replace JSON serializer with JSON Hex Tag (User module)

@m2-assistant
Copy link

m2-assistant bot commented Dec 18, 2020

Hi @lbajsarowicz. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@lbajsarowicz
Copy link
Contributor Author

@magento run all tests

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

Could you cover this change with some kind of test?

@m2-community-project m2-community-project bot added this to Changes Requested in Pull Requests Dashboard Dec 19, 2020
@ihor-sviziev ihor-sviziev added Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests Award: bug fix Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Dec 19, 2020
@ihor-sviziev
Copy link
Contributor

@magento create issue

@sidolov sidolov added the Priority: P3 May be fixed according to the position in the backlog. label Dec 23, 2020
@ihor-sviziev
Copy link
Contributor

@lbajsarowicz will you be able to cover your change with any type of test?

@lbajsarowicz
Copy link
Contributor Author

@ihor-sviziev Yes, I need few more days - sorry.

@ihor-sviziev
Copy link
Contributor

@lbajsarowicz any updates on this?

@sinhaparul sinhaparul added the Project: Community Picked PRs upvoted by the community label Aug 16, 2023
@m2-community-project m2-community-project bot added this to Changes Requested in Community Dashboard Aug 16, 2023
@m2-community-project m2-community-project bot removed this from Changes Requested in Pull Requests Dashboard Aug 16, 2023
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel engcom-Hotel self-assigned this Sep 5, 2023
@engcom-Hotel
Copy link
Contributor

engcom-Hotel commented Sep 5, 2023

Hello @ihor-sviziev,

This is to inform you that, the test is already added for the below method:

public function serialize(array $data): string
{
return $this->serializer->serialize($data);
}

Please refer to the test below:

public function testSerialize(): void
{
$this->jsonEncoderMock->expects($this->once())
->method('serialize')
->willReturnCallback(
function ($value) {
return json_encode($value);
}
);
$this->assertEquals(
json_encode(
[
'http://example.com/customer/section/load/'
]
),
$this->model->serialize(['http://example.com/customer/section/load/'])
);
}

Which has been added after this PR, Please refer to the below commit:

1239118

And the failed test seems flaky to me, hence moving this PR to the pending review bucket again.

Thanks

@engcom-Hotel engcom-Hotel moved this from Changes Requested to Ready for Testing in Community Dashboard Sep 5, 2023
@engcom-Lima
Copy link
Contributor

✔️ QA Passed

Preconditions:

  • Install fresh Magento 2.4-develop and PHP 8.1

Manual testing scenario:

  • Verified JSON serializer is updated with JSON Hex tag in app/code/Magento/User/ViewModel/JsonSerializer.php file.
  • Created multiple store views and placed orders from all of them.
  • Verified the functionality of store views in the Order page.

No additional manual test cases are required as part of regression as this PR is related to the replacement of the JSON serializer with JSON hex tag.

Builds are failed. Hence, moving this PR to Extended Testing.

@engcom-Lima engcom-Lima moved this from Testing in Progress to Extended testing (optional) in Community Dashboard Sep 12, 2023
@engcom-Echo
Copy link
Contributor

@magento run Functional Tests CE,Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo engcom-Echo self-assigned this Sep 12, 2023
@m2-community-project m2-community-project bot moved this from Extended testing (optional) to Ready for Testing in Community Dashboard Sep 12, 2023
@engcom-Echo engcom-Echo moved this from Ready for Testing to Extended testing (optional) in Community Dashboard Sep 12, 2023
@engcom-Echo
Copy link
Contributor

@magento run Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run Functional Tests CE,Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

Functional Tests CE failures are different on last two run on same commit.
Run1
Screenshot 2023-09-13 at 9 11 00 AM

Run2
Screenshot 2023-09-13 at 9 11 05 AM

Integration Tests Failure is known failure not related to this PR. Hence moving it to merge in progress

@engcom-Echo engcom-Echo moved this from Extended testing (optional) to Merge in Progress in Community Dashboard Sep 13, 2023
@magento-devops-reposync-svc magento-devops-reposync-svc merged commit e423b68 into magento:2.4-develop Oct 20, 2023
10 of 12 checks passed
@engcom-Charlie engcom-Charlie moved this from Merge in Progress to Recently Merged in Community Dashboard Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Award: bug fix Component: User Partner: Blue Acorn iCi partners-contribution Pull Request is created by Magento Partner Priority: P3 May be fixed according to the position in the backlog. Progress: accept Project: Community Picked PRs upvoted by the community Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Community Dashboard
Recently Merged
Development

Successfully merging this pull request may close these issues.

[Issue] Replace JSON serializer with JSON Hex Tag (User module)
9 participants