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

undo icontentish interface #3836

Merged
merged 10 commits into from
Oct 24, 2023
Merged

undo icontentish interface #3836

merged 10 commits into from
Oct 24, 2023

Conversation

Akshat2Jain
Copy link
Member

@Akshat2Jain Akshat2Jain commented Sep 3, 2023

fixes #3833

also related to plone/plone.restapi#1674

@mister-roboto
Copy link

@Akshat2Jain thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

Products/CMFPlone/Portal.py Outdated Show resolved Hide resolved
@davisagli
Copy link
Member

@jenkins-plone-org please run jobs

@wesleybl
Copy link
Member

wesleybl commented Sep 5, 2023

The tests are failing with the error:

File "/home/jenkins/.buildout/eggs/cp311/Products.CMFUid-4.0-py3.11.egg/Products/CMFUid/UniqueIdAnnotationTool.py", line 86, in handleUidAnnotationEvent
    uidtool.unregister(ob)
'NoneType' object has no attribute 'unregister'

in this line of this subscriber:

https://github.com/zopefoundation/Products.CMFUid/blob/8ac5c69df3d8d008561b9ace1cb5fc43d3d3bf1d/src/Products/CMFUid/UniqueIdAnnotationTool.py#L86

The error occurs when creating a Plone Site. It looks like the subscriber wants to use the portal_uidhandler tool, but it hasn't been created yet. Then this line could test if it exists, looking like this:

if anno_tool is not None and uidtool is not None:

@Akshat2Jain
Copy link
Member Author

The tests are failing with the error:

File "/home/jenkins/.buildout/eggs/cp311/Products.CMFUid-4.0-py3.11.egg/Products/CMFUid/UniqueIdAnnotationTool.py", line 86, in handleUidAnnotationEvent
    uidtool.unregister(ob)
'NoneType' object has no attribute 'unregister'

in this line of this subscriber:

https://github.com/zopefoundation/Products.CMFUid/blob/8ac5c69df3d8d008561b9ace1cb5fc43d3d3bf1d/src/Products/CMFUid/UniqueIdAnnotationTool.py#L86

The error occurs when creating a Plone Site. It looks like the subscriber wants to use the portal_uidhandler tool, but it hasn't been created yet. Then this line could test if it exists, looking like this:

if anno_tool is not None and uidtool is not None:

@wesleybl what do I have to do in this?

@wesleybl
Copy link
Member

@polyester @icemac

@Akshat2Jain have already signed the Plone contributor agreement. Could you add it to zopefoundation, so I can fix this error?

@Akshat2Jain
Copy link
Member Author

any progress?

@polyester
Copy link
Member

I'm not too sure what my role here is. For historical reasons, we need a (separate) contributor agreement for the Zopefoundation repos; that can be signed here: https://sign.plone.org/d/FTU6XN6qrGtoni

Is the question if @icemac should put that in there for him? Or if @Akshat2Jain does it there himself? I'm not at all familiar with the Zope codebase, testing infrastructure, and customs, although @jaroel is I think so maybe he knows.

@wesleybl
Copy link
Member

@Akshat2Jain please sign the Zopefoundation contributor agreement. This way you can make a PR for Products.CMFUid

@Akshat2Jain
Copy link
Member Author

@Akshat2Jain please sign the Zopefoundation contributor agreement. This way you can make a PR for Products.CMFUid

Done

@Akshat2Jain
Copy link
Member Author

@wesleybl I have been added to the Zope Foundation. Please guide what I have to do next.

@wesleybl
Copy link
Member

@Akshat2Jain you need to make a PR on Products.CMFUid, with what was explained in: #3836 (comment)

@Akshat2Jain
Copy link
Member Author

@wesleybl can you run jobs again?

@wesleybl
Copy link
Member

@Akshat2Jain It's no use running the jobs again. We need a new release of Products.CMFUid with the modifications made in zopefoundation/Products.CMFUid#23

@wesleybl
Copy link
Member

wesleybl commented Oct 2, 2023

@Akshat2Jain a new 4.1 release of Products.CMFUid is available. You now need to do a PR on buildout.coredev updating the version:

https://github.com/plone/buildout.coredev/blob/54aaf0f60c79f1e0038f832180b506a71c4498bb/versions.cfg#L151

@wesleybl
Copy link
Member

wesleybl commented Oct 9, 2023

@jenkins-plone-org please run jobs

@wesleybl
Copy link
Member

@davisagli @jaroel @Akshat2Jain the errors with Products.CMFUid are gone.

We now have two tests failing in plone.api. Are they:

These tests count the number of objects returned by searching the catalog through the object_provides index, using the IContentish interface. As Plone Site now also implements this interface, the number of objects has increased by one. Therefore, I think it is only necessary to fix the number of objects in the test asserts.

@Akshat2Jain , can you make a PR on plone.api fxing these tests?

@wesleybl
Copy link
Member

@Akshat2Jain can you please make a PR like this in branch 6.0.x?

https://github.com/plone/Products.CMFPlone/tree/6.0.x

@Akshat2Jain
Copy link
Member Author

@davisagli @jaroel @Akshat2Jain the errors with Products.CMFUid are gone.

We now have two tests failing in plone.api. Are they:

These tests count the number of objects returned by searching the catalog through the object_provides index, using the IContentish interface. As Plone Site now also implements this interface, the number of objects has increased by one. Therefore, I think it is only necessary to fix the number of objects in the test asserts.

@Akshat2Jain , can you make a PR on plone.api fxing these tests?

this pr would be on the master branch? @wesleybl

@Akshat2Jain
Copy link
Member Author

@Akshat2Jain can you please make a PR like this in branch 6.0.x?

https://github.com/plone/Products.CMFPlone/tree/6.0.x

and this pr would be on 6.0x branch? @wesleybl

@wesleybl
Copy link
Member

this pr would be on the master branch?

in master of https://github.com/plone/plone.api

and this pr would be on 6.0x branch?

in branch 6.0.x of https://github.com/plone/Products.CMFPlone

@wesleybl
Copy link
Member

wesleybl commented Oct 11, 2023

@Akshat2Jain can you please make a PR like this in branch 6.0.x?

@Akshat2Jain the "like this" is the PR we are in now #3836, but in branch 6.0.x.

@wesleybl
Copy link
Member

@jaroel did you manage to make this test fail locally? What did you do?

@jaroel
Copy link
Member

jaroel commented Oct 19, 2023

@jenkins-plone-org please run jobs

@jaroel
Copy link
Member

jaroel commented Oct 19, 2023

@wesleybl Sorry, I had a left over change. My buildout.coredev only checks out Products.CMFPlone branch=undo_icontentish and the test passes.

I fetched origin and then merged origin/master in. That should correctly disable that thingy I do in

if __version__ < "7":
# This sets SKIP_PTA to skip the check for
# Publication through acquisition in Plone 6.
# Please remove this code block when can.
import Products.CMFCore.explicitacquisition
from Products.CMFCore.explicitacquisition import PTA_ENV_KEY
os.environ[PTA_ENV_KEY] = os.environ.get(PTA_ENV_KEY, "false")
# Importing (from) the module sets SKIP_PTA. We need to override that too.
Products.CMFCore.explicitacquisition.SKIP_PTA = os.environ[PTA_ENV_KEY] == "false"

@wesleybl
Copy link
Member

@jaroel anyway, this doesn't explain why the test fails in Jenkins and works locally. Are any environment variables set in Jenkins?

@gforcada can you help here?

@jaroel
Copy link
Member

jaroel commented Oct 20, 2023

I'm setting SKIP_PTA in https://github.com/plone/plone.rest/blob/5f9898970f871008e84b254bf73ff13f48218bbc/src/plone/rest/tests/test_explicitacquisition.py#L67-L118, which then leaks into our test_site_serializer.py.

I can reproduce with ./bin/test -t test_portal_root -t test_site_root_get_request. Order is important here

@wesleybl
Copy link
Member

@jaroel so you need to test the environment variable at the end of these tests and set the SKIP_PTA variable again, to restore the default behavior. Can you take care of it?

@jaroel
Copy link
Member

jaroel commented Oct 20, 2023

@wesleybl please look here: plone/plone.rest#168

@wesleybl
Copy link
Member

@jaroel anyway, it would be good to create a test similar to test_site_root_get_request, but setting SKIP_PTA to false. In the end, it was a good thing the test failed.

@jaroel
Copy link
Member

jaroel commented Oct 20, 2023

@wesleybl No, there should be no difference.
There is a bug in plone.rest though, but that's out of scope for this PR.

@wesleybl
Copy link
Member

No, there should be no difference.

But if someone uses SKIP_PTA = false, restapi will not work. That's why I think it's worth creating the test.

There is a bug in plone.rest though

Was it this bug that caused the test to fail? Is there already an issue about this? Can you point?

@jaroel
Copy link
Member

jaroel commented Oct 20, 2023

@jenkins-plone-org please run jobs

note to self: This is gonna be useless because the plone.rest stuff isn't merge yet, isn't it?

@jaroel
Copy link
Member

jaroel commented Oct 20, 2023

There is a bug in plone.rest though

Was it this bug that caused the test to fail? Is there already an issue about this? Can you point?

plone/plone.rest#169

@wesleybl
Copy link
Member

@jenkins-plone-org please run jobs

@jaroel I think the tests will pass now. But I don't know if we should merge this before fix plone/plone.rest#169. If someone uses SKIP_PTA = false, restapi will not work.

@jaroel
Copy link
Member

jaroel commented Oct 20, 2023

@wesleybl No worries, nobody uses that. It's just there so we don't ship it as enabled by default.

@wesleybl
Copy link
Member

@jaroel can you please take care of #3856?

@jaroel
Copy link
Member

jaroel commented Oct 20, 2023

@jaroel can you please take care of #3856?

amanhã, amanhã (I think I used that correctly)

@wesleybl
Copy link
Member

@jenkins-plone-org please run jobs

news/3833.bugfix Show resolved Hide resolved
@jaroel
Copy link
Member

jaroel commented Oct 23, 2023

@davisagli how do you feel about landing this IContentish branch?

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

Looks good to me. I also looked through the zopefoundation and plone github organizations for references to IContentish, just to see if there was anything that might be surprising, and I think it should be okay (as also indicated by the state of the tests).

I think I would keep it for 6.1 (master) only though and not make this change for 6.0 at this point.

Special thanks to @Akshat2Jain and @wesleybl for your persistence and patience with this one!

@mauritsvanrees mauritsvanrees dismissed wesleybl’s stale review October 24, 2023 09:15

We will keep it at bugfix instead of feature.

@mauritsvanrees mauritsvanrees merged commit 6a8eb55 into master Oct 24, 2023
@mauritsvanrees mauritsvanrees deleted the undo_icontentish branch October 24, 2023 09:16
@wesleybl
Copy link
Member

I think I would keep it for 6.1 (master) only though and not make this change for 6.0 at this point.

If we don't have this in Plone 6.0, it won't be possible to fix plone/plone.restapi#1674 in an easy way, since we don't have a version of restapi just for Plone 6.1

@wesleybl
Copy link
Member

I think it would be good to have an upgrade step to reindex the Plone Site, since we have indexes that have interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Un-remove IContentish from site root class
7 participants