JustPaste.it

Magento Contribution Day 2022

Magento Contribution Day is an essential event for the Magento community and its dedicated group of Magento enthusiasts. Its goal is to unite as many developers as possible to contribute to the platform's development. Almost 80% of all changes to the Magento code were added thanks to the personal and team contributions made during these events.

 

c5c8c4ef83eb9d43f3d4a8a37c3136f1.jpg

Our company has also joined this initiative. In 2022, 9 developers took part in Magento Contribution Day. They devoted a whole day to solving problems, which were super annoying from the previous version of M2. There were 2 or 3 tasks (pull requests) per person. As a result, the Perspective team has found a solution for ten tasks and put together 1477 lines of fixed code. Most tasks have a priority level of P1 and P2, meaning they need a solution as soon as possible.

 

The Advantages of Magento Contribution Day

  • Working with the maintainers and Magento core architects would give us unique insights into the platform and allow us to contribute to its development. By becoming part of Magento history, our team can enhance our code awareness and better understand the platform's capabilities. Working with the maintainers could lead to more options for our clients and a more substantial reputation in the industry.

  • We are improving the company's image within the community of the Magento development team. Earning a contributor mark for a company on GitHub is incredible for the team. Contributing to an open-source project goes from an active GitHub account desire. It helps improve the company's image within the community and shows that the team is actively involved in open-source development.

In addition to the benefits I mentioned, participating in events like Magento Contribution Day can significantly improve your dev environment.

You'll be able to work with other professionals and learn from their approaches and techniques to help you refine your workflow and become more efficient in your development process. It's a win-win situation - you get to contribute to an important project while improving your skills and knowledge.

 

How are the tasks chosen?

A new column, "good first issue," appears on the GitHub "board" during Contribution Day. Practical tasks are snapped up, but you can remove some from the High Priority issue column, just like we did. These high-priority issues involved developing features we use almost daily at work. We understood that solving the chosen tasks would provide a new perspective on M2 development.

When choosing a task, there may be a situation like this: pull request may be "empty." That is, somewhere, there is a clone of the problem with almost the same description, and ANOTHER developer (because it can be added as a person working with the company as a solo developer) described his decision to the letter (only "gaps" in different places), and it coincided. The version control system automatically shows no differences.

 

How to check the code?

How to check the code?

After completing the task, we encountered high standards of code acceptance. The "quality" of the code is checked in the first place by the machine with a set of rules. An interesting nuance is that the developer should write an autotest if this area code is new or not covered with tests. It's essential to do code reviews to have better code awareness. Writing autotests for new or untested code areas can also ensure high-quality work. According to the standards, there were almost no problems because the quality of the code was good.

There was a different situation with autotests; we thought we messed things up when we wrote, launched, and ran them. That is just because the tests broke in random places; even in those, we did not change anything. As it turned out, the collapse of some tests is typical for such an important mechanism as M2.

On the last Contribution day, we tended to take in the tasks on M2 fixation under the hood to avoid writing functional tests (i.e., the visual part). By then, we wanted to avoid playing around with the settings and WebDriver for Google Chrome. Besides that, we wanted to get away from Luma, the original M2 Theme. We understood that it would be deprecated in the nearest future little by little, which happened! Adobe released PWA studio. The Venia Theme and those more likely to choose the traditional approach decided to develop what is now called Hyva.

Further verification of the task is done by the Magento development team from the Adobe/Magento side, and the QA team plays the last, but not the least, role in this stage.

 

What tasks were solved during the last Contribution Day?

New Relic Module does not match CSP. We have taken a lot of work to allow Magento to communicate with the New Relic profiler, which allows us to speed up site loading considerably. The fix has already been accepted.

1. The browser has not allowed the loading of scripts with errors:

1
[Report Only] Refused to load the script 'https://js-agent.newrelic.com/nr-spa-1212.min.js' because it violates the following Content Security Policy directive: "script-src [.....] 'self' 'unsafe-inline' 'unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
2
[Report Only] Refused to load the script 'https://bam.nr-data.net/1/[..]etToken' because it violates the following Content Security Policy directive: "script-src [..]'unsafe-inline' 'unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

The solution of code review: A rule has been added to the browser that allows the loading of 3rd-party scripts.

2. The client's email address with the diagram is forbidden:

Example of tasks solved by Magento enthusiasts
4e85558babe79cf5bea8c86e89aca44d.png

 

 

4e85558babe79cf5bea8c86e89aca44d.png

The pre-validation function is fixed so that some characters are read:

 

{
 "message": "\"Email\" is not a valid email address."
}

The solution of Magento validation:

Example of tasks solved at Magento Contribution Day
a4bc649b43463d541c57d516a563b23e.png

 

 

a4bc649b43463d541c57d516a563b23e.png

3. The invoice does not display whether an email with an invoice has been sent.

The site administrator can track the history of the order in the office. However, the invoice was incomplete in terms of information. Our developer has added a function to the invoice page to correctly display the invoice (because the invoice number may not match the order number). Fix for issue 27474 by topanok · Pull Request #36030 · magento/magento2

4. The product availability email template should be received according to the store's settings.

Letters were sent incorrectly because the wrong template was chosen. The problem was that when items in the store collection were rearranged, the current user's store ID was constantly added to the email object. Our developers have fixed this problem. Since the template selection logic is also included in Product Price Alerts, both problems were solved at the same time. Issue-33519. Added logic for grouping alerts by store #35996 - magento/magento2

5. The Excel handler creates invalid files for numbers preceded by gaps.

When exporting data from Excel, Magento wrote invalid characters in a cell with numbers. As a result, the files could not be opened. We fixed that, so any additional information is written correctly in an Excel file.

The Magento code for Excel handler before fixing:

1
<Data ss:Type="Number"> 123</Data>

The Magento code for Excel handler after fixing:

1

<Data ss:Type="String"> 123</Data>

6. Incorrect filtering of GraphQL queries (date ranges).

At the entrance to the backend part, Magento requests the frontend part, but it did not extract any data between the dates. The developer fixed the bug. The fix has already been accepted.

magento/magento2#31537: Magento2.4 GraphQL CustomerOrders Query Logic by serbyynskyi · pull Request #36036 · magento/magento2

7. When Magento was switched to external storage mode, Logo Files did not work when printing PDF invoices.

When Magento makes PDF invoices for the administrator, it works according to the mechanisms built into the PHP programming language. And when this language was created, it did not count on the network data storage device name, so it became an obstacle in creating PDF invoices.

 

Cannot create image resource. File not found."
#1 Zend_Pdf_Image::imageWithPath() called at [vendor\/magento\/module-sales\/Model\/Order\/Pdf\/AbstractPdf.php:282]

 

Creating PDF invoices in Magento after fixing:

Creating PDF invoices in Magento after fixes

 

df79922932c964321cee7e30c832c92d.png

 

 

df79922932c964321cee7e30c832c92d.png

8. The GraphQL Routes Strip Request has a problem on the Category page.

For some reason, the front part of Magento PWA crashed in search by URL. The code did not work correctly. The developer corrected this.

Magento PWA crash before fixing:

 

{ "errors": [ { "debugMessage": "Notice: Undefined property: GraphQL\\Language\\AST\\FragmentSpreadNode::$selectionSet in /var/www/html/mage245/vendor/magento/module-catalog-graph-ql/Model/Category/DepthCalculator.php on line 83", "message": "Internal server error", "extensions": { "category": "internal" }, "locations": [ { "line": 2, "column": 5 } ], "path": [ "route" ] } ], "data": { "route": null } }

 

Magento PWA crash after fixing:

 

{ "data": { "route": { "redirect_code": 0, "relative_url": "men.html", "type": "CATEGORY", "name": "Men", "id": 11, "url_path": "men", "url_suffix": ".html", "breadcrumbs": null } } }

 

9. Administrator users cannot change the external logo in a single-store configuration

A Single Store Mode was disabled in default configurations. If you're a multi-brand store and try to adjust something, configurations remain the same when you switch from the Multi Store Page to the Single Store Page. Our developer successfully made a pull request and fixed that incorrection.

magento/magento2#35952 Admin Users unable to change frontend Logo in Design Config when in Single Store Mode by monteshot · pull Request #36008 · magento/magento2

10. Unlike the Product List In Catalog (shown below), the recently viewed widget did not include a price.

We have listed taxes in the price display on the Recently Viewed widget.

Magento Recenty Viewed widget
7946140dd0c2fb7e2ff20a93fb8e8ead.png

 

 

7946140dd0c2fb7e2ff20a93fb8e8ead.png

magento/magento2#35881: Final Price for grouped products does not include tax in the Recently Viewed Widget by shmVan · Pull Request #36041 · magento/magento2

 

Expectations

The Magento core community engineering team did a lot of work, so our tasks hovered for 2 or 3 months with green ticks. All that remained was to merge them into the main branch. After one of the task developers had a request accepted, we ordered pizza to celebrate at our office location. Next, Magento Contribution Day was more dynamic from the Adobe side. Already a week later, we had feedback from the Magento community engineering team, two of our pool requests were merged, and we were also given a Partner label on Github=)), Partner label on GitHub is not only adorable but can also be a valuable business asset as it demonstrates expertise in Magento core and credibility in the industry.

The Magento Contribution Day is an excellent opportunity for developers to contribute to the Magento community and a measure of success. The fact that the developers have a lot of work and find time to take pull requests shows how dedicated they are to improving the platform. This level of commitment can only lead to better business outcomes for both Adobe and its partners.