Validation and Build

Validation is not optional in this repository. The purpose of validation is to catch the kinds of failures that historically appeared only after packaging or deployment.

Run commands from the repository root.

Validation Entry Points

Validate all migrated markets:

Rscript scripts/validate_all.R

Validate one migrated market:

Rscript scripts/validate_market.R markets/CN/store_visits

Build Entry Point

Build one market/KPI:

Rscript scripts/build_market.R markets/CN/store_visits

Market-Specific Local Repros

Where a market investigation needs a tactical proof outside the main scaffold, the market folder may also carry a local repro bundle.

For China store visits, the current local repro can be run with:

./markets/CN/store_visits/local-repro/run_cn_repro.sh

This is not the long-term replacement for the repo-wide validation harness. It is a market-specific runner used to demonstrate that the local transform/refit/decomp path works from explicit artefacts.

What Validation Should Prove

Current enforced minimum:

  1. required files exist
  2. config loads
  3. forbidden local-environment patterns are absent
  4. required functions can be sourced
  5. the market contract is satisfied

Planned next-stage validation:

  1. transform runs in a clean session
  2. transformed output matches model requirements
  3. predict works
  4. decomp works
  5. build output is reproducible and traceable

Clean Environment Principle

If a market implementation only works on one analyst machine because of:

  • attached packages
  • hidden sourced files
  • local paths
  • interactive session state

then it is not ready.

See Validation Contract for the distinction between enforced and planned checks.