使用 entmesh-experiment

使用 entmesh-experiment

entmesh-experiment 管理 A/B Testing 控制面:实验草稿、typed Feature Flag、独立 Release、环境部署、流量治理、健康、结果和决策。它不会调用采集 API 模拟曝光。

离线生成、校验和创建草稿

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py generate-draft \
  --key checkout_copy_test \
  --name 结算按钮短文案实验 \
  --hypothesis 如果缩短按钮文案则支付转化率会提升 \
  --subject user \
  --primary-metric 指标UUID \
  --flag 功能开关UUID \
  --mde 0.05 \
  --output experiment.json

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py validate --json experiment.json
python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py create --json experiment.json

generate-draft 完全离线。创建前检查服务端返回的指标版本、样本计划、Flag 占用和警告。

发布和部署

发布不可变版本需要用户明确授权和 --apply

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py publish 实验UUID --apply

部署前读取实验、版本和现有部署;确认时间、环境、冻结 Targeting 和初始流量:

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py deploy \
  实验UUID \
  --version 实验版本UUID \
  --starts-at 2026-09-10T00:00:00Z \
  --ends-at 2026-09-24T00:00:00Z \
  --traffic 1000

traffic 使用万分比,1000 表示 10%。动态分群必须有成功且不超过一百万成员的快照;缺失时停止,不得移除 Targeting 或扩大为全量。

流量治理

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py ramp \
  实验UUID 部署UUID --traffic 5000 --apply

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py complete \
  实验UUID 部署UUID --apply

发布、扩流、结束、归档、Release 创建/回滚和 decision-ship 执行前,都要重新读取乐观锁版本、复述不可变/流量/Flag 占用或全量发布影响,并取得显式用户请求。写操作不自动重试。

其他带强确认的示例:

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py flag-publish \
  功能开关UUID --value '"立即支付"' --apply

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py release-create \
  功能开关UUID --json release.json --apply

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py release-rollback \
  功能开关UUID ReleaseUUID --to 目标ReleaseUUID --apply

健康和结果

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py health

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py result-run \
  实验UUID 部署UUID --kind interim

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py wait 结果任务UUID --timeout 120

报告结果时同时展示样本进度、SRM、护栏、blockers、指标版本、校正 p 值和数据状态。中间结果即使显著也只是 provisional;只有成熟 final 的 conclusion=winner 且没有 blockers 才能报告胜者。

决策

普通 decision-create --json 只记录业务决定。decision-ship 是强确认:结束实验并为所有绑定 Flag 原子创建 100% Release:

python3 ~/.codex/skills/entmesh-experiment/scripts/entmesh_experiment.py decision-ship \
  实验UUID --json ship-decision.json --apply

选择非统计胜者时,JSON 中需要至少 20 个字符的用户自述覆盖原因。