@urateam/core 0.1.55 → 0.1.57

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 (332) hide show
  1. package/dist/__tests__/audit-immutability.test.js +8 -0
  2. package/dist/__tests__/audit-immutability.test.js.map +1 -1
  3. package/dist/__tests__/auth-check.test.js +130 -16
  4. package/dist/__tests__/auth-check.test.js.map +1 -1
  5. package/dist/__tests__/auth-monitor.test.js +210 -87
  6. package/dist/__tests__/auth-monitor.test.js.map +1 -1
  7. package/dist/__tests__/bec-238-repro.test.d.ts +2 -0
  8. package/dist/__tests__/bec-238-repro.test.d.ts.map +1 -0
  9. package/dist/__tests__/bec-238-repro.test.js +116 -0
  10. package/dist/__tests__/bec-238-repro.test.js.map +1 -0
  11. package/dist/__tests__/bec146-repro.test.d.ts +2 -0
  12. package/dist/__tests__/bec146-repro.test.d.ts.map +1 -0
  13. package/dist/__tests__/bec146-repro.test.js +153 -0
  14. package/dist/__tests__/bec146-repro.test.js.map +1 -0
  15. package/dist/__tests__/circuit-breaker-config.test.d.ts +2 -0
  16. package/dist/__tests__/circuit-breaker-config.test.d.ts.map +1 -0
  17. package/dist/__tests__/circuit-breaker-config.test.js +32 -0
  18. package/dist/__tests__/circuit-breaker-config.test.js.map +1 -0
  19. package/dist/__tests__/circuit-breaker-events.test.d.ts +2 -0
  20. package/dist/__tests__/circuit-breaker-events.test.d.ts.map +1 -0
  21. package/dist/__tests__/circuit-breaker-events.test.js +53 -0
  22. package/dist/__tests__/circuit-breaker-events.test.js.map +1 -0
  23. package/dist/__tests__/circuit-breaker-integration.test.d.ts +2 -0
  24. package/dist/__tests__/circuit-breaker-integration.test.d.ts.map +1 -0
  25. package/dist/__tests__/circuit-breaker-integration.test.js +192 -0
  26. package/dist/__tests__/circuit-breaker-integration.test.js.map +1 -0
  27. package/dist/__tests__/circuit-breaker-probe.test.d.ts +2 -0
  28. package/dist/__tests__/circuit-breaker-probe.test.d.ts.map +1 -0
  29. package/dist/__tests__/circuit-breaker-probe.test.js +124 -0
  30. package/dist/__tests__/circuit-breaker-probe.test.js.map +1 -0
  31. package/dist/__tests__/circuit-breaker-recover.test.d.ts +2 -0
  32. package/dist/__tests__/circuit-breaker-recover.test.d.ts.map +1 -0
  33. package/dist/__tests__/circuit-breaker-recover.test.js +52 -0
  34. package/dist/__tests__/circuit-breaker-recover.test.js.map +1 -0
  35. package/dist/__tests__/circuit-breaker-sweep.test.d.ts +2 -0
  36. package/dist/__tests__/circuit-breaker-sweep.test.d.ts.map +1 -0
  37. package/dist/__tests__/circuit-breaker-sweep.test.js +118 -0
  38. package/dist/__tests__/circuit-breaker-sweep.test.js.map +1 -0
  39. package/dist/__tests__/db-migrations.test.js +7 -3
  40. package/dist/__tests__/db-migrations.test.js.map +1 -1
  41. package/dist/__tests__/decision-artifact-schema.test.d.ts +2 -0
  42. package/dist/__tests__/decision-artifact-schema.test.d.ts.map +1 -0
  43. package/dist/__tests__/decision-artifact-schema.test.js +45 -0
  44. package/dist/__tests__/decision-artifact-schema.test.js.map +1 -0
  45. package/dist/__tests__/decisions-parser.test.d.ts +2 -0
  46. package/dist/__tests__/decisions-parser.test.d.ts.map +1 -0
  47. package/dist/__tests__/decisions-parser.test.js +59 -0
  48. package/dist/__tests__/decisions-parser.test.js.map +1 -0
  49. package/dist/__tests__/decisions-store.test.d.ts +2 -0
  50. package/dist/__tests__/decisions-store.test.d.ts.map +1 -0
  51. package/dist/__tests__/decisions-store.test.js +68 -0
  52. package/dist/__tests__/decisions-store.test.js.map +1 -0
  53. package/dist/__tests__/decisions-table-migration.test.d.ts +2 -0
  54. package/dist/__tests__/decisions-table-migration.test.d.ts.map +1 -0
  55. package/dist/__tests__/decisions-table-migration.test.js +56 -0
  56. package/dist/__tests__/decisions-table-migration.test.js.map +1 -0
  57. package/dist/__tests__/execute-stage-session-opts.test.js +2 -1
  58. package/dist/__tests__/execute-stage-session-opts.test.js.map +1 -1
  59. package/dist/__tests__/executor-issue-id.test.js +2 -1
  60. package/dist/__tests__/executor-issue-id.test.js.map +1 -1
  61. package/dist/__tests__/extract-handoff-decisions.test.d.ts +2 -0
  62. package/dist/__tests__/extract-handoff-decisions.test.d.ts.map +1 -0
  63. package/dist/__tests__/extract-handoff-decisions.test.js +26 -0
  64. package/dist/__tests__/extract-handoff-decisions.test.js.map +1 -0
  65. package/dist/__tests__/force-push-agent-branches.test.js +38 -15
  66. package/dist/__tests__/force-push-agent-branches.test.js.map +1 -1
  67. package/dist/__tests__/github-webhook.test.js +117 -0
  68. package/dist/__tests__/github-webhook.test.js.map +1 -1
  69. package/dist/__tests__/implement-template-decisions.test.d.ts +2 -0
  70. package/dist/__tests__/implement-template-decisions.test.d.ts.map +1 -0
  71. package/dist/__tests__/implement-template-decisions.test.js +41 -0
  72. package/dist/__tests__/implement-template-decisions.test.js.map +1 -0
  73. package/dist/__tests__/migrator.test.js +137 -39
  74. package/dist/__tests__/migrator.test.js.map +1 -1
  75. package/dist/__tests__/pipeline-runner.test.js +118 -0
  76. package/dist/__tests__/pipeline-runner.test.js.map +1 -1
  77. package/dist/__tests__/pm-audit-retention-step.test.js +3 -0
  78. package/dist/__tests__/pm-audit-retention-step.test.js.map +1 -1
  79. package/dist/__tests__/pm-budget-alerts.test.d.ts +14 -0
  80. package/dist/__tests__/pm-budget-alerts.test.d.ts.map +1 -1
  81. package/dist/__tests__/pm-budget-alerts.test.js +90 -18
  82. package/dist/__tests__/pm-budget-alerts.test.js.map +1 -1
  83. package/dist/__tests__/pm-budget-refused-event.test.js +2 -0
  84. package/dist/__tests__/pm-budget-refused-event.test.js.map +1 -1
  85. package/dist/__tests__/pm-budget-utc-boundary.test.d.ts +2 -0
  86. package/dist/__tests__/pm-budget-utc-boundary.test.d.ts.map +1 -0
  87. package/dist/__tests__/pm-budget-utc-boundary.test.js +128 -0
  88. package/dist/__tests__/pm-budget-utc-boundary.test.js.map +1 -0
  89. package/dist/__tests__/pm-conflict.test.js +145 -5
  90. package/dist/__tests__/pm-conflict.test.js.map +1 -1
  91. package/dist/__tests__/pm-cost-rollup-step.test.js +2 -0
  92. package/dist/__tests__/pm-cost-rollup-step.test.js.map +1 -1
  93. package/dist/__tests__/pm-promote.test.js +111 -0
  94. package/dist/__tests__/pm-promote.test.js.map +1 -1
  95. package/dist/__tests__/pm-scheduler.test.js +1 -0
  96. package/dist/__tests__/pm-scheduler.test.js.map +1 -1
  97. package/dist/__tests__/pm-sso-prune-step.test.js +2 -0
  98. package/dist/__tests__/pm-sso-prune-step.test.js.map +1 -1
  99. package/dist/__tests__/preflight-claude-auth.test.js +3 -2
  100. package/dist/__tests__/preflight-claude-auth.test.js.map +1 -1
  101. package/dist/__tests__/ralph-review-fix-regression.test.js +1 -0
  102. package/dist/__tests__/ralph-review-fix-regression.test.js.map +1 -1
  103. package/dist/__tests__/ralph.test.js +1 -0
  104. package/dist/__tests__/ralph.test.js.map +1 -1
  105. package/dist/__tests__/release-manager-qarun-query.test.d.ts +2 -0
  106. package/dist/__tests__/release-manager-qarun-query.test.d.ts.map +1 -0
  107. package/dist/__tests__/release-manager-qarun-query.test.js +233 -0
  108. package/dist/__tests__/release-manager-qarun-query.test.js.map +1 -0
  109. package/dist/__tests__/release-manager-scheduler.test.js +62 -0
  110. package/dist/__tests__/release-manager-scheduler.test.js.map +1 -1
  111. package/dist/__tests__/release-manager-slack-handler.test.js +66 -0
  112. package/dist/__tests__/release-manager-slack-handler.test.js.map +1 -1
  113. package/dist/__tests__/reproduce-bec113-pagination-warning.test.js +1 -0
  114. package/dist/__tests__/reproduce-bec113-pagination-warning.test.js.map +1 -1
  115. package/dist/__tests__/reproduce-bec62.test.js +1 -0
  116. package/dist/__tests__/reproduce-bec62.test.js.map +1 -1
  117. package/dist/__tests__/reproduce-bec91-stuck-in-progress.test.js +2 -0
  118. package/dist/__tests__/reproduce-bec91-stuck-in-progress.test.js.map +1 -1
  119. package/dist/__tests__/resolve-claude-auth.test.js +10 -8
  120. package/dist/__tests__/resolve-claude-auth.test.js.map +1 -1
  121. package/dist/__tests__/session-lazy-creation.test.js +2 -1
  122. package/dist/__tests__/session-lazy-creation.test.js.map +1 -1
  123. package/dist/__tests__/session-resolver.test.d.ts +13 -0
  124. package/dist/__tests__/session-resolver.test.d.ts.map +1 -0
  125. package/dist/__tests__/session-resolver.test.js +152 -0
  126. package/dist/__tests__/session-resolver.test.js.map +1 -0
  127. package/dist/__tests__/session-resume-fallback.test.js +2 -1
  128. package/dist/__tests__/session-resume-fallback.test.js.map +1 -1
  129. package/dist/__tests__/stage-models.test.js +3 -2
  130. package/dist/__tests__/stage-models.test.js.map +1 -1
  131. package/dist/__tests__/start-todo.test.js +29 -0
  132. package/dist/__tests__/start-todo.test.js.map +1 -1
  133. package/dist/__tests__/surgical-review-fix-prompt.test.d.ts +2 -0
  134. package/dist/__tests__/surgical-review-fix-prompt.test.d.ts.map +1 -0
  135. package/dist/__tests__/surgical-review-fix-prompt.test.js +71 -0
  136. package/dist/__tests__/surgical-review-fix-prompt.test.js.map +1 -0
  137. package/dist/__tests__/surgical-review-fix-runner.test.d.ts +2 -0
  138. package/dist/__tests__/surgical-review-fix-runner.test.d.ts.map +1 -0
  139. package/dist/__tests__/surgical-review-fix-runner.test.js +171 -0
  140. package/dist/__tests__/surgical-review-fix-runner.test.js.map +1 -0
  141. package/dist/__tests__/triage-preserve-acs.test.d.ts +2 -0
  142. package/dist/__tests__/triage-preserve-acs.test.d.ts.map +1 -0
  143. package/dist/__tests__/triage-preserve-acs.test.js +240 -0
  144. package/dist/__tests__/triage-preserve-acs.test.js.map +1 -0
  145. package/dist/__tests__/validate-run-mode.test.js +1 -0
  146. package/dist/__tests__/validate-run-mode.test.js.map +1 -1
  147. package/dist/__tests__/validate.test.js +1 -0
  148. package/dist/__tests__/validate.test.js.map +1 -1
  149. package/dist/audit/auth-error-messages.d.ts +6 -0
  150. package/dist/audit/auth-error-messages.d.ts.map +1 -0
  151. package/dist/audit/auth-error-messages.js +18 -0
  152. package/dist/audit/auth-error-messages.js.map +1 -0
  153. package/dist/audit/events.d.ts +51 -4
  154. package/dist/audit/events.d.ts.map +1 -1
  155. package/dist/audit/events.js +78 -5
  156. package/dist/audit/events.js.map +1 -1
  157. package/dist/audit/index.d.ts +1 -0
  158. package/dist/audit/index.d.ts.map +1 -1
  159. package/dist/audit/index.js +1 -0
  160. package/dist/audit/index.js.map +1 -1
  161. package/dist/db/client.d.ts.map +1 -1
  162. package/dist/db/client.js +20 -0
  163. package/dist/db/client.js.map +1 -1
  164. package/dist/db/decisions-store.d.ts +25 -0
  165. package/dist/db/decisions-store.d.ts.map +1 -0
  166. package/dist/db/decisions-store.js +56 -0
  167. package/dist/db/decisions-store.js.map +1 -0
  168. package/dist/db/index.d.ts +2 -2
  169. package/dist/db/index.d.ts.map +1 -1
  170. package/dist/db/index.js +2 -2
  171. package/dist/db/index.js.map +1 -1
  172. package/dist/db/migrations/postgres/008_sso.sql +9 -20
  173. package/dist/db/migrations/postgres/009_review_model_runs.sql +9 -18
  174. package/dist/db/migrations/postgres/009_sso.sql +20 -0
  175. package/dist/db/migrations/postgres/010_release_manager.sql +9 -38
  176. package/dist/db/migrations/postgres/010_review_model_runs.sql +18 -0
  177. package/dist/db/migrations/postgres/011_qa_run_columns.sql +9 -8
  178. package/dist/db/migrations/postgres/011_release_manager.sql +38 -0
  179. package/dist/db/migrations/postgres/012_qa_gap_issues.sql +9 -18
  180. package/dist/db/migrations/postgres/012_qa_run_columns.sql +8 -0
  181. package/dist/db/migrations/postgres/013_qa_gap_issues.sql +18 -0
  182. package/dist/db/migrations/postgres/013_stage_runs_cache_tokens.sql +11 -6
  183. package/dist/db/migrations/postgres/014_missing_indexes.sql +9 -28
  184. package/dist/db/migrations/postgres/014_stage_runs_cache_tokens.sql +6 -0
  185. package/dist/db/migrations/postgres/015_missing_indexes.sql +28 -0
  186. package/dist/db/migrations/postgres/015_triage_results.sql +9 -11
  187. package/dist/db/migrations/postgres/016_triage_results.sql +11 -0
  188. package/dist/db/migrations/sqlite/007_sso.sql +9 -20
  189. package/dist/db/migrations/sqlite/008_review_model_runs.sql +9 -18
  190. package/dist/db/migrations/sqlite/008_sso.sql +20 -0
  191. package/dist/db/migrations/sqlite/009_release_manager.sql +9 -43
  192. package/dist/db/migrations/sqlite/009_review_model_runs.sql +18 -0
  193. package/dist/db/migrations/sqlite/010_qa_run_columns.sql +9 -9
  194. package/dist/db/migrations/sqlite/010_release_manager.sql +43 -0
  195. package/dist/db/migrations/sqlite/011_qa_gap_issues.sql +9 -22
  196. package/dist/db/migrations/sqlite/011_qa_run_columns.sql +9 -0
  197. package/dist/db/migrations/sqlite/012_qa_gap_issues.sql +22 -0
  198. package/dist/db/migrations/sqlite/012_stage_runs_cache_tokens.sql +11 -6
  199. package/dist/db/migrations/sqlite/013_missing_indexes.sql +10 -28
  200. package/dist/db/migrations/sqlite/013_stage_runs_cache_tokens.sql +6 -0
  201. package/dist/db/migrations/sqlite/013_triage_results.sql +10 -11
  202. package/dist/db/migrations/sqlite/014_missing_indexes.sql +28 -0
  203. package/dist/db/migrations/sqlite/015_triage_results.sql +11 -0
  204. package/dist/db/migrator.d.ts +45 -2
  205. package/dist/db/migrator.d.ts.map +1 -1
  206. package/dist/db/migrator.js +113 -29
  207. package/dist/db/migrator.js.map +1 -1
  208. package/dist/db/schema.d.ts +213 -0
  209. package/dist/db/schema.d.ts.map +1 -1
  210. package/dist/db/schema.js +28 -0
  211. package/dist/db/schema.js.map +1 -1
  212. package/dist/executor/auth-check.d.ts +30 -7
  213. package/dist/executor/auth-check.d.ts.map +1 -1
  214. package/dist/executor/auth-check.js +66 -16
  215. package/dist/executor/auth-check.js.map +1 -1
  216. package/dist/executor/auth-monitor.d.ts.map +1 -1
  217. package/dist/executor/auth-monitor.js +48 -39
  218. package/dist/executor/auth-monitor.js.map +1 -1
  219. package/dist/executor/deep-review.d.ts.map +1 -1
  220. package/dist/executor/deep-review.js +14 -79
  221. package/dist/executor/deep-review.js.map +1 -1
  222. package/dist/executor/executor.d.ts +21 -0
  223. package/dist/executor/executor.d.ts.map +1 -1
  224. package/dist/executor/executor.js +42 -91
  225. package/dist/executor/executor.js.map +1 -1
  226. package/dist/executor/extract-handoff.d.ts +9 -0
  227. package/dist/executor/extract-handoff.d.ts.map +1 -1
  228. package/dist/executor/extract-handoff.js +48 -0
  229. package/dist/executor/extract-handoff.js.map +1 -1
  230. package/dist/executor/handoff.d.ts +10 -1
  231. package/dist/executor/handoff.d.ts.map +1 -1
  232. package/dist/executor/handoff.js +7 -1
  233. package/dist/executor/handoff.js.map +1 -1
  234. package/dist/executor/index.d.ts +1 -0
  235. package/dist/executor/index.d.ts.map +1 -1
  236. package/dist/executor/index.js +1 -0
  237. package/dist/executor/index.js.map +1 -1
  238. package/dist/executor/prompt/templates.d.ts +12 -1
  239. package/dist/executor/prompt/templates.d.ts.map +1 -1
  240. package/dist/executor/prompt/templates.js +64 -0
  241. package/dist/executor/prompt/templates.js.map +1 -1
  242. package/dist/executor/session-resolver.d.ts +51 -0
  243. package/dist/executor/session-resolver.d.ts.map +1 -0
  244. package/dist/executor/session-resolver.js +83 -0
  245. package/dist/executor/session-resolver.js.map +1 -0
  246. package/dist/index.d.ts +3 -2
  247. package/dist/index.d.ts.map +1 -1
  248. package/dist/index.js +3 -2
  249. package/dist/index.js.map +1 -1
  250. package/dist/notifier/composite.js +1 -1
  251. package/dist/notifier/composite.js.map +1 -1
  252. package/dist/notifier/linear.d.ts +1 -1
  253. package/dist/notifier/linear.d.ts.map +1 -1
  254. package/dist/notifier/linear.js +49 -9
  255. package/dist/notifier/linear.js.map +1 -1
  256. package/dist/pipeline/run-surgical-review-fix.d.ts +29 -0
  257. package/dist/pipeline/run-surgical-review-fix.d.ts.map +1 -0
  258. package/dist/pipeline/run-surgical-review-fix.js +48 -0
  259. package/dist/pipeline/run-surgical-review-fix.js.map +1 -0
  260. package/dist/pipeline/runner.d.ts.map +1 -1
  261. package/dist/pipeline/runner.js +132 -36
  262. package/dist/pipeline/runner.js.map +1 -1
  263. package/dist/pm/actions/circuit-breaker-config.d.ts +13 -0
  264. package/dist/pm/actions/circuit-breaker-config.d.ts.map +1 -0
  265. package/dist/pm/actions/circuit-breaker-config.js +23 -0
  266. package/dist/pm/actions/circuit-breaker-config.js.map +1 -0
  267. package/dist/pm/actions/db-queries.d.ts +18 -0
  268. package/dist/pm/actions/db-queries.d.ts.map +1 -1
  269. package/dist/pm/actions/db-queries.js +75 -2
  270. package/dist/pm/actions/db-queries.js.map +1 -1
  271. package/dist/pm/actions/promote.d.ts +7 -0
  272. package/dist/pm/actions/promote.d.ts.map +1 -1
  273. package/dist/pm/actions/promote.js +17 -1
  274. package/dist/pm/actions/promote.js.map +1 -1
  275. package/dist/pm/actions/recover-circuit-breaker.d.ts +21 -0
  276. package/dist/pm/actions/recover-circuit-breaker.d.ts.map +1 -0
  277. package/dist/pm/actions/recover-circuit-breaker.js +47 -0
  278. package/dist/pm/actions/recover-circuit-breaker.js.map +1 -0
  279. package/dist/pm/actions/select-probe-candidates.d.ts +21 -0
  280. package/dist/pm/actions/select-probe-candidates.d.ts.map +1 -0
  281. package/dist/pm/actions/select-probe-candidates.js +81 -0
  282. package/dist/pm/actions/select-probe-candidates.js.map +1 -0
  283. package/dist/pm/actions/start-todo.d.ts +7 -0
  284. package/dist/pm/actions/start-todo.d.ts.map +1 -1
  285. package/dist/pm/actions/start-todo.js +2 -1
  286. package/dist/pm/actions/start-todo.js.map +1 -1
  287. package/dist/pm/actions/sweep-recovered-circuit-breakers.d.ts +28 -0
  288. package/dist/pm/actions/sweep-recovered-circuit-breakers.d.ts.map +1 -0
  289. package/dist/pm/actions/sweep-recovered-circuit-breakers.js +47 -0
  290. package/dist/pm/actions/sweep-recovered-circuit-breakers.js.map +1 -0
  291. package/dist/pm/actions/triage-prompt.d.ts +14 -0
  292. package/dist/pm/actions/triage-prompt.d.ts.map +1 -1
  293. package/dist/pm/actions/triage-prompt.js +52 -9
  294. package/dist/pm/actions/triage-prompt.js.map +1 -1
  295. package/dist/pm/actions/triage.d.ts.map +1 -1
  296. package/dist/pm/actions/triage.js +37 -24
  297. package/dist/pm/actions/triage.js.map +1 -1
  298. package/dist/pm/conflict.d.ts +2 -0
  299. package/dist/pm/conflict.d.ts.map +1 -1
  300. package/dist/pm/conflict.js +59 -9
  301. package/dist/pm/conflict.js.map +1 -1
  302. package/dist/pm/scheduler.d.ts +5 -0
  303. package/dist/pm/scheduler.d.ts.map +1 -1
  304. package/dist/pm/scheduler.js +91 -44
  305. package/dist/pm/scheduler.js.map +1 -1
  306. package/dist/pm/slack.d.ts +11 -0
  307. package/dist/pm/slack.d.ts.map +1 -1
  308. package/dist/pm/slack.js +48 -5
  309. package/dist/pm/slack.js.map +1 -1
  310. package/dist/release-manager/release-helpers.d.ts +19 -2
  311. package/dist/release-manager/release-helpers.d.ts.map +1 -1
  312. package/dist/release-manager/release-helpers.js +22 -3
  313. package/dist/release-manager/release-helpers.js.map +1 -1
  314. package/dist/release-manager/release-tick.d.ts.map +1 -1
  315. package/dist/release-manager/release-tick.js +20 -8
  316. package/dist/release-manager/release-tick.js.map +1 -1
  317. package/dist/release-manager/slack-handler.d.ts +6 -0
  318. package/dist/release-manager/slack-handler.d.ts.map +1 -1
  319. package/dist/release-manager/slack-handler.js +76 -1
  320. package/dist/release-manager/slack-handler.js.map +1 -1
  321. package/dist/release-manager/state.d.ts.map +1 -1
  322. package/dist/release-manager/state.js +25 -18
  323. package/dist/release-manager/state.js.map +1 -1
  324. package/dist/types.d.ts +238 -13
  325. package/dist/types.d.ts.map +1 -1
  326. package/dist/types.js +67 -0
  327. package/dist/types.js.map +1 -1
  328. package/dist/webhook/github-handler.d.ts +2 -2
  329. package/dist/webhook/github-handler.d.ts.map +1 -1
  330. package/dist/webhook/github-handler.js +18 -6
  331. package/dist/webhook/github-handler.js.map +1 -1
  332. package/package.json +1 -1
@@ -1,38 +1,9 @@
1
- -- BEC-135: Release Manager agent decision log + one-shot approvals.
2
-
3
- CREATE TABLE IF NOT EXISTS release_decisions (
4
- id TEXT PRIMARY KEY,
5
- repo_url TEXT NOT NULL,
6
- branch TEXT NOT NULL,
7
- decided_at TIMESTAMPTZ NOT NULL DEFAULT now(),
8
- decision TEXT NOT NULL,
9
- reason TEXT NOT NULL,
10
- trigger_state_json TEXT NOT NULL,
11
- proposed_version TEXT,
12
- fired_tag TEXT,
13
- fired_sha TEXT,
14
- attempt_count INTEGER NOT NULL DEFAULT 0
15
- );
16
-
17
- CREATE INDEX IF NOT EXISTS idx_release_decisions_repo_branch_decided
18
- ON release_decisions(repo_url, branch, decided_at DESC);
19
-
20
- CREATE INDEX IF NOT EXISTS idx_release_decisions_decision_decided
21
- ON release_decisions(decision, decided_at);
22
-
23
- CREATE TABLE IF NOT EXISTS release_approvals (
24
- id TEXT PRIMARY KEY,
25
- repo_url TEXT NOT NULL,
26
- branch TEXT NOT NULL,
27
- approved_at TIMESTAMPTZ NOT NULL DEFAULT now(),
28
- approved_by TEXT NOT NULL,
29
- consumed_at TIMESTAMPTZ,
30
- consumed_by_decision_id TEXT
31
- );
32
-
33
- CREATE UNIQUE INDEX IF NOT EXISTS idx_release_approvals_unique_fresh
34
- ON release_approvals(repo_url, branch, approved_by)
35
- WHERE consumed_at IS NULL;
36
-
37
- CREATE INDEX IF NOT EXISTS idx_release_approvals_repo_branch_consumed
38
- ON release_approvals(repo_url, branch, consumed_at);
1
+ -- BEC-149: This migration was renumbered to 011_release_manager to fix cascading
2
+ -- prefix collision introduced when 008_sso was renumbered to 009_sso.
3
+ --
4
+ -- This file is retained for git history only. The migrator skips it based on
5
+ -- the POSTGRES_MIGRATION_RENAMES map in migrator.ts, which also renames any
6
+ -- existing "010_release_manager" entries in schema_migrations to
7
+ -- "011_release_manager" so that existing deployments do not re-run this migration.
8
+ --
9
+ -- Active migration: packages/core/src/db/migrations/postgres/011_release_manager.sql
@@ -0,0 +1,18 @@
1
+ -- BEC-134: per-model results from review-stage fanout.
2
+ CREATE TABLE IF NOT EXISTS review_model_runs (
3
+ id TEXT PRIMARY KEY,
4
+ stage_run_id TEXT NOT NULL REFERENCES stage_runs(id),
5
+ provider_id TEXT NOT NULL,
6
+ model_id TEXT NOT NULL,
7
+ status TEXT NOT NULL,
8
+ input_tokens INTEGER NOT NULL DEFAULT 0,
9
+ output_tokens INTEGER NOT NULL DEFAULT 0,
10
+ duration_ms INTEGER NOT NULL DEFAULT 0,
11
+ error_message TEXT,
12
+ truncated_files INTEGER NOT NULL DEFAULT 0,
13
+ started_at TIMESTAMPTZ,
14
+ completed_at TIMESTAMPTZ
15
+ );
16
+
17
+ CREATE INDEX IF NOT EXISTS idx_review_model_runs_stage_run_id
18
+ ON review_model_runs(stage_run_id);
@@ -1,8 +1,9 @@
1
- -- BEC-136: QA agent track in-flight workflow runs on the release_decisions table.
2
-
3
- ALTER TABLE release_decisions ADD COLUMN IF NOT EXISTS qa_run_id INTEGER;
4
- ALTER TABLE release_decisions ADD COLUMN IF NOT EXISTS qa_run_sha TEXT;
5
-
6
- CREATE INDEX IF NOT EXISTS idx_release_decisions_qa_run_id
7
- ON release_decisions(repo_url, branch, qa_run_id, decided_at DESC)
8
- WHERE qa_run_id IS NOT NULL;
1
+ -- BEC-149: This migration was renumbered to 012_qa_run_columns to fix cascading
2
+ -- prefix collision introduced when 008_sso was renumbered to 009_sso.
3
+ --
4
+ -- This file is retained for git history only. The migrator skips it based on
5
+ -- the POSTGRES_MIGRATION_RENAMES map in migrator.ts, which also renames any
6
+ -- existing "011_qa_run_columns" entries in schema_migrations to
7
+ -- "012_qa_run_columns" so that existing deployments do not re-run this migration.
8
+ --
9
+ -- Active migration: packages/core/src/db/migrations/postgres/012_qa_run_columns.sql
@@ -0,0 +1,38 @@
1
+ -- BEC-135: Release Manager agent — decision log + one-shot approvals.
2
+
3
+ CREATE TABLE IF NOT EXISTS release_decisions (
4
+ id TEXT PRIMARY KEY,
5
+ repo_url TEXT NOT NULL,
6
+ branch TEXT NOT NULL,
7
+ decided_at TIMESTAMPTZ NOT NULL DEFAULT now(),
8
+ decision TEXT NOT NULL,
9
+ reason TEXT NOT NULL,
10
+ trigger_state_json TEXT NOT NULL,
11
+ proposed_version TEXT,
12
+ fired_tag TEXT,
13
+ fired_sha TEXT,
14
+ attempt_count INTEGER NOT NULL DEFAULT 0
15
+ );
16
+
17
+ CREATE INDEX IF NOT EXISTS idx_release_decisions_repo_branch_decided
18
+ ON release_decisions(repo_url, branch, decided_at DESC);
19
+
20
+ CREATE INDEX IF NOT EXISTS idx_release_decisions_decision_decided
21
+ ON release_decisions(decision, decided_at);
22
+
23
+ CREATE TABLE IF NOT EXISTS release_approvals (
24
+ id TEXT PRIMARY KEY,
25
+ repo_url TEXT NOT NULL,
26
+ branch TEXT NOT NULL,
27
+ approved_at TIMESTAMPTZ NOT NULL DEFAULT now(),
28
+ approved_by TEXT NOT NULL,
29
+ consumed_at TIMESTAMPTZ,
30
+ consumed_by_decision_id TEXT
31
+ );
32
+
33
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_release_approvals_unique_fresh
34
+ ON release_approvals(repo_url, branch, approved_by)
35
+ WHERE consumed_at IS NULL;
36
+
37
+ CREATE INDEX IF NOT EXISTS idx_release_approvals_repo_branch_consumed
38
+ ON release_approvals(repo_url, branch, consumed_at);
@@ -1,18 +1,9 @@
1
- -- BEC-136: QA agent Linear issue idempotency for missing QA workflows.
2
-
3
- CREATE TABLE IF NOT EXISTS qa_gap_issues (
4
- id TEXT PRIMARY KEY,
5
- repo_url TEXT NOT NULL,
6
- branch TEXT NOT NULL,
7
- workflow_path TEXT NOT NULL,
8
- linear_issue_id TEXT NOT NULL,
9
- filed_at TIMESTAMPTZ NOT NULL DEFAULT now(),
10
- resolved_at TIMESTAMPTZ
11
- );
12
-
13
- CREATE UNIQUE INDEX IF NOT EXISTS idx_qa_gap_issues_unique_open
14
- ON qa_gap_issues(repo_url, branch, workflow_path)
15
- WHERE resolved_at IS NULL;
16
-
17
- CREATE INDEX IF NOT EXISTS idx_qa_gap_issues_lookup
18
- ON qa_gap_issues(repo_url, branch, workflow_path, resolved_at);
1
+ -- BEC-149: This migration was renumbered to 013_qa_gap_issues to fix cascading
2
+ -- prefix collision introduced when 008_sso was renumbered to 009_sso.
3
+ --
4
+ -- This file is retained for git history only. The migrator skips it based on
5
+ -- the POSTGRES_MIGRATION_RENAMES map in migrator.ts, which also renames any
6
+ -- existing "012_qa_gap_issues" entries in schema_migrations to
7
+ -- "013_qa_gap_issues" so that existing deployments do not re-run this migration.
8
+ --
9
+ -- Active migration: packages/core/src/db/migrations/postgres/013_qa_gap_issues.sql
@@ -0,0 +1,8 @@
1
+ -- BEC-136: QA agent — track in-flight workflow runs on the release_decisions table.
2
+
3
+ ALTER TABLE release_decisions ADD COLUMN IF NOT EXISTS qa_run_id INTEGER;
4
+ ALTER TABLE release_decisions ADD COLUMN IF NOT EXISTS qa_run_sha TEXT;
5
+
6
+ CREATE INDEX IF NOT EXISTS idx_release_decisions_qa_run_id
7
+ ON release_decisions(repo_url, branch, qa_run_id, decided_at DESC)
8
+ WHERE qa_run_id IS NOT NULL;
@@ -0,0 +1,18 @@
1
+ -- BEC-136: QA agent — Linear issue idempotency for missing QA workflows.
2
+
3
+ CREATE TABLE IF NOT EXISTS qa_gap_issues (
4
+ id TEXT PRIMARY KEY,
5
+ repo_url TEXT NOT NULL,
6
+ branch TEXT NOT NULL,
7
+ workflow_path TEXT NOT NULL,
8
+ linear_issue_id TEXT NOT NULL,
9
+ filed_at TIMESTAMPTZ NOT NULL DEFAULT now(),
10
+ resolved_at TIMESTAMPTZ
11
+ );
12
+
13
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_qa_gap_issues_unique_open
14
+ ON qa_gap_issues(repo_url, branch, workflow_path)
15
+ WHERE resolved_at IS NULL;
16
+
17
+ CREATE INDEX IF NOT EXISTS idx_qa_gap_issues_lookup
18
+ ON qa_gap_issues(repo_url, branch, workflow_path, resolved_at);
@@ -1,6 +1,11 @@
1
- -- 013_stage_runs_cache_tokens.sql
2
- -- BEC: cache telemetry capture prompt-cache token usage from the
3
- -- Anthropic Agent SDK so we can measure hit-rate per stage.
4
-
5
- ALTER TABLE stage_runs ADD COLUMN cache_creation_input_tokens INTEGER NOT NULL DEFAULT 0;
6
- ALTER TABLE stage_runs ADD COLUMN cache_read_input_tokens INTEGER NOT NULL DEFAULT 0;
1
+ -- BEC-149: This migration was renumbered to 014_stage_runs_cache_tokens to fix
2
+ -- a duplicate prefix (013_qa_gap_issues and 013_stage_runs_cache_tokens shared
3
+ -- prefix 013 after the initial BEC-149 rename pass).
4
+ --
5
+ -- This file is retained for git history only. The migrator skips it based on
6
+ -- the POSTGRES_MIGRATION_RENAMES map in migrator.ts, which also renames any
7
+ -- existing "013_stage_runs_cache_tokens" entries in schema_migrations to
8
+ -- "014_stage_runs_cache_tokens" so existing deployments do not re-run this
9
+ -- migration.
10
+ --
11
+ -- Active migration: packages/core/src/db/migrations/postgres/014_stage_runs_cache_tokens.sql
@@ -1,28 +1,9 @@
1
- -- Migration: BEC-187 Add 5 missing hot-path indexes to pipeline_runs + pm_approvals
2
- -- Idempotent: all statements use CREATE INDEX IF NOT EXISTS (supported since Postgres 9.5).
3
-
4
- -- pipeline_runs.pr_url: queried on every check_suite, pull_request, and review
5
- -- event in webhook/github-handler.ts to look up the run by PR URL.
6
- CREATE INDEX IF NOT EXISTS idx_pipeline_runs_pr_url
7
- ON pipeline_runs(pr_url);
8
-
9
- -- pipeline_runs.branch: queried alongside pr_url in webhook/github-handler.ts
10
- -- to find runs by branch name on push/CI events.
11
- CREATE INDEX IF NOT EXISTS idx_pipeline_runs_branch
12
- ON pipeline_runs(branch);
13
-
14
- -- pipeline_runs.started_at: range-scanned by pm/actions/db-queries.ts,
15
- -- pm/budget.ts, audit/reader.ts, cost/csv.ts, and runner.ts on every PM tick
16
- -- (60s cadence) and dashboard page load.
17
- CREATE INDEX IF NOT EXISTS idx_pipeline_runs_started_at
18
- ON pipeline_runs(started_at);
19
-
20
- -- pipeline_runs.completed_at: range-scanned by pm/actions/db-queries.ts and
21
- -- cost/aggregate.ts for active-run detection and cost rollup windows.
22
- CREATE INDEX IF NOT EXISTS idx_pipeline_runs_completed_at
23
- ON pipeline_runs(completed_at);
24
-
25
- -- pm_approvals.issue_id: queried by approval-helpers.ts:batchFetchPendingApprovals
26
- -- on every PM tick to find pending approvals for a batch of issue IDs.
27
- CREATE INDEX IF NOT EXISTS idx_pm_approvals_issue_id
28
- ON pm_approvals(issue_id);
1
+ -- BEC-149: This migration was renumbered to 015_missing_indexes to follow the
2
+ -- 014_stage_runs_cache_tokens renumbering (preserves monotonic prefix order).
3
+ --
4
+ -- This file is retained for git history only. The migrator skips it based on
5
+ -- the POSTGRES_MIGRATION_RENAMES map in migrator.ts, which also renames any
6
+ -- existing "014_missing_indexes" entries in schema_migrations to
7
+ -- "015_missing_indexes" so existing deployments do not re-run this migration.
8
+ --
9
+ -- Active migration: packages/core/src/db/migrations/postgres/015_missing_indexes.sql
@@ -0,0 +1,6 @@
1
+ -- 013_stage_runs_cache_tokens.sql
2
+ -- BEC: cache telemetry — capture prompt-cache token usage from the
3
+ -- Anthropic Agent SDK so we can measure hit-rate per stage.
4
+
5
+ ALTER TABLE stage_runs ADD COLUMN cache_creation_input_tokens INTEGER NOT NULL DEFAULT 0;
6
+ ALTER TABLE stage_runs ADD COLUMN cache_read_input_tokens INTEGER NOT NULL DEFAULT 0;
@@ -0,0 +1,28 @@
1
+ -- Migration: BEC-187 — Add 5 missing hot-path indexes to pipeline_runs + pm_approvals
2
+ -- Idempotent: all statements use CREATE INDEX IF NOT EXISTS (supported since Postgres 9.5).
3
+
4
+ -- pipeline_runs.pr_url: queried on every check_suite, pull_request, and review
5
+ -- event in webhook/github-handler.ts to look up the run by PR URL.
6
+ CREATE INDEX IF NOT EXISTS idx_pipeline_runs_pr_url
7
+ ON pipeline_runs(pr_url);
8
+
9
+ -- pipeline_runs.branch: queried alongside pr_url in webhook/github-handler.ts
10
+ -- to find runs by branch name on push/CI events.
11
+ CREATE INDEX IF NOT EXISTS idx_pipeline_runs_branch
12
+ ON pipeline_runs(branch);
13
+
14
+ -- pipeline_runs.started_at: range-scanned by pm/actions/db-queries.ts,
15
+ -- pm/budget.ts, audit/reader.ts, cost/csv.ts, and runner.ts on every PM tick
16
+ -- (60s cadence) and dashboard page load.
17
+ CREATE INDEX IF NOT EXISTS idx_pipeline_runs_started_at
18
+ ON pipeline_runs(started_at);
19
+
20
+ -- pipeline_runs.completed_at: range-scanned by pm/actions/db-queries.ts and
21
+ -- cost/aggregate.ts for active-run detection and cost rollup windows.
22
+ CREATE INDEX IF NOT EXISTS idx_pipeline_runs_completed_at
23
+ ON pipeline_runs(completed_at);
24
+
25
+ -- pm_approvals.issue_id: queried by approval-helpers.ts:batchFetchPendingApprovals
26
+ -- on every PM tick to find pending approvals for a batch of issue IDs.
27
+ CREATE INDEX IF NOT EXISTS idx_pm_approvals_issue_id
28
+ ON pm_approvals(issue_id);
@@ -1,11 +1,9 @@
1
- -- 015_triage_results.sql
2
- -- BEC-223: persist triage v2 prediction at triage time so the runner Tier 6e
3
- -- hook reads from DB instead of parsing the description (which gets truncated
4
- -- by mapIssueToSchema at 4000 chars, slicing off the appended v2 sections for
5
- -- realistic issues).
6
-
7
- CREATE TABLE IF NOT EXISTS triage_results (
8
- issue_id TEXT PRIMARY KEY,
9
- v2_prediction TEXT NOT NULL DEFAULT '{}',
10
- triaged_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
11
- );
1
+ -- BEC-149: This migration was renumbered to 016_triage_results to follow the
2
+ -- 014_stage_runs_cache_tokens and 015_missing_indexes renumberings.
3
+ --
4
+ -- This file is retained for git history only. The migrator skips it based on
5
+ -- the POSTGRES_MIGRATION_RENAMES map in migrator.ts, which also renames any
6
+ -- existing "015_triage_results" entries in schema_migrations to
7
+ -- "016_triage_results" so existing deployments do not re-run this migration.
8
+ --
9
+ -- Active migration: packages/core/src/db/migrations/postgres/016_triage_results.sql
@@ -0,0 +1,11 @@
1
+ -- 015_triage_results.sql
2
+ -- BEC-223: persist triage v2 prediction at triage time so the runner Tier 6e
3
+ -- hook reads from DB instead of parsing the description (which gets truncated
4
+ -- by mapIssueToSchema at 4000 chars, slicing off the appended v2 sections for
5
+ -- realistic issues).
6
+
7
+ CREATE TABLE IF NOT EXISTS triage_results (
8
+ issue_id TEXT PRIMARY KEY,
9
+ v2_prediction TEXT NOT NULL DEFAULT '{}',
10
+ triaged_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
11
+ );
@@ -1,20 +1,9 @@
1
- -- Enterprise feature 4.1: SSO via WorkOS
2
- CREATE TABLE IF NOT EXISTS dashboard_users (
3
- id TEXT PRIMARY KEY,
4
- email TEXT NOT NULL UNIQUE,
5
- name TEXT,
6
- workos_user_id TEXT,
7
- created_at INTEGER NOT NULL,
8
- last_login_at INTEGER
9
- );
10
-
11
- CREATE TABLE IF NOT EXISTS dashboard_sessions (
12
- id TEXT PRIMARY KEY,
13
- user_id TEXT NOT NULL REFERENCES dashboard_users(id),
14
- created_at INTEGER NOT NULL,
15
- expires_at INTEGER NOT NULL,
16
- last_seen_at INTEGER NOT NULL
17
- );
18
-
19
- CREATE INDEX IF NOT EXISTS idx_dashboard_sessions_user_id ON dashboard_sessions(user_id);
20
- CREATE INDEX IF NOT EXISTS idx_dashboard_sessions_expires_at ON dashboard_sessions(expires_at);
1
+ -- BEC-149: This migration was renumbered to 008_sso to fix a duplicate prefix
2
+ -- (007_cost_rollups and 007_sso shared prefix 007).
3
+ --
4
+ -- This file is retained for git history only. The migrator skips it based on
5
+ -- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
6
+ -- existing "007_sso" entries in schema_migrations to "008_sso" so that
7
+ -- existing deployments do not re-run this migration.
8
+ --
9
+ -- Active migration: packages/core/src/db/migrations/sqlite/008_sso.sql
@@ -1,18 +1,9 @@
1
- -- BEC-134: per-model results from review-stage fanout.
2
- CREATE TABLE IF NOT EXISTS review_model_runs (
3
- id TEXT PRIMARY KEY,
4
- stage_run_id TEXT NOT NULL REFERENCES stage_runs(id),
5
- provider_id TEXT NOT NULL,
6
- model_id TEXT NOT NULL,
7
- status TEXT NOT NULL,
8
- input_tokens INTEGER NOT NULL DEFAULT 0,
9
- output_tokens INTEGER NOT NULL DEFAULT 0,
10
- duration_ms INTEGER NOT NULL DEFAULT 0,
11
- error_message TEXT,
12
- truncated_files INTEGER NOT NULL DEFAULT 0,
13
- started_at INTEGER,
14
- completed_at INTEGER
15
- );
16
-
17
- CREATE INDEX IF NOT EXISTS idx_review_model_runs_stage_run_id
18
- ON review_model_runs(stage_run_id);
1
+ -- BEC-149: This migration was renumbered to 009_review_model_runs to fix cascading
2
+ -- prefix collision introduced when 007_sso was renumbered to 008_sso.
3
+ --
4
+ -- This file is retained for git history only. The migrator skips it based on
5
+ -- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
6
+ -- existing "008_review_model_runs" entries in schema_migrations to
7
+ -- "009_review_model_runs" so that existing deployments do not re-run this migration.
8
+ --
9
+ -- Active migration: packages/core/src/db/migrations/sqlite/009_review_model_runs.sql
@@ -0,0 +1,20 @@
1
+ -- Enterprise feature 4.1: SSO via WorkOS
2
+ CREATE TABLE IF NOT EXISTS dashboard_users (
3
+ id TEXT PRIMARY KEY,
4
+ email TEXT NOT NULL UNIQUE,
5
+ name TEXT,
6
+ workos_user_id TEXT,
7
+ created_at INTEGER NOT NULL,
8
+ last_login_at INTEGER
9
+ );
10
+
11
+ CREATE TABLE IF NOT EXISTS dashboard_sessions (
12
+ id TEXT PRIMARY KEY,
13
+ user_id TEXT NOT NULL REFERENCES dashboard_users(id),
14
+ created_at INTEGER NOT NULL,
15
+ expires_at INTEGER NOT NULL,
16
+ last_seen_at INTEGER NOT NULL
17
+ );
18
+
19
+ CREATE INDEX IF NOT EXISTS idx_dashboard_sessions_user_id ON dashboard_sessions(user_id);
20
+ CREATE INDEX IF NOT EXISTS idx_dashboard_sessions_expires_at ON dashboard_sessions(expires_at);
@@ -1,43 +1,9 @@
1
- -- BEC-135: Release Manager agent decision log + one-shot approvals.
2
-
3
- CREATE TABLE IF NOT EXISTS release_decisions (
4
- id TEXT PRIMARY KEY,
5
- repo_url TEXT NOT NULL,
6
- branch TEXT NOT NULL,
7
- decided_at INTEGER NOT NULL,
8
- decision TEXT NOT NULL,
9
- reason TEXT NOT NULL,
10
- trigger_state_json TEXT NOT NULL,
11
- proposed_version TEXT,
12
- fired_tag TEXT,
13
- fired_sha TEXT,
14
- attempt_count INTEGER NOT NULL DEFAULT 0
15
- );
16
-
17
- -- Index for /release status: fast lookup of the most recent N decisions per (repo, branch).
18
- CREATE INDEX IF NOT EXISTS idx_release_decisions_repo_branch_decided
19
- ON release_decisions(repo_url, branch, decided_at DESC);
20
-
21
- -- Index for retry sweep: find fire-pending rows.
22
- CREATE INDEX IF NOT EXISTS idx_release_decisions_decision_decided
23
- ON release_decisions(decision, decided_at);
24
-
25
- CREATE TABLE IF NOT EXISTS release_approvals (
26
- id TEXT PRIMARY KEY,
27
- repo_url TEXT NOT NULL,
28
- branch TEXT NOT NULL,
29
- approved_at INTEGER NOT NULL,
30
- approved_by TEXT NOT NULL,
31
- consumed_at INTEGER,
32
- consumed_by_decision_id TEXT
33
- );
34
-
35
- -- Partial UNIQUE: one fresh (un-consumed) approval per (repo, branch, user).
36
- -- Once consumed, the row stays for audit but no longer blocks new approves.
37
- CREATE UNIQUE INDEX IF NOT EXISTS idx_release_approvals_unique_fresh
38
- ON release_approvals(repo_url, branch, approved_by)
39
- WHERE consumed_at IS NULL;
40
-
41
- -- Lookup index for fresh-approval check at decision time.
42
- CREATE INDEX IF NOT EXISTS idx_release_approvals_repo_branch_consumed
43
- ON release_approvals(repo_url, branch, consumed_at);
1
+ -- BEC-149: This migration was renumbered to 010_release_manager to fix cascading
2
+ -- prefix collision introduced when 007_sso was renumbered to 008_sso.
3
+ --
4
+ -- This file is retained for git history only. The migrator skips it based on
5
+ -- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
6
+ -- existing "009_release_manager" entries in schema_migrations to
7
+ -- "010_release_manager" so that existing deployments do not re-run this migration.
8
+ --
9
+ -- Active migration: packages/core/src/db/migrations/sqlite/010_release_manager.sql
@@ -0,0 +1,18 @@
1
+ -- BEC-134: per-model results from review-stage fanout.
2
+ CREATE TABLE IF NOT EXISTS review_model_runs (
3
+ id TEXT PRIMARY KEY,
4
+ stage_run_id TEXT NOT NULL REFERENCES stage_runs(id),
5
+ provider_id TEXT NOT NULL,
6
+ model_id TEXT NOT NULL,
7
+ status TEXT NOT NULL,
8
+ input_tokens INTEGER NOT NULL DEFAULT 0,
9
+ output_tokens INTEGER NOT NULL DEFAULT 0,
10
+ duration_ms INTEGER NOT NULL DEFAULT 0,
11
+ error_message TEXT,
12
+ truncated_files INTEGER NOT NULL DEFAULT 0,
13
+ started_at INTEGER,
14
+ completed_at INTEGER
15
+ );
16
+
17
+ CREATE INDEX IF NOT EXISTS idx_review_model_runs_stage_run_id
18
+ ON review_model_runs(stage_run_id);
@@ -1,9 +1,9 @@
1
- -- BEC-136: QA agent track in-flight workflow runs on the release_decisions table.
2
-
3
- ALTER TABLE release_decisions ADD COLUMN qa_run_id INTEGER;
4
- ALTER TABLE release_decisions ADD COLUMN qa_run_sha TEXT;
5
-
6
- -- Index for collectState's qaRun lookup: fastest path for "most recent decision with non-null qa_run_id"
7
- CREATE INDEX IF NOT EXISTS idx_release_decisions_qa_run_id
8
- ON release_decisions(repo_url, branch, qa_run_id, decided_at DESC)
9
- WHERE qa_run_id IS NOT NULL;
1
+ -- BEC-149: This migration was renumbered to 011_qa_run_columns to fix cascading
2
+ -- prefix collision introduced when 007_sso was renumbered to 008_sso.
3
+ --
4
+ -- This file is retained for git history only. The migrator skips it based on
5
+ -- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
6
+ -- existing "010_qa_run_columns" entries in schema_migrations to
7
+ -- "011_qa_run_columns" so that existing deployments do not re-run this migration.
8
+ --
9
+ -- Active migration: packages/core/src/db/migrations/sqlite/011_qa_run_columns.sql
@@ -0,0 +1,43 @@
1
+ -- BEC-135: Release Manager agent — decision log + one-shot approvals.
2
+
3
+ CREATE TABLE IF NOT EXISTS release_decisions (
4
+ id TEXT PRIMARY KEY,
5
+ repo_url TEXT NOT NULL,
6
+ branch TEXT NOT NULL,
7
+ decided_at INTEGER NOT NULL,
8
+ decision TEXT NOT NULL,
9
+ reason TEXT NOT NULL,
10
+ trigger_state_json TEXT NOT NULL,
11
+ proposed_version TEXT,
12
+ fired_tag TEXT,
13
+ fired_sha TEXT,
14
+ attempt_count INTEGER NOT NULL DEFAULT 0
15
+ );
16
+
17
+ -- Index for /release status: fast lookup of the most recent N decisions per (repo, branch).
18
+ CREATE INDEX IF NOT EXISTS idx_release_decisions_repo_branch_decided
19
+ ON release_decisions(repo_url, branch, decided_at DESC);
20
+
21
+ -- Index for retry sweep: find fire-pending rows.
22
+ CREATE INDEX IF NOT EXISTS idx_release_decisions_decision_decided
23
+ ON release_decisions(decision, decided_at);
24
+
25
+ CREATE TABLE IF NOT EXISTS release_approvals (
26
+ id TEXT PRIMARY KEY,
27
+ repo_url TEXT NOT NULL,
28
+ branch TEXT NOT NULL,
29
+ approved_at INTEGER NOT NULL,
30
+ approved_by TEXT NOT NULL,
31
+ consumed_at INTEGER,
32
+ consumed_by_decision_id TEXT
33
+ );
34
+
35
+ -- Partial UNIQUE: one fresh (un-consumed) approval per (repo, branch, user).
36
+ -- Once consumed, the row stays for audit but no longer blocks new approves.
37
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_release_approvals_unique_fresh
38
+ ON release_approvals(repo_url, branch, approved_by)
39
+ WHERE consumed_at IS NULL;
40
+
41
+ -- Lookup index for fresh-approval check at decision time.
42
+ CREATE INDEX IF NOT EXISTS idx_release_approvals_repo_branch_consumed
43
+ ON release_approvals(repo_url, branch, consumed_at);
@@ -1,22 +1,9 @@
1
- -- BEC-136: QA agent Linear issue idempotency for missing QA workflows.
2
-
3
- CREATE TABLE IF NOT EXISTS qa_gap_issues (
4
- id TEXT PRIMARY KEY,
5
- repo_url TEXT NOT NULL,
6
- branch TEXT NOT NULL,
7
- workflow_path TEXT NOT NULL,
8
- linear_issue_id TEXT NOT NULL,
9
- filed_at INTEGER NOT NULL,
10
- resolved_at INTEGER
11
- );
12
-
13
- -- Partial UNIQUE: at most one open gap issue per (repo, branch, workflow) at a time.
14
- -- Once resolved (resolved_at IS NOT NULL), the row is preserved for audit but a new
15
- -- issue can be filed for the same gap in the future.
16
- CREATE UNIQUE INDEX IF NOT EXISTS idx_qa_gap_issues_unique_open
17
- ON qa_gap_issues(repo_url, branch, workflow_path)
18
- WHERE resolved_at IS NULL;
19
-
20
- -- Lookup index for "is there an open gap for this (repo, branch, workflow)?" — partial too.
21
- CREATE INDEX IF NOT EXISTS idx_qa_gap_issues_lookup
22
- ON qa_gap_issues(repo_url, branch, workflow_path, resolved_at);
1
+ -- BEC-149: This migration was renumbered to 012_qa_gap_issues to fix cascading
2
+ -- prefix collision introduced when 007_sso was renumbered to 008_sso.
3
+ --
4
+ -- This file is retained for git history only. The migrator skips it based on
5
+ -- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
6
+ -- existing "011_qa_gap_issues" entries in schema_migrations to
7
+ -- "012_qa_gap_issues" so that existing deployments do not re-run this migration.
8
+ --
9
+ -- Active migration: packages/core/src/db/migrations/sqlite/012_qa_gap_issues.sql
@@ -0,0 +1,9 @@
1
+ -- BEC-136: QA agent — track in-flight workflow runs on the release_decisions table.
2
+
3
+ ALTER TABLE release_decisions ADD COLUMN qa_run_id INTEGER;
4
+ ALTER TABLE release_decisions ADD COLUMN qa_run_sha TEXT;
5
+
6
+ -- Index for collectState's qaRun lookup: fastest path for "most recent decision with non-null qa_run_id"
7
+ CREATE INDEX IF NOT EXISTS idx_release_decisions_qa_run_id
8
+ ON release_decisions(repo_url, branch, qa_run_id, decided_at DESC)
9
+ WHERE qa_run_id IS NOT NULL;
@@ -0,0 +1,22 @@
1
+ -- BEC-136: QA agent — Linear issue idempotency for missing QA workflows.
2
+
3
+ CREATE TABLE IF NOT EXISTS qa_gap_issues (
4
+ id TEXT PRIMARY KEY,
5
+ repo_url TEXT NOT NULL,
6
+ branch TEXT NOT NULL,
7
+ workflow_path TEXT NOT NULL,
8
+ linear_issue_id TEXT NOT NULL,
9
+ filed_at INTEGER NOT NULL,
10
+ resolved_at INTEGER
11
+ );
12
+
13
+ -- Partial UNIQUE: at most one open gap issue per (repo, branch, workflow) at a time.
14
+ -- Once resolved (resolved_at IS NOT NULL), the row is preserved for audit but a new
15
+ -- issue can be filed for the same gap in the future.
16
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_qa_gap_issues_unique_open
17
+ ON qa_gap_issues(repo_url, branch, workflow_path)
18
+ WHERE resolved_at IS NULL;
19
+
20
+ -- Lookup index for "is there an open gap for this (repo, branch, workflow)?" — partial too.
21
+ CREATE INDEX IF NOT EXISTS idx_qa_gap_issues_lookup
22
+ ON qa_gap_issues(repo_url, branch, workflow_path, resolved_at);
@@ -1,6 +1,11 @@
1
- -- 012_stage_runs_cache_tokens.sql
2
- -- BEC: cache telemetry capture prompt-cache token usage from the
3
- -- Anthropic Agent SDK so we can measure hit-rate per stage.
4
-
5
- ALTER TABLE stage_runs ADD COLUMN cache_creation_input_tokens INTEGER NOT NULL DEFAULT 0;
6
- ALTER TABLE stage_runs ADD COLUMN cache_read_input_tokens INTEGER NOT NULL DEFAULT 0;
1
+ -- BEC-149: This migration was renumbered to 013_stage_runs_cache_tokens to fix
2
+ -- a duplicate prefix (012_qa_gap_issues and 012_stage_runs_cache_tokens shared
3
+ -- prefix 012 after the initial BEC-149 rename pass).
4
+ --
5
+ -- This file is retained for git history only. The migrator skips it based on
6
+ -- the SQLITE_MIGRATION_RENAMES map in migrator.ts, which also renames any
7
+ -- existing "012_stage_runs_cache_tokens" entries in schema_migrations to
8
+ -- "013_stage_runs_cache_tokens" so existing deployments do not re-run this
9
+ -- migration.
10
+ --
11
+ -- Active migration: packages/core/src/db/migrations/sqlite/013_stage_runs_cache_tokens.sql