Skip to content

feat: rendered-text hardening — template wildcards, branch tagging, shared normalization#11

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-1/step-1.5-text-hardening
Jul 13, 2026
Merged

feat: rendered-text hardening — template wildcards, branch tagging, shared normalization#11
officialCodeWork merged 1 commit into
developmentfrom
build/phase-1/step-1.5-text-hardening

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

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

Screenshot shows Source has Bridge
SHOPPING CART Shopping cart shared normalization (case/punctuation/whitespace)
3 items in cart {`${count} items in cart`} template → * items in cart wildcard entry
1 item in cart same naive plural folding (itemsitem) both sides
Could not load orders if (error) return <p>… branch-tagged entry, evidence: renders only when error
Small order book ternary else-branch extracted + negated branch !(orders.length > 10)
  • core/text.tsnormalizeText + textMatches: one normalization shared by extraction, today's matcher, and the Phase 4 matcher (by design — both sides of every comparison must normalize identically).
  • Branch tagging — ternary / && / early-return conditions ride on renderedText.branch and surface in match evidence. This is also groundwork for G5 (feature-flag conditions).
  • Writing the a8 test exposed that ternary string branches and {"literal"} JSX expressions were never extracted at all — fixed.

Eval movement

  • New fixtures a7-transformed-text, a8-conditional-text — 8 new queries, all green.
  • Scorecard: 77 pass / 0 fail / 2 xfail / 0 unexpected-pass · precision 1.000 · recall 0.889 · match accuracy 1.000.

Test plan

  • 60 unit tests green (11 new: normalization, wildcards, plural folding, template extraction, branch tags incl. negation, evidence surfacing)
  • pnpm eval gate OK; schema regenerated (template flag), drift gate green

Documentation

  • TRACKER.md — 1.5 done, Status → 1.6

🤖 Generated with Claude Code

…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>
@officialCodeWork
officialCodeWork merged commit d13b90d into development Jul 13, 2026
1 check passed
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.

2 participants