ab-analysis-kit 0.4.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 (175) hide show
  1. {ab_analysis_kit-0.4.0/ab_analysis_kit.egg-info → ab_analysis_kit-0.5.0}/PKG-INFO +12 -9
  2. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/README.md +11 -8
  3. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0/ab_analysis_kit.egg-info}/PKG-INFO +12 -9
  4. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/ab_analysis_kit.egg-info/SOURCES.txt +1 -0
  5. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/__init__.py +1 -1
  6. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/experiments.md +35 -9
  7. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/explore.md +7 -0
  8. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/overview.md +5 -2
  9. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-new-experiment/SKILL.md +14 -6
  10. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-plan/SKILL.md +1 -1
  11. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/explore.py +1 -8
  12. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/init.py +28 -5
  13. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/plan.py +18 -9
  14. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/unlock.py +7 -1
  15. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/validate.py +1 -7
  16. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/compute/incremental_backend.py +17 -14
  17. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/compute/recompute_backend.py +16 -9
  18. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/compute/reconcile.py +3 -9
  19. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/config/experiment_config.py +284 -16
  20. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/config/validator.py +33 -10
  21. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/core/__init__.py +8 -0
  22. ab_analysis_kit-0.5.0/abkit/core/period_planner.py +407 -0
  23. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_experiments.py +3 -2
  24. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_unit_state.py +1 -1
  25. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/manager.py +24 -7
  26. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/tables.py +16 -7
  27. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/loaders/exposure_copy.py +13 -2
  28. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/analyze.py +6 -3
  29. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/driver.py +30 -9
  30. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/enrich.py +4 -13
  31. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/state.py +37 -12
  32. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/reporting/builder.py +1 -7
  33. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/base.py +35 -0
  34. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/__init__.py +2 -0
  35. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/bootstrap.py +72 -3
  36. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/paired_bootstrap.py +4 -5
  37. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/paired_post_normed_bootstrap.py +3 -4
  38. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/poisson_bootstrap.py +11 -8
  39. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/post_normed_bootstrap.py +6 -4
  40. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/rng.py +2 -2
  41. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/tuning/__init__.py +2 -0
  42. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/tuning/payload.py +1 -1
  43. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/tuning/recompute.py +251 -23
  44. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/tuning/server.py +121 -29
  45. ab_analysis_kit-0.5.0/abkit/tuning/session.py +572 -0
  46. ab_analysis_kit-0.5.0/abkit/utils/warn_scope.py +344 -0
  47. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/scoring.py +5 -3
  48. ab_analysis_kit-0.4.0/abkit/core/period_planner.py +0 -206
  49. ab_analysis_kit-0.4.0/abkit/tuning/session.py +0 -233
  50. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/LICENSE +0 -0
  51. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/MANIFEST.in +0 -0
  52. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/ab_analysis_kit.egg-info/dependency_links.txt +0 -0
  53. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/ab_analysis_kit.egg-info/entry_points.txt +0 -0
  54. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/ab_analysis_kit.egg-info/requires.txt +0 -0
  55. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/ab_analysis_kit.egg-info/top_level.txt +0 -0
  56. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/__init__.py +0 -0
  57. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/_output.py +0 -0
  58. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/CLAUDE.section.md +0 -0
  59. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/cli.md +0 -0
  60. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/methods.md +0 -0
  61. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/metrics.md +0 -0
  62. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/plan.md +0 -0
  63. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/project.md +0 -0
  64. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/rules/validate.md +0 -0
  65. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-explore/SKILL.md +0 -0
  66. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-feedback/SKILL.md +0 -0
  67. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-new-metric/SKILL.md +0 -0
  68. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-setup-project/SKILL.md +0 -0
  69. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/assets/claude/skills/abk-validate/SKILL.md +0 -0
  70. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/__init__.py +0 -0
  71. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/_context.py +0 -0
  72. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/clean.py +0 -0
  73. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/init_claude.py +0 -0
  74. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/run.py +0 -0
  75. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/test_report.py +0 -0
  76. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/commands/verify_incremental.py +0 -0
  77. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/cli/main.py +0 -0
  78. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/compute/__init__.py +0 -0
  79. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/config/__init__.py +0 -0
  80. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/config/discovery.py +0 -0
  81. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/config/method_config.py +0 -0
  82. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/config/metric_config.py +0 -0
  83. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/config/profile.py +0 -0
  84. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/config/project_config.py +0 -0
  85. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/core/exposure_counting.py +0 -0
  86. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/core/interval.py +0 -0
  87. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/core/models.py +0 -0
  88. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/__init__.py +0 -0
  89. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/_sql_manager.py +0 -0
  90. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/clickhouse_manager.py +0 -0
  91. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/__init__.py +0 -0
  92. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_aa_runs.py +0 -0
  93. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_base.py +0 -0
  94. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_exposures.py +0 -0
  95. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_maintenance.py +0 -0
  96. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_results.py +0 -0
  97. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_schema.py +0 -0
  98. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/_tasks.py +0 -0
  99. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/internal_tables/manager.py +0 -0
  100. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/mysql_manager.py +0 -0
  101. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/database/postgres_manager.py +0 -0
  102. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/loaders/__init__.py +0 -0
  103. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/loaders/exposure_loader.py +0 -0
  104. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/loaders/exposure_source.py +0 -0
  105. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/loaders/metric_loader.py +0 -0
  106. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/loaders/query_template.py +0 -0
  107. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/loaders/state_loader.py +0 -0
  108. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/loaders/templates/abkit_assignment.jinja +0 -0
  109. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/notify/__init__.py +0 -0
  110. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/notify/base.py +0 -0
  111. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/notify/branding.py +0 -0
  112. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/notify/email.py +0 -0
  113. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/notify/factory.py +0 -0
  114. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/notify/mattermost.py +0 -0
  115. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/notify/mock.py +0 -0
  116. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/notify/slack.py +0 -0
  117. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/notify/telegram.py +0 -0
  118. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/notify/webhook.py +0 -0
  119. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/__init__.py +0 -0
  120. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/_types.py +0 -0
  121. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/pipeline/readout.py +0 -0
  122. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/planning/__init__.py +0 -0
  123. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/planning/sizing.py +0 -0
  124. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/reporting/__init__.py +0 -0
  125. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/reporting/assets/report.js +0 -0
  126. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/reporting/calibration.py +0 -0
  127. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/reporting/html_report.py +0 -0
  128. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/__init__.py +0 -0
  129. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/accumulate.py +0 -0
  130. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/applier.py +0 -0
  131. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/ci.py +0 -0
  132. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/bootstrap/engine.py +0 -0
  133. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/correction.py +0 -0
  134. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/effects.py +0 -0
  135. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/exceptions.py +0 -0
  136. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/factory.py +0 -0
  137. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/__init__.py +0 -0
  138. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/cuped_ttest.py +0 -0
  139. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/paired_cuped_ttest.py +0 -0
  140. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/paired_ttest.py +0 -0
  141. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/ratio_delta.py +0 -0
  142. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/ttest.py +0 -0
  143. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/parametric/ztest.py +0 -0
  144. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/power.py +0 -0
  145. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/registry.py +0 -0
  146. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/result.py +0 -0
  147. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/samples.py +0 -0
  148. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/sequential/__init__.py +0 -0
  149. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/sequential/apply.py +0 -0
  150. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/sequential/confidence_sequence.py +0 -0
  151. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/sequential/mixture.py +0 -0
  152. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/stats/srm.py +0 -0
  153. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/tuning/assets/explore.js +0 -0
  154. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/tuning/config_writer.py +0 -0
  155. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/tuning/html.py +0 -0
  156. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/utils/__init__.py +0 -0
  157. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/utils/datetime_utils.py +0 -0
  158. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/utils/env_interpolation.py +0 -0
  159. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/utils/json_utils.py +0 -0
  160. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/__init__.py +0 -0
  161. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/_types.py +0 -0
  162. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/family.py +0 -0
  163. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/inject.py +0 -0
  164. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/load.py +0 -0
  165. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/panel.py +0 -0
  166. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/persistence.py +0 -0
  167. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/resample.py +0 -0
  168. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/result.py +0 -0
  169. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/run_id.py +0 -0
  170. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/runner.py +0 -0
  171. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/abkit/validate/vector_resample.py +0 -0
  172. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/pyproject.toml +0 -0
  173. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/requirements.txt +0 -0
  174. {ab_analysis_kit-0.4.0 → ab_analysis_kit-0.5.0}/setup.cfg +0 -0
  175. {ab_analysis_kit-0.4.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.4.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,12 +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.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
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
85
87
  > statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
86
88
  > self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
87
89
  > opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
@@ -94,8 +96,9 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
94
96
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
95
97
  ```
96
98
 
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
+ (`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:
99
102
  `pip install -e ".[dev]"`.)
100
103
 
101
104
  `abk --version` and `abk --help` work with no database driver; you can even lint a
@@ -11,12 +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.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
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
20
22
  > statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
21
23
  > self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
22
24
  > opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
@@ -29,8 +31,9 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
29
31
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
30
32
  ```
31
33
 
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
+ (`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:
34
37
  `pip install -e ".[dev]"`.)
35
38
 
36
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.4.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,12 +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.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
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
85
87
  > statistical core, the declarative config / DB / pipeline layer, the explore cockpit +
86
88
  > self-contained reports, `abk validate` (now numpy-vectorized — minutes → sub-seconds),
87
89
  > opt-in sequential analysis + `abk plan`, and the DX layer (`abk init-claude`, docs site,
@@ -94,8 +96,9 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
94
96
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
95
97
  ```
96
98
 
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
+ (`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:
99
102
  `pip install -e ".[dev]"`.)
100
103
 
101
104
  `abk --version` and `abk --help` work with no database driver; you can even lint a
@@ -155,6 +155,7 @@ abkit/utils/__init__.py
155
155
  abkit/utils/datetime_utils.py
156
156
  abkit/utils/env_interpolation.py
157
157
  abkit/utils/json_utils.py
158
+ abkit/utils/warn_scope.py
158
159
  abkit/validate/__init__.py
159
160
  abkit/validate/_types.py
160
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.4.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.
@@ -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)
@@ -92,11 +97,16 @@ comparisons: # required — each binds one library metric to
92
97
 
93
98
  ## Cumulative window, cadence & data_lag
94
99
 
95
- - 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;
96
101
  each cutoff advances the end through the horizon, producing the stabilization
97
- series (one point per cutoff, effect + CI over `[start_date .. cutoff]`).
98
- - `end_date` is the **horizon**: the last daily cutoff covers this day, and it
99
- 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.
100
110
  - `cadence` is the cutoff step. Either a **duration scalar** (`"1h"`, `"30m"`,
101
111
  `"1d"`, or integer seconds) or a **coarsening schedule** — a dense-early list
102
112
  that must be strictly coarsening with strictly increasing `until` bounds (only
@@ -108,6 +118,22 @@ comparisons: # required — each binds one library metric to
108
118
  - {every: 1d} # daily thereafter
109
119
  ```
110
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.
111
137
  - `data_lag` is the completeness watermark: a cutoff is analyzed only once
112
138
  `end_ts <= now() - data_lag`. **Required when cadence < 1d** (declare your
113
139
  ingestion SLA). At daily cadence the default `0` reproduces the legacy
@@ -166,8 +192,8 @@ series early and stopping ("peeking") inflates the false-positive rate. Therefor
166
192
 
167
193
  ```yaml
168
194
  name: pricing_test
169
- start_date: 2024-07-01
170
- end_date: 2024-07-14
195
+ start_ts: 2024-07-01
196
+ horizon_ts: 2024-07-15
171
197
  unit_key: user_id
172
198
  assignment:
173
199
  query_file: sql/assignment.sql
@@ -71,6 +71,13 @@ 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
@@ -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
@@ -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
@@ -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:
@@ -145,18 +145,28 @@ profiles:
145
145
 
146
146
  EXPERIMENT_YML = """\
147
147
  # The runnable example experiment — works against seed/seed_dataset.*.sql.
148
- # Fixed past dates keep every daily cutoff complete, so a first run computes
149
- # the full 14-point stabilization series immediately.
148
+ # Fixed past timestamps keep every daily cutoff complete, so a first run
149
+ # computes the full 14-point stabilization series immediately.
150
150
  name: example_signup_test
151
151
  description: "Example: onboarding experiment against the synthetic seed dataset"
152
152
  status: running
153
153
  is_actual: true
154
154
  tags: [example]
155
155
 
156
- start_date: 2024-07-01 # PINNED left edge of every cumulative window
157
- end_date: 2024-07-14 # planner horizon (the last cutoff covers this day)
156
+ start_ts: 2024-07-01 # PINNED left edge of every cumulative window
157
+ # (a bare date = local midnight; a full timestamp,
158
+ # e.g. 2024-07-01 14:30:00, is that exact instant)
159
+ horizon_ts: 2024-07-15 # planner horizon — the EXCLUSIVE right edge, so
160
+ # this covers July 1..14 in full
158
161
  unit_key: user_id
159
162
  cadence: 1d # or dense-early: [{every: 1h, until: 48h}, {every: 1d}]
163
+ interval_anchor: midnight # WHERE the cutoffs land: midnight (local midnight
164
+ # of `timezone` — whole calendar days, what BI
165
+ # reads) | start (count from start_ts: a 14:00
166
+ # start ⇒ 14:00 cutoffs) | an explicit timestamp to
167
+ # align to an external cycle (it MAY precede
168
+ # start_ts — the first window is then partial).
169
+ # Cutoffs are anchor + k*cadence, kept after start_ts
160
170
  timezone: UTC
161
171
 
162
172
  assignment: # READ-ONLY exposure source — abkit never randomizes
@@ -362,11 +372,24 @@ experiment analysis (YAML + SQL) over your warehouse.
362
372
 
363
373
  4. Look at the numbers:
364
374
 
365
- SELECT metric, end_date, effect, pvalue, left_bound, right_bound
375
+ SELECT metric, end_ts, effect, pvalue, left_bound, right_bound
366
376
  FROM abkit_internal._ab_results
367
377
  WHERE experiment = 'example_signup_test'
368
378
  ORDER BY metric, end_ts
369
379
 
380
+ `end_ts` is the **exclusive** right edge of the cumulative window, and it
381
+ is the canonical cutoff key — group and order by it. If you need the
382
+ calendar DAY a look covers, derive it from `end_ts` minus one microsecond
383
+ in the experiment's timezone; a bare `toDate(end_ts)` takes the UTC date of
384
+ an exclusive edge and misdates every non-UTC experiment by a day (the
385
+ example experiment's `timezone` is `UTC`; substitute your own). In
386
+ ClickHouse:
387
+
388
+ toDate(end_ts - toIntervalMicrosecond(1), 'UTC')
389
+
390
+ The PostgreSQL and MySQL forms — and the traps each one avoids — are in the
391
+ `_ab_results` reference: https://abkit.pipelab.dev/reference/internal-tables/
392
+
370
393
  ## Layout
371
394
 
372
395
  - `abkit_project.yml` — project config (statistical defaults, limits)
@@ -25,13 +25,14 @@ always-valid average sample number. No arrival data ⇒ runtime SKIPPED, never i
25
25
  from __future__ import annotations
26
26
 
27
27
  import math
28
+ from datetime import date, datetime, time
28
29
 
29
30
  import click
30
31
 
31
32
  from abkit.cli._output import echo_done, echo_error, echo_tree
32
33
  from abkit.cli.commands._context import load_project_context
33
34
  from abkit.config import select_experiments
34
- from abkit.core.period_planner import GridLimitExceeded, generate_grid
35
+ from abkit.core.period_planner import GridLimitExceeded, as_local_datetime
35
36
  from abkit.pipeline import comparison_alpha, effective_alphas
36
37
  from abkit.planning.sizing import (
37
38
  FRACTION,
@@ -139,13 +140,7 @@ def _plan_one(
139
140
  # OOM-enumerating in this read-only command (plan skips the config-lint that would
140
141
  # otherwise catch it — M5 exit-gate round-1 finding).
141
142
  try:
142
- grid = generate_grid(
143
- experiment.start_date,
144
- experiment.end_date,
145
- experiment.cadence_segments(),
146
- tz=experiment.timezone,
147
- limit=project.limits.max_looks,
148
- )
143
+ grid = experiment.grid(limit=project.limits.max_looks)
149
144
  except GridLimitExceeded as exc:
150
145
  raise click.ClickException(
151
146
  f"{experiment.name}: planned looks exceed max_looks="
@@ -562,7 +557,8 @@ def _emit_plan(experiment, project, alphas, power, looks, grid, rows_per_refresh
562
557
  cadence = _fmt_cadence(experiment)
563
558
  children.append(
564
559
  f"looks: {looks} planned · cadence {cadence} · horizon "
565
- f"{grid.horizon_ts.date().isoformat()} · ~{rows_per_refresh:,} _ab_results rows/full-refresh"
560
+ f"{_fmt_instant(experiment.horizon_ts)} · ~{rows_per_refresh:,} "
561
+ f"_ab_results rows/full-refresh"
566
562
  )
567
563
  if experiment.is_sub_day():
568
564
  children.append(" sub-day: each look ≤ one day of fact rows (day-grained state, §6.4)")
@@ -670,6 +666,19 @@ def _runtime_lines(rt) -> list[str]:
670
666
  return lines
671
667
 
672
668
 
669
+ def _fmt_instant(value: date | datetime) -> str:
670
+ """A window edge for the terminal: date alone at midnight, else date + time.
671
+
672
+ Fed the LOCAL config value, not ``grid.horizon_ts`` — the grid edge is
673
+ naive UTC, so a Moscow experiment configured ``horizon_ts: 2024-07-15``
674
+ would otherwise print an unlabelled ``2024-07-14 21:00:00``, which is
675
+ neither what was written nor a local time. Echoing the config keeps the
676
+ line readable and, at UTC, byte-identical to the pre-m10 output.
677
+ """
678
+ local = as_local_datetime(value)
679
+ return local.date().isoformat() if local.time() == time.min else local.isoformat(sep=" ")
680
+
681
+
673
682
  def _fmt_cadence(experiment) -> str:
674
683
  segments = experiment.cadence_segments()
675
684
  if len(segments) == 1 and segments[0][1] is None:
@@ -29,7 +29,13 @@ def run_unlock(select: tuple[str, ...], profile: str | None) -> None:
29
29
  manager = context.manager_factory(profile)()
30
30
  try:
31
31
  tables = InternalTablesManager(manager)
32
- tables.ensure_tables()
32
+ try:
33
+ tables.ensure_tables()
34
+ except Exception as exc:
35
+ # The breaking-release schema guard names a drop-and-recreate
36
+ # remedy; a traceback would bury it (`abk run` does the same).
37
+ echo_error("unlock", str(exc))
38
+ raise SystemExit(1) from exc
33
39
 
34
40
  cleared = 0
35
41
  errors = 0
@@ -30,7 +30,6 @@ from abkit.cli._output import (
30
30
  from abkit.cli.commands._context import load_project_context
31
31
  from abkit.config import select_experiments, validate_level2
32
32
  from abkit.config.method_config import MethodConfig
33
- from abkit.core.period_planner import generate_grid
34
33
  from abkit.pipeline import effective_alphas
35
34
  from abkit.stats import n_comparisons
36
35
 
@@ -167,12 +166,7 @@ def _validate_one(
167
166
  renderer = StageLogRenderer(titles=_VALIDATE_STAGE_TITLES)
168
167
  try:
169
168
  tables.ensure_tables()
170
- grid = generate_grid(
171
- experiment.start_date,
172
- experiment.end_date,
173
- experiment.cadence_segments(),
174
- tz=experiment.timezone,
175
- )
169
+ grid = experiment.grid()
176
170
  # the WP4 factory: copy mode joins the persisted cohort (query-free
177
171
  # here), direct mode renders + validates the live source once —
178
172
  # the snapshot is reused by --report so one invocation never
@@ -59,7 +59,7 @@ metric's own value load is the only thing this class replaces.
59
59
  from __future__ import annotations
60
60
 
61
61
  from collections.abc import Callable
62
- from datetime import date, datetime, timedelta, timezone
62
+ from datetime import date, datetime, timedelta
63
63
  from pathlib import Path
64
64
  from zoneinfo import ZoneInfo
65
65
 
@@ -68,7 +68,7 @@ import numpy as np
68
68
  from abkit.compute.recompute_backend import RecomputeBackend
69
69
  from abkit.config.experiment_config import ComparisonConfig, ExperimentConfig
70
70
  from abkit.config.metric_config import MetricConfig
71
- from abkit.core.period_planner import Cutoff, Grid, tz_midnight_utc
71
+ from abkit.core.period_planner import Cutoff, Grid, local_date, tz_midnight_utc
72
72
  from abkit.database.internal_tables import InternalTablesManager
73
73
  from abkit.database.manager import BaseDatabaseManager
74
74
  from abkit.loaders.exposure_source import ExposureSnapshot, load_variant_map
@@ -87,11 +87,6 @@ _ROLE_MOMENTS: dict[str, dict[str, str]] = {
87
87
  }
88
88
 
89
89
 
90
- def _local_date(ts: datetime, zone: ZoneInfo) -> date:
91
- """The experiment-timezone calendar date of a naive-UTC timestamp."""
92
- return ts.replace(tzinfo=timezone.utc).astimezone(zone).date()
93
-
94
-
95
90
  def build_incremental_backend(
96
91
  manager: BaseDatabaseManager,
97
92
  tables: InternalTablesManager,
@@ -265,13 +260,17 @@ class IncrementalBackend:
265
260
  ) -> MetricLoadResult:
266
261
  """Load one (comparison, cutoff) from state + at most one day of tail."""
267
262
  end_ts = cutoff.end_ts
268
- cutoff_day = _local_date(end_ts, self._zone)
263
+ cutoff_day = local_date(end_ts, self._zone)
269
264
  last_midnight = tz_midnight_utc(cutoff_day, self._zone)
270
265
  required_last = cutoff_day - timedelta(days=1)
271
266
  role_moments = _ROLE_MOMENTS[metric.type]
272
267
 
273
268
  totals: dict[str, dict[str, float]] = {}
274
- if required_last >= self._experiment.start_date:
269
+ # The first materialized day is the GRID's opening local day, never
270
+ # the raw config field: with a sub-day start_ts the field carries a
271
+ # time-of-day, and `date >= datetime` is a TypeError, not a comparison.
272
+ first_state_day = local_date(grid.start_ts, self._zone)
273
+ if required_last >= first_state_day:
275
274
  key = self._series_key(metric, metric_sql)
276
275
  last_state = self._cached_last_state_day(key)
277
276
  if last_state is None or last_state < required_last:
@@ -293,17 +292,21 @@ class IncrementalBackend:
293
292
  moments = cached[1]
294
293
  else:
295
294
  moments = self._tables.per_unit_cumulative(
296
- key[0], key[1], self._experiment.start_date, required_last
295
+ key[0], key[1], first_state_day, required_last
297
296
  )
298
297
  self._cumulative_cache[key] = (required_last, moments)
299
298
  for unit, unit_moments in moments.items():
300
299
  totals[unit] = {role: unit_moments[m] for role, m in role_moments.items()}
301
300
 
302
301
  tail_variant: dict[str, str] = {}
303
- if last_midnight < end_ts:
304
- tail = self._recompute.load_window(
305
- metric, metric_sql, RenderWindow(last_midnight, end_ts)
306
- )
302
+ # Clamped to the window's left edge, the mirror of the STATE writer's
303
+ # opening-day clamp: with a sub-day start_ts a cutoff can land INSIDE
304
+ # the opening local day, and an unclamped [midnight, end_ts) tail
305
+ # would sum hours of pre-experiment facts that full recompute — which
306
+ # renders [grid.start_ts, end_ts) — never sees.
307
+ tail_start = max(last_midnight, grid.start_ts)
308
+ if tail_start < end_ts:
309
+ tail = self._recompute.load_window(metric, metric_sql, RenderWindow(tail_start, end_ts))
307
310
  for variant in tail.variants():
308
311
  units = tail.units_by_variant[variant]
309
312
  roles = tail.roles_by_variant[variant]
@@ -25,7 +25,7 @@ from zoneinfo import ZoneInfo
25
25
  from abkit.config.experiment_config import ComparisonConfig, ExperimentConfig
26
26
  from abkit.config.metric_config import MetricConfig
27
27
  from abkit.core.interval import Interval
28
- from abkit.core.period_planner import Cutoff, Grid, tz_midnight_utc
28
+ from abkit.core.period_planner import Cutoff, Grid, local_date, tz_midnight_utc
29
29
  from abkit.database.manager import BaseDatabaseManager
30
30
  from abkit.loaders.metric_loader import (
31
31
  MetricLoadResult,
@@ -102,17 +102,24 @@ class RecomputeBackend:
102
102
  def _preperiod_window(self, lookback: str | int, grid: Grid) -> RenderWindow:
103
103
  """The fixed pre-period, WHOLE-DAY aligned in the experiment timezone.
104
104
 
105
- ``[tz-midnight(start_date − lookback_days), start_ts)`` — day
106
- arithmetic in the experiment tz (a UTC-seconds subtraction would
107
- misalign local days across a DST transition inside the lookback;
108
- statistics-changes.md §5 defines the lookback in whole days).
105
+ ``[tz-midnight(D − lookback_days), tz-midnight(D))`` where ``D`` is the
106
+ local calendar day the window starts on — day arithmetic in the
107
+ experiment tz (a UTC-seconds subtraction would misalign local days
108
+ across a DST transition inside the lookback; statistics-changes.md §5
109
+ defines the lookback in whole days).
110
+
111
+ Both edges come off ``grid.start_ts``, never off the raw config field:
112
+ with a sub-day ``start_ts`` (m10) the window still ends at the local
113
+ midnight that OPENS the start day, so the lookback stays exactly
114
+ ``lookback_days`` whole days instead of gaining a partial tail. At a
115
+ midnight start — every pre-m10 config — that midnight IS
116
+ ``grid.start_ts`` and the window is byte-identical to before.
109
117
  """
110
118
  lookback_days = Interval(lookback).seconds // 86400
111
119
  zone = ZoneInfo(self._experiment.timezone)
112
- pre_start = tz_midnight_utc(
113
- self._experiment.start_date - timedelta(days=lookback_days), zone
114
- )
115
- return RenderWindow(start_ts=pre_start, end_ts=grid.start_ts)
120
+ start_day = local_date(grid.start_ts, zone)
121
+ pre_start = tz_midnight_utc(start_day - timedelta(days=lookback_days), zone)
122
+ return RenderWindow(start_ts=pre_start, end_ts=tz_midnight_utc(start_day, zone))
116
123
 
117
124
  def render(self, metric_sql: str, window: RenderWindow) -> str:
118
125
  """The provenance copy of the executed SQL."""