ab-analysis-kit 0.6.4__tar.gz → 0.7.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 (187) hide show
  1. {ab_analysis_kit-0.6.4/ab_analysis_kit.egg-info → ab_analysis_kit-0.7.0}/PKG-INFO +15 -6
  2. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/README.md +14 -5
  3. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0/ab_analysis_kit.egg-info}/PKG-INFO +15 -6
  4. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/ab_analysis_kit.egg-info/SOURCES.txt +8 -0
  5. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/__init__.py +1 -1
  6. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/rules/cli.md +24 -0
  7. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/rules/experiments.md +8 -0
  8. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/rules/overview.md +1 -0
  9. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/rules/project.md +45 -7
  10. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/run.py +130 -13
  11. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/validate.py +48 -1
  12. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/main.py +22 -0
  13. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/config/experiment_config.py +40 -1
  14. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/config/profile.py +21 -5
  15. ab_analysis_kit-0.7.0/abkit/config/signals.py +20 -0
  16. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/core/period_planner.py +21 -3
  17. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/_maintenance.py +7 -1
  18. ab_analysis_kit-0.7.0/abkit/database/internal_tables/_notify_states.py +145 -0
  19. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/manager.py +2 -0
  20. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/tables.py +45 -0
  21. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/notify/__init__.py +16 -4
  22. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/notify/base.py +126 -5
  23. ab_analysis_kit-0.7.0/abkit/notify/cooldown.py +124 -0
  24. ab_analysis_kit-0.7.0/abkit/notify/discord.py +137 -0
  25. ab_analysis_kit-0.7.0/abkit/notify/dispatch.py +711 -0
  26. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/notify/email.py +44 -18
  27. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/notify/factory.py +20 -0
  28. ab_analysis_kit-0.7.0/abkit/notify/googlechat.py +146 -0
  29. ab_analysis_kit-0.7.0/abkit/notify/ntfy.py +167 -0
  30. ab_analysis_kit-0.7.0/abkit/notify/teams.py +180 -0
  31. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/notify/telegram.py +26 -15
  32. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/notify/webhook.py +18 -12
  33. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/pipeline/_types.py +27 -0
  34. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/pipeline/driver.py +14 -4
  35. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/LICENSE +0 -0
  36. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/MANIFEST.in +0 -0
  37. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/ab_analysis_kit.egg-info/dependency_links.txt +0 -0
  38. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/ab_analysis_kit.egg-info/entry_points.txt +0 -0
  39. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/ab_analysis_kit.egg-info/requires.txt +0 -0
  40. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/ab_analysis_kit.egg-info/top_level.txt +0 -0
  41. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/__init__.py +0 -0
  42. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/_output.py +0 -0
  43. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/CLAUDE.section.md +0 -0
  44. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/rules/explore.md +0 -0
  45. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/rules/methods.md +0 -0
  46. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/rules/metrics.md +0 -0
  47. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/rules/plan.md +0 -0
  48. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/rules/validate.md +0 -0
  49. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/skills/abk-explore/SKILL.md +0 -0
  50. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/skills/abk-feedback/SKILL.md +0 -0
  51. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/skills/abk-new-experiment/SKILL.md +0 -0
  52. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/skills/abk-new-metric/SKILL.md +0 -0
  53. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/skills/abk-plan/SKILL.md +0 -0
  54. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/skills/abk-setup-project/SKILL.md +0 -0
  55. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/assets/claude/skills/abk-validate/SKILL.md +0 -0
  56. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/__init__.py +0 -0
  57. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/_context.py +0 -0
  58. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/clean.py +0 -0
  59. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/dashboard.py +0 -0
  60. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/explore.py +0 -0
  61. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/init.py +0 -0
  62. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/init_claude.py +0 -0
  63. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/plan.py +0 -0
  64. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/test_report.py +0 -0
  65. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/unlock.py +0 -0
  66. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/cli/commands/verify_incremental.py +0 -0
  67. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/compute/__init__.py +0 -0
  68. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/compute/incremental_backend.py +0 -0
  69. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/compute/recompute_backend.py +0 -0
  70. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/compute/reconcile.py +0 -0
  71. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/config/__init__.py +0 -0
  72. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/config/discovery.py +0 -0
  73. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/config/method_config.py +0 -0
  74. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/config/metric_config.py +0 -0
  75. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/config/project_config.py +0 -0
  76. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/config/validator.py +0 -0
  77. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/core/__init__.py +0 -0
  78. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/core/exposure_counting.py +0 -0
  79. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/core/interval.py +0 -0
  80. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/core/models.py +0 -0
  81. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/__init__.py +0 -0
  82. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/_sql_manager.py +0 -0
  83. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/clickhouse_manager.py +0 -0
  84. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/__init__.py +0 -0
  85. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/_aa_runs.py +0 -0
  86. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/_base.py +0 -0
  87. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/_experiments.py +0 -0
  88. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/_exposures.py +0 -0
  89. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/_results.py +0 -0
  90. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/_schema.py +0 -0
  91. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/_tasks.py +0 -0
  92. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/internal_tables/_unit_state.py +0 -0
  93. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/manager.py +0 -0
  94. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/mysql_manager.py +0 -0
  95. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/database/postgres_manager.py +0 -0
  96. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/loaders/__init__.py +0 -0
  97. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/loaders/exposure_copy.py +0 -0
  98. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/loaders/exposure_loader.py +0 -0
  99. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/loaders/exposure_source.py +0 -0
  100. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/loaders/metric_loader.py +0 -0
  101. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/loaders/query_template.py +0 -0
  102. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/loaders/state_loader.py +0 -0
  103. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/loaders/templates/abkit_assignment.jinja +0 -0
  104. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/notify/branding.py +0 -0
  105. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/notify/mattermost.py +0 -0
  106. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/notify/mock.py +0 -0
  107. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/notify/slack.py +0 -0
  108. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/pipeline/__init__.py +0 -0
  109. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/pipeline/analyze.py +0 -0
  110. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/pipeline/enrich.py +0 -0
  111. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/pipeline/readout.py +0 -0
  112. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/pipeline/state.py +0 -0
  113. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/planning/__init__.py +0 -0
  114. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/planning/sizing.py +0 -0
  115. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/reporting/__init__.py +0 -0
  116. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/reporting/assets/report.js +0 -0
  117. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/reporting/builder.py +0 -0
  118. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/reporting/calibration.py +0 -0
  119. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/reporting/html_report.py +0 -0
  120. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/__init__.py +0 -0
  121. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/accumulate.py +0 -0
  122. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/base.py +0 -0
  123. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/bootstrap/__init__.py +0 -0
  124. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/bootstrap/applier.py +0 -0
  125. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/bootstrap/bootstrap.py +0 -0
  126. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/bootstrap/ci.py +0 -0
  127. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/bootstrap/engine.py +0 -0
  128. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/bootstrap/paired_bootstrap.py +0 -0
  129. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/bootstrap/paired_post_normed_bootstrap.py +0 -0
  130. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/bootstrap/poisson_bootstrap.py +0 -0
  131. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/bootstrap/post_normed_bootstrap.py +0 -0
  132. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/correction.py +0 -0
  133. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/effects.py +0 -0
  134. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/exceptions.py +0 -0
  135. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/factory.py +0 -0
  136. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/parametric/__init__.py +0 -0
  137. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/parametric/cuped_ttest.py +0 -0
  138. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/parametric/paired_cuped_ttest.py +0 -0
  139. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/parametric/paired_ttest.py +0 -0
  140. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/parametric/ratio_delta.py +0 -0
  141. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/parametric/ttest.py +0 -0
  142. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/parametric/ztest.py +0 -0
  143. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/power.py +0 -0
  144. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/registry.py +0 -0
  145. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/result.py +0 -0
  146. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/rng.py +0 -0
  147. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/samples.py +0 -0
  148. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/sequential/__init__.py +0 -0
  149. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/sequential/apply.py +0 -0
  150. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/sequential/confidence_sequence.py +0 -0
  151. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/sequential/mixture.py +0 -0
  152. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/stats/srm.py +0 -0
  153. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/__init__.py +0 -0
  154. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/assets/dashboard.js +0 -0
  155. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/assets/explore.js +0 -0
  156. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/config_files.py +0 -0
  157. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/config_writer.py +0 -0
  158. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/dashboard_server.py +0 -0
  159. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/html.py +0 -0
  160. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/jobs.py +0 -0
  161. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/overview.py +0 -0
  162. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/payload.py +0 -0
  163. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/recompute.py +0 -0
  164. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/server.py +0 -0
  165. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/tuning/session.py +0 -0
  166. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/utils/__init__.py +0 -0
  167. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/utils/datetime_utils.py +0 -0
  168. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/utils/env_interpolation.py +0 -0
  169. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/utils/json_utils.py +0 -0
  170. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/utils/warn_scope.py +0 -0
  171. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/__init__.py +0 -0
  172. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/_types.py +0 -0
  173. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/family.py +0 -0
  174. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/inject.py +0 -0
  175. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/load.py +0 -0
  176. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/panel.py +0 -0
  177. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/persistence.py +0 -0
  178. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/resample.py +0 -0
  179. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/result.py +0 -0
  180. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/run_id.py +0 -0
  181. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/runner.py +0 -0
  182. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/scoring.py +0 -0
  183. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/abkit/validate/vector_resample.py +0 -0
  184. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/pyproject.toml +0 -0
  185. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/requirements.txt +0 -0
  186. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/setup.cfg +0 -0
  187. {ab_analysis_kit-0.6.4 → ab_analysis_kit-0.7.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ab-analysis-kit
3
- Version: 0.6.4
3
+ Version: 0.7.0
4
4
  Summary: A/B experiment analysis as declarative YAML + SQL
5
5
  Author: ab-analysis-kit authors
6
6
  License: MIT
@@ -76,8 +76,16 @@ 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.6.4` (Alpha) — the latest on PyPI**
80
- > (milestones **M1–M11** shipped — M11 added **`abk dashboard`**, the
79
+ > **Status: `0.7.0` (Alpha) — the latest on PyPI**
80
+ > (milestones **M1–M12** shipped — M12 wired **notifications**: `abk run
81
+ > --notify` and `abk validate --notify` push what a run just decided to nine
82
+ > channel types (Slack, Telegram, email, webhook, Mattermost, Discord, Teams,
83
+ > Google Chat, ntfy), as six routable signals — the readout verdict, a verdict
84
+ > flip, a failed sample-ratio gate, a pipeline error, a slipped schedule, and an
85
+ > A/A cell that broke its false-positive budget. Nothing is recomputed for a
86
+ > message, so it cannot disagree with the report; a repeat run over unchanged
87
+ > data is silent; and no channel failure can change an exit code. M11 added
88
+ > **`abk dashboard`**, the
81
89
  > project-level cockpit: one row per experiment with its headline verdict,
82
90
  > effect + CI, p/α and a sparkline of the cumulative series, plus buttons that
83
91
  > spawn real `abk` subprocesses (Run — for the whole experiment or one metric —
@@ -107,9 +115,10 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
107
115
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
108
116
  ```
109
117
 
110
- (`pip install ab-analysis-kit` gets `0.6.4` — `abk dashboard` with its YAML editor,
111
- `abk ui`, CUPED-aware `abk plan` sizing, `abk plan --from-history` and the
112
- discoverable additive read path all included.)
118
+ (`pip install ab-analysis-kit` gets `0.7.0` — opt-in notifications across nine
119
+ channels, `abk dashboard` with its YAML editor, `abk ui`, CUPED-aware `abk plan`
120
+ sizing, `abk plan --from-history` and the discoverable additive read path all
121
+ included.)
113
122
 
114
123
  `abk --version` and `abk --help` work with no database driver; you can even lint a
115
124
  config (`abk run --steps validate`) with no database at all. See the
@@ -11,8 +11,16 @@ 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.6.4` (Alpha) — the latest on PyPI**
15
- > (milestones **M1–M11** shipped — M11 added **`abk dashboard`**, the
14
+ > **Status: `0.7.0` (Alpha) — the latest on PyPI**
15
+ > (milestones **M1–M12** shipped — M12 wired **notifications**: `abk run
16
+ > --notify` and `abk validate --notify` push what a run just decided to nine
17
+ > channel types (Slack, Telegram, email, webhook, Mattermost, Discord, Teams,
18
+ > Google Chat, ntfy), as six routable signals — the readout verdict, a verdict
19
+ > flip, a failed sample-ratio gate, a pipeline error, a slipped schedule, and an
20
+ > A/A cell that broke its false-positive budget. Nothing is recomputed for a
21
+ > message, so it cannot disagree with the report; a repeat run over unchanged
22
+ > data is silent; and no channel failure can change an exit code. M11 added
23
+ > **`abk dashboard`**, the
16
24
  > project-level cockpit: one row per experiment with its headline verdict,
17
25
  > effect + CI, p/α and a sparkline of the cumulative series, plus buttons that
18
26
  > spawn real `abk` subprocesses (Run — for the whole experiment or one metric —
@@ -42,9 +50,10 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
42
50
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
43
51
  ```
44
52
 
45
- (`pip install ab-analysis-kit` gets `0.6.4` — `abk dashboard` with its YAML editor,
46
- `abk ui`, CUPED-aware `abk plan` sizing, `abk plan --from-history` and the
47
- discoverable additive read path all included.)
53
+ (`pip install ab-analysis-kit` gets `0.7.0` — opt-in notifications across nine
54
+ channels, `abk dashboard` with its YAML editor, `abk ui`, CUPED-aware `abk plan`
55
+ sizing, `abk plan --from-history` and the discoverable additive read path all
56
+ included.)
48
57
 
49
58
  `abk --version` and `abk --help` work with no database driver; you can even lint a
50
59
  config (`abk run --steps validate`) with no database at all. See the
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ab-analysis-kit
3
- Version: 0.6.4
3
+ Version: 0.7.0
4
4
  Summary: A/B experiment analysis as declarative YAML + SQL
5
5
  Author: ab-analysis-kit authors
6
6
  License: MIT
@@ -76,8 +76,16 @@ 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.6.4` (Alpha) — the latest on PyPI**
80
- > (milestones **M1–M11** shipped — M11 added **`abk dashboard`**, the
79
+ > **Status: `0.7.0` (Alpha) — the latest on PyPI**
80
+ > (milestones **M1–M12** shipped — M12 wired **notifications**: `abk run
81
+ > --notify` and `abk validate --notify` push what a run just decided to nine
82
+ > channel types (Slack, Telegram, email, webhook, Mattermost, Discord, Teams,
83
+ > Google Chat, ntfy), as six routable signals — the readout verdict, a verdict
84
+ > flip, a failed sample-ratio gate, a pipeline error, a slipped schedule, and an
85
+ > A/A cell that broke its false-positive budget. Nothing is recomputed for a
86
+ > message, so it cannot disagree with the report; a repeat run over unchanged
87
+ > data is silent; and no channel failure can change an exit code. M11 added
88
+ > **`abk dashboard`**, the
81
89
  > project-level cockpit: one row per experiment with its headline verdict,
82
90
  > effect + CI, p/α and a sparkline of the cumulative series, plus buttons that
83
91
  > spawn real `abk` subprocesses (Run — for the whole experiment or one metric —
@@ -107,9 +115,10 @@ pip install ab-analysis-kit # Python 3.10+; add a DB extra for real dat
107
115
  pip install "ab-analysis-kit[clickhouse]" # or [postgres] / [mysql] / [all-db]
108
116
  ```
109
117
 
110
- (`pip install ab-analysis-kit` gets `0.6.4` — `abk dashboard` with its YAML editor,
111
- `abk ui`, CUPED-aware `abk plan` sizing, `abk plan --from-history` and the
112
- discoverable additive read path all included.)
118
+ (`pip install ab-analysis-kit` gets `0.7.0` — opt-in notifications across nine
119
+ channels, `abk dashboard` with its YAML editor, `abk ui`, CUPED-aware `abk plan`
120
+ sizing, `abk plan --from-history` and the discoverable additive read path all
121
+ included.)
113
122
 
114
123
  `abk --version` and `abk --help` work with no database driver; you can even lint a
115
124
  config (`abk run --steps validate`) with no database at all. See the
@@ -55,6 +55,7 @@ abkit/config/method_config.py
55
55
  abkit/config/metric_config.py
56
56
  abkit/config/profile.py
57
57
  abkit/config/project_config.py
58
+ abkit/config/signals.py
58
59
  abkit/config/validator.py
59
60
  abkit/core/__init__.py
60
61
  abkit/core/exposure_counting.py
@@ -74,6 +75,7 @@ abkit/database/internal_tables/_base.py
74
75
  abkit/database/internal_tables/_experiments.py
75
76
  abkit/database/internal_tables/_exposures.py
76
77
  abkit/database/internal_tables/_maintenance.py
78
+ abkit/database/internal_tables/_notify_states.py
77
79
  abkit/database/internal_tables/_results.py
78
80
  abkit/database/internal_tables/_schema.py
79
81
  abkit/database/internal_tables/_tasks.py
@@ -90,11 +92,17 @@ abkit/loaders/templates/abkit_assignment.jinja
90
92
  abkit/notify/__init__.py
91
93
  abkit/notify/base.py
92
94
  abkit/notify/branding.py
95
+ abkit/notify/cooldown.py
96
+ abkit/notify/discord.py
97
+ abkit/notify/dispatch.py
93
98
  abkit/notify/email.py
94
99
  abkit/notify/factory.py
100
+ abkit/notify/googlechat.py
95
101
  abkit/notify/mattermost.py
96
102
  abkit/notify/mock.py
103
+ abkit/notify/ntfy.py
97
104
  abkit/notify/slack.py
105
+ abkit/notify/teams.py
98
106
  abkit/notify/telegram.py
99
107
  abkit/notify/webhook.py
100
108
  abkit/pipeline/__init__.py
@@ -10,7 +10,7 @@ from __future__ import annotations
10
10
 
11
11
  from typing import Any
12
12
 
13
- __version__ = "0.6.4"
13
+ __version__ = "0.7.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.
@@ -142,6 +142,30 @@ on with nothing declared additive, and how many looks fell back to recompute.
142
142
  what the other read path would have done with it. That slice is PART OF the
143
143
  `compute` total, never a sibling; do not add them. The evidence for turning
144
144
  `compute.incremental_reads` on; unrelated to `--profile` (the DB connection).
145
+ - `--notify` / `--no-notify` (default off, 0.7.0) — after the run, push each
146
+ **completed** experiment's readout to the `notification_channels` configured in
147
+ `profiles.yml`. Same decision the report bakes (`readout.evaluate()` over the
148
+ persisted rows — nothing is recomputed for a message), one message per verdict,
149
+ and **best-effort exactly like `--report`**: a channel that is down or
150
+ misconfigured is a yellow line, never a non-zero exit. A **failed** run sends an
151
+ error notice instead (the reason, no statistics block — nothing was measured);
152
+ `locked`/`skipped` runs and an experiment with no persisted rows of its own send
153
+ nothing. A **failed SRM gate adds no second message**: the readout already built
154
+ answers to the `srm` kind too, so an `on: [srm, error]` channel hears about a
155
+ broken split without receiving routine readouts. Route it per experiment with a
156
+ `notify:` block (`channels` / `mentions` / `on`); with no block, a notified run
157
+ goes to every configured channel. **Only a CHANGE is announced**: `_ab_notify_states`
158
+ remembers what each comparison last said, and an unchanged verdict is not
159
+ re-sent — so a scheduled run every hour is not a message every hour. A newly
160
+ broken SRM gate counts as a change even when the verdict word is identical
161
+ (a pre-horizon pair says INCONCLUSIVE either way), and a message no channel
162
+ accepted is not recorded, so the next run retries it. A completed run also
163
+ sends a **`stale`** notice when a metric's series was more than 3 cadence steps
164
+ behind the looks ALREADY DUE when the run planned it. Read it as "the schedule
165
+ slipped" — the same run computes the missing looks, so it is retrospective, and
166
+ an experiment past its horizon with everything computed is never behind. It
167
+ dedups on WHICH metrics were behind (never how far — that number grows every
168
+ run) and re-announces once they clear and fall behind again.
145
169
  - `--force` — take over a held lock (prefer `abk unlock`; risky with concurrent runs).
146
170
  - `--profile` — override `profiles.yml`'s `default_profile` (e.g. run against staging).
147
171
 
@@ -54,6 +54,14 @@ readout: # READ-TIME verdict knobs — NEVER enter metho
54
54
  stabilization_days: 7 # trailing elapsed-DAYS window for "persistent significance" (default 7)
55
55
  guardrail_policy: block # block (default): regressed guardrail caps WIN at INCONCLUSIVE; warn: keep WIN + caveat
56
56
 
57
+ # notify: # optional ROUTING for `abk run --notify` (0.7.0). Omitting it does
58
+ # channels: [team_slack] # NOT silence the experiment — a notified run with no block goes to
59
+ # mentions: [growth-team] # every configured channel. `on` = the signal kinds this experiment
60
+ # on: [readout] # sends (default all); it INTERSECTS a channel's own `on:`
61
+ # cooldown_seconds: 86400 # repeat an UNCHANGED stale/calibration_red this often
62
+ # # (default: announce each distinct condition once). Never
63
+ # # applies to a verdict — a flip always sends immediately.
64
+
57
65
  comparisons: # required — each binds one library metric to one method
58
66
  - metric: signup_cr # references metrics/signup_cr.yml by name
59
67
  is_main_metric: true # primary winner criterion (drives the verdict + two-tier Bonferroni)
@@ -73,6 +73,7 @@ profile's `internal_database` / `internal_schema`, separate from the
73
73
  | `_ab_experiments` | Informational experiment catalog (descriptions, variants, split, alpha, cadence, tags) for BI joins; the pipeline never reads it back for decisions. |
74
74
  | `_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`. |
75
75
  | `_ab_tasks` | Pipeline run/lock bookkeeping — the atomic per-experiment lock (`abk unlock` clears a stale one). |
76
+ | `_ab_notify_states` | What `--notify` last ANNOUNCED per comparison (verdict + SRM flag + when), so an unchanged verdict is not re-sent on every scheduled run — plus one sentinel row per recurring signal (`metric='__stale__'`/`'__calibration_red__'`, empty arm pair) holding that condition's signature. Written only after a channel accepted the message; purged with the experiment by `abk clean --orphaned-experiments`, which resets the dedup. Not a BI table. |
76
77
  | `_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, and what `abk init` scaffolds, though the library default (the key absent) is off; any gap falls back to full recompute. Not a BI table. |
77
78
 
78
79
  ## Glossary
@@ -176,13 +176,14 @@ Keep the internal location **separate** from your analytics location so the
176
176
  `_ab_*` tables don't clutter shared schemas. Override per run with
177
177
  `abk run --profile prod`.
178
178
 
179
- ### `notification_channels` (optional — for `abk test-report`)
179
+ ### `notification_channels` (optional — where readouts are sent)
180
180
 
181
181
  A top-level `notification_channels:` block in `profiles.yml`, keyed by channel
182
182
  name, declares where readouts can be sent. Each entry has a `type`
183
- (`slack` \| `mattermost` \| `webhook` \| `telegram` \| `email`) plus that
183
+ (`slack` \| `mattermost` \| `webhook` \| `telegram` \| `email` \| `discord` \|
184
+ `teams` \| `googlechat` \| `ntfy` — nine) plus that
184
185
  transport's fields (put secrets behind `env_var`/`${VAR}` — an unresolved
185
- channel secret **is** rejected):
186
+ channel secret **is** rejected), and an optional `on:` filter:
186
187
 
187
188
  ```yaml
188
189
  notification_channels:
@@ -193,12 +194,49 @@ notification_channels:
193
194
  type: telegram
194
195
  bot_token: "${TELEGRAM_BOT_TOKEN}"
195
196
  chat_id: "-1001234567890"
197
+ on: [srm, error] # urgent only — no routine readouts (0.7.0)
196
198
  ```
197
199
 
198
- `abk test-report <exp> [--channel <name>]... [--profile <p>]` sends a **mock**
199
- WIN readout through them (no lock, no warehouse read, no stats) and prints a
200
- per-channel ✓/✗, exiting non-zero if any channel fails — a connectivity/format
201
- smoke test before wiring channels into an orchestrator.
200
+ Two commands use them:
201
+
202
+ - `abk test-report <exp> [--channel <name>]... [--profile <p>]` sends a **mock**
203
+ WIN readout (no lock, no warehouse read, no stats) and prints a per-channel
204
+ ✓/✗, exiting non-zero if any channel fails — the connectivity/format smoke
205
+ test to run before wiring channels into an orchestrator.
206
+ - `abk validate --notify` (0.7.0) sends a `calibration_red` notice when a cell's
207
+ measured FPR exceeds its budget — best-effort, exactly like its `--report`.
208
+ - `abk run --notify` (0.7.0) sends the **real** readout of each completed
209
+ experiment — the same `readout.evaluate()` decision `--report` bakes. Opt-in
210
+ and best-effort: a failing channel never fails the run. Narrow it per
211
+ experiment with a `notify:` block; with no block, every configured channel
212
+ receives it.
213
+
214
+ `on:` accepts `readout`, `verdict_change`, `srm`, `calibration_red`, `stale`,
215
+ `error` — **all six fire**. A channel's `on:` and an experiment's `notify.on`
216
+ INTERSECT: the experiment narrows what it sends, the channel what it accepts.
217
+
218
+ `srm` and `verdict_change` are NARROW views of the same readout payload, never
219
+ extra messages: `on: [srm]` gets only readouts whose split broke, and
220
+ `on: [verdict_change]` only those whose verdict WORD moved — not the first
221
+ message about a comparison, and not one re-sent because the SRM gate moved while
222
+ the word held.
223
+
224
+ Two of them describe the MACHINERY rather than a result, and both are recurring —
225
+ their condition survives the run that reports it, so they are deduped on WHICH
226
+ things are wrong (never on the drifting numbers) and repeat only when that set
227
+ changes, or after `notify.cooldown_seconds` if the experiment sets one:
228
+
229
+ - **`calibration_red`** comes from `abk validate --notify`, not from `abk run`:
230
+ the cells whose measured A/A false-positive rate exceeded their budget — the
231
+ matrix's "do not use" verdict, delivered.
232
+ - **`stale`** comes from `abk run --notify`: a metric series more than 3 cadence
233
+ steps behind the looks already due at PLAN time. Retrospective by construction
234
+ (that same run computes them), so it reports a slipped SCHEDULE, not a stale
235
+ warehouse.
236
+
237
+ `srm` is not a second message — an SRM-failed readout answers to BOTH kinds, so
238
+ an `on: [srm, error]` channel is the on-call one: it hears about a broken split
239
+ and a failed run, and stays quiet through routine readouts.
202
240
 
203
241
  ## The two-tier alpha (why the effective alpha isn't the alpha you set)
204
242
 
@@ -12,6 +12,11 @@ value matching NOWHERE is a loud error, never a silent no-op. The alphas below
12
12
  are echoed — and persisted — unfiltered: the two-tier scheme is a property of
13
13
  the config, not of what one invocation recomputes.
14
14
 
15
+ ``--notify`` (m12 NTF-1) pushes each completed experiment's readout through the
16
+ configured ``notification_channels``. Opt-in, and fail-soft on the same terms as
17
+ ``--report``: a channel that raises is a yellow line, never a non-zero exit. It
18
+ reads the rows the run just persisted — it computes nothing.
19
+
15
20
  ``--report`` (tri-state: absent / bare / path — the donor's flag shape) emits
16
21
  one self-contained HTML readout per experiment after its pipeline, inside
17
22
  try/except: a report failure yellow-skips and NEVER fails the run — the one
@@ -166,6 +171,7 @@ def run_run(
166
171
  resync_cohort: bool = False,
167
172
  cost_report: bool = False,
168
173
  metric: str | None = None,
174
+ notify: bool = False,
169
175
  ) -> None:
170
176
  try:
171
177
  parsed_steps = PipelineStep.parse(steps)
@@ -178,6 +184,13 @@ def run_run(
178
184
  "--report needs pipeline steps (validate-only runs never touch the DB)",
179
185
  param_hint="--report",
180
186
  )
187
+ if validate_only and notify:
188
+ # Same shape as --report: a notification carries a readout, and a
189
+ # validate-only run never reads a result row to build one from.
190
+ raise click.BadParameter(
191
+ "--notify needs pipeline steps (validate-only runs never touch the DB)",
192
+ param_hint="--notify",
193
+ )
181
194
  if validate_only and metric is not None:
182
195
  # The config lint is whole-project by construction (every metric SQL,
183
196
  # every method): accepting a narrowing flag it cannot honour would read
@@ -358,9 +371,39 @@ def run_run(
358
371
  click.echo()
359
372
  failed = 0
360
373
  experiments_by_name = {experiment.name: experiment for _, experiment in selected}
361
- report_manager = None
362
- report_tables = None
374
+
375
+ # m12 NTF-1: resolved once. An operator who passed --notify with nothing
376
+ # configured must hear about it — silence there reads as a broken flag.
377
+ notify_channels: dict = {}
378
+ if notify:
379
+ notify_channels = dict(context.profiles.notification_channels)
380
+ if not notify_channels:
381
+ click.echo(
382
+ click.style(
383
+ " ⚠ --notify: no notification_channels in profiles.yml — "
384
+ "nothing to send to (see docs/guides/notification-channels.md)",
385
+ fg="yellow",
386
+ )
387
+ )
388
+
389
+ # ONE manager per invocation, shared by --report and --notify (both read
390
+ # back the rows this run just persisted); built on first use so a run with
391
+ # neither flag opens no extra connection.
392
+ readback_manager = None
393
+ readback_tables = None
363
394
  generated_at = None
395
+
396
+ def readback():
397
+ nonlocal readback_manager, readback_tables, generated_at
398
+ if readback_tables is None:
399
+ from abkit.database.internal_tables import InternalTablesManager
400
+ from abkit.utils.datetime_utils import now_utc_naive
401
+
402
+ readback_manager = context.manager_factory(profile)()
403
+ readback_tables = InternalTablesManager(readback_manager)
404
+ generated_at = now_utc_naive().strftime("%Y-%m-%d %H:%M UTC")
405
+ return readback_tables
406
+
364
407
  try:
365
408
  for outcome in outcomes:
366
409
  if outcome.status == "completed":
@@ -406,6 +449,87 @@ def run_run(
406
449
  failed += 1
407
450
  echo_error(outcome.experiment, outcome.error or "failed")
408
451
 
452
+ # ── notify (m12 NTF-1): the just-persisted readout, pushed to the
453
+ # configured channels. Sits BEFORE the report block on purpose —
454
+ # that block's `continue` would skip everything after it. The whole
455
+ # call is wrapped again here on top of dispatch's own per-channel
456
+ # catch (§0.4 point 1): the inner one keeps one bad channel from
457
+ # blocking the rest, this one keeps ANY notify failure — a
458
+ # warehouse read, a config surprise — from failing the run.
459
+ #
460
+ # Two signals, two conditions. `completed` sends the readout — "a
461
+ # new look landed", which a locked/skipped experiment never
462
+ # produced. `failed` sends the error notice instead (m12 NTF-2):
463
+ # the absence of a result is precisely what it reports, so unlike
464
+ # the readout path it is NOT gated on persisted rows.
465
+ if notify and notify_channels and outcome.status in ("completed", "failed"):
466
+ try:
467
+ from abkit.notify.dispatch import (
468
+ dispatch_experiment_signals,
469
+ dispatch_pipeline_error,
470
+ dispatch_stale,
471
+ load_experiment_readout,
472
+ )
473
+
474
+ experiment = experiments_by_name[outcome.experiment]
475
+
476
+ def notify_echo(line: str) -> None:
477
+ click.echo(click.style(f" │ Notify: {line}", fg="yellow"))
478
+
479
+ sent = 0
480
+ if outcome.status == "failed":
481
+ sent = dispatch_pipeline_error(
482
+ experiment=experiment,
483
+ error=outcome.error or "failed",
484
+ channels_cfg=notify_channels,
485
+ project_name=context.project.name,
486
+ echo=notify_echo,
487
+ )
488
+ else:
489
+ loaded = load_experiment_readout(
490
+ experiment, readback(), project=context.project
491
+ )
492
+ if loaded is None:
493
+ click.echo(
494
+ click.style(
495
+ " │ Notify skipped: no persisted results yet", fg="yellow"
496
+ )
497
+ )
498
+ else:
499
+ experiment_readout, result_rows = loaded
500
+ sent = dispatch_experiment_signals(
501
+ experiment=experiment,
502
+ readout=experiment_readout,
503
+ rows=result_rows,
504
+ channels_cfg=notify_channels,
505
+ project_name=context.project.name,
506
+ # m12 NTF-3: the same tables handle carries the
507
+ # dedup state, so an unchanged verdict is not
508
+ # re-announced on every scheduled run
509
+ states=readback(),
510
+ echo=notify_echo,
511
+ )
512
+ # m12 NTF-5: the `stale` signal, routed off the SAME
513
+ # backlog the PLAN stage already warned about above.
514
+ # Completed runs only — a failed run's news is the
515
+ # failure, and it has just been sent. The call is made
516
+ # even with an empty backlog: that is how the stored
517
+ # signature is cleared, so a gap that reappears next
518
+ # month is news again instead of deduping against a
519
+ # months-old row.
520
+ sent += dispatch_stale(
521
+ experiment=experiment,
522
+ entries=outcome.backlog,
523
+ channels_cfg=notify_channels,
524
+ project_name=context.project.name,
525
+ states=readback(),
526
+ echo=notify_echo,
527
+ )
528
+ if sent:
529
+ click.echo(click.style(f" │ Notify → {sent} message(s) sent", fg="cyan"))
530
+ except Exception as notify_error: # never fail the run on a notification
531
+ click.echo(click.style(f" │ Notify skipped: {notify_error}", fg="yellow"))
532
+
409
533
  # ── the readout (D8): per experiment, after its pipeline, inside
410
534
  # try/except — never fail the run on a report ─────────────────────
411
535
  if report_path is None:
@@ -419,27 +543,20 @@ def run_run(
419
543
  )
420
544
  continue
421
545
  try:
422
- if report_tables is None:
423
- from abkit.database.internal_tables import InternalTablesManager
424
- from abkit.utils.datetime_utils import now_utc_naive
425
-
426
- report_manager = context.manager_factory(profile)()
427
- report_tables = InternalTablesManager(report_manager)
428
- generated_at = now_utc_naive().strftime("%Y-%m-%d %H:%M UTC")
429
546
  _emit_experiment_report(
430
547
  experiments_by_name[outcome.experiment],
431
- report_tables,
548
+ readback(),
432
549
  context,
433
550
  report_path,
434
551
  generated_at or "",
435
- manager=report_manager,
552
+ manager=readback_manager,
436
553
  cohort_counts=outcome.exposure_counts or None,
437
554
  )
438
555
  except Exception as report_error: # never fail the run on a report
439
556
  click.echo(click.style(f" │ Report skipped: {report_error}", fg="yellow"))
440
557
  finally:
441
- if report_manager is not None:
442
- report_manager.close()
558
+ if readback_manager is not None:
559
+ readback_manager.close()
443
560
 
444
561
  total_rows = sum(o.results_written for o in outcomes)
445
562
  echo_done(
@@ -10,7 +10,9 @@ Lock discipline (D5): a distinct ``(experiment, "pipeline", "validate")`` claim
10
10
  validate writes only ``_ab_aa_runs`` (never read by the run pipeline), so it need not
11
11
  serialize behind nightly runs. Failures are recorded on the lock row before
12
12
  propagating; ``abk unlock`` clears both the run and validate locks. Any failed
13
- experiment exits NON-ZERO. ``--report`` is best-effort (the one exception).
13
+ experiment exits NON-ZERO. ``--report`` and ``--notify`` (m12 NTF-5 — a
14
+ ``calibration_red`` notice for the cells whose FPR exceeded their budget) are
15
+ best-effort: neither may turn a successful validation into a failed one.
14
16
  """
15
17
 
16
18
  from __future__ import annotations
@@ -64,10 +66,25 @@ def run_validate(
64
66
  profile: str | None,
65
67
  *,
66
68
  family_sweep: bool = False,
69
+ notify: bool = False,
67
70
  ) -> None:
68
71
  context = load_project_context(require_profiles=True)
69
72
  click.echo(f"Project root: {context.root}")
70
73
 
74
+ # m12 NTF-5: resolved once, like `abk run --notify`. A --notify with nothing
75
+ # configured is loud — silence there is indistinguishable from a broken flag.
76
+ notify_channels: dict = {}
77
+ if notify:
78
+ notify_channels = dict(context.profiles.notification_channels)
79
+ if not notify_channels:
80
+ click.echo(
81
+ click.style(
82
+ " ⚠ --notify: no notification_channels in profiles.yml — "
83
+ "nothing will be sent",
84
+ fg="yellow",
85
+ )
86
+ )
87
+
71
88
  # ── config lint (no DB) ──────────────────────────────────────────────────
72
89
  report = validate_level2(context.root, context.project, context.experiments, context.metrics)
73
90
  for warning in report.warnings:
@@ -109,6 +126,8 @@ def run_validate(
109
126
  report_path,
110
127
  force,
111
128
  family_sweep,
129
+ notify_channels,
130
+ context.project.name,
112
131
  )
113
132
  if status == "failed":
114
133
  failed += 1
@@ -130,6 +149,8 @@ def _validate_one(
130
149
  report_path,
131
150
  force,
132
151
  family_sweep,
152
+ notify_channels: dict | None = None,
153
+ project_name: str | None = None,
133
154
  ) -> str:
134
155
  from abkit.database.internal_tables import InternalTablesManager
135
156
  from abkit.loaders.exposure_source import build_cohort_backend
@@ -225,6 +246,32 @@ def _validate_one(
225
246
  fg="yellow",
226
247
  )
227
248
  )
249
+ # m12 NTF-5: the over-budget cells, routed as `calibration_red`.
250
+ # INSIDE the lock's try, before the release, for the same reason
251
+ # `_emit_matrix` is: these are this validation's own findings. The
252
+ # call is made even when nothing is red — that is how a previously
253
+ # announced failure is cleared, so the same cell going red again
254
+ # later is news rather than a dedup hit. Wrapped like `_emit_report`
255
+ # (validate.py's own precedent): a notification may never turn a
256
+ # successful validation into a failed one.
257
+ if notify_channels:
258
+ try:
259
+ from abkit.notify.dispatch import dispatch_calibration_red
260
+
261
+ sent = dispatch_calibration_red(
262
+ experiment=experiment,
263
+ cells=result.cells,
264
+ channels_cfg=notify_channels,
265
+ project_name=project_name,
266
+ states=tables,
267
+ echo=lambda line: click.echo(
268
+ click.style(f" │ Notify: {line}", fg="yellow")
269
+ ),
270
+ )
271
+ if sent:
272
+ click.echo(click.style(f" │ Notify → {sent} message(s) sent", fg="cyan"))
273
+ except Exception as notify_error:
274
+ click.echo(click.style(f" │ Notify skipped: {notify_error}", fg="yellow"))
228
275
  tables.release_lock(experiment.name, "pipeline", "validate", status="completed")
229
276
  except BaseException as exc: # incl. KeyboardInterrupt/SystemExit — never strand the lock
230
277
  tables.release_lock(
@@ -141,6 +141,15 @@ def init_claude(target_dir: str) -> None:
141
141
  "selects the DB connection."
142
142
  ),
143
143
  )
144
+ @click.option(
145
+ "--notify/--no-notify",
146
+ default=False,
147
+ help=(
148
+ "After the run, push each completed experiment's readout to the "
149
+ "profiles.yml notification_channels (best-effort — never fails the "
150
+ "run). Route per experiment with a notify: block."
151
+ ),
152
+ )
144
153
  def run(
145
154
  select: tuple[str, ...],
146
155
  exclude: tuple[str, ...],
@@ -155,6 +164,7 @@ def run(
155
164
  workers: int,
156
165
  report_path: str | None,
157
166
  cost_report: bool,
167
+ notify: bool,
158
168
  ) -> None:
159
169
  """Run the pipeline: validate → plan → load → SRM → state → compute → persist."""
160
170
  from abkit.cli.commands.run import run_run
@@ -173,6 +183,7 @@ def run(
173
183
  resync_cohort=resync_cohort,
174
184
  cost_report=cost_report,
175
185
  metric=metric,
186
+ notify=notify,
176
187
  )
177
188
 
178
189
 
@@ -317,6 +328,15 @@ cli.add_command(dashboard, name="ui")
317
328
  )
318
329
  @click.option("--force", is_flag=True, help="Take over a held validate lock (use with care)")
319
330
  @click.option("--profile", help="Profile name (default: profiles.yml default_profile)")
331
+ @click.option(
332
+ "--notify/--no-notify",
333
+ default=False,
334
+ help=(
335
+ "Push a calibration_red notice to the profiles.yml notification_channels "
336
+ "when a cell's measured FPR exceeds its budget (best-effort — never fails "
337
+ "the validation). Route per experiment with a notify: block."
338
+ ),
339
+ )
320
340
  def validate(
321
341
  select: tuple[str, ...],
322
342
  method: tuple[str, ...],
@@ -328,6 +348,7 @@ def validate(
328
348
  report_path: str | None,
329
349
  force: bool,
330
350
  profile: str | None,
351
+ notify: bool,
331
352
  ) -> None:
332
353
  """Score each method's empirical false-positive rate on placebo A/A splits.
333
354
 
@@ -349,6 +370,7 @@ def validate(
349
370
  force,
350
371
  profile,
351
372
  family_sweep=family_sweep,
373
+ notify=notify,
352
374
  )
353
375
 
354
376