Skip to content

refactor(breeze): move all Breeze-specific code under src/Breeze - #137

Merged
parisek merged 2 commits into
mainfrom
refactor/breeze-boundary
Aug 24, 2026
Merged

refactor(breeze): move all Breeze-specific code under src/Breeze#137
parisek merged 2 commits into
mainfrom
refactor/breeze-boundary

Conversation

@parisek

@parisek parisek commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Všechno, co v tomhle balíčku ví o pluginu Breeze, se přestěhovalo pod src/Breeze/ (namespace Parisek\TimberKit\Breeze). Projekt, který Breeze neprovozuje, teď vidí v jedné složce, co je pro něj mrtvá váha.

Žádná změna chování. Logika warmupu je nedotčená — je to přesun plus kompatibilní alias.

Hranici vynucuje test, ne dokumentace

tests/Unit/Architecture/BreezeBoundaryTest.php

Projde src/ a shodí build, když se slovo Breeze objeví mimo src/Breeze/. Hranice, kterou nikdo nevynucuje, se do půl roku rozmaže — stačí, aby si jeden helper sáhl na breeze_get_option() odkudkoli, kde je to zrovna pohodlné.

Test vznikl před přesunem a nechal se spadnout: vyjmenoval přesně těch osm souborů, které bylo potřeba přestěhovat, a posloužil tak jako seznam práce.

Druhý test v tom souboru hlídá první — kontroluje, že src/Breeze/ existuje a není prázdná. Bez toho by hlavní kontrola prošla naprázdno ve chvíli, kdy by někdo tu složku přejmenoval.

Jediná výjimka

StarterBase zůstává venku a test ho má jako povolenou výjimku. Nese opt-in flagy a jejich jména jsou veřejné rozhraní — šest projektů v parku má $breeze_warmup_sitemap = true. Implementace se přestěhovala, jména flagů ne.

Vědomě jsem tam nechal i do_action( 'breeze_clear_all_cache' ) ve dvou metodách pro mazání cache. Technicky patří dovnitř, ale ty flagy jsou default true a sahat na chování, které dnes běží na šesti webech, mi za dokonalou hranici nestálo. Kandidát na příště.

Zpětná kompatibilita

BreezeWarmupSitemap je jediná třída z těch osmi, která už vyšla (v1.38.0). Zůstává po ní class_alias v compat/aliases.php, načítaný přes autoload.files v composer.json. Podtřída nešla — třída je final.

Zbylých sedm nikdy nevyšlo, takže se stěhovaly bez stopy.

Zrušit alias rovnou jsem zavrhl: starý název je venku a jeho odstranění by bylo breaking change pro každého, kdo se na něj odkazuje.

Ověření

Brána Stav
composer test 1624 testů (1622 + 2 strážné), 0 selhání
composer test:property 18 testů, 16 280 asercí
composer phpstan bez chyb
composer adr 6 ADR, všechny v indexu
Starý název třídy resolvuje a míří na novou

Git rozpoznal všech 19 přesunů jako přejmenování, takže historie souborů zůstala zachovaná.

Proč teď

Navazující práce (dohřívání warmup ocasu, #136) přidá do téhle oblasti dalších zhruba 600 řádků. Nakreslit hranici teď znamená kreslit ji kolem menšího kusu kódu — a hlavně dokud většina těch tříd ještě nevyšla a stěhují se zadarmo.

Everything that knows about the Breeze plugin now lives under src/Breeze/
(namespace Parisek\TimberKit\Breeze), so a project that does not run Breeze
can see in one directory what is dead weight.

A new architecture test enforces the boundary rather than documenting it:
naming Breeze anywhere else under src/ fails the build. StarterBase is the
sole documented exception, because it keeps the opt-in flags and those flag
names are public API — six projects in the fleet already set them.

BreezeWarmupSitemap becomes Breeze\WarmupSitemap. The old class name keeps
resolving through a class_alias in compat/aliases.php, wired as a composer
files autoload entry; the class is final, which rules out a subclass shim.
Dropping the alias outright was rejected: the old name has shipped, so
removing it would break any consumer still referencing it.

No behaviour changes. The warmup logic is untouched — this is a relocation
plus the compatibility shim.
The alias in compat/aliases.php was invisible to the suite. Every other test
uses the new name, so dropping the composer autoload.files entry, mistyping
the alias target, or having it fail under an optimised autoloader would all
have left the build green — the one thing that must not break on upgrade was
the one thing nothing exercised.

Three assertions: the legacy name resolves, it resolves to the moved class
rather than merely to something, and the shim stays wired through
composer.json. Verified to fail on a deliberately mistyped alias.
@parisek
parisek merged commit 1374756 into main Aug 24, 2026
6 checks passed
@parisek
parisek deleted the refactor/breeze-boundary branch August 24, 2026 16:46
parisek added a commit that referenced this pull request Aug 24, 2026
Cuts 1.39.0 over the two Breeze warmup changes already on `main`: #134
(order the preload list by importance) and #137 (move Breeze code under
`src/Breeze`).

No code changes — this only stamps the `[Unreleased]` section with a
version and a date, the same shape as 9766ccc did for 1.38.0.

## Why now

The ordering in #134 is the difference between the feature working and
not working, measured on a real site rather than argued. On `sloneek`
(2873 sitemap URLs, five languages, 10 sub-sitemaps), the pre-#134
behaviour spends the whole 200-URL cap inside the first sub-sitemap:

| Page | before #134 | with #134 |
| --- | --- | --- |
| `/blog/` | 261 — missed | **17** |
| `/sk/`, `/it/`, `/pl/` blog | 262–264 — missed | **18–20** |
| 53 category archives | unreachable (last sub-sitemap) | **27–30** |
| `/pricing/` | 64 | 7 |

Those are the site's most expensive pages: 4.0–4.4 s cold TTFB against
0.07 s warm. Without ordering, the cap warmed 200 cheap pages and left
every expensive one cold — which is why the flag read as pointless
before this landed.

Simulated by applying the weights `StarterBase` declares on `main` to
the site's real sitemap, `lastmod` dates, 262 menu targets and Breeze's
own manual list.

## One thing the measurement also showed

Category archives score only through Breeze's **manual list** (weight
800). They are in no menu, are not a homepage, and their `lastmod` is
old — so with the manual list absent they fall to position ~2864 of
2873. That list lives in a `wp_options` row, so a database import wipes
it.

Not a blocker for this release, and not something #134 claims to solve.
Worth recording as the gap: a code-side curated list
(`$breeze_warmup_urls`, scored like `manual`) would be the missing link,
since the kit currently has no property or filter for explicit URLs —
`SignalCollector::manualKeys()` reads the admin row.

## Verification

`main` is green (PHP 8.3, PHP 8.4, PHPStan, composer hygiene). Locally:
1627 tests, 2707 assertions, 1 skipped.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01JMYy6JHLf4mU4H4Hd47spb
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