refactor(242): extract runtime-island recognition from HtmlTransformer - #1271
Merged
Conversation
Move the runtime-target and runtime-island cluster into Support/RuntimeIslandTrait: canvas and DOM targets, app-shell roots, workspace surfaces, bounded data-attribute targets, and the island and preservation records that follow from them. Pure move. All 24 method bodies are byte-identical to trunk, the class still resolves the same 522 methods, and no logic changed. ShellLandmarkPolicy gains an explicit import because the code now sits in the Support namespace rather than HtmlToBlocks. HtmlTransformer 13,242 -> 12,858 lines.
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.
Slice of #242, workstream 1 — the epic names "nav-chrome / runtime-island units" as extraction targets.
What moved
Support/RuntimeIslandTraitnow owns the runtime-target and runtime-island cluster: canvas and DOM target recognition, app-shell roots, workspace surfaces, bounded data-attribute targets, and the island and preservation records that follow from them.24 methods, ~404 lines.
HtmlTransformergoes 13,242 → 12,858 lines.Why this cluster
It was already a contiguous band in the file and cohesive by responsibility. Eight non-runtime methods were interleaved in that range and are deliberately left in place —
descendantElements(9 callers) andrequiredScriptsForElement(5 callers) are shared utilities, and the rest are single-caller helpers belonging to other clusters. Moving only the runtime-named methods keeps the boundary unambiguous.The three state accessors (
runtimeBehavior,runtimeDom,runtimeSelectors) and the scattered runtime predicates elsewhere in the file also stay put; they are embedded in other clusters and are not this slice.Pure move, verified
The epic requires behaviour-preserving slices with no logic smuggled in. Rather than assert that, I checked it:
origin/trunk— compared programmatically, signature through closing brace, not eyeballed.One necessary change:
ShellLandmarkPolicygains an explicit import. It lived in the same namespace asHtmlTransformerand needed nousethere; inSupport\it does. That is a namespace-resolution consequence of the move, not a behaviour change — and it surfaced as a hard fatal in the contract suite, which is how I caught it.Verification
Full
composer teston the php-transformer package, before and after:SUITE EXIT=0Identical green, zero block-output diff.
Base
Taken on a quiet base. #939, #764 and #659 were the open PRs touching this file and were closed as superseded or unsalvageably stale before starting. #1268 is open against
HtmlTransformerbut has zero hunks in the extracted band, so it will not conflict.AI assistance
OpenAI GPT-5.6 Sol via OpenCode identified the cluster from method-density analysis, scripted the extraction to guarantee byte-identical moves, and verified the parity suite before and after. Chris Huber directed the work and remains responsible for the change.