Skip to content

1.21.0 - #318

Open
koriym wants to merge 8 commits into
1.xfrom
release-1.21.0
Open

1.21.0#318
koriym wants to merge 8 commits into
1.xfrom
release-1.21.0

Conversation

@koriym

@koriym koriym commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Release 1.21.0: CHANGELOG [Unreleased] becomes [1.21.0] - 2026-12-02.

Release notes

A child declared with #[Embed] is a dependency of its parent whether or not the child is cached. A write to the child invalidates the parent, with no #[Cacheable], ETag or Surrogate-Key needed on the child.

  • #[Link(rel: 'collection')] on a row's onGet(): a write to the row purges its list.

  • #[DependsOn(uri: ..., key: ...)] ties a list to the rows in its body; AppSurrogateKeyModule adds one key to every entry for whole-app invalidation.

  • Every write runs one interceptor in one order, and a write on a resource without a cache attribute invalidates its own key.

  • #[Cacheable] with private/no-store throws UnstorableDeclaration; a past expiryAt is not stored.

  • Deprecated APIs from 1.20.x are removed (src-deprecated/ stays as in 1.20.2, unmaintained).

  • AppSurrogateKeyModule's key comes first in the Surrogate-Key of each response the package stores or writes as a donut, so a CDN that ignores keys past its header limit still purges by it.

  • A write whose CDN purge fails runs its remaining purges and reads, then throws the first failure.

  • #[NoHttpCache] applies to a response of any status; #[HttpCache] still applies to a 200 only.

  • StorageRedisDsnModule compresses stored values with deflate and connects to Redis on first use by default, and requires ext-zlib.

  • ServerContextInterface extends BEAR.Sunday's ServerContextInterface; requires bear/sunday 1.10 or later.

  • ResourceStorageInterface::saveDonut() returns bool; a custom implementation must return bool.

  • #[HttpCache] and #[NoHttpCache] on a class that inherits onGet() from a parent now apply.

  • UriTag and the other classes listed under Changed require their dependency: a test that builds one with new UriTag() takes UriTagInterface from the injector instead.

Each behaviour change and removal is in CHANGELOG.md with what to do.

Why 1.21.0

New features plus behaviour changes in the cache's own invalidation. The removed APIs were deprecated in 1.20.x or were not meant to be built directly (now @internal); the cases where application code has to change (such as #[DependsOn] on a row class, or #[Purge] on a method that is not a write) are each marked in CHANGELOG.md.

Summary by CodeRabbit

  • Documentation
    • Added the 1.21.0 release notes dated December 2, 2026.
    • Documented that Redis storage uses deflate compression by default when no marshalling options are set; compression can be disabled, and requires ext-zlib.
    • Documented that Redis connections are established on first use by default, with a pool_error log entry for each request when Redis is unavailable. Connecting when the pool is created remains configurable.
    • Noted the minimum supported symfony/cache version: 6.4.12.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Automatic approval withheld

CodeRabbit could not verify the path filters used for the saved review. Run a full review using the repository's approval configuration.

A reviewer can post @coderabbitai approve as a new top-level comment to request approval.

Commit: 26de1068c0cf.

No actionable comments were generated in the recent review.

Walkthrough

The changelog replaces the Unreleased heading with the dated 1.21.0 heading. It documents Redis compression and connection behavior, configuration options, and related requirements.

Changes: Release notes

Layer / File(s) Summary
Release heading and Redis notes
CHANGELOG.md
The changelog adds the 1.21.0 heading dated 2026-12-02. It documents default deflate compression, lazy Redis connections, configuration options, and related requirements and limitations.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Other

Possibly related PRs

Merge Risk: Minimal · up to 26de1

This change only updates release notes for 1.21.0, covering Redis compression, lazy connections and the ext-zlib and symfony/cache requirements. It does not alter runtime behavior, so no merge-blocking risk remains.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Inconclusive The title "1.21.0" is only a version number. It names no change. The changeset does release 1.21.0 (changelog adds the 1.21.0 section and moves the Redis notes into it), so the title refers to a real … Replace the version-only title with a short description of the main change. For example: "Release 1.21.0: Redis deflate compression and lazy connection defaults, DependsOn cache invalidation". Keep the version number if the release naming c…
Passed Passed checks: 3 passed

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "1.21.0" is only a version number. It names no change. The changeset does release 1.21.0 (changelog adds the 1.21.0 section and moves the Redis notes into it), so the title refers to a real part of the change. It does not describe the main change: cache invalidation, Redis storage behavior changes, and removal of deprecated 1.20.x APIs. A teammate scanning history cannot tell what the release contains.

Resolution

Replace the version-only title with a short description of the main change. For example: "Release 1.21.0: Redis deflate compression and lazy connection defaults, DependsOn cache invalidation". Keep the version number if the release naming convention requires it.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f97cac9 and 26de106.

Files selected for processing: 1

  • CHANGELOG.md
Files skipped from review as they are similar to previous changes: 1

  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@koriym

koriym commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Not included in 1.21.0: the local branch self-stored-dependency (0dfe8331, "Keep the embedded dependency of a page whose putStatic() was refused"). It has never been pushed or reviewed, and its putDonut() path is unverified. It can go into a later patch release once it has a PR and reviews.

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (aca076f) to head (26de106).

Additional details and impacted files
@@             Coverage Diff             @@
##                 1.x      #318   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity       885       885           
===========================================
  Files            123       123           
  Lines           1965      1965           
===========================================
  Hits            1965      1965           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@koriym

koriym commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@koriym

koriym commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai Commit b668c83 (merged into 1.x through #319) never got a review from you: #319 was merged before you reached it, and you no longer act on #319 because it is closed. This release PR ships it, but it is not in this PR's diff.

Please review that commit's changes here: git show b668c836 -- src/RefreshAnnotatedCommand.php (a path-only #[Link(rel: 'collection')] href is resolved with BEAR\Resource\UriFactory, under the context scheme, and an href that is not a resource URI is skipped). Report any correctness problem; we will fix it in a new PR to 1.x.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

Analysis chain

Script executed:

#!/bin/bash
set -u
printf '%s\n' '--- Commit diff ---'
git show --format=fuller --stat b668c836
git show --format= -- src/RefreshAnnotatedCommand.php b668c836 2>/dev/null || true
git show b668c836 -- src/RefreshAnnotatedCommand.php
printf '%s\n' '--- File outline ---'
ast-grep outline src/RefreshAnnotatedCommand.php --items all
printf '%s\n' '--- Source ---'
cat -n src/RefreshAnnotatedCommand.php
printf '%s\n' '--- Relevant references ---'
rg -n -C 3 'RefreshAnnotatedCommand|UriFactory|rel: .collection.|rel="collection"|collectionLink|collection link' .
printf '%s\n' '--- Dependency declarations ---'
cat -n composer.json | sed -n '1,180p'

Length of output: 31881


Script executed:

#!/bin/bash
set -u
printf '%s\n' '--- Commit diff ---'
git show --format=fuller --stat b668c836
git show b668c836 -- src/RefreshAnnotatedCommand.php
printf '%s\n' '--- File outline ---'
ast-grep outline src/RefreshAnnotatedCommand.php --items all
printf '%s\n' '--- Source ---'
cat -n src/RefreshAnnotatedCommand.php
printf '%s\n' '--- Relevant references ---'
rg -n -C 3 'RefreshAnnotatedCommand|UriFactory|rel: .collection.|rel="collection"|collectionLink|collection link' .
printf '%s\n' '--- Dependency declarations ---'
cat -n composer.json | sed -n '1,180p'

Length of output: 31798


Script executed:

#!/bin/bash
set -u
for file in tests/CollectionLinkTest.php tests/RefreshAnnotatedCommandTest.php src/CommandInterceptor.php src/CacheIdentityFactory.php src/CommandQuery.php src/QueryRepository.php tests/Fake/fake-app/src/Resource/App/Collection/Comment.php; do
  printf '\n--- %s outline ---\n' "$file"
  ast-grep outline "$file" --items all
done
printf '\n--- Collection tests ---\n'
cat -n tests/CollectionLinkTest.php
printf '\n--- Collection test fixture ---\n'
cat -n tests/Fake/fake-app/src/Resource/App/Collection/Comment.php
printf '\n--- Purge and URI handling ---\n'
rg -n -C 5 'function (invoke|purge|exactTag|tag|refresh|query)|->declared\(|->purge\(|->exactTag\(' src/CommandInterceptor.php src/CacheIdentityFactory.php src/CommandQuery.php src/QueryRepository.php
printf '\n--- UriFactory or context scheme bindings ---\n'
rg -n -C 4 'ContextScheme|UriFactory|ResourceModule|QueryRepositoryModule' tests/Fake tests/CollectionLinkTest.php src
printf '\n--- Dependency source: BEAR.Resource 1.36.0 ---\n'
for name in UriFactory.php Uri.php AbstractUri.php Linker.php Exception/UriException.php; do
  printf '\n--- %s ---\n' "$name"
  curl -fsSL "https://raw.githubusercontent.com/bearsunday/BEAR.Resource/1.36.0/src/$name" | nl -ba || true
done

Length of output: 31476


Script executed:

#!/bin/bash
set -u
for file in src/CacheTags.php src/MatchQuery.php src/CommandInterceptor.php src/CacheIdentityFactory.php src/QueryRepository.php; do
  printf '\n--- %s ---\n' "$file"
  if [ -f "$file" ]; then ast-grep outline "$file" --items all; cat -n "$file" | sed -n '1,260p'; fi
done
printf '\n--- Cache tags and route handling ---\n'
rg -n -C 5 'function forUri|class CacheTags|function __invoke|FactoryInterface|ResourceFactory|ContextScheme|ResourceNotFound|UnmatchedQuery' src tests/CollectionLinkTest.php
printf '\n--- BEAR.Resource 1.36.0 factory sources ---\n'
for name in Factory.php FactoryInterface.php LinkCrawler.php ResourceModule.php; do
  printf '\n--- %s ---\n' "$name"
  curl -fsSL "https://raw.githubusercontent.com/bearsunday/BEAR.Resource/1.36.0/src/$name" | nl -ba || true
done
printf '\n--- Built-in URL validation examples ---\n'
php -r 'foreach (["page://selfcollection/posts", "page://self//example.com/posts", "https://example.com/posts", "page://self/posts", "page://self", "page://self?foo=1"] as $u) { echo $u, " valid=", var_export(filter_var($u, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), true), " parsed=", json_encode(parse_url($u)), PHP_EOL; }' 2>/dev/null || true

Length of output: 63173


Script executed:

#!/bin/bash
set -u
printf '%s\n' '--- Changed documentation ---'
git show b668c836 -- CHANGELOG.md docs/llms-full.txt
printf '\n%s\n' '--- Version and lock files ---'
fd -a 'composer\.lock|UriFactory|Linker|CollectionLink' .
printf '\n%s\n' '--- BEAR.Resource release tags ---'
gh api 'repos/bearsunday/BEAR.Resource/tags?per_page=30' --jq '.[] | [.name,.commit.sha] | @tsv' || true
printf '\n%s\n' '--- Latest 1.x source excerpts ---'
for name in UriFactory.php Uri.php Linker.php LinkCrawler.php; do
  printf '\n--- %s ---\n' "$name"
  curl -fsSL "https://raw.githubusercontent.com/bearsunday/BEAR.Resource/1.x/src/$name" | nl -ba | grep -E -C 4 'function __invoke|parse_url\(|new Uri\(|newInstance\(|function validate|FILTER_FLAG_PATH_REQUIRED' || true
done
printf '\n%s\n' '--- Validation of raw and prefixed hrefs ---'
php -r 'foreach (["/collection/posts", "collection/posts", "page://selfcollection/posts", "//example.com/posts", "page://self//example.com/posts"] as $u) { echo json_encode($u), " => ", var_export(filter_var($u, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), true), " ", json_encode(parse_url($u)), PHP_EOL; }' 2>/dev/null || true

Length of output: 11121


@koriym I found two correctness problems in commit b668c836.

  1. Relative hrefs can purge an unrelated resource. In src/RefreshAnnotatedCommand.php, Line 139, UriFactory prefixes every schemeless href, not only paths beginning with /. With the default context, collection/posts becomes page://selfcollection/posts and passes URI validation. The purge then targets /posts instead of skipping the href. The existing learning about CacheIdentityFactory::exactTag() matters here: the tag ignores the host. Consider filtering unsupported relative hrefs before calling UriFactory, and add a regression test.

  2. The documentation overstates path-only link crawling. docs/llms-full.txt, Line 146 says the purge and link crawl name the same resource. However, the permitted BEAR.Resource 1.36.0 Linker and LinkCrawler also pass the original href to new Uri($uri). For /articles, that validation throws UriException if resource lookup succeeds. The purge can work, but the crawl cannot complete. Please narrow the documentation or coordinate an upstream fix and test.

I inspected the source and existing tests. I did not run the repository tests in the sandbox.

Would you like me to open a follow-up issue for these findings?


Learnings used

Learnt from: koriym
Repo: bearsunday/BEAR.QueryRepository PR: 319
File: src/RefreshAnnotatedCommand.php:65-65
Timestamp: 2026-11-24T00:43:14.088Z
Learning: Within repository "bearsunday/BEAR.QueryRepository", only for files matching one of ["src/RefreshAnnotatedCommand.php"]: In BEAR.QueryRepository's src/RefreshAnnotatedCommand.php, when collection purge tags use CacheIdentityFactory::exactTag(), the tag depends on the URI path and sorted query, not its scheme or host. Do not assume that a changed origin leaves a collection cache entry stale when the resolved URIs are valid and have the same path and query.

You are interacting with an AI system.

@koriym

koriym commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai Thanks, both findings reproduced locally and are fixed in #320 ( #320 ): a schemeless href without a leading slash is now skipped, and the docs no longer claim parity with the link crawl. No issue needed.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@koriym Thanks for reproducing both findings and fixing them in #320. No follow-up issue is needed.


Learnings added

Learnt from: koriym
URL: https://github.com/bearsunday/BEAR.QueryRepository/pull/318

Timestamp: 2026-11-24T03:58:31.986Z
Learning: Within repository "bearsunday/BEAR.QueryRepository", only for files matching one of ["src/RefreshAnnotatedCommand.php","docs/llms-full.txt"]: In BEAR.QueryRepository, do not assume that link crawling accepts a path-only `#[Link(rel: 'collection')]` href because `src/RefreshAnnotatedCommand.php` resolves it for purging with `BEAR\Resource\UriFactory`. In supported BEAR.Resource 1.36.0, `Linker` and `LinkCrawler` pass the original href to `new Uri($uri)`, which throws `UriException` for `/articles` if resource lookup succeeds.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

You are interacting with an AI system.

1.x carries the deflate and lazy Redis entries under a second Unreleased
heading. They join the Changed list of 1.21.0, so the release has one
section with every entry once.
@koriym

koriym commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@koriym

koriym commented Nov 30, 2026 •

Copy link
Copy Markdown
Member Author

Note for the next time 1.x is merged into this branch: #331 ( #331 ) rewrote the #[DependsOn(uri: ..., key: ...)] entry on 1.x, and this branch has not touched that line, so the merge takes #331's wording without a conflict. After the merge, rewrite the entry to this wording; the boundary cases stay in docs/llms-full.txt and the DependsOnNotExpandable docblock:

- `#[DependsOn(uri: ..., key: ...)]`: `key` names the rows in the body `onGet()` returns, so `#[DependsOn(uri: 'app://self/article?id={id}', key: 'articles')]` with `$this->body['articles'] = [['id' => 1, ...], ['id' => 2, ...]]` depends on `?id=1` and `?id=2`; a row that lacks the variable is skipped and an empty list names no URI. A body or row list that can be read only once, such as a `Generator`, is put back in the body as an `ArrayIterator` of its rows.

1.x also has two ## [Unreleased] headings; the entries under both go under [1.21.0].

This branch has not been deployed

No deployments
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.

1 participant