Skip to content

Validate normalization builtin pattern preconditions #15

Description

@ctoth

Problem

Normalization builtin handlers still use non-null assertions for step.pattern, so handler preconditions live implicitly in TypeScript rather than in the YAML pipeline validator.

Evidence

  • src/g2p/text-normalize.ts has seven new RegExp(step.pattern!, step.flags) calls in builtin handlers.
  • validateNormalizationPipelineConfig() currently checks known builtin handler names, but does not require the pattern field for handlers that need one.
  • The YAML pipeline depends on those patterns for dateToWords, isoDateToWords, timeToWords, currencyToWords, decimalToWords, ordinalToWordsInline, and numberToWordsInline.

Acceptance criteria

  • Remove step.pattern! from src/g2p/text-normalize.ts.
  • Validate handler-specific requirements at pipeline load time: pattern-required handlers must define a string pattern, and patternless handlers must not silently rely on undefined state.
  • Add focused tests for at least one missing-pattern builtin and one valid patternless builtin (lowercase or punctuationCleanup).
  • Errors use E_NORMALIZE_CONFIG.
  • npm.cmd run typecheck:core passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions