ab-analysis-kit 0.2.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. {ab_analysis_kit-0.2.0/ab_analysis_kit.egg-info → ab_analysis_kit-0.4.0}/PKG-INFO +10 -4
  2. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/README.md +9 -3
  3. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0/ab_analysis_kit.egg-info}/PKG-INFO +10 -4
  4. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/ab_analysis_kit.egg-info/SOURCES.txt +8 -0
  5. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/__init__.py +1 -1
  6. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/rules/cli.md +46 -5
  7. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/rules/experiments.md +21 -3
  8. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/rules/explore.md +8 -3
  9. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/rules/metrics.md +45 -5
  10. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/rules/overview.md +9 -5
  11. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/rules/plan.md +5 -2
  12. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/rules/project.md +5 -0
  13. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/rules/validate.md +12 -4
  14. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/skills/abk-explore/SKILL.md +6 -0
  15. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/skills/abk-new-metric/SKILL.md +6 -2
  16. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/skills/abk-plan/SKILL.md +6 -3
  17. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/skills/abk-setup-project/SKILL.md +5 -3
  18. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/skills/abk-validate/SKILL.md +8 -3
  19. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/clean.py +59 -2
  20. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/explore.py +27 -2
  21. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/init.py +21 -3
  22. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/plan.py +70 -18
  23. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/run.py +24 -0
  24. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/validate.py +16 -4
  25. ab_analysis_kit-0.4.0/abkit/cli/commands/verify_incremental.py +160 -0
  26. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/main.py +62 -4
  27. ab_analysis_kit-0.4.0/abkit/compute/incremental_backend.py +439 -0
  28. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/compute/recompute_backend.py +74 -14
  29. ab_analysis_kit-0.4.0/abkit/compute/reconcile.py +372 -0
  30. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/config/__init__.py +2 -0
  31. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/config/experiment_config.py +78 -0
  32. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/config/metric_config.py +16 -0
  33. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/config/project_config.py +18 -1
  34. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/config/validator.py +24 -0
  35. ab_analysis_kit-0.4.0/abkit/core/exposure_counting.py +95 -0
  36. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/core/models.py +11 -0
  37. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/_sql_manager.py +64 -6
  38. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/clickhouse_manager.py +36 -1
  39. ab_analysis_kit-0.4.0/abkit/database/internal_tables/__init__.py +17 -0
  40. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/internal_tables/_exposures.py +125 -53
  41. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/internal_tables/_schema.py +10 -2
  42. ab_analysis_kit-0.4.0/abkit/database/internal_tables/_unit_state.py +429 -0
  43. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/manager.py +176 -1
  44. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/mysql_manager.py +10 -0
  45. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/postgres_manager.py +12 -0
  46. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/tables.py +19 -6
  47. ab_analysis_kit-0.4.0/abkit/loaders/__init__.py +47 -0
  48. ab_analysis_kit-0.4.0/abkit/loaders/exposure_copy.py +300 -0
  49. ab_analysis_kit-0.4.0/abkit/loaders/exposure_loader.py +96 -0
  50. ab_analysis_kit-0.4.0/abkit/loaders/exposure_source.py +336 -0
  51. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/loaders/query_template.py +53 -0
  52. ab_analysis_kit-0.4.0/abkit/loaders/state_loader.py +96 -0
  53. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/loaders/templates/abkit_assignment.jinja +11 -6
  54. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/pipeline/_types.py +35 -0
  55. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/pipeline/driver.py +242 -50
  56. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/pipeline/enrich.py +4 -0
  57. ab_analysis_kit-0.4.0/abkit/pipeline/state.py +419 -0
  58. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/planning/__init__.py +1 -1
  59. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/planning/sizing.py +1 -1
  60. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/reporting/builder.py +39 -2
  61. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/base.py +8 -0
  62. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/parametric/cuped_ttest.py +8 -0
  63. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/result.py +8 -0
  64. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/tuning/assets/explore.js +3 -3
  65. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/tuning/recompute.py +122 -24
  66. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/tuning/server.py +8 -4
  67. ab_analysis_kit-0.2.0/abkit/database/internal_tables/__init__.py +0 -6
  68. ab_analysis_kit-0.2.0/abkit/database/internal_tables/_unit_state.py +0 -148
  69. ab_analysis_kit-0.2.0/abkit/loaders/__init__.py +0 -28
  70. ab_analysis_kit-0.2.0/abkit/loaders/exposure_loader.py +0 -121
  71. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/LICENSE +0 -0
  72. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/MANIFEST.in +0 -0
  73. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/ab_analysis_kit.egg-info/dependency_links.txt +0 -0
  74. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/ab_analysis_kit.egg-info/entry_points.txt +0 -0
  75. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/ab_analysis_kit.egg-info/requires.txt +0 -0
  76. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/ab_analysis_kit.egg-info/top_level.txt +0 -0
  77. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/__init__.py +0 -0
  78. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/_output.py +0 -0
  79. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/CLAUDE.section.md +0 -0
  80. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/rules/methods.md +0 -0
  81. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/skills/abk-feedback/SKILL.md +0 -0
  82. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/assets/claude/skills/abk-new-experiment/SKILL.md +0 -0
  83. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/__init__.py +0 -0
  84. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/_context.py +0 -0
  85. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/init_claude.py +0 -0
  86. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/test_report.py +0 -0
  87. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/cli/commands/unlock.py +0 -0
  88. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/compute/__init__.py +0 -0
  89. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/config/discovery.py +0 -0
  90. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/config/method_config.py +0 -0
  91. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/config/profile.py +0 -0
  92. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/core/__init__.py +0 -0
  93. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/core/interval.py +0 -0
  94. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/core/period_planner.py +0 -0
  95. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/__init__.py +0 -0
  96. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/internal_tables/_aa_runs.py +0 -0
  97. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/internal_tables/_base.py +0 -0
  98. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/internal_tables/_experiments.py +0 -0
  99. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/internal_tables/_maintenance.py +0 -0
  100. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/internal_tables/_results.py +0 -0
  101. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/internal_tables/_tasks.py +0 -0
  102. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/database/internal_tables/manager.py +0 -0
  103. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/loaders/metric_loader.py +0 -0
  104. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/notify/__init__.py +0 -0
  105. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/notify/base.py +0 -0
  106. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/notify/branding.py +0 -0
  107. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/notify/email.py +0 -0
  108. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/notify/factory.py +0 -0
  109. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/notify/mattermost.py +0 -0
  110. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/notify/mock.py +0 -0
  111. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/notify/slack.py +0 -0
  112. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/notify/telegram.py +0 -0
  113. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/notify/webhook.py +0 -0
  114. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/pipeline/__init__.py +0 -0
  115. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/pipeline/analyze.py +0 -0
  116. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/pipeline/readout.py +0 -0
  117. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/reporting/__init__.py +0 -0
  118. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/reporting/assets/report.js +0 -0
  119. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/reporting/calibration.py +0 -0
  120. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/reporting/html_report.py +0 -0
  121. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/__init__.py +0 -0
  122. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/accumulate.py +0 -0
  123. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/bootstrap/__init__.py +0 -0
  124. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/bootstrap/applier.py +0 -0
  125. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/bootstrap/bootstrap.py +0 -0
  126. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/bootstrap/ci.py +0 -0
  127. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/bootstrap/engine.py +0 -0
  128. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/bootstrap/paired_bootstrap.py +0 -0
  129. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/bootstrap/paired_post_normed_bootstrap.py +0 -0
  130. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/bootstrap/poisson_bootstrap.py +0 -0
  131. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/bootstrap/post_normed_bootstrap.py +0 -0
  132. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/correction.py +0 -0
  133. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/effects.py +0 -0
  134. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/exceptions.py +0 -0
  135. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/factory.py +0 -0
  136. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/parametric/__init__.py +0 -0
  137. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/parametric/paired_cuped_ttest.py +0 -0
  138. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/parametric/paired_ttest.py +0 -0
  139. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/parametric/ratio_delta.py +0 -0
  140. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/parametric/ttest.py +0 -0
  141. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/parametric/ztest.py +0 -0
  142. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/power.py +0 -0
  143. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/registry.py +0 -0
  144. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/rng.py +0 -0
  145. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/samples.py +0 -0
  146. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/sequential/__init__.py +0 -0
  147. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/sequential/apply.py +0 -0
  148. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/sequential/confidence_sequence.py +0 -0
  149. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/sequential/mixture.py +0 -0
  150. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/stats/srm.py +0 -0
  151. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/tuning/__init__.py +0 -0
  152. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/tuning/config_writer.py +0 -0
  153. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/tuning/html.py +0 -0
  154. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/tuning/payload.py +0 -0
  155. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/tuning/session.py +0 -0
  156. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/utils/__init__.py +0 -0
  157. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/utils/datetime_utils.py +0 -0
  158. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/utils/env_interpolation.py +0 -0
  159. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/utils/json_utils.py +0 -0
  160. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/__init__.py +0 -0
  161. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/_types.py +0 -0
  162. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/family.py +0 -0
  163. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/inject.py +0 -0
  164. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/load.py +0 -0
  165. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/panel.py +0 -0
  166. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/persistence.py +0 -0
  167. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/resample.py +0 -0
  168. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/result.py +0 -0
  169. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/run_id.py +0 -0
  170. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/runner.py +0 -0
  171. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/scoring.py +0 -0
  172. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/abkit/validate/vector_resample.py +0 -0
  173. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/pyproject.toml +0 -0
  174. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/requirements.txt +0 -0
  175. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/setup.cfg +0 -0
  176. {ab_analysis_kit-0.2.0 → ab_analysis_kit-0.4.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ab-analysis-kit
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: A/B experiment analysis as declarative YAML + SQL
5
5
  Author: ab-analysis-kit authors
6
6
  License: MIT
@@ -76,8 +76,12 @@ stabilization chart), writes them to a clean warehouse table any BI can read, an
76
76
  gives you a local cockpit to tune the analysis and a harness to prove your method is
77
77
  actually calibrated.
78
78
 
79
- > **Status: `0.2.0` (Alpha) — release-ready** (milestones **M1–M7**; `0.1.2` is the
80
- > latest published on PyPI, the `v0.2.0` tag/publish is the maintainer's pending step). The
79
+ > **Status: `0.4.0` (Alpha) — release-ready; `0.3.0` is the latest on PyPI**
80
+ > (milestones **M1–M9** shipped — M9 adds the additive compute engine: a STATE
81
+ > stage materializing per-(unit, day) moments, the opt-in
82
+ > `compute.incremental_reads` path that turns the O(D²) full-window rescan into
83
+ > a linear one, `abk verify-incremental` to prove it moved no number, and
84
+ > instant CUPED in the cockpit). The
81
85
  > statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
82
86
  > self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
83
87
  > opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
@@ -90,7 +94,9 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
90
94
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
91
95
  ```
92
96
 
93
- (For `0.2.0` before its tag lands, install from source — `pip install -e ".[dev]"`.)
97
+ (`0.4.0`'s M9 additive engine lands with its tag; until then `pip install
98
+ ab-analysis-kit` gets `0.3.0` — for the M9 behavior install from source:
99
+ `pip install -e ".[dev]"`.)
94
100
 
95
101
  `abk --version` and `abk --help` work with no database driver; you can even lint a
96
102
  config (`abk run --steps validate`) with no database at all. See the
@@ -11,8 +11,12 @@ stabilization chart), writes them to a clean warehouse table any BI can read, an
11
11
  gives you a local cockpit to tune the analysis and a harness to prove your method is
12
12
  actually calibrated.
13
13
 
14
- > **Status: `0.2.0` (Alpha) — release-ready** (milestones **M1–M7**; `0.1.2` is the
15
- > latest published on PyPI, the `v0.2.0` tag/publish is the maintainer's pending step). The
14
+ > **Status: `0.4.0` (Alpha) — release-ready; `0.3.0` is the latest on PyPI**
15
+ > (milestones **M1–M9** shipped — M9 adds the additive compute engine: a STATE
16
+ > stage materializing per-(unit, day) moments, the opt-in
17
+ > `compute.incremental_reads` path that turns the O(D²) full-window rescan into
18
+ > a linear one, `abk verify-incremental` to prove it moved no number, and
19
+ > instant CUPED in the cockpit). The
16
20
  > statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
17
21
  > self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
18
22
  > opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
@@ -25,7 +29,9 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
25
29
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
26
30
  ```
27
31
 
28
- (For `0.2.0` before its tag lands, install from source — `pip install -e ".[dev]"`.)
32
+ (`0.4.0`'s M9 additive engine lands with its tag; until then `pip install
33
+ ab-analysis-kit` gets `0.3.0` — for the M9 behavior install from source:
34
+ `pip install -e ".[dev]"`.)
29
35
 
30
36
  `abk --version` and `abk --help` work with no database driver; you can even lint a
31
37
  config (`abk run --steps validate`) with no database at all. See the
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ab-analysis-kit
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: A/B experiment analysis as declarative YAML + SQL
5
5
  Author: ab-analysis-kit authors
6
6
  License: MIT
@@ -76,8 +76,12 @@ stabilization chart), writes them to a clean warehouse table any BI can read, an
76
76
  gives you a local cockpit to tune the analysis and a harness to prove your method is
77
77
  actually calibrated.
78
78
 
79
- > **Status: `0.2.0` (Alpha) — release-ready** (milestones **M1–M7**; `0.1.2` is the
80
- > latest published on PyPI, the `v0.2.0` tag/publish is the maintainer's pending step). The
79
+ > **Status: `0.4.0` (Alpha) — release-ready; `0.3.0` is the latest on PyPI**
80
+ > (milestones **M1–M9** shipped — M9 adds the additive compute engine: a STATE
81
+ > stage materializing per-(unit, day) moments, the opt-in
82
+ > `compute.incremental_reads` path that turns the O(D²) full-window rescan into
83
+ > a linear one, `abk verify-incremental` to prove it moved no number, and
84
+ > instant CUPED in the cockpit). The
81
85
  > statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
82
86
  > self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
83
87
  > opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
@@ -90,7 +94,9 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
90
94
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
91
95
  ```
92
96
 
93
- (For `0.2.0` before its tag lands, install from source — `pip install -e ".[dev]"`.)
97
+ (`0.4.0`'s M9 additive engine lands with its tag; until then `pip install
98
+ ab-analysis-kit` gets `0.3.0` — for the M9 behavior install from source:
99
+ `pip install -e ".[dev]"`.)
94
100
 
95
101
  `abk --version` and `abk --help` work with no database driver; you can even lint a
96
102
  config (`abk run --steps validate`) with no database at all. See the
@@ -42,8 +42,11 @@ abkit/cli/commands/run.py
42
42
  abkit/cli/commands/test_report.py
43
43
  abkit/cli/commands/unlock.py
44
44
  abkit/cli/commands/validate.py
45
+ abkit/cli/commands/verify_incremental.py
45
46
  abkit/compute/__init__.py
47
+ abkit/compute/incremental_backend.py
46
48
  abkit/compute/recompute_backend.py
49
+ abkit/compute/reconcile.py
47
50
  abkit/config/__init__.py
48
51
  abkit/config/discovery.py
49
52
  abkit/config/experiment_config.py
@@ -53,6 +56,7 @@ abkit/config/profile.py
53
56
  abkit/config/project_config.py
54
57
  abkit/config/validator.py
55
58
  abkit/core/__init__.py
59
+ abkit/core/exposure_counting.py
56
60
  abkit/core/interval.py
57
61
  abkit/core/models.py
58
62
  abkit/core/period_planner.py
@@ -75,9 +79,12 @@ abkit/database/internal_tables/_tasks.py
75
79
  abkit/database/internal_tables/_unit_state.py
76
80
  abkit/database/internal_tables/manager.py
77
81
  abkit/loaders/__init__.py
82
+ abkit/loaders/exposure_copy.py
78
83
  abkit/loaders/exposure_loader.py
84
+ abkit/loaders/exposure_source.py
79
85
  abkit/loaders/metric_loader.py
80
86
  abkit/loaders/query_template.py
87
+ abkit/loaders/state_loader.py
81
88
  abkit/loaders/templates/abkit_assignment.jinja
82
89
  abkit/notify/__init__.py
83
90
  abkit/notify/base.py
@@ -95,6 +102,7 @@ abkit/pipeline/analyze.py
95
102
  abkit/pipeline/driver.py
96
103
  abkit/pipeline/enrich.py
97
104
  abkit/pipeline/readout.py
105
+ abkit/pipeline/state.py
98
106
  abkit/planning/__init__.py
99
107
  abkit/planning/sizing.py
100
108
  abkit/reporting/__init__.py
@@ -10,7 +10,7 @@ from __future__ import annotations
10
10
 
11
11
  from typing import Any
12
12
 
13
- __version__ = "0.2.0"
13
+ __version__ = "0.4.0"
14
14
 
15
15
  #: Symbols re-exported lazily from ``abkit.stats`` (PEP 562) so importing
16
16
  #: ``abkit`` for ``__version__`` (the CLI path) stays numpy-free and fast.
@@ -17,6 +17,7 @@ task = one `abk` invocation), so a broken run fails the job instead of exiting 0
17
17
  | `abk plan --select <exp>` | Read-only pre-launch sizing: required-N / achievable-MDE / power (see `plan.md`) |
18
18
  | `abk unlock --select <exp>` | Clear a stuck pipeline / validate lock |
19
19
  | `abk clean --select <exp>` | Prune internal rows that no longer match the config |
20
+ | `abk verify-incremental --select <exp>` | Reconcile the incremental read path against full recompute across the whole computed series — the gate for `compute.incremental_reads`; read-only, no lock, non-zero exit on any divergence |
20
21
  | `abk test-report <exp>` | Send a **mock** WIN readout through the configured notification channels — a connectivity smoke test (no lock, no warehouse read); `--channel <name>` (repeatable) / `--profile`; non-zero exit if any channel fails. See `project.md` `notification_channels` |
21
22
  | `abk --version` | Show the installed abkit version |
22
23
 
@@ -69,17 +70,22 @@ to refresh this context.
69
70
  ## `abk run`
70
71
 
71
72
  ```bash
72
- abk run [--select <exp>] [--exclude <sel>] [--steps validate,plan,load,compute] \
73
- [--from TS] [--to TS] [--full-refresh] [--workers N] \
73
+ abk run [--select <exp>] [--exclude <sel>] [--steps validate,plan,load,state,compute] \
74
+ [--from TS] [--to TS] [--full-refresh] [--resync-cohort] [--workers N] \
74
75
  [--report [PATH]] [--force] [--profile NAME]
75
76
  ```
76
77
 
77
- The pipeline: **validate → plan → load → SRM → compute → persist**, streaming
78
- `VALIDATE → PLAN → LOAD → SRM → COMPUTE → RESULT`. It is incremental by
78
+ The pipeline: **validate → plan → load → SRM → state → compute → persist**,
79
+ streaming `VALIDATE → PLAN → LOAD → SRM → STATE → COMPUTE → RESULT` (`state`,
80
+ M9: materializes per-unit day moments into `_ab_unit_state` for closed-form
81
+ metrics; with the opt-in `compute.incremental_reads: true` those moments then
82
+ replace the full-window fact rescan on the compute path — any gap falls back
83
+ to recompute, and results math is unchanged either way).
84
+ It is incremental by
79
85
  an anti-join — only cutoffs past the `data_lag` watermark and not already computed
80
86
  are (re)computed, so re-running is idempotent.
81
87
 
82
- - `--steps` (default `validate,plan,load,compute`) — comma-separated steps.
88
+ - `--steps` (default `validate,plan,load,state,compute`) — comma-separated steps.
83
89
  **`--steps validate` alone is the config lint** (no DB, no lock): it parses the
84
90
  YAML, lints every metric SQL for the one-row-per-unit contract and the cohort
85
91
  macro, and instantiates each method. This is the ONLY meaning of "validate" on
@@ -88,12 +94,21 @@ are (re)computed, so re-running is idempotent.
88
94
  use with `--full-refresh`.
89
95
  - `--full-refresh` — re-open already-computed cutoffs in `[--from, --to)` and
90
96
  recompute them. Use after changing a metric query or a method param.
97
+ - `--resync-cohort` — copy mode only (`assignment.cohort_copy.enabled: true`):
98
+ delete the persisted `_ab_exposures` copy and rebuild it from the experiment
99
+ start through the same incremental engine — the recovery for late-arriving/
100
+ corrected assignment rows the watermark cannot heal. A documented no-op in
101
+ the direct (no-copy) default. Distinct from `--full-refresh` (results-window
102
+ recompute) — the two never overload each other.
91
103
  - `--workers N` (default 1) — worker threads across experiments (each gets its own
92
104
  DB connection).
93
105
  - `--report [PATH]` — after the run, emit a self-contained HTML readout per
94
106
  experiment (best-effort — never fails the run). Tri-state: bare `--report` →
95
107
  `reports/<exp>.html`; a directory → `<dir>/<exp>.html`; a `.html` path → that
96
108
  file. Reads persisted rows, so even a load-only run can produce one.
109
+ - `--cost-report` — print per-stage warehouse cost (wall-time, queries, rows returned,
110
+ rows scanned where the backend reports them). The evidence for turning
111
+ `compute.incremental_reads` on; unrelated to `--profile` (the DB connection).
97
112
  - `--force` — take over a held lock (prefer `abk unlock`; risky with concurrent runs).
98
113
  - `--profile` — override `profiles.yml`'s `default_profile` (e.g. run against staging).
99
114
 
@@ -210,6 +225,32 @@ default** — pass `--execute` to actually delete.
210
225
  - **GC mode** — `abk clean --orphaned-experiments`: purges all internal rows for
211
226
  experiment names present in the DB but no longer defined by any YAML (renamed or
212
227
  deleted experiments). Asks for confirmation on `--execute` unless `--yes`.
228
+ - **State sweep** — runs alongside drift mode, no flag: drops `_ab_unit_state`
229
+ series no live `(experiment, metric)` pair claims (a removed comparison, a renamed
230
+ metric, a deleted experiment, or a comparison that stopped being state-eligible).
231
+ A normal run only drops series superseded by an edit to a metric it still
232
+ materializes. Deliberately NOT narrowed by `--select` — state rows are keyed by
233
+ `(source_table, column_set_id)`, not by experiment.
234
+
235
+ ## `abk verify-incremental`
236
+
237
+ ```bash
238
+ abk verify-incremental [--select <exp>] [--metric <m>] [--rel-tol 1e-9] [--profile NAME]
239
+ ```
240
+
241
+ The gate before turning `compute.incremental_reads` on (and the drift detector
242
+ after). For EVERY already-computed cutoff of every state-eligible comparison it
243
+ loads the data both ways — `_ab_unit_state` day moments vs a full-window fact
244
+ rescan — and diffs the numbers field by field. Whole-series by design: a drift
245
+ that accumulates over many days cannot hide behind a green latest cutoff.
246
+
247
+ Read-only and lock-free; never part of `abk run` (it costs more than the run it
248
+ checks). Outcomes: **matched** (agree within `--rel-tol`), **DIVERGED** (prints
249
+ the offending fields, exits non-zero — usually an event backfilled into an
250
+ already-materialized day later than `data_lag`; heal with `abk run --full-refresh
251
+ --from/--to`), and **unverified** (the incremental read fell back to recompute for
252
+ that cutoff, so both sides ran the same code — reported separately, never counted
253
+ as a pass).
213
254
 
214
255
  ## Common workflows
215
256
 
@@ -31,10 +31,19 @@ assignment: # READ-ONLY exposure source — abkit never ran
31
31
  added_filters: "" # optional extra SQL fragment (must start with AND)
32
32
  variants: [control, treatment] # FIRST is control (name_1); >= 2, unique
33
33
  expected_split: {control: 0.5, treatment: 0.5} # must cover every variant, sum to 1.0; drives SRM
34
+ # cohort_copy: # opt-in (default OFF): persist an incremental,
35
+ # enabled: true # append-only _ab_exposures copy instead of
36
+ # update_column: exposure_ts # re-reading the live source every invocation
37
+ # batch_interval: 1d # (grid-anchored closed-interval batches;
38
+ # maturity_delay: 0 # batch_intervals_per_round_trip: 30 — intervals, not rows)
34
39
 
35
40
  alpha: 0.05 # experiment-level significance (unset -> project default)
36
41
  correction: bonferroni # none | bonferroni | benjamini_hochberg (unset -> project default)
37
42
  sequential: {enabled: false, scheme: always_valid} # opt-in peeking-safe CIs (default OFF)
43
+ # incremental_reads: true # override project.compute.incremental_reads here (unset -> project
44
+ # default): eligible closed-form comparisons read `_ab_unit_state`
45
+ # day moments instead of re-scanning the fact window. Changes HOW a
46
+ # number is computed, never the number; any state gap falls back.
38
47
 
39
48
  readout: # READ-TIME verdict knobs — NEVER enter method_config_id
40
49
  stabilization_days: 7 # trailing elapsed-DAYS window for "persistent significance" (default 7)
@@ -68,9 +77,18 @@ comparisons: # required — each binds one library metric to
68
77
  line and no verdict is trusted. Check SRM before believing any effect; fix the
69
78
  assignment query or randomization first.
70
79
  - The assignment SQL is a **read-only** source: it SELECTs `unit_key`, `variant`,
71
- and an exposure timestamp — abkit persists it once per run into `_ab_exposures`
72
- and never randomizes. Use `added_filters` (must start with `AND`) as the only
73
- escape hatch for extra WHERE conditions.
80
+ and an exposure timestamp — abkit never randomizes. By default
81
+ (`assignment.cohort_copy` unset) nothing is persisted: every
82
+ `abk run`/`plan`/`validate`/`explore` invocation re-renders and validates the
83
+ assignment SQL live and metric queries join a deduping subquery over it (the
84
+ no-copy cost/freshness tradeoff — never a stale row, at a render+validate
85
+ query each time). Set `assignment.cohort_copy.enabled: true` to persist an
86
+ append-only incremental copy into `_ab_exposures` instead (worth it for a
87
+ heavy multi-join or a mutating source; in copy mode the assignment SQL must
88
+ reference `{{ ab_added_filters }}` — the copy engine injects batch bounds
89
+ through it, and `abk run --resync-cohort` rebuilds a poisoned copy). Use
90
+ `added_filters` (must start with `AND`) as the only escape hatch for extra
91
+ WHERE conditions.
74
92
 
75
93
  ## Cumulative window, cadence & data_lag
76
94
 
@@ -23,6 +23,11 @@ name a configured **comparison** of that experiment (default: the main metric).
23
23
  — it never runs the pipeline, takes **no pipeline lock**, and never writes to
24
24
  the warehouse. Run `abk run --select <exp>` **first**: no computed rows ⇒ a
25
25
  friendly noop telling you to run first.
26
+ - **A broken live assignment source blocks the cockpit too** (M8): at
27
+ session-load explore resolves the cohort through the same
28
+ `build_cohort_backend` factory as `abk run` (the SRM chip's count source) —
29
+ in the default no-copy mode a source that empties or corrupts fails with a
30
+ clean, actionable error naming the fix, never a raw traceback.
26
31
  - Freshness is whatever the last `abk run` produced; the header shows the latest
27
32
  `end_ts` / watermark so staleness is visible. It is a **retuning** surface, not
28
33
  a live monitor.
@@ -57,10 +62,10 @@ DB round-trip** for a normal tune. Cost depends on which knob you turned:
57
62
 
58
63
  | Tier | Knob → | How it recomputes |
59
64
  |---|---|---|
60
- | **E** exact | `test_type`, most closed-form params | suffstats reconstructed from persisted rows, whole grid |
61
- | **α** | experiment-level `alpha` | alpha-inversion on closed-form rows (approx), whole grid |
65
+ | **E** exact | `test_type`, `alpha`, most closed-form params — incl. every CUPED knob except `covariate_lookback` (0.4.0) | suffstats reconstructed from persisted rows, whole grid |
66
+ | **α** | `alpha` on rows that cannot reconstruct (e.g. CUPED rows written before 0.4.0) | alpha-inversion on closed-form rows (approx), whole grid |
62
67
  | **S** session cache | needs raw samples (e.g. bootstrap) | `from_samples` over the bounded session cache (cached cutoffs) |
63
- | **R** reload | CUPED off→on with no cached covariate | flagged `R`; a serialized `/reload` re-reads the warehouse on demand |
68
+ | **R** reload | `covariate_lookback`, or CUPED off→on with no cached covariate | flagged `R`; a serialized `/reload` re-reads the warehouse on demand |
64
69
 
65
70
  The one session-load pass at startup (lock-free, read-only) fills a **bounded**
66
71
  Tier-S cache. Over budget ⇒ honest suffstats-only degradation (a smaller live
@@ -28,6 +28,9 @@ sql: | # inline SQL (or `query_file: sql/arpu.sql`)
28
28
  {% import 'abkit_assignment.jinja' as ab %}
29
29
  ...
30
30
  aa_fpr_budget: 0.07 # optional — per-metric A/A false-positive budget
31
+ state_additive: false # optional — declare that every role column is a plain
32
+ # sum()/count() over the window, so per-day partials add
33
+ # up to the window total (see below)
31
34
  ```
32
35
 
33
36
  Provide **exactly one** of `sql:` (inline; `query:` is an accepted alias) or
@@ -82,15 +85,20 @@ live there once, so metric SQL describes only its own aggregation:
82
85
  {% import 'abkit_assignment.jinja' as ab %}
83
86
  ```
84
87
 
85
- - `{{ ab.exposed_units() }}` — `INNER JOIN`s the persisted `_ab_exposures`
86
- cohort (loaded once per run, deduped per dialect), and applies both the coarse
87
- `event_date` predicate and the precise half-open `event_time` window. Optional
88
- args override the fact-side column names: `ab.exposed_units('dt', 'ts')`.
88
+ - `{{ ab.exposed_units() }}` — `INNER JOIN`s the ONE `ab_cohort_source`
89
+ builtin: by default (`assignment.cohort_copy` unset) a live deduping subquery
90
+ over the rendered assignment SQL (re-validated every invocation); with
91
+ `cohort_copy.enabled: true` the persisted, append-only-copied `_ab_exposures`
92
+ table (`FINAL` on ClickHouse). Metric authors never choose between the two.
93
+ Either mode applies both the coarse `event_date` predicate and the precise
94
+ half-open `event_time` window. Optional args override the fact-side column
95
+ names: `ab.exposed_units('dt', 'ts')`.
89
96
  - `{{ ab.variant_col() }}` — the arm label from the cohort (project it `AS
90
97
  variant` and reference it in `columns.variant`).
91
98
  - `{{ ab.stratum_col() }}` — the stratum label, when stratifying.
92
99
 
93
- Config-lint asserts the rendered SQL joins `_ab_exposures`; a metric authored
100
+ Config-lint asserts the rendered SQL joins the cohort through the macro
101
+ (present identically in both cohort modes); a metric authored
94
102
  without the macro fails. Never hand-roll the assignment join or the window
95
103
  filter. `{{ data_database }}` is the data-location built-in on **every** dialect
96
104
  (on Postgres it resolves to the profile's `data_schema` value); there is no
@@ -111,6 +119,38 @@ Set an explicit `columns.covariate` **only** when you compute a different
111
119
  covariate yourself (e.g. a snapshot column in your SQL); an explicit covariate
112
120
  role takes precedence and skips the second render.
113
121
 
122
+ ## `state_additive` (optional)
123
+
124
+ `state_additive: true` is your promise that this metric **splits by day**: every
125
+ role column is a plain `sum()`/`count()` over the window, so the per-day partials
126
+ add up to the whole-window total.
127
+
128
+ It gates the incremental compute engine. With it set, the `state` pipeline step
129
+ materializes this metric's per-(unit, day) moments into `_ab_unit_state`, and
130
+ `compute.incremental_reads: true` may then serve cutoffs from those moments
131
+ instead of re-scanning the fact window. Without it, the metric is always
132
+ recomputed over the whole window — always correct, just not cheap.
133
+
134
+ **Leave it off** for anything that does not split by day:
135
+
136
+ | Projection | Why it is not additive |
137
+ |---|---|
138
+ | `max(converted) AS converted` | summing daily maxima counts active days, not the window max |
139
+ | `1 AS visits` (a constant) | eleven daily renders sum to eleven, not one |
140
+ | `avg(x) AS x` | a mean of means is not the mean |
141
+ | `uniq(session_id)`, `count(DISTINCT …)` | daily distinct counts do not sum to the window's |
142
+ | `sum(x) / count(*) AS rate` | a ratio of aggregates; use a `ratio` metric instead |
143
+
144
+ abkit cannot read additivity off your SQL — a staging CTE, an outer
145
+ re-aggregation, a `UNION` branch or an identity `sum()` over a renamed per-unit
146
+ `max()` all look additive textually. It does refuse projections that visibly
147
+ contradict the promise (a bare `max()`, `DISTINCT`, a window function, a
148
+ multi-branch query), but that filter can only take eligibility away, never grant
149
+ it. The empirical check is
150
+ [`abk verify-incremental`](../reference/cli.md#abk-verify-incremental), which
151
+ reconciles both read paths across the whole computed series — run it before
152
+ turning `compute.incremental_reads` on.
153
+
114
154
  ## `aa_fpr_budget` (optional)
115
155
 
116
156
  A per-metric A/A false-positive budget (a fraction in `(0, 1]`) that `abk
@@ -25,9 +25,13 @@ pointing a **metric** (a separate reusable YAML + SQL) at a statistical
25
25
 
26
26
  Every `abk run` executes three stages per experiment:
27
27
 
28
- 1. **load** — persists the assignment cohort ONCE into `_ab_exposures`, then runs
29
- each metric's SQL against the source DB over the cumulative window (the macro
30
- joins the cohort). One row per unit in, additive aggregates out.
28
+ 1. **load** — resolves the assignment cohort once per run: by default
29
+ (`assignment.cohort_copy.enabled: false`) the assignment SQL is re-rendered
30
+ and validated live and nothing is persisted; with `cohort_copy.enabled:
31
+ true` an append-only, watermark-resumed incremental copy lands in
32
+ `_ab_exposures`. Then each metric's SQL runs against the source DB over the
33
+ cumulative window (the macro joins the cohort either way). One row per unit
34
+ in, additive aggregates out.
31
35
  2. **compute** — runs the configured statistical method (t/z-test, CUPED,
32
36
  ratio-delta, bootstrap) at each planned cutoff, gates SRM, and writes rows to
33
37
  `_ab_results` (the BI contract). Idempotent: already-computed cutoffs are
@@ -64,11 +68,11 @@ profile's `internal_database` / `internal_schema`, separate from the
64
68
  | Table | Holds |
65
69
  |---|---|
66
70
  | `_ab_results` | **The BI contract.** One row per `(experiment, metric, variant-pair, method_config_id, end_ts)` cumulative cutoff: effect, CI, p-value, per-arm stats, SRM flag, `insufficient_data`, `ci_kind`, `is_horizon`. Point BI here. |
67
- | `_ab_exposures` | The persisted assignment cohort (unit → variant → exposure_ts), loaded once per run; joined by every metric query and the SRM count source. |
71
+ | `_ab_exposures` | **Optional** — the persisted assignment cohort copy (unit → variant → exposure_ts), created/written only when `assignment.cohort_copy.enabled: true` (an append-only incremental copy; a routine run never deletes — `--resync-cohort` is the one exception). On the default no-copy path the table does not exist: metric queries and the SRM counts read the live assignment source instead. |
68
72
  | `_ab_experiments` | Informational experiment catalog (descriptions, variants, split, alpha, cadence, tags) for BI joins; the pipeline never reads it back for decisions. |
69
73
  | `_ab_aa_runs` | The `abk validate` A/A audit trail (per-cell FPR/power at the effective alpha); lights the explore calibration chip. Never pruned by `abk clean`. |
70
74
  | `_ab_tasks` | Pipeline run/lock bookkeeping — the atomic per-experiment lock (`abk unlock` clears a stale one). |
71
- | `_ab_unit_state` | A scalability seam (thin per-unit-moment materialization); v1 does NOT read it on the compute path. |
75
+ | `_ab_unit_state` | Per-(unit, day) cumulative moments, written by the `state` pipeline stage for eligible closed-form metrics. Read on the compute path only with `compute.incremental_reads: true` (opt-in, default off); any gap falls back to full recompute. Not a BI table. |
72
76
 
73
77
  ## Glossary
74
78
 
@@ -46,7 +46,7 @@ Without either, that comparison is reported **un-sizable — not guessed**. The
46
46
  | `--power 0.8` | Target power. Default: the project statistics default. |
47
47
  | `--alpha 0.05` | Experiment-level alpha *before* correction; the two-tier scheme still divides it. Default: experiment/project alpha. |
48
48
  | `--baseline <spec>` | Greenfield baseline moments (repeatable; see above). |
49
- | `--arrival-rate <units/day>` | Total units/day across arms, for the **runtime** (days-to-required-N) + always-valid **ASN** estimates. Default: derived read-only from `_ab_exposures`; without arrival data both are skipped. Must be `> 0`. |
49
+ | `--arrival-rate <units/day>` | Total units/day across arms, for the **runtime** (days-to-required-N) + always-valid **ASN** estimates. Default: derived read-only from the cohort source — the persisted `_ab_exposures` copy under `assignment.cohort_copy.enabled`, otherwise (the default) a fresh snapshot of the live assignment source re-executed at invocation time (the documented no-copy cost/freshness tradeoff); without arrival data both are skipped. Must be `> 0`. |
50
50
  | `--profile` | Profile name (default: `profiles.yml` `default_profile`). |
51
51
 
52
52
  ## What it refuses (honest, never invented math)
@@ -91,7 +91,10 @@ the false-positive rate (enable sequential or coarsen the cadence).
91
91
 
92
92
  The footer look-count + cost-shape line is the pre-launch timing/cost companion.
93
93
  **Runtime and ASN** ship too: given a **unit-arrival rate** — derived read-only from
94
- `_ab_exposures` (distinct units per observed day, whole-cohort window, split to the
94
+ the cohort source (the persisted `_ab_exposures` copy under
95
+ `assignment.cohort_copy.enabled: true`, otherwise a live re-render + re-validation
96
+ of the assignment SQL at invocation time — the default no-copy cost/freshness
97
+ tradeoff; distinct units per observed day, whole-cohort window, split to the
95
98
  control arm) or supplied with `--arrival-rate <units/day>` — each sizable comparison
96
99
  also reports **runtime** (`days-to-required-N = required_n / rate` plus the horizon
97
100
  length) and, for a `sequential.enabled`, sequential-eligible comparison, the **ASN**
@@ -41,6 +41,11 @@ timeouts: # per-step, seconds
41
41
 
42
42
  compute:
43
43
  mode: recompute # v1: full-window recompute (the golden reference). Only value today.
44
+ incremental_reads: false # opt-in (M9): eligible closed-form comparisons read the `state`
45
+ # stage's `_ab_unit_state` day moments instead of re-scanning the
46
+ # fact window; any gap falls back to recompute. An experiment can
47
+ # override it with its own `incremental_reads:`. Changes HOW a
48
+ # number is computed, never the number.
44
49
  ```
45
50
 
46
51
  Everything except `name` and `default_profile` has a default — a minimal project
@@ -130,8 +130,13 @@ abk validate --select <exp> [--method <m>]... [--metric <m>] [--iterations N] \
130
130
  serialize behind nightly runs.
131
131
  - **Exits non-zero** on any cell/harness failure; `--report` is the one best-effort
132
132
  exception (a bake failure yellow-skips, never fails validation).
133
- - Reads the experiment's persisted cohort — run `abk run --select <exp>` at least
134
- once first so there is data to resample.
133
+ - Resolves the cohort itself via `build_cohort_backend` each invocation — in the
134
+ default no-copy mode it renders and validates the LIVE assignment source
135
+ directly (no prior `abk run` needed for the cohort); with
136
+ `assignment.cohort_copy.enabled: true` it reads the persisted,
137
+ incrementally-copied `_ab_exposures` table, so a prior copy-mode run must have
138
+ populated it. Either way the metric event data must already exist in the
139
+ source DB.
135
140
 
136
141
  ## Reading the matrix — the three classic failures
137
142
 
@@ -217,8 +222,11 @@ A/A is the expensive corner**. So:
217
222
  - **Not a config lint.** `abk validate` = the A/A statistical matrix; `abk run
218
223
  --steps validate` = the config/schema/SQL gate. Different purpose, different lock,
219
224
  different stage names — never conflate.
220
- - **Run the pipeline first.** validate resamples the experiment's persisted cohort —
221
- `abk run --select <exp>` must have persisted data or there is nothing to split.
225
+ - **The cohort is resolved live, not read from a prior run.** In the no-copy
226
+ default validate re-renders/validates the live assignment source itself, so
227
+ `abk run` is not a prerequisite for the cohort (the metric event data must
228
+ still exist). Only in copy mode (`assignment.cohort_copy.enabled: true`) does
229
+ it read what previous runs copied into `_ab_exposures`.
222
230
  - **Peeking FPR is the hazard, not the verdict.** It deliberately measures the
223
231
  optional-stopping trap the readout's stabilization rule defends against; a high
224
232
  peeking FPR on a low single-look FPR means "enable `sequential`", not "the method
@@ -40,6 +40,12 @@ need an experiment that has run at least once:
40
40
  - **A project root** contains `abkit_project.yml` and `profiles.yml`. If
41
41
  `profiles.yml` is still the `abk init` placeholder, set up the DB first with
42
42
  **`abk-setup-project`**.
43
+ - **A broken assignment source blocks the cockpit too** (M8): at session-load
44
+ explore re-validates the live assignment SQL (the SRM chip's count source,
45
+ same `build_cohort_backend` factory as `abk run`); a validation failure
46
+ raises a clean error naming the fix — repair the assignment SQL, or set
47
+ `assignment.cohort_copy.enabled: true` to explore the last persisted cohort
48
+ instead of the live source.
43
49
  - **No experiment or metric yet?** Hand off to **`abk-new-experiment`** (and
44
50
  **`abk-new-metric`**) to design the config first — never fabricate YAML/SQL here.
45
51
  - **Compute a series** (more cutoffs ⇒ a richer stabilization curve):
@@ -86,8 +86,12 @@ hand-roll the assignment join.
86
86
  {% import 'abkit_assignment.jinja' as ab %}
87
87
  ```
88
88
 
89
- - `{{ ab.exposed_units() }}` — `INNER JOIN`s the persisted `_ab_exposures`
90
- cohort and applies the window + exposure filters and dedup. Override fact-side
89
+ - `{{ ab.exposed_units() }}` — `INNER JOIN`s the assignment cohort through the
90
+ `ab_cohort_source` builtin and applies the window + exposure filters and
91
+ dedup. By default (no `cohort_copy`) that is a live deduping subquery over
92
+ the assignment SQL — no `_ab_exposures` table involved; with
93
+ `assignment.cohort_copy.enabled: true` it joins the persisted copy instead.
94
+ Metric authors never choose between the two. Override fact-side
91
95
  column names with args if needed: `ab.exposed_units('dt', 'ts')`.
92
96
  - `{{ ab.variant_col() }}` — the arm label (project it `AS variant`).
93
97
  - `{{ ab.stratum_col() }}` — the stratum label, only when stratifying.
@@ -59,7 +59,7 @@ Flags (confirm the live set with `abk plan --help`):
59
59
  | `--power` | Target power (default: `statistics.power`, typically 0.8) |
60
60
  | `--alpha` | Experiment-level significance **before** correction (default: experiment/project alpha) |
61
61
  | `--baseline` | Baseline moments for a metric with no data (repeatable — Step 2) |
62
- | `--arrival-rate` | Total units/day across arms, for the runtime (days-to-N) + always-valid ASN estimates (default: derived read-only from `_ab_exposures`; must be `> 0`) |
62
+ | `--arrival-rate` | Total units/day across arms, for the runtime (days-to-N) + always-valid ASN estimates (default: derived read-only from the cohort source — the persisted `_ab_exposures` copy in copy mode, otherwise a fresh re-execution of the live assignment SQL at invocation time; must be `> 0`) |
63
63
  | `--profile` | Profile name (default: `profiles.yml` `default_profile`) |
64
64
 
65
65
  `--mde` and `--alpha` are in the comparison's own units: a `relative` test type reads
@@ -144,8 +144,11 @@ this; tell the user the true requirement is lower.
144
144
 
145
145
  `abk plan` is planning-only. Sizing (required-N / MDE / power) is the core; **runtime /
146
146
  ASN** ship alongside it. If the user asks "how long", `abk plan` reports **runtime**
147
- (days-to-required-N) from a unit-arrival rate — derived read-only from `_ab_exposures`
148
- or supplied with `--arrival-rate <units/day>` — and, for a `sequential.enabled`,
147
+ (days-to-required-N) from a unit-arrival rate — derived read-only by re-executing
148
+ the cohort source at invocation time (the live assignment SQL in the default
149
+ no-copy mode — the documented cost/freshness tradeoff — or the persisted
150
+ `_ab_exposures` copy in copy mode) or supplied with `--arrival-rate <units/day>` —
151
+ and, for a `sequential.enabled`,
149
152
  sequential-eligible comparison, the **ASN** (the always-valid design's average sample
150
153
  number: expected stopping N under H1/H0, horizon-capped). Without an arrival rate both
151
154
  are SKIPPED with a reason (never invented); a fixed-horizon/resampling design shows
@@ -83,9 +83,11 @@ profile already models this pattern.
83
83
  Point **both** at the user's real databases (the placeholder ships examples):
84
84
 
85
85
  - `internal_database` — a dedicated database for abkit's own `_ab_*` tables
86
- (`_ab_results`, `_ab_exposures`, `_ab_tasks`, `_ab_aa_runs`), created
87
- automatically on first run. Keep it **separate** from analytics data, e.g.
88
- `abkit_internal`.
86
+ (`_ab_results`, `_ab_tasks`, `_ab_aa_runs`), created automatically on first
87
+ run. `_ab_exposures` is created there too, but only when the experiment sets
88
+ `assignment.cohort_copy.enabled: true` — the (default) no-copy mode never
89
+ writes it; metric SQL joins the live assignment source instead. Keep it
90
+ **separate** from analytics data, e.g. `abkit_internal`.
89
91
  - `data_database` — where the source/fact tables your metric queries read from
90
92
  live (and where the seed dataset loads).
91
93
 
@@ -36,9 +36,14 @@ schema, the sequential/composed columns, budget-band resolution).
36
36
  - A project root has `abkit_project.yml`; `profiles.yml` must point at the real
37
37
  warehouse (if it's still the `abk init` placeholder, use **`abk-setup-project`**
38
38
  first).
39
- - **The pipeline must have run at least once.** validate resamples the
40
- experiment's **persisted** cohort — if nothing is loaded there is nothing to
41
- split. Run `abk run --select <exp>` first if needed.
39
+ - **In the (default) no-copy mode no prior `abk run` is required** — validate
40
+ re-renders and validates the live assignment source itself (the same
41
+ `build_cohort_backend` factory every command uses) and splits it in memory;
42
+ an empty/not-yet-launched cohort fails loudly with a reason. Only in copy
43
+ mode (`assignment.cohort_copy.enabled: true`) does validate read the
44
+ persisted `_ab_exposures` copy, so `abk run --select <exp>` must have
45
+ populated it first. The metric event data must exist in the source DB either
46
+ way.
42
47
 
43
48
  ## Step 1 — Run validate
44
49