Wire SubtreeClassifier into core/html fallback as measurement (#497)#258
Merged
Conversation
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>
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.
What
Classifier measurement wiring on the
core/htmlfallback path — the first wiring step from epic-spine #497. The standaloneSubtreeClassifier(#254) is now run on subtrees that fall back to rawcore/html, and its verdict (bucket+confidence+ topsignals) is attached to the existing fallback diagnostic.This surfaces, across the whole corpus, which
core/htmldumps 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
classificationkey to the fallback diagnostic. It runs solely on thecore/htmlfallback 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 publicclassifyFallbackSubtree()(+ClassificationContextbuilder from inline CSS / inline<script>+on*handler JS, and a top-signals projector); attached incaptureInlineSvgFallback,captureCanvasFallback,captureScriptFallback,captureTemplateFallback.HtmlTransformer.php: attached at the form, unsupported-element, and iframecore/htmlfallback 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 assertsexpected_blocksfor every fixture).composer testgreen (contract + 23 classifier unit tests + parity + packaging).php -lclean.core/htmlfallback now carries the classifier verdict and that block output is unchanged.Refs #497