fix(analytics): fold deco flag names into experiment keys the collector keeps
Why
A deco_segment flag name is the matcher's block name in the CMS (TestePLPIA), and the deco adapter passed it to setExperiment raw. The collector keeps only experiment keys matching [a-z0-9][a-z0-9_-]*, so every capitalised matcher lost its arm on every event. Monte Carlo runs all of its PLP tests under TestePLPIA.
What changes
src/v8/analytics/runtime/modules/deco.ts: the adapter folds a flag name into a valid key: accents off, lower case, anything else to _. Valid keys pass through unchanged.
This mirrors decocms/analytics#69. Until decocms/analytics builds the tag from this package (task 3.7), its own runtime/ is what production serves, so both copies have to change together. node ops/build-tag.mjs --check --src <this>/packages/blocks/src/v8/analytics passes against this branch: both copies build to the same ten bundles.
Test
The behaviour is asserted end to end in decocms/analytics (tests/browser.spec.ts). Here: vitest run packages/blocks/src/v8/analytics (48 passed) and biome check are clean.
š¤ Generated with Claude Code
Summary by cubic
Fixes deco experiment tracking so matcher flag names like TestePLPIA no longer get dropped by the collector.
The collector keeps only experiment keys matching [a-z0-9][a-z0-9_-]*, so every capitalised matcher lost its arm on every event. Names are now folded into valid keys ā accents stripped, lower-cased, everything else to _ ā while already-valid keys pass through unchanged. The fold runs in core setExperiment/variant and the pre-boot x, so a page's own arm and the deco module's arm land on the same key. Nested tests (plp/b) now travel as plp_b instead of being dropped, and the deco module keeps the first of two names that fold to one key.
Migration
- Mirrors the change in
decocms/analytics; both copies must land together because production servesdecocms/analytics' runtime until it builds from this package. build-tag --checkpasses against this branch, so both copies build to the same bundles.