Skip to content

Conversation

fredden
Copy link
Member

@fredden fredden commented Oct 4, 2022

Description

When dealing with XML in Magento, the error messages are not always most helpful. When each XML document is individually valid, but the result of merging these isn't, the error message does not help a developer identify the issue.

This pull request adds the filename causing a problem to the error message output.

Before and after pictures

The following two pictures show the output from bin/magento setup:upgrade where the problem shows up.

Before:

Screenshot_2022-10-04_15-59-12

After:

Screenshot_2022-10-04_15-57-42

Manual testing scenarios

Note that if you fix/merge #36240 before this, then you will need to find alternative steps to reproduce.

  1. Ensure Magento is in "developer" mode with bin/magento deploy:mode:set developer
  2. Create a new local module in app/code/
  3. Create a valid etc/db_schema.xml file changing the 'type' of an existing column from 'int' (with 'padding') to 'varchar'. For example,
    <column xsi:type="int" name="operation_count" padding="10" unsigned="true" nullable="false" identity="false"
    comment="Total number of operations scheduled within this bulk"/>
    and
    <?xml version="1.0"?>
    <schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
        <table name="magento_bulk">
            <column xsi:type="varchar" name="operation_count" />
        </table>
    </schema>
  4. Run bin/magento setup:upgrade
  5. Witness error message

Before this change, it is very difficult to identify the location of the error.

Questions or comments

All unit tests pass both before and after this change, suggesting that the code coverage isn't ideal. Perhaps we need a separate task to improve code coverage of this class.

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)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Oct 4, 2022

Hi @fredden. Thank you for your contribution
Here are 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
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.

For more details, 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, join the Community Contributions Triage session to discuss the appropriate ticket.

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

@m2-github-services m2-github-services added Partner: Fisheye partners-contribution Pull Request is created by Magento Partner labels Oct 4, 2022
@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 re-request them if they don't show in a reasonable amount of time.

@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 re-request them if they don't show in a reasonable amount of time.

@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 re-request them if they don't show in a reasonable amount of time.

@sdzhepa sdzhepa added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Oct 6, 2022
@ihor-sviziev
Copy link
Contributor

@fredden Great job! Do you feel it's possible to cover with any type of automated 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 re-request them if they don't show in a reasonable amount of time.

2 similar comments
@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 re-request them if they don't show in a reasonable amount of time.

@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 re-request them if they don't show in a reasonable amount of time.

@fredden
Copy link
Member Author

fredden commented Oct 17, 2022

Do you feel it's possible to cover with any type of automated tests?

I don't know how to reliably cover this with a test. We could write a test using the given example, but the underlying problem is being fixed in #36240, so we'd need another test case that will reliably break. I'm open to suggestions.

@ihor-sviziev ihor-sviziev added the Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests label Oct 18, 2022
@ihor-sviziev
Copy link
Contributor

Yeah, looks like it will be too hard to cover it with test, let's skip it

@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 re-request them if they don't show in a reasonable amount of time.

@engcom-Lima
Copy link
Contributor

@magento run Functional Tests EE

@fredden
Copy link
Member Author

fredden commented Nov 22, 2022

@engcom-Delta thanks for testing. I can see that you have successfully verified the change. What changes would you like to be made to this pull request? Perhaps you meant to confirm/approve this and picked the wrong option?

@engcom-Delta
Copy link
Contributor

@fredden My apologies for that. I have updated and will move it to the appropriate column.

@engcom-Delta
Copy link
Contributor

@magento run 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 re-request them if they don't show in a reasonable amount of time.

@engcom-Delta
Copy link
Contributor

@magento run Functional Tests EE

@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 re-request them if they don't show in a reasonable amount of time.

@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 re-request them if they don't show in a reasonable amount of time.

@engcom-Delta
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 re-request them if they don't show in a reasonable amount of time.

@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 re-request them if they don't show in a reasonable amount of time.

1 similar comment
@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 re-request them if they don't show in a reasonable amount of time.

@engcom-Echo
Copy link
Contributor

@magento run 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 re-request them if they don't show in a reasonable amount of time.

1 similar comment
@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 re-request them if they don't show in a reasonable amount of time.

@engcom-Echo
Copy link
Contributor

@magento run 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 re-request them if they don't show in a reasonable amount of time.

@magento-devops-reposync-svc magento-devops-reposync-svc merged commit fd798cc into magento:2.4-develop Dec 22, 2022
@fredden fredden deleted the xml-validation/better-messaging branch December 23, 2022 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Partner: Fisheye partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Project: Community Picked PRs upvoted by the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.