Repository navigation
fix(theme-builder): make Hyva and TailwindCSS detection mutually exclusive - #289
Merged
Merged
Conversation
…usive Both builders decided independently in detect(), so a theme with mixed Hyva signals (theme.xml vs. composer name) matched both and the result depended on the order in di.xml. Share the decision through a new HyvaThemeDetector and make TailwindCSS reject Hyva themes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the changes making Hyvä and TailwindCSS builder detection mutually exclusive.
No open issues 🎉
What changed in this PR
This PR makes Hyvä and TailwindCSS builder detection mutually exclusive, removing their dependence on registration order in BuilderPool when theme metadata contains mixed signals.
Changes:
- Extracts existing Hyvä identification logic into a shared
HyvaThemeDetector. - Updates both builders to use complementary detection rules.
- Adds detector and mixed-metadata regression tests, and documents detection exclusivity.
| File | Description |
|---|---|
tests/Unit/Service/ThemeBuilder/TailwindCSS/BuilderTest.php |
Adds mixed-metadata regression tests and injects the detector. |
tests/Unit/Service/ThemeBuilder/HyvaThemes/BuilderTest.php |
Updates test construction to inject the detector. |
tests/Unit/Service/Hyva/HyvaThemeDetectorTest.php |
Tests Hyvä identification across metadata combinations. |
src/Service/ThemeBuilder/TailwindCSS/Builder.php |
Excludes themes identified as Hyvä by the shared detector. |
src/Service/ThemeBuilder/HyvaThemes/Builder.php |
Delegates Hyvä identification to the shared detector. |
src/Service/Hyva/HyvaThemeDetector.php |
Centralises Hyvä identification from theme and Composer metadata. |
docs/custom_theme_builders.md |
Explains first-match selection and mutually exclusive detection. |
Review effort: Balanced
[Medium impact] The PR appears safe to merge; no actionable new issues were found.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Hyva and TailwindCSS builders decided independently in
detect(). A theme withweb/tailwindand mixed signals (neutral theme.xml but composer namehyva-themes/..., or the reverse) matched both;BuilderPoolpicked the first, so the result depended on the order indi.xml.Fix
HyvaThemeDetector::isHyvaTheme()(same logic as before) shared by both builders.web/tailwindexists and detector matches.web/tailwindexists, theme.xml or composer.json exists, and detector does not match.Verification