Skip to content

Preserve expiry dates from nested cache collectors - #19509

Draft
timkelty wants to merge 2 commits into
5.xfrom
timkelty/fix-nested-cache-expiry
Draft

Preserve expiry dates from nested cache collectors#19509
timkelty wants to merge 2 commits into
5.xfrom
timkelty/fix-nested-cache-expiry

Conversation

@timkelty

Copy link
Copy Markdown
Contributor

Nested element-cache collectors could discard their expiry when the parent collector did not have one yet. Preserve the nested duration so outer caches cannot outlive expirable content.

Discovered while reviewing #19508.

Supersedes #19507 after the branch was renamed.

Copilot AI lite review requested due to automatic review settings August 28, 2026 16:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a subtle bug in nested element-cache info collection where a nested collector’s expiry could be lost if the parent collector didn’t yet have an expiry, ensuring outer caches can’t outlive expirable content.

Changes:

  • Preserve nested cache duration when unwinding nested cache-info collectors (even if the parent duration is currently null).
  • Add a unit test that reproduces the nested-collector expiry-loss scenario and asserts the resulting duration is bounded as expected.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/services/Elements.php Ensures nested collected expiry duration is retained when parent duration hasn’t been set yet.
tests/unit/services/ElementsTest.php Adds coverage validating nested cache collection preserves expiry duration for the outer collector.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/services/Elements.php Outdated
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.

2 participants