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

Restore and modernize resourceRegistries ETag. #65

Merged
merged 8 commits into from
Feb 1, 2021

Conversation

mauritsvanrees
Copy link
Sponsor Member

In plone.app.caching version 2, for Plone 5.2+, the resourceRegistries ETag was removed, because this ETag handled the old css/kss/js resource registry tools, which are gone now. Good.
But there was no upgrade step for this, so for existing sites upgraded from 5.1 to 5.2, you get lots of warnings in the logs: "Could not find value adapter for ETag component resourceRegistries". I reported this in issue #61. In that issue, I propose several solutions.

This PR chooses (I think) the most elegant of the solutions: reintroduce the resourceRegistries ETag, but make it valid for the new-style Plone 5 resource registries. The ETag returns the timestamp from the production bundle: http://localhost:8080/Plone/portal_resources/resource_overrides/production/timestamp.txt/manage_main

The ETag is added to the same settings where it was previously, by partially reverting a commit. Where catalogCounter is, we add resourceRegistries, except in the feeds. Still sounds logical.

The assumption is that this ETag is still as useful and needed as it ever was, for the same reasons, and that the existing ETag should have already been updated in Plone 5.0, but this was overlooked. (Not that I blame anyone.)

While I was at it, I fixed a few minor issues in the tests, mostly unclosed files.

I don't think this needs migration:

  • A Plone 5.1 site migrated to 5.2 will still have the resourceRegistries in the ETags, unless an admin removed them manually or with a policy package.
  • A 5.2.2 site will not have it in the cache settings, but it's not so bad.
  • We could add it in the settings, but we cannot really know if the admin wants it. Maybe some people have always removed this ETag in all their sites, already in Plone 4. Let's not mess with existing sites.

@mister-roboto

This comment has been minimized.

@mauritsvanrees
Copy link
Sponsor Member Author

@jenkins-plone-org please run jobs

1 similar comment
@mauritsvanrees
Copy link
Sponsor Member Author

@jenkins-plone-org please run jobs

@mauritsvanrees
Copy link
Sponsor Member Author

Jenkins Plone 6 passes, but all Plone 5 jobs have failures. They seem unrelated. Let's try again:

@jenkins-plone-org please run jobs

@mauritsvanrees
Copy link
Sponsor Member Author

And we are green.
Ready for review.

@mauritsvanrees mauritsvanrees force-pushed the maurits/restore-resource-registries branch from f325791 to 15624e4 Compare October 13, 2020 06:54
@mauritsvanrees
Copy link
Sponsor Member Author

I have rebased on master to fix a merge conflict, and force pushed.

@jenkins-plone-org please run jobs

@frapell
Copy link
Sponsor Member

frapell commented Jan 25, 2021

@jenkins-plone-org please run jobs

@frapell
Copy link
Sponsor Member

frapell commented Jan 25, 2021

@mauritsvanrees This looks good to me, however it doesn't seem to be wired with Jenkins? do we need to manually run tests?

@mauritsvanrees
Copy link
Sponsor Member Author

According to my comment it originally passed on Plone 6 and failed on Plone 5, but that got fixed.
Problem is that since recently the master branch is for Plone 6 only. And the @jenkins-plone-org please run jobs comment does not yet work for Plone 6. Plone 5.2 uses branch 2.x.
So for Plone 6 we need to start the the jobs manually.
I prefer a rebase on master instead of merging master into this. Maybe that's just me. I am looking into it.
And now I need an extra PR for merging this into the 2.x branch.

@frapell
Copy link
Sponsor Member

frapell commented Jan 25, 2021

@mauritsvanrees Ouch, sorry for merging before asking :/ feel free to force push it to fit your preference :)

This was referenced Jan 25, 2021
@mauritsvanrees mauritsvanrees force-pushed the maurits/restore-resource-registries branch from 5ad5170 to bdd8fe5 Compare January 25, 2021 21:47
@mauritsvanrees
Copy link
Sponsor Member Author

@mauritsvanrees Ouch, sorry for merging before asking :/ feel free to force push it to fit your preference :)

That's okay. Thanks for reviewing this PR and getting the ball rolling again!
After I rebased locally, I compared with your merge and it boiled down to the same code except for minor details, so both ways work. I force pushed.
But I see far too many test failures locally, so I need to look into that.

@mauritsvanrees
Copy link
Sponsor Member Author

Some tests fail because they fail on master too. We'll have to wait until that gets sorted out.
See ed4d6b0

Copy link
Sponsor Member

@frapell frapell left a comment

Choose a reason for hiding this comment

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

LGTM

…ries.

Fixes warning "Could not find value adapter for ETag component resourceRegistries".
…rceRegistries removed"

This partially reverts commit b18dedb.

Specifically:

- This reintroduces the resourceRegistries ETag in the various caching profiles.
- Adds documentation for the ETag.
- Adapts the tests to expect content for the ETag.

The tests will need changes though.

The legacy resource registries (portal_css/kss/javascript) are definitely not supported with this revert.
This is only about the "new-style" Plone 5 resource registries in `@@resourceregistry-controlpanel`.
The previous code blindly removed the last etag, assuming it was the time based resourceRegistries ETag.
This is true again, after reintroducing the modernized version of this ETag, but it was not true before.

Moved the two versions of the _normalize_etag function to normalize_etag in test_utils.py.
Fixed it there to only remove the last component when the current year is in it.
@jensens jensens force-pushed the maurits/restore-resource-registries branch from 2463875 to fea0e1a Compare February 1, 2021 16:26
@jensens jensens merged commit 86df884 into master Feb 1, 2021
@jensens jensens deleted the maurits/restore-resource-registries branch February 1, 2021 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants