ab-analysis-kit 0.3.0__tar.gz → 0.5.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 (177) hide show
  1. {ab_analysis_kit-0.3.0/ab_analysis_kit.egg-info → ab_analysis_kit-0.5.0}/PKG-INFO +12 -6
  2. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/README.md +11 -5
  3. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0/ab_analysis_kit.egg-info}/PKG-INFO +12 -6
  4. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/ab_analysis_kit.egg-info/SOURCES.txt +6 -0
  5. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/__init__.py +1 -1
  6. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/cli.md +39 -4
  7. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/experiments.md +39 -9
  8. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/explore.md +10 -3
  9. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/metrics.md +35 -0
  10. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/overview.md +6 -3
  11. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/project.md +5 -0
  12. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-new-experiment/SKILL.md +14 -6
  13. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-plan/SKILL.md +1 -1
  14. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/clean.py +59 -2
  15. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/explore.py +1 -8
  16. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/init.py +37 -5
  17. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/plan.py +18 -9
  18. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/run.py +12 -0
  19. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/unlock.py +7 -1
  20. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/validate.py +1 -7
  21. ab_analysis_kit-0.5.0/abkit/cli/commands/verify_incremental.py +160 -0
  22. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/main.py +47 -2
  23. ab_analysis_kit-0.5.0/abkit/compute/incremental_backend.py +442 -0
  24. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/compute/recompute_backend.py +69 -21
  25. ab_analysis_kit-0.5.0/abkit/compute/reconcile.py +366 -0
  26. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/config/experiment_config.py +290 -16
  27. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/config/metric_config.py +16 -0
  28. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/config/project_config.py +15 -0
  29. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/config/validator.py +33 -10
  30. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/core/__init__.py +8 -0
  31. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/core/models.py +11 -0
  32. ab_analysis_kit-0.5.0/abkit/core/period_planner.py +407 -0
  33. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/_sql_manager.py +64 -6
  34. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/clickhouse_manager.py +36 -1
  35. ab_analysis_kit-0.5.0/abkit/database/internal_tables/__init__.py +17 -0
  36. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_experiments.py +3 -2
  37. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_exposures.py +30 -0
  38. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_schema.py +10 -2
  39. ab_analysis_kit-0.5.0/abkit/database/internal_tables/_unit_state.py +429 -0
  40. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/manager.py +193 -1
  41. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/mysql_manager.py +10 -0
  42. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/postgres_manager.py +12 -0
  43. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/tables.py +24 -7
  44. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/loaders/exposure_copy.py +13 -2
  45. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/loaders/exposure_source.py +46 -0
  46. ab_analysis_kit-0.5.0/abkit/loaders/state_loader.py +96 -0
  47. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/_types.py +31 -0
  48. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/analyze.py +6 -3
  49. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/driver.py +190 -42
  50. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/enrich.py +8 -13
  51. ab_analysis_kit-0.5.0/abkit/pipeline/state.py +444 -0
  52. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/reporting/builder.py +1 -7
  53. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/base.py +43 -0
  54. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/__init__.py +2 -0
  55. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/bootstrap.py +72 -3
  56. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/paired_bootstrap.py +4 -5
  57. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/paired_post_normed_bootstrap.py +3 -4
  58. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/poisson_bootstrap.py +11 -8
  59. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/post_normed_bootstrap.py +6 -4
  60. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/cuped_ttest.py +8 -0
  61. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/result.py +8 -0
  62. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/rng.py +2 -2
  63. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/tuning/__init__.py +2 -0
  64. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/tuning/assets/explore.js +3 -3
  65. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/tuning/payload.py +1 -1
  66. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/tuning/recompute.py +373 -47
  67. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/tuning/server.py +121 -29
  68. ab_analysis_kit-0.5.0/abkit/tuning/session.py +572 -0
  69. ab_analysis_kit-0.5.0/abkit/utils/warn_scope.py +344 -0
  70. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/scoring.py +5 -3
  71. ab_analysis_kit-0.3.0/abkit/core/period_planner.py +0 -206
  72. ab_analysis_kit-0.3.0/abkit/database/internal_tables/__init__.py +0 -6
  73. ab_analysis_kit-0.3.0/abkit/database/internal_tables/_unit_state.py +0 -148
  74. ab_analysis_kit-0.3.0/abkit/tuning/session.py +0 -233
  75. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/LICENSE +0 -0
  76. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/MANIFEST.in +0 -0
  77. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/ab_analysis_kit.egg-info/dependency_links.txt +0 -0
  78. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/ab_analysis_kit.egg-info/entry_points.txt +0 -0
  79. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/ab_analysis_kit.egg-info/requires.txt +0 -0
  80. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/ab_analysis_kit.egg-info/top_level.txt +0 -0
  81. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/__init__.py +0 -0
  82. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/_output.py +0 -0
  83. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/CLAUDE.section.md +0 -0
  84. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/methods.md +0 -0
  85. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/plan.md +0 -0
  86. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/validate.md +0 -0
  87. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-explore/SKILL.md +0 -0
  88. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-feedback/SKILL.md +0 -0
  89. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-new-metric/SKILL.md +0 -0
  90. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-setup-project/SKILL.md +0 -0
  91. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-validate/SKILL.md +0 -0
  92. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/__init__.py +0 -0
  93. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/_context.py +0 -0
  94. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/init_claude.py +0 -0
  95. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/test_report.py +0 -0
  96. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/compute/__init__.py +0 -0
  97. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/config/__init__.py +0 -0
  98. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/config/discovery.py +0 -0
  99. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/config/method_config.py +0 -0
  100. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/config/profile.py +0 -0
  101. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/core/exposure_counting.py +0 -0
  102. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/core/interval.py +0 -0
  103. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/__init__.py +0 -0
  104. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_aa_runs.py +0 -0
  105. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_base.py +0 -0
  106. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_maintenance.py +0 -0
  107. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_results.py +0 -0
  108. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_tasks.py +0 -0
  109. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/manager.py +0 -0
  110. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/loaders/__init__.py +0 -0
  111. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/loaders/exposure_loader.py +0 -0
  112. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/loaders/metric_loader.py +0 -0
  113. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/loaders/query_template.py +0 -0
  114. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/loaders/templates/abkit_assignment.jinja +0 -0
  115. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/notify/__init__.py +0 -0
  116. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/notify/base.py +0 -0
  117. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/notify/branding.py +0 -0
  118. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/notify/email.py +0 -0
  119. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/notify/factory.py +0 -0
  120. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/notify/mattermost.py +0 -0
  121. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/notify/mock.py +0 -0
  122. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/notify/slack.py +0 -0
  123. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/notify/telegram.py +0 -0
  124. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/notify/webhook.py +0 -0
  125. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/__init__.py +0 -0
  126. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/readout.py +0 -0
  127. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/planning/__init__.py +0 -0
  128. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/planning/sizing.py +0 -0
  129. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/reporting/__init__.py +0 -0
  130. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/reporting/assets/report.js +0 -0
  131. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/reporting/calibration.py +0 -0
  132. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/reporting/html_report.py +0 -0
  133. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/__init__.py +0 -0
  134. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/accumulate.py +0 -0
  135. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/applier.py +0 -0
  136. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/ci.py +0 -0
  137. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/engine.py +0 -0
  138. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/correction.py +0 -0
  139. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/effects.py +0 -0
  140. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/exceptions.py +0 -0
  141. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/factory.py +0 -0
  142. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/__init__.py +0 -0
  143. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/paired_cuped_ttest.py +0 -0
  144. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/paired_ttest.py +0 -0
  145. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/ratio_delta.py +0 -0
  146. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/ttest.py +0 -0
  147. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/ztest.py +0 -0
  148. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/power.py +0 -0
  149. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/registry.py +0 -0
  150. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/samples.py +0 -0
  151. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/sequential/__init__.py +0 -0
  152. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/sequential/apply.py +0 -0
  153. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/sequential/confidence_sequence.py +0 -0
  154. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/sequential/mixture.py +0 -0
  155. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/stats/srm.py +0 -0
  156. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/tuning/config_writer.py +0 -0
  157. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/tuning/html.py +0 -0
  158. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/utils/__init__.py +0 -0
  159. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/utils/datetime_utils.py +0 -0
  160. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/utils/env_interpolation.py +0 -0
  161. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/utils/json_utils.py +0 -0
  162. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/__init__.py +0 -0
  163. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/_types.py +0 -0
  164. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/family.py +0 -0
  165. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/inject.py +0 -0
  166. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/load.py +0 -0
  167. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/panel.py +0 -0
  168. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/persistence.py +0 -0
  169. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/resample.py +0 -0
  170. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/result.py +0 -0
  171. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/run_id.py +0 -0
  172. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/runner.py +0 -0
  173. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/abkit/validate/vector_resample.py +0 -0
  174. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/pyproject.toml +0 -0
  175. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/requirements.txt +0 -0
  176. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/setup.cfg +0 -0
  177. {ab_analysis_kit-0.3.0 → ab_analysis_kit-0.5.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ab-analysis-kit
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: A/B experiment analysis as declarative YAML + SQL
5
5
  Author: ab-analysis-kit authors
6
6
  License: MIT
@@ -76,9 +76,14 @@ 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.3.0` (Alpha) — release-ready; `0.2.0` is the latest on PyPI**
80
- > (milestones **M1–M8** shipped — M8 adds the no-copy assignment default + the
81
- > opt-in incremental `_ab_exposures` copy). The
79
+ > **Status: `0.5.0` (Alpha) — release-ready; `0.4.0` is the latest on PyPI**
80
+ > (milestones **M1–M10** shipped — M10 makes an experiment's window a pair of
81
+ > real timestamps (`start_ts`/`horizon_ts`, with `interval_anchor` deciding
82
+ > where the cutoff lattice sits), collects both breaking schema changes of the
83
+ > polish track into this one release with a single recreate instruction, and
84
+ > fixes two live `abk explore` defects: a knob turn no longer queues behind a
85
+ > Reload or Auto-validate, and dragging alpha over a bootstrap series stops
86
+ > redrawing the replicates — 6.01 s → 1.01 s over six turns). The
82
87
  > statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
83
88
  > self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
84
89
  > opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
@@ -91,8 +96,9 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
91
96
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
92
97
  ```
93
98
 
94
- (`0.3.0`'s M8 no-copy default lands with its tag; until then `pip install
95
- ab-analysis-kit` gets `0.2.0` — for the M8 behavior install from source:
99
+ (`0.5.0`'s renamed window fields + explore fixes land with its tag; until then
100
+ `pip install ab-analysis-kit` gets `0.4.0`, which still expects
101
+ `start_date`/`end_date` — for the M10 behavior install from source:
96
102
  `pip install -e ".[dev]"`.)
97
103
 
98
104
  `abk --version` and `abk --help` work with no database driver; you can even lint a
@@ -11,9 +11,14 @@ 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.3.0` (Alpha) — release-ready; `0.2.0` is the latest on PyPI**
15
- > (milestones **M1–M8** shipped — M8 adds the no-copy assignment default + the
16
- > opt-in incremental `_ab_exposures` copy). The
14
+ > **Status: `0.5.0` (Alpha) — release-ready; `0.4.0` is the latest on PyPI**
15
+ > (milestones **M1–M10** shipped — M10 makes an experiment's window a pair of
16
+ > real timestamps (`start_ts`/`horizon_ts`, with `interval_anchor` deciding
17
+ > where the cutoff lattice sits), collects both breaking schema changes of the
18
+ > polish track into this one release with a single recreate instruction, and
19
+ > fixes two live `abk explore` defects: a knob turn no longer queues behind a
20
+ > Reload or Auto-validate, and dragging alpha over a bootstrap series stops
21
+ > redrawing the replicates — 6.01 s → 1.01 s over six turns). The
17
22
  > statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
18
23
  > self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
19
24
  > opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
@@ -26,8 +31,9 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
26
31
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
27
32
  ```
28
33
 
29
- (`0.3.0`'s M8 no-copy default lands with its tag; until then `pip install
30
- ab-analysis-kit` gets `0.2.0` — for the M8 behavior install from source:
34
+ (`0.5.0`'s renamed window fields + explore fixes land with its tag; until then
35
+ `pip install ab-analysis-kit` gets `0.4.0`, which still expects
36
+ `start_date`/`end_date` — for the M10 behavior install from source:
31
37
  `pip install -e ".[dev]"`.)
32
38
 
33
39
  `abk --version` and `abk --help` work with no database driver; you can even lint a
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ab-analysis-kit
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary: A/B experiment analysis as declarative YAML + SQL
5
5
  Author: ab-analysis-kit authors
6
6
  License: MIT
@@ -76,9 +76,14 @@ 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.3.0` (Alpha) — release-ready; `0.2.0` is the latest on PyPI**
80
- > (milestones **M1–M8** shipped — M8 adds the no-copy assignment default + the
81
- > opt-in incremental `_ab_exposures` copy). The
79
+ > **Status: `0.5.0` (Alpha) — release-ready; `0.4.0` is the latest on PyPI**
80
+ > (milestones **M1–M10** shipped — M10 makes an experiment's window a pair of
81
+ > real timestamps (`start_ts`/`horizon_ts`, with `interval_anchor` deciding
82
+ > where the cutoff lattice sits), collects both breaking schema changes of the
83
+ > polish track into this one release with a single recreate instruction, and
84
+ > fixes two live `abk explore` defects: a knob turn no longer queues behind a
85
+ > Reload or Auto-validate, and dragging alpha over a bootstrap series stops
86
+ > redrawing the replicates — 6.01 s → 1.01 s over six turns). The
82
87
  > statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
83
88
  > self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
84
89
  > opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
@@ -91,8 +96,9 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
91
96
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
92
97
  ```
93
98
 
94
- (`0.3.0`'s M8 no-copy default lands with its tag; until then `pip install
95
- ab-analysis-kit` gets `0.2.0` — for the M8 behavior install from source:
99
+ (`0.5.0`'s renamed window fields + explore fixes land with its tag; until then
100
+ `pip install ab-analysis-kit` gets `0.4.0`, which still expects
101
+ `start_date`/`end_date` — for the M10 behavior install from source:
96
102
  `pip install -e ".[dev]"`.)
97
103
 
98
104
  `abk --version` and `abk --help` work with no database driver; you can even lint a
@@ -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
@@ -81,6 +84,7 @@ abkit/loaders/exposure_loader.py
81
84
  abkit/loaders/exposure_source.py
82
85
  abkit/loaders/metric_loader.py
83
86
  abkit/loaders/query_template.py
87
+ abkit/loaders/state_loader.py
84
88
  abkit/loaders/templates/abkit_assignment.jinja
85
89
  abkit/notify/__init__.py
86
90
  abkit/notify/base.py
@@ -98,6 +102,7 @@ abkit/pipeline/analyze.py
98
102
  abkit/pipeline/driver.py
99
103
  abkit/pipeline/enrich.py
100
104
  abkit/pipeline/readout.py
105
+ abkit/pipeline/state.py
101
106
  abkit/planning/__init__.py
102
107
  abkit/planning/sizing.py
103
108
  abkit/reporting/__init__.py
@@ -150,6 +155,7 @@ abkit/utils/__init__.py
150
155
  abkit/utils/datetime_utils.py
151
156
  abkit/utils/env_interpolation.py
152
157
  abkit/utils/json_utils.py
158
+ abkit/utils/warn_scope.py
153
159
  abkit/validate/__init__.py
154
160
  abkit/validate/_types.py
155
161
  abkit/validate/family.py
@@ -10,7 +10,7 @@ from __future__ import annotations
10
10
 
11
11
  from typing import Any
12
12
 
13
- __version__ = "0.3.0"
13
+ __version__ = "0.5.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
+ abk run [--select <exp>] [--exclude <sel>] [--steps validate,plan,load,state,compute] \
73
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
@@ -100,6 +106,9 @@ are (re)computed, so re-running is idempotent.
100
106
  experiment (best-effort — never fails the run). Tri-state: bare `--report` →
101
107
  `reports/<exp>.html`; a directory → `<dir>/<exp>.html`; a `.html` path → that
102
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).
103
112
  - `--force` — take over a held lock (prefer `abk unlock`; risky with concurrent runs).
104
113
  - `--profile` — override `profiles.yml`'s `default_profile` (e.g. run against staging).
105
114
 
@@ -216,6 +225,32 @@ default** — pass `--execute` to actually delete.
216
225
  - **GC mode** — `abk clean --orphaned-experiments`: purges all internal rows for
217
226
  experiment names present in the DB but no longer defined by any YAML (renamed or
218
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).
219
254
 
220
255
  ## Common workflows
221
256
 
@@ -18,13 +18,18 @@ status: running # design | running | concluded | archived (defa
18
18
  is_actual: true # catalog flag only (persisted to _ab_experiments); NOT read for selection (default true)
19
19
  tags: [growth, onboarding] # optional — selectable via `--select tag:<t>` (e.g. tag:actual matches this list)
20
20
 
21
- start_date: 2024-07-01 # required — PINNED left edge of every cumulative window
22
- end_date: 2024-07-14 # required — planner horizon (also drives the power plan)
21
+ start_ts: 2024-07-01 # required — PINNED left edge of every cumulative window
22
+ # (bare date = local midnight; a timestamp is exact)
23
+ horizon_ts: 2024-07-15 # required — planner horizon, the EXCLUSIVE right edge
24
+ # (this covers July 1..14); also drives the power plan
23
25
  unit_key: user_id # required — randomization + default analysis unit
24
26
 
25
27
  cadence: 1d # cumulative cutoff step (default "1d"); see "Cadence" below
28
+ interval_anchor: midnight # WHERE the cutoffs land: midnight (default) | start |
29
+ # an explicit timestamp; see "Cadence" below
26
30
  data_lag: 0 # completeness watermark; REQUIRED when cadence < 1d
27
- timezone: UTC # interprets date fields & midnight snapping; storage is UTC (default UTC)
31
+ timezone: UTC # interprets bare-date edges, the `midnight` anchor and the
32
+ # day lattice; storage is UTC (default UTC)
28
33
 
29
34
  assignment: # READ-ONLY exposure source — abkit never randomizes
30
35
  query_file: sql/assignment.sql # or inline `query:` (exactly one, never both)
@@ -40,6 +45,10 @@ assignment: # READ-ONLY exposure source — abkit never ran
40
45
  alpha: 0.05 # experiment-level significance (unset -> project default)
41
46
  correction: bonferroni # none | bonferroni | benjamini_hochberg (unset -> project default)
42
47
  sequential: {enabled: false, scheme: always_valid} # opt-in peeking-safe CIs (default OFF)
48
+ # incremental_reads: true # override project.compute.incremental_reads here (unset -> project
49
+ # default): eligible closed-form comparisons read `_ab_unit_state`
50
+ # day moments instead of re-scanning the fact window. Changes HOW a
51
+ # number is computed, never the number; any state gap falls back.
43
52
 
44
53
  readout: # READ-TIME verdict knobs — NEVER enter method_config_id
45
54
  stabilization_days: 7 # trailing elapsed-DAYS window for "persistent significance" (default 7)
@@ -88,11 +97,16 @@ comparisons: # required — each binds one library metric to
88
97
 
89
98
  ## Cumulative window, cadence & data_lag
90
99
 
91
- - The analysis window is **pinned-start / moving-end**: `start_date` never moves;
100
+ - The analysis window is **pinned-start / moving-end**: `start_ts` never moves;
92
101
  each cutoff advances the end through the horizon, producing the stabilization
93
- series (one point per cutoff, effect + CI over `[start_date .. cutoff]`).
94
- - `end_date` is the **horizon**: the last daily cutoff covers this day, and it
95
- drives the power plan and the sequential pre-horizon rule below.
102
+ series (one point per cutoff, effect + CI over `[start_ts .. cutoff]`).
103
+ - Both edges are **timestamps**. A bare date is shorthand for local midnight of
104
+ that day in `timezone`, so `start_ts: 2024-07-01` reads exactly as before; a
105
+ full timestamp (`2024-07-01 14:30:00`) is that exact instant, with no snap.
106
+ - `horizon_ts` is the **horizon** and it is EXCLUSIVE — the window is
107
+ `[start_ts, horizon_ts)`. An experiment running July 1..14 inclusive has
108
+ `horizon_ts: 2024-07-15`. It drives the power plan and the sequential
109
+ pre-horizon rule below.
96
110
  - `cadence` is the cutoff step. Either a **duration scalar** (`"1h"`, `"30m"`,
97
111
  `"1d"`, or integer seconds) or a **coarsening schedule** — a dense-early list
98
112
  that must be strictly coarsening with strictly increasing `until` bounds (only
@@ -104,6 +118,22 @@ comparisons: # required — each binds one library metric to
104
118
  - {every: 1d} # daily thereafter
105
119
  ```
106
120
 
121
+ - `interval_anchor` decides **where** the cutoff lattice sits (`cadence` decides
122
+ how far apart the points are). Cutoffs are `anchor + k*cadence`, kept strictly
123
+ after `start_ts`. Three forms:
124
+
125
+ | value | meaning |
126
+ |---|---|
127
+ | `midnight` (default when absent) | local midnight of the day the window opens — whole calendar days, what BI dashboards read |
128
+ | `start` | count from the start instant: a 14:00 start ⇒ 14:00 cutoffs |
129
+ | an explicit timestamp | align to an external cycle (e.g. 3-day windows at 00:00 MSK on a UTC warehouse) |
130
+
131
+ The anchor MAY precede `start_ts` — the forward snap is what makes that
132
+ well-defined, and the first window is then legitimately partial. Note
133
+ `midnight` anchors to the experiment's OWN opening day, not to a global
134
+ cycle: two experiments starting a day apart get interleaved 3-day lattices.
135
+ Use the explicit form when the cycle must be shared. Day-or-coarser steps hold
136
+ the anchor's local wall-clock time across DST; sub-day steps are absolute.
107
137
  - `data_lag` is the completeness watermark: a cutoff is analyzed only once
108
138
  `end_ts <= now() - data_lag`. **Required when cadence < 1d** (declare your
109
139
  ingestion SLA). At daily cadence the default `0` reproduces the legacy
@@ -162,8 +192,8 @@ series early and stopping ("peeking") inflates the false-positive rate. Therefor
162
192
 
163
193
  ```yaml
164
194
  name: pricing_test
165
- start_date: 2024-07-01
166
- end_date: 2024-07-14
195
+ start_ts: 2024-07-01
196
+ horizon_ts: 2024-07-15
167
197
  unit_key: user_id
168
198
  assignment:
169
199
  query_file: sql/assignment.sql
@@ -62,15 +62,22 @@ DB round-trip** for a normal tune. Cost depends on which knob you turned:
62
62
 
63
63
  | Tier | Knob → | How it recomputes |
64
64
  |---|---|---|
65
- | **E** exact | `test_type`, most closed-form params | suffstats reconstructed from persisted rows, whole grid |
66
- | **α** | 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 |
67
67
  | **S** session cache | needs raw samples (e.g. bootstrap) | `from_samples` over the bounded session cache (cached cutoffs) |
68
- | **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 |
69
69
 
70
70
  The one session-load pass at startup (lock-free, read-only) fills a **bounded**
71
71
  Tier-S cache. Over budget ⇒ honest suffstats-only degradation (a smaller live
72
72
  surface), never a silently partial cache.
73
73
 
74
+ Since 0.5.0 an **alpha drag over a bootstrap series redraws nothing**: the
75
+ replicates are alpha-free, so they are drawn once per (metric, arm pair,
76
+ cutoff, method, resolved params) and the percentile CI is re-derived per alpha.
77
+ Same replicates ⇒ same numbers (a cache, not an approximation); a `Reload`
78
+ of a cutoff discards them, and any knob that feeds the draw itself
79
+ (`n_samples`, `stat`, `stratify`, …) is a new draw.
80
+
74
81
  ## Calibration is always visible; Apply is gated
75
82
 
76
83
  - The **A/A real-α chip** lives in the cockpit, never a separate screen. It keys
@@ -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
@@ -116,6 +119,38 @@ Set an explicit `columns.covariate` **only** when you compute a different
116
119
  covariate yourself (e.g. a snapshot column in your SQL); an explicit covariate
117
120
  role takes precedence and skips the second render.
118
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
+
119
154
  ## `aa_fpr_budget` (optional)
120
155
 
121
156
  A per-metric A/A false-positive budget (a fraction in `(0, 1]`) that `abk
@@ -72,7 +72,7 @@ profile's `internal_database` / `internal_schema`, separate from the
72
72
  | `_ab_experiments` | Informational experiment catalog (descriptions, variants, split, alpha, cadence, tags) for BI joins; the pipeline never reads it back for decisions. |
73
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`. |
74
74
  | `_ab_tasks` | Pipeline run/lock bookkeeping — the atomic per-experiment lock (`abk unlock` clears a stale one). |
75
- | `_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. |
76
76
 
77
77
  ## Glossary
78
78
 
@@ -92,8 +92,11 @@ profile's `internal_database` / `internal_schema`, separate from the
92
92
  extra SQL). Sized on raw variance.
93
93
  - **cadence** — the spacing of cumulative cutoffs (`1d`, or a coarsening schedule
94
94
  `[{every: 1h, until: 48h}, {every: 1d}]`). Window start is PINNED; end moves.
95
- - **horizon** — the planned end (`end_date`); fixed-horizon CIs are only valid
96
- here. `is_horizon` marks the row where a WIN/LOSE/FLAT may be called.
95
+ - **interval_anchor** — WHERE that lattice sits: `midnight` (default — local
96
+ midnight of the opening day) | `start` | an explicit timestamp. Cutoffs are
97
+ `anchor + k*cadence`, kept after `start_ts`.
98
+ - **horizon** — the planned end (`horizon_ts`, EXCLUSIVE); fixed-horizon CIs are
99
+ only valid here. `is_horizon` marks the row where a WIN/LOSE/FLAT may be called.
97
100
  - **data_lag** — the watermark: a cutoff is pending only once late data has
98
101
  landed (`end_ts ≤ now − data_lag`). Required when cadence < 1d.
99
102
  - **method_config_id** — hash of the method + its non-default **identity** params
@@ -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
@@ -104,13 +104,19 @@ and `abk clean` prune the strays. `seed` and `alpha` are identity-EXCLUDED.
104
104
 
105
105
  ## Step 6 — Window, cadence, data_lag, alpha
106
106
 
107
- - `start_date` (PINNED left edge of every cumulative window) and `end_date` (the
108
- planned **horizon** the power plan targets). Use `unit_key` for the analysis
109
- unit.
107
+ - `start_ts` (PINNED left edge of every cumulative window) and `horizon_ts` (the
108
+ planned **horizon** the power plan targets). Both take a bare date — local
109
+ midnight of that day in `timezone` — or a full timestamp, which is the exact
110
+ instant. `horizon_ts` is **EXCLUSIVE**: an experiment running Aug 1..21
111
+ inclusive has `horizon_ts: 2024-08-22`. Use `unit_key` for the analysis unit.
110
112
  - `cadence:` — the cutoff step (`1d` default; or a dense-early schedule like
111
113
  `[{every: 1h, until: 48h}, {every: 1d}]`). **Cadence below `1d` REQUIRES
112
114
  `data_lag:`** (declare the ingestion SLA; use `data_lag: 0` only if data is
113
115
  truly complete in real time).
116
+ - `interval_anchor:` — WHERE the cutoffs land: `midnight` (default when omitted —
117
+ local midnight of the opening day) | `start` (count from `start_ts`) | an
118
+ explicit timestamp to align to an external cycle (it may precede `start_ts`,
119
+ making the first window partial). Cutoffs are `anchor + k*cadence`.
114
120
  - `alpha:` / `correction:` — omit to inherit project defaults; `correction:
115
121
  bonferroni` gives the two-tier split, read-time BH is applied across a family.
116
122
 
@@ -140,10 +146,11 @@ result:
140
146
  name: checkout_button_color
141
147
  description: "Green vs blue primary CTA on checkout"
142
148
  status: running
143
- start_date: 2024-08-01 # PINNED window start
144
- end_date: 2024-08-21 # horizon
149
+ start_ts: 2024-08-01 # PINNED window start (bare date = local midnight)
150
+ horizon_ts: 2024-08-22 # horizon — EXCLUSIVE, so this covers Aug 1..21
145
151
  unit_key: user_id
146
152
  cadence: 1d
153
+ interval_anchor: midnight # midnight (default) | start | an explicit timestamp
147
154
 
148
155
  assignment:
149
156
  query_file: sql/checkout_button_color_assignment.sql
@@ -178,7 +185,8 @@ Fix every reported error before declaring done. Re-check:
178
185
  - [ ] Exactly ≥1 comparison sets `is_main_metric: true`; no main+guardrail clash.
179
186
  - [ ] Each method name is registered and its params instantiate (no quarantined
180
187
  branch, no unknown param).
181
- - [ ] `end_date >= start_date`; sub-day cadence has `data_lag`.
188
+ - [ ] `horizon_ts > start_ts` (the horizon is exclusive); sub-day cadence has
189
+ `data_lag`.
182
190
 
183
191
  ## Step 9 — Run it, and what's next
184
192
 
@@ -133,7 +133,7 @@ this; tell the user the true requirement is lower.
133
133
 
134
134
  ## Step 5 — Act on the result
135
135
 
136
- - **Underpowered at the horizon?** Extend `end_date`, raise traffic/allocation, pick a
136
+ - **Underpowered at the horizon?** Extend `horizon_ts`, raise traffic/allocation, pick a
137
137
  lower-variance or CUPED method, or accept a larger detectable MDE. Re-plan.
138
138
  - **Comfortably powered?** The design is sound to launch. Remind the user that reading
139
139
  the daily series early is peeking — if they want to stop early, enable
@@ -65,6 +65,56 @@ def _clean_drift(
65
65
  return experiments_touched, pruned
66
66
 
67
67
 
68
+ def _clean_state_series(
69
+ context: ProjectContext,
70
+ tables: InternalTablesManager,
71
+ execute: bool,
72
+ ) -> int:
73
+ """Prune ``_ab_unit_state`` series no live (experiment, metric) claims.
74
+
75
+ The STATE-side analogue of the drift sweep (m9 WP5). The per-run sweep in
76
+ ``pipeline/state.py`` already drops superseded ``column_set_id``s under a
77
+ source key it touches — this catches what a run can never revisit: a
78
+ comparison removed, a metric renamed, an experiment deleted, or a
79
+ comparison that stopped being STATE-eligible. Deliberately
80
+ selection-INDEPENDENT: state rows are not experiment-keyed, so the valid
81
+ set is computed from the WHOLE project (pruning by a narrow ``--select``
82
+ would delete another experiment's live series).
83
+ """
84
+ from abkit.pipeline.state import state_eligible_metrics, state_series_key
85
+
86
+ if not tables.unit_state_table_exists():
87
+ return 0
88
+
89
+ metrics_by_name = context.metrics_by_name
90
+ valid: dict[str, str] = {}
91
+ for _, experiment in context.experiments:
92
+ for metric, metric_sql in state_eligible_metrics(experiment, metrics_by_name, context.root):
93
+ source_id, series_id = state_series_key(experiment, metric, metric_sql, context.root)
94
+ valid[source_id] = series_id
95
+
96
+ dropped = 0
97
+ children: list[str] = []
98
+ for source_id in tables.list_state_sources():
99
+ live_series = valid.get(source_id)
100
+ for series_id in tables.list_state_column_sets(source_id):
101
+ if series_id == live_series:
102
+ continue
103
+ reason = "no live metric" if live_series is None else "superseded definition"
104
+ children.append(
105
+ f"{'pruned' if execute else 'would prune'} state {source_id} / "
106
+ f"{series_id[:12]}… ({reason})"
107
+ )
108
+ dropped += 1
109
+ if execute:
110
+ tables.delete_state_series(source_id, series_id)
111
+ if children:
112
+ echo_tree("_ab_unit_state", children)
113
+ else:
114
+ echo_noop("_ab_unit_state", "no orphaned state series")
115
+ return dropped
116
+
117
+
68
118
  def _clean_orphaned_experiments(
69
119
  context: ProjectContext,
70
120
  tables: InternalTablesManager,
@@ -122,10 +172,17 @@ def run_clean(
122
172
  return
123
173
 
124
174
  touched, pruned = _clean_drift(context, tables, select, execute)
175
+ state_dropped = _clean_state_series(context, tables, execute)
125
176
  if execute:
126
- echo_done(f"Pruned {pruned} row(s) across {touched} experiment(s).")
177
+ summary = f"Pruned {pruned} row(s) across {touched} experiment(s)."
178
+ if state_dropped:
179
+ summary += f" Dropped {state_dropped} orphaned state series."
180
+ echo_done(summary)
127
181
  else:
128
- echo_done(f"Dry run: {touched} experiment(s) have orphaned series.")
182
+ summary = f"Dry run: {touched} experiment(s) have orphaned series."
183
+ if state_dropped:
184
+ summary += f" {state_dropped} orphaned state series."
185
+ echo_done(summary)
129
186
  except Exception as exc:
130
187
  echo_error("clean", str(exc))
131
188
  raise SystemExit(1) from exc
@@ -48,7 +48,6 @@ def run_explore(
48
48
  no_serve: bool,
49
49
  no_open: bool,
50
50
  ) -> None:
51
- from abkit.core.period_planner import generate_grid
52
51
  from abkit.database.internal_tables import InternalTablesManager
53
52
  from abkit.loaders.exposure_source import ExposureLoadError, build_cohort_backend
54
53
  from abkit.reporting import build_report_payload
@@ -136,13 +135,7 @@ def run_explore(
136
135
  }
137
136
  # the WP4 factory (the same grid parameters load_session enumerates):
138
137
  # copy mode joins the persisted cohort, direct mode the live source
139
- grid = generate_grid(
140
- experiment.start_date,
141
- experiment.end_date,
142
- experiment.cadence_segments(),
143
- tz=experiment.timezone,
144
- limit=context.project.limits.max_looks,
145
- )
138
+ grid = experiment.grid(limit=context.project.limits.max_looks)
146
139
  try:
147
140
  backend, cohort_snapshot = build_cohort_backend(manager, experiment, context.root, grid)
148
141
  except ExposureLoadError as exc: