refactor: ValueCleaner is the named choke point (H1)
The choke point moves out of AttrWriter into ValueCleaner (catalog, the composition's VariableRef, sanitizer): clean() (was AttrWriter::cleanValue), kindOf(), guardPath() and the private cleanNode/kind/unknownKind/tightens with VALUE_KEY, URL_KEY, URL_SEGMENT, STRICTNESS, BUILDER_ONLY (its docblock now sits on it; STRUCTURE stays in AttrWriter). Code of the pipeline moved unchanged. - ValueCleaner's docblock is the one canonical description: steps 0-8 with their rulings in code order, invariants I1-I3; the step comments in cleanNode carry the same numbers. AttrWriter/ShortformWriter/Composer/TextReplacer docblocks point there and keep only their own rules. - ValueCleaner::textReplacementFor($module) holds the D10 rule that was a closure in DiviReplaceTextAbility::replace (text/html only, clean() by kind). - AttrWriter, ShortformWriter and Composer take the ValueCleaner; DiviComposition builds one per composition (cleaner()). Tests: the eight AttrWriterTest methods that only exercised cleanValue/kindOf moved verbatim to ValueCleanerTest (clean/kindOf, ComposeFixture::cleaner()); mixed tests call the cleaner in place; +1 test for textReplacementFor. Every provider row and per-test assertion count unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -18,8 +18,8 @@ use LIT\MCP\Integrations\Divi\BlockTree\Serializer;
|
||||
* Rulings S8/S45: each string is tokenized (quote-aware tags, comments, entities, references,
|
||||
* raw-text bodies such as <script>); only text tokens are searched. A string with an
|
||||
* unterminated tag, quote, comment or reference and a hit is refused. The inserted text is the
|
||||
* replacement as the $clean callback returns it for that place (AttrWriter::cleanValue() in the
|
||||
* ability: sanitized by the field kind, markers rejected – rulings S2/S28). A string with no
|
||||
* replacement as the $clean callback returns it for that place (ValueCleaner::textReplacementFor()
|
||||
* in the ability: sanitized by the field kind, markers rejected – rulings S2/S28). A string with no
|
||||
* effective hit is returned as it is and never cleaned (Task 1 forward risk). A changed string
|
||||
* must keep every non-text token of the original byte for byte, gain only the inserted text's
|
||||
* own, add no reference marker, and an independent scan (HtmlContext) must see each replaced
|
||||
|
||||
Reference in New Issue
Block a user