Skip to content

Remove usage of obsolete property $_isScopePrivate #31754

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

Conversation

mrtuvn
Copy link
Contributor

@mrtuvn mrtuvn commented Jan 19, 2021

Description (*)

In old codebase developers still use this property in someplace. We should clean that to follow best practices
https://devdocs.magento.com/guides/v2.4/extension-dev-guide/cache/page-caching/private-content.html#config-cache-priv-how-block
Search results return around 59 blocks still have this property. It's quite lot and can make break change if we refactor this

Just wonder if blocks created not from layout and created via other place (Controllers, Template view), How we can manager cache for that after remove isScopePrivate property

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes More than core 80 blocks use _isScopePrivate in spite of being officially described as _not working properly_ #30506

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

CC: @ihor-sviziev @ericmorand @marvinhinz @orlangur @sidolov
Feel free to give me any 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)

@m2-assistant
Copy link

m2-assistant bot commented Jan 19, 2021

Hi @mrtuvn. 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.5-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

ℹ️ 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

@ihor-sviziev
Copy link
Contributor

TBH I don't think it's a bad practice to use _isScopePrivate. It would be good to understand what issues it's causing.
The cacheable=false causing the entire page to be not cached at all.

@mrtuvn mrtuvn force-pushed the get-rid-off-old-property-scope-private branch 2 times, most recently from d566665 to 07438f7 Compare January 19, 2021 10:14
@mrtuvn
Copy link
Contributor Author

mrtuvn commented Jan 19, 2021

We should update more in docs related with this. Maybe add some real-world use case for example. Seem currently it's not clearly at my point of view

@mrtuvn mrtuvn force-pushed the get-rid-off-old-property-scope-private branch from 07438f7 to 382d77f Compare January 19, 2021 10:29
@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Jan 19, 2021

It seems like a message about not using _isScopePrivat was added a long time ago, in 2016 magento/devdocs@a75a7a9#diff-21ef8286af3f0fb99ca6976a2c50f78693f2fe7e46b6394635ac8112792087adR62-R64.

@sivaschenko @sidolov, could you explain why this approach was deprecated and should work incorrectly but still used in the core?

@sivaschenko
Copy link
Member

@ihor-sviziev I believe the reason to walk away from $_isScopePrivate is to handle and invalidate private data more precisely that is possible with customer data sections.

The property was not yet deprecated by core teams due to low priority, internal ticket: https://jira.corp.magento.com/browse/MAGETWO-56701

@sivaschenko
Copy link
Member

This pull request not fixing but is related to the issue #30506 (just to create a link)

@sivaschenko
Copy link
Member

I'd probably try to deprecate the property in 2.4 and remove in 2.5, @gabrieldagama @sidolov what do you think?

@mrtuvn
Copy link
Contributor Author

mrtuvn commented Jan 19, 2021

Should i re-target branch and update issue link ?

@mrtuvn mrtuvn changed the base branch from 2.5-develop to 2.4-develop January 19, 2021 14:13
@mrtuvn mrtuvn marked this pull request as ready for review January 19, 2021 14:14
@sivaschenko
Copy link
Member

@mrtuvn considering the tumb-ups, yes, please

Thanks! :)

/**
* @var bool
*/
protected $_isScopePrivate = true;
Copy link
Member

Choose a reason for hiding this comment

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

While it should be ok to remove the redeclarations of the inherited property with the same value, I don't think we should remove the $_isScopePrivate = true in this pull request (that should be done in 2.5 as part as deprecated property removal preparation)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should i need revert all that ? only keep deprecate notes

Copy link
Member

@sivaschenko sivaschenko Jan 19, 2021

Choose a reason for hiding this comment

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

This is the only file where the removal should be reverted

@sivaschenko sivaschenko added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Jan 19, 2021
@sivaschenko
Copy link
Member

Prioritized as P2 as missing the deprecated tag on the property prevents any further progress in moving to best practices in this direction

@mrtuvn mrtuvn force-pushed the get-rid-off-old-property-scope-private branch 3 times, most recently from 89d3a2c to ffc0d75 Compare January 19, 2021 15:00
@ihor-sviziev
Copy link
Contributor

@magento run all tests

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-8668 has been created to process this Pull Request

@engcom-Bravo
Copy link
Contributor

✔️ QA Passed

Manual testing scenario

  1. Open Magento project in PHP Storm, for example
  2. Go to /app/code/Magento
  3. Search for text $this->_isScopePrivate = true

AFTER applying changes provided in this PR, all the $this->_isScopePrivate = true are marked as Deprecated
see an example
is_deprecated

@mrtuvn mrtuvn force-pushed the get-rid-off-old-property-scope-private branch from ffc0d75 to f340589 Compare January 21, 2021 14:54
@mrtuvn
Copy link
Contributor Author

mrtuvn commented Jan 21, 2021

Only rebase code nothing else change

@engcom-Foxtrot
Copy link
Contributor

@magento run all tests

@engcom-Bravo
Copy link
Contributor

✔️ QA Passed
The result is the same as in the report above #31754 (comment)

@mrtuvn
Copy link
Contributor Author

mrtuvn commented Jan 23, 2021

@magento run Functional Tests B2B

@m2-assistant
Copy link

m2-assistant bot commented Jan 31, 2021

Hi @mrtuvn, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@mrtuvn mrtuvn deleted the get-rid-off-old-property-scope-private branch February 5, 2021 14:46
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 Component: View Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. Type: Code Cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More than core 80 blocks use _isScopePrivate in spite of being officially described as _not working properly_
7 participants