Simplify slice 1g: move the 10 most-wired leaf methods out of HtmlCompilation and delete their 33 closures
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Read HtmlCompilation.php, the listed methods, and the consumers that receive them through constructor closures; inspect SourceBlockCreator and the existing style or presentation services to identify suitable owners. Trace the constructor wiring and internal call sites before moving the methods and removing closure parameters, fields, and forwarders. Run the php-transformer gates and compare output byte for byte; report closures removed, the HtmlCompilation.php line change, and net lines.
Written by the indexing model from the issue text.
Description
Part of #4368. Measured at trunk after #4634.
Problem
43 closure-wired methods in HtmlCompilation, behind 66 constructor closures, call no other HtmlCompilation method except createBlock and attr. They only use services, the session or static helpers, so they don't need to live in HtmlCompilation, and the closures exist only to reach them.
Scope: the 10 most-wired, 33 closures
| Method | Closures | Lines | Notes |
|---|---|---|---|
htmlPreservationBlock |
8 | 5 | createBlock('core/html', safeFallbackHtml(..., tagMarkers)) |
disclosureControlPresentation |
6 | 10 | |
codePresentationAttributes |
3 | 15 | |
recognizePatterns |
3 | 14 | |
requiredScriptsForElement |
3 | 11 | |
runtimeAuthoredButton |
2 | 32 | uses createBlock |
socialAnchorColors |
2 | 14 | |
rememberAccordionDisclosureRoot |
2 | 9 | |
imageDimensions |
2 | 8 | |
parsedCssSelector |
2 | 5 |
Change
- Move each method to its natural owner:
htmlPreservationBlockgoes ontoSourceBlockCreator, or a small service next to it. Converters already receiveSourceBlockCreator.- Presentation and attribute helpers go to the existing style or presentation service they read from.
- Use a new small service only when no existing owner fits.
- If a method has one consumer, move it into that consumer.
- Every consumer that received one of these methods as a closure gets the owning service instead. Delete those closure parameters, fields and forwarders, plus the constructor wiring.
HtmlCompilation's own internal call sites call the new owner directly. Delete the methods fromHtmlCompilation.- Keep the change mechanical. The other 33 leaf methods are follow-up work.
Acceptance
- Byte-identical output across all php-transformer gates.
- The PR body reports closures removed (target 33), the
HtmlCompilation.phpline change, and net lines (which must go down). - No new tests.
AI assistance: measured and scoped by Claude Opus (Anthropic) via Pi/Roadie.
- Dominant language
- PHP
- Stars
- 25
- Forks
- 3
- Avg merge
- 3h 25m
- Merged PRs (30d)
- 935
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/blocks-engine
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/blocks-engine#4621 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Automattic/blocks-engine#775 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
Automattic/blocks-engine#4638 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Automattic/blocks-engine#4630 ·
Maintainers usually reply within 1 day
-
Navigation overflow trigger chevron renders below the label instead of inlinePossibly taken @chubes4 claimed this 1 day ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Automattic/blocks-engine#4629 ·
Maintainers usually reply within 1 day
All issues in Automattic/blocks-engine
Similar issues
-
Visual COBOL: missing 11.0 and 12.0, and 9.0 date differs from Rocket Software's lifecycle pageOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
endoflife-date/endoflife.date#11561 ·
Maintainers usually reply within 1 day
-
good first issue priority:low type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
crazy-goat/fdb-php#184 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nextcloud/groupfolders#5218 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/sharelisting#624 ·
-
`wp theme mod set` prints its failure message as `Success` and exits 0Possibly taken @dhrupo claimed this today. Openbug command:theme-mod-set status:unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
wp-cli/extension-command#570 ·