Skip to content

refactor(242): extract runtime-island recognition from HtmlTransformer - #1271

Merged
chubes4 merged 1 commit into
trunkfrom
refactor/242-extract-runtime-island
Aug 27, 2026
Merged

refactor(242): extract runtime-island recognition from HtmlTransformer#1271
chubes4 merged 1 commit into
trunkfrom
refactor/242-extract-runtime-island

Conversation

@chubes4

@chubes4 chubes4 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Slice of #242, workstream 1 — the epic names "nav-chrome / runtime-island units" as extraction targets.

What moved

Support/RuntimeIslandTrait now 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. HtmlTransformer goes 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 placedescendantElements (9 callers) and requiredScriptsForElement (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:

  • All 24 method bodies are byte-identical to origin/trunk — compared programmatically, signature through closing brace, not eyeballed.
  • Method inventory unchanged: trunk resolved 522 methods on the class; class + trait still resolve exactly 522. No method lost, none added.
  • The extraction was scripted rather than hand-edited so the moves could not drift.

One necessary change: ShellLandmarkPolicy gains an explicit import. It lived in the same namespace as HtmlTransformer and needed no use there; in Support\ 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 test on the php-transformer package, before and after:

  • baseline: 289 parity fixtures passed, all contract suites green
  • after: 289 parity fixtures passed, all contract suites green, SUITE EXIT=0

Identical 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 HtmlTransformer but 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.

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.
@chubes4
chubes4 merged commit b5c1e6e into trunk Aug 27, 2026
10 checks passed
@chubes4
chubes4 deleted the refactor/242-extract-runtime-island branch August 27, 2026 14:16
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