# AI Video Signal V23 — Cloudflare setup

V23 keeps every V22 binding and adds optional exact Pages deployment-ID verification.

## Existing bindings/secrets retained
- Analytics Engine binding: `AFFILIATE_EVENTS` → dataset `aivs_affiliate_clicks`
- KV binding (optional but recommended): `EXPERIMENT_LEDGER`
- `CF_ACCOUNT_ID`
- `CF_ANALYTICS_READ_TOKEN`
- `AIVS_EXPORT_TOKEN`

## V23 optional Pages deployment verification
Add server-side:
- `CF_PAGES_PROJECT_NAME` = your Cloudflare Pages project name
- `CF_PAGES_READ_TOKEN` = Cloudflare API token with **Pages Read** permission for the account/project

The Pages token is used only by `_worker.js` to list recent production deployments. It is never returned to the browser.

## Deployment workflow
1. Extract the V23 package.
2. For the base release, `assets/deployment-fingerprint-v23.json` is already stamped.
3. For an experiment package: apply the exact change manifest, then run:
   `python assets/aivs_release_manager_v23.py stamp . --label EXP-<label> --change-manifest /path/to/change-manifest.json`
4. Validate: `python assets/aivs_release_manager_v23.py verify .`
5. Upload the stamped site to Cloudflare Pages. Drag-and-drop accepts a ZIP/folder; Wrangler Pages deploy accepts a folder.
6. Open `/conversion-intelligence/`, enter the private token and choose **Verify online deployment**.
7. If Pages Read is configured, V23 matches the release fingerprint against recent production deployment-specific URLs and records the exact deployment ID.
8. Mark the experiment deployed only after verification. The Worker rejects packages that do not contain that experiment's exact `change_manifest_hash`.

No deployment or rollback is performed automatically by V23.
