feat: rendered-text hardening — template wildcards, branch tagging, shared normalization#11
Merged
officialCodeWork merged 1 commit intoJul 13, 2026
Conversation
…hared normalization
Step 1.5 (TRACKER). Failure modes A7 (extraction half), A8:
- core/text.ts: normalizeText (lowercase, unicode-safe punctuation strip,
whitespace collapse, naive plural folding) + textMatches (bidirectional
containment with * wildcards) — ONE normalization used by extraction and
matching, and later by the Phase 4 matcher.
- Template JSX children extract as wildcard entries: {`${count} items in
cart`} → '* items in cart' (template: true), so the screenshot text
'3 items in cart' matches. Resolvable template parts fold via 1.1.
- Branch tagging: text guarded by ternaries, && gates, or early-return ifs
carries branch: <condition>; ternary else-branches negate. Evidence
surfaces it: 'renders only when isAdmin'. Ternary string branches and
{"literal"} JSX expressions are now extracted at all (found by the new
a8 test failing).
- Fixtures a7-transformed-text (CSS uppercase / template / plural queries)
and a8-conditional-text (error/empty/admin states).
- Scorecard: 77 pass / 0 fail / 2 xfail. 60 unit tests.
Co-Authored-By: Claude Fable 5 <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.
Summary
TRACKER Step 1.5 — failure modes A7/A8. Screenshot text never equals source text: CSS uppercases it, templates inject runtime values, error states render text the happy path never shows.
What matches now
SHOPPING CARTShopping cart3 items in cart{`${count} items in cart`}* items in cartwildcard entry1 item in cartitems→item) both sidesCould not load ordersif (error) return <p>…Small order book!(orders.length > 10)core/text.ts—normalizeText+textMatches: one normalization shared by extraction, today's matcher, and the Phase 4 matcher (by design — both sides of every comparison must normalize identically).&&/ early-return conditions ride onrenderedText.branchand surface in match evidence. This is also groundwork for G5 (feature-flag conditions).{"literal"}JSX expressions were never extracted at all — fixed.Eval movement
a7-transformed-text,a8-conditional-text— 8 new queries, all green.Test plan
pnpm evalgate OK; schema regenerated (template flag), drift gate greenDocumentation
TRACKER.md— 1.5 done, Status → 1.6🤖 Generated with Claude Code