Skip to content

Wire SubtreeClassifier into core/html fallback as measurement (#497)#258

Merged
chubes4 merged 1 commit into
trunkfrom
feat/classifier-fallback-measurement
Jun 28, 2026
Merged

Wire SubtreeClassifier into core/html fallback as measurement (#497)#258
chubes4 merged 1 commit into
trunkfrom
feat/classifier-fallback-measurement

Conversation

@chubes4

@chubes4 chubes4 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What

Classifier measurement wiring on the core/html fallback path — the first wiring step from epic-spine #497. The standalone SubtreeClassifier (#254) is now run on subtrees that fall back to raw core/html, and its verdict (bucket + confidence + top signals) is attached to the existing fallback diagnostic.

This surfaces, across the whole corpus, which core/html dumps the classifier believes should have been native blocks (custom_block / custom_application / etc.) — the data the pattern-recognition swarm optimizes against.

Measurement only — routing/generation deferred

No routing or output changes. Block output is byte-identical; the classifier only adds a classification key to the fallback diagnostic. It runs solely on the core/html fallback emission path (script, canvas, template, inline SVG, form, iframe, unsupported-element), guarded so it never runs per converted element.

Where it's wired

  • Diagnostics/FallbackEmitter.php: new public classifyFallbackSubtree() (+ ClassificationContext builder from inline CSS / inline <script> + on* handler JS, and a top-signals projector); attached in captureInlineSvgFallback, captureCanvasFallback, captureScriptFallback, captureTemplateFallback.
  • HtmlTransformer.php: attached at the form, unsupported-element, and iframe core/html fallback emission points via $this->fallbackEmitter->classifyFallbackSubtree().
  • Classification/ is read-only (untouched).

Example (canvas core/html fallback)

{
  "diagnostic_code": "html_canvas_runtime_fallback",
  "classification": {
    "bucket": "custom_application",
    "confidence": 0.88,
    "signals": { "flags": ["canvas"], "scores": { "custom_application": 3, ... } }
  }
}

Verification

  • composer parity: 128 → 128, block output byte-identical (parity asserts expected_blocks for every fixture).
  • Full composer test green (contract + 23 classifier unit tests + parity + packaging).
  • php -l clean.
  • Added a contract assertion that the canvas core/html fallback now carries the classifier verdict and that block output is unchanged.

Refs #497

Run the standalone SubtreeClassifier (#254) on subtrees that fall back to
raw core/html and attach its verdict (bucket + confidence + top signals)
to the existing fallback diagnostic. This surfaces, across the corpus,
which core/html dumps the classifier believes should have been native
blocks — the data the pattern-recognition swarm optimizes against.

Measurement only: routing and block output are unchanged. The classifier
runs solely on the core/html fallback emission path (script, canvas,
template, inline SVG, form, iframe, unsupported-element), never per
converted element, and only adds a `classification` key to the diagnostic.

Parity 128 -> 128 with byte-identical block output; full composer test
green. Adds a contract assertion that the canvas core/html fallback now
carries a classifier verdict.

Refs #497

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chubes4 chubes4 merged commit fa0f752 into trunk Jun 28, 2026
1 check passed
@chubes4 chubes4 deleted the feat/classifier-fallback-measurement branch June 28, 2026 00:44
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