Aller au contenu

Category map normalization

60-category-map.php is a compatibility facade. The active merchant-category mapping implementation lives under includes/pipeline/norm/category-map/.

Module ownership

  • 10-primary-map.php owns the main active-rule selection and category-to-vertical application pass.
  • 20-final-map.php owns the final priority-based category mapping pass that intentionally gets the last word after feed-specific corrections.
  • 30-final-coherence.php owns the final vertical_id / spec_type_final alignment repair.
  • 90-compose.php loads the modules and preserves the historical public entrypoints.

Compatibility contract

The public functions remain ccx_norm_apply_category_vertical_map() and ccx_norm_apply_category_vertical_map_final().

The primary pass keeps the historical accessory protections that prevent already-specialized accessory and audio verticals from being overwritten by generic merchant-category mappings. The final pass intentionally does not inherit those protections: it remains the last-word mapping pass. Rule selection continues to support both wildcard (*) and merchant-specific source_feed rules and keeps priority ascending with id as the tie-breaker.

Change policy

Structural moves must remain behavior-neutral. Changes to mapping priority, wildcard behavior, protected verticals, final-pass precedence, collation, SQL predicates, classifier reason codes, or coherence semantics are behavioral changes and require dedicated regression coverage.