@open-qa/qa 0.0.0-stage → 0.1.0-alpha.4

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 (313) hide show
  1. package/LICENSE +204 -0
  2. package/NOTICE +7 -0
  3. package/THIRD_PARTY.md +12 -0
  4. package/THIRD_PARTY_NOTICES.md +11 -0
  5. package/drizzle/0000_qa_core.sql +158 -0
  6. package/drizzle/0001_run_health.sql +3 -0
  7. package/drizzle/0002_bounded_cleanup.sql +5 -0
  8. package/drizzle/0003_step_replay_cache.sql +9 -0
  9. package/drizzle/0004_credential_expiry.sql +1 -0
  10. package/drizzle/0005_server_api.sql +19 -0
  11. package/drizzle/0006_submission_created.sql +3 -0
  12. package/drizzle/0007_findings.sql +19 -0
  13. package/drizzle/0008_classification_labels.sql +14 -0
  14. package/drizzle/0009_job_queue.sql +20 -0
  15. package/drizzle/0010_result_notifications.sql +13 -0
  16. package/drizzle/0011_result_notification_retries.sql +5 -0
  17. package/drizzle/0012_result_notification_flows.sql +44 -0
  18. package/drizzle/0013_flow_quarantine.sql +35 -0
  19. package/drizzle/0014_run_budgets.sql +2 -0
  20. package/drizzle/0015_flow_lifecycle.sql +9 -0
  21. package/drizzle/0016_open_qa_classification.sql +28 -0
  22. package/drizzle/meta/0000_snapshot.json +1002 -0
  23. package/drizzle/meta/0001_snapshot.json +1021 -0
  24. package/drizzle/meta/0002_snapshot.json +1027 -0
  25. package/drizzle/meta/0003_snapshot.json +1081 -0
  26. package/drizzle/meta/0004_snapshot.json +1087 -0
  27. package/drizzle/meta/0005_snapshot.json +1210 -0
  28. package/drizzle/meta/0006_snapshot.json +1244 -0
  29. package/drizzle/meta/0007_snapshot.json +1353 -0
  30. package/drizzle/meta/0008_snapshot.json +1435 -0
  31. package/drizzle/meta/0009_snapshot.json +1587 -0
  32. package/drizzle/meta/0010_snapshot.json +1675 -0
  33. package/drizzle/meta/0011_snapshot.json +1692 -0
  34. package/drizzle/meta/0012_snapshot.json +1818 -0
  35. package/drizzle/meta/0013_snapshot.json +2016 -0
  36. package/drizzle/meta/0014_snapshot.json +2028 -0
  37. package/drizzle/meta/0015_snapshot.json +2064 -0
  38. package/drizzle/meta/0016_snapshot.json +2076 -0
  39. package/drizzle/meta/_journal.json +125 -0
  40. package/package.json +118 -4
  41. package/problem-matcher.json +32 -0
  42. package/src/adapters/db-lease-pool.d.ts +25 -0
  43. package/src/adapters/db-lease-pool.js +293 -0
  44. package/src/adapters/dir-artifact-store.d.ts +9 -0
  45. package/src/adapters/dir-artifact-store.js +64 -0
  46. package/src/adapters/e2b-agent.d.ts +7 -0
  47. package/src/adapters/e2b-agent.js +94 -0
  48. package/src/adapters/e2b-artifacts.d.ts +3 -0
  49. package/src/adapters/e2b-artifacts.js +66 -0
  50. package/src/adapters/e2b-bounded.d.ts +1 -0
  51. package/src/adapters/e2b-bounded.js +19 -0
  52. package/src/adapters/e2b-client.d.ts +33 -0
  53. package/src/adapters/e2b-client.js +114 -0
  54. package/src/adapters/e2b-executor.d.ts +26 -0
  55. package/src/adapters/e2b-executor.js +194 -0
  56. package/src/adapters/e2b-lifetime.d.ts +20 -0
  57. package/src/adapters/e2b-lifetime.js +73 -0
  58. package/src/adapters/e2b-prune.d.ts +13 -0
  59. package/src/adapters/e2b-prune.js +42 -0
  60. package/src/adapters/file-replay-cache.d.ts +14 -0
  61. package/src/adapters/file-replay-cache.js +120 -0
  62. package/src/adapters/file-run-store.d.ts +175 -0
  63. package/src/adapters/file-run-store.js +280 -0
  64. package/src/adapters/fixed-lease-pool.d.ts +10 -0
  65. package/src/adapters/fixed-lease-pool.js +237 -0
  66. package/src/adapters/gcs/artifact-store.d.ts +49 -0
  67. package/src/adapters/gcs/artifact-store.js +247 -0
  68. package/src/adapters/gcs/client.d.ts +22 -0
  69. package/src/adapters/gcs/client.js +106 -0
  70. package/src/adapters/gcs/download.d.ts +9 -0
  71. package/src/adapters/gcs/download.js +43 -0
  72. package/src/adapters/gcs/index.d.ts +8 -0
  73. package/src/adapters/gcs/index.js +23 -0
  74. package/src/adapters/gcs/periodic-flush.d.ts +5 -0
  75. package/src/adapters/gcs/periodic-flush.js +16 -0
  76. package/src/adapters/gcs/pg-catalog.d.ts +16 -0
  77. package/src/adapters/gcs/pg-catalog.js +149 -0
  78. package/src/adapters/gcs/replay-completeness.d.ts +1 -0
  79. package/src/adapters/gcs/replay-completeness.js +65 -0
  80. package/src/adapters/gcs/scan-upload.d.ts +10 -0
  81. package/src/adapters/gcs/scan-upload.js +26 -0
  82. package/src/adapters/index.d.ts +5 -0
  83. package/src/adapters/index.js +12 -0
  84. package/src/adapters/lease-transaction.d.ts +2 -0
  85. package/src/adapters/lease-transaction.js +61 -0
  86. package/src/adapters/local-credential-resolver.d.ts +5 -0
  87. package/src/adapters/local-credential-resolver.js +15 -0
  88. package/src/adapters/local-env.d.ts +1 -0
  89. package/src/adapters/local-env.js +37 -0
  90. package/src/adapters/local-files.d.ts +17 -0
  91. package/src/adapters/local-files.js +150 -0
  92. package/src/adapters/pg-classification-store.d.ts +58 -0
  93. package/src/adapters/pg-classification-store.js +112 -0
  94. package/src/adapters/pg-replay-cache.d.ts +16 -0
  95. package/src/adapters/pg-replay-cache.js +111 -0
  96. package/src/adapters/pg-run-store.d.ts +58 -0
  97. package/src/adapters/pg-run-store.js +399 -0
  98. package/src/adapters/resource-pools.d.ts +2 -0
  99. package/src/adapters/resource-pools.js +28 -0
  100. package/src/adapters/secret-manager-credential-resolver.d.ts +44 -0
  101. package/src/adapters/secret-manager-credential-resolver.js +102 -0
  102. package/src/artifact-scan.d.ts +21 -0
  103. package/src/artifact-scan.js +139 -0
  104. package/src/budget-confirmation.d.ts +23 -0
  105. package/src/budget-confirmation.js +43 -0
  106. package/src/cache-command.d.ts +7 -0
  107. package/src/cache-command.js +107 -0
  108. package/src/classification-command.d.ts +14 -0
  109. package/src/classification-command.js +72 -0
  110. package/src/classification-diff.d.ts +10 -0
  111. package/src/classification-diff.js +47 -0
  112. package/src/classification-model.d.ts +17 -0
  113. package/src/classification-model.js +51 -0
  114. package/src/classification-notifier.d.ts +21 -0
  115. package/src/classification-notifier.js +34 -0
  116. package/src/classify-runs.d.ts +31 -0
  117. package/src/classify-runs.js +138 -0
  118. package/src/cli-program.d.ts +9 -0
  119. package/src/cli-program.js +172 -0
  120. package/src/cli.d.ts +2 -0
  121. package/src/cli.js +12 -0
  122. package/src/commands.d.ts +7 -0
  123. package/src/commands.js +17 -0
  124. package/src/credential-references.d.ts +24 -0
  125. package/src/credential-references.js +33 -0
  126. package/src/db/commands.d.ts +1 -0
  127. package/src/db/commands.js +34 -0
  128. package/src/db/credentials.d.ts +16 -0
  129. package/src/db/credentials.js +73 -0
  130. package/src/db/database.d.ts +12 -0
  131. package/src/db/database.js +135 -0
  132. package/src/db/event-chunks.d.ts +405 -0
  133. package/src/db/event-chunks.js +74 -0
  134. package/src/db/fencing.d.ts +8 -0
  135. package/src/db/fencing.js +16 -0
  136. package/src/db/flow-status.d.ts +41 -0
  137. package/src/db/flow-status.js +208 -0
  138. package/src/db/index.d.ts +12 -0
  139. package/src/db/index.js +24 -0
  140. package/src/db/queries.d.ts +73 -0
  141. package/src/db/queries.js +122 -0
  142. package/src/db/resources.d.ts +14 -0
  143. package/src/db/resources.js +61 -0
  144. package/src/db/schema.d.ts +3532 -0
  145. package/src/db/schema.js +501 -0
  146. package/src/demo-command.d.ts +1 -0
  147. package/src/demo-command.js +50 -0
  148. package/src/doctor-command.d.ts +15 -0
  149. package/src/doctor-command.js +275 -0
  150. package/src/doctor-summary.d.ts +2 -0
  151. package/src/doctor-summary.js +31 -0
  152. package/src/draft-api.d.ts +460 -0
  153. package/src/draft-api.js +333 -0
  154. package/src/draft-command.d.ts +10 -0
  155. package/src/draft-command.js +73 -0
  156. package/src/draft-hooks.d.ts +3 -0
  157. package/src/draft-hooks.js +33 -0
  158. package/src/draft-pages.d.ts +11 -0
  159. package/src/draft-pages.js +82 -0
  160. package/src/engine.d.ts +105 -0
  161. package/src/engine.js +323 -0
  162. package/src/execution-snapshot.d.ts +21 -0
  163. package/src/execution-snapshot.js +141 -0
  164. package/src/flow-check.d.ts +9 -0
  165. package/src/flow-check.js +68 -0
  166. package/src/flow-lifecycle.d.ts +6 -0
  167. package/src/flow-lifecycle.js +61 -0
  168. package/src/flow-lint.d.ts +8 -0
  169. package/src/flow-lint.js +73 -0
  170. package/src/flow-loader.d.ts +219 -0
  171. package/src/flow-loader.js +236 -0
  172. package/src/flow-source.d.ts +2 -0
  173. package/src/flow-source.js +6 -0
  174. package/src/flows-api.d.ts +1 -0
  175. package/src/flows-api.js +12 -0
  176. package/src/heal-notification.d.ts +16 -0
  177. package/src/heal-notification.js +62 -0
  178. package/src/hooks/api.d.ts +29 -0
  179. package/src/hooks/api.js +15 -0
  180. package/src/hooks/consumer.d.ts +18 -0
  181. package/src/hooks/consumer.js +98 -0
  182. package/src/hooks/loader.d.ts +6 -0
  183. package/src/hooks/loader.js +28 -0
  184. package/src/hooks/registry.d.ts +22 -0
  185. package/src/hooks/registry.js +23 -0
  186. package/src/hooks/runner.d.ts +19 -0
  187. package/src/hooks/runner.js +279 -0
  188. package/src/hooks/session-cache.d.ts +16 -0
  189. package/src/hooks/session-cache.js +42 -0
  190. package/src/hooks/session-store.d.ts +20 -0
  191. package/src/hooks/session-store.js +95 -0
  192. package/src/hooks/worker.d.ts +1 -0
  193. package/src/hooks/worker.js +84 -0
  194. package/src/http-stage-client.d.ts +367 -0
  195. package/src/http-stage-client.js +190 -0
  196. package/src/independent-model.d.ts +22 -0
  197. package/src/independent-model.js +215 -0
  198. package/src/lifecycle-command.d.ts +15 -0
  199. package/src/lifecycle-command.js +190 -0
  200. package/src/local-command.d.ts +3 -0
  201. package/src/local-command.js +27 -0
  202. package/src/local-host-executor.d.ts +38 -0
  203. package/src/local-host-executor.js +196 -0
  204. package/src/open-command.d.ts +7 -0
  205. package/src/open-command.js +39 -0
  206. package/src/operations-api.d.ts +2 -0
  207. package/src/operations-api.js +6 -0
  208. package/src/personas.d.ts +2 -0
  209. package/src/personas.js +61 -0
  210. package/src/program-runner.d.ts +3 -0
  211. package/src/program-runner.js +263 -0
  212. package/src/program-sandbox.py +75 -0
  213. package/src/program-scratch.d.ts +2 -0
  214. package/src/program-scratch.js +48 -0
  215. package/src/program-worker.mjs +101 -0
  216. package/src/public-id.d.ts +2 -0
  217. package/src/public-id.js +5 -0
  218. package/src/public-report-url.d.ts +1 -0
  219. package/src/public-report-url.js +18 -0
  220. package/src/publication-check.d.ts +1 -0
  221. package/src/publication-check.js +31 -0
  222. package/src/quarantine-command.d.ts +9 -0
  223. package/src/quarantine-command.js +69 -0
  224. package/src/remote-command.d.ts +30 -0
  225. package/src/remote-command.js +156 -0
  226. package/src/replay-image.d.ts +1 -0
  227. package/src/replay-image.js +35 -0
  228. package/src/report/assets.d.ts +1 -0
  229. package/src/report/assets.js +5 -0
  230. package/src/report/browser.css +414 -0
  231. package/src/report/browser.d.ts +1 -0
  232. package/src/report/browser.js +219 -0
  233. package/src/report/data.d.ts +1 -0
  234. package/src/report/data.js +4 -0
  235. package/src/report/generate.d.ts +1 -0
  236. package/src/report/generate.js +54 -0
  237. package/src/report/load.d.ts +870 -0
  238. package/src/report/load.js +139 -0
  239. package/src/report/resource-table.d.ts +2 -0
  240. package/src/report/resource-table.js +4 -0
  241. package/src/report/status-icon.d.ts +2 -0
  242. package/src/report/status-icon.js +20 -0
  243. package/src/report/style.css +413 -0
  244. package/src/result-notifier.d.ts +121 -0
  245. package/src/result-notifier.js +230 -0
  246. package/src/result-transports.d.ts +12 -0
  247. package/src/result-transports.js +150 -0
  248. package/src/run-command.d.ts +32 -0
  249. package/src/run-command.js +493 -0
  250. package/src/run-setup-error.d.ts +11 -0
  251. package/src/run-setup-error.js +18 -0
  252. package/src/sandboxes-command.d.ts +9 -0
  253. package/src/sandboxes-command.js +29 -0
  254. package/src/screen-proxy.d.ts +5 -0
  255. package/src/screen-proxy.js +79 -0
  256. package/src/screen-url.d.ts +18 -0
  257. package/src/screen-url.js +54 -0
  258. package/src/server/app.d.ts +29 -0
  259. package/src/server/app.js +350 -0
  260. package/src/server/auth.d.ts +33 -0
  261. package/src/server/auth.js +113 -0
  262. package/src/server/credentials.d.ts +30 -0
  263. package/src/server/credentials.js +77 -0
  264. package/src/server/errors.d.ts +9 -0
  265. package/src/server/errors.js +26 -0
  266. package/src/server/index.d.ts +35 -0
  267. package/src/server/index.js +96 -0
  268. package/src/server/maintenance.d.ts +13 -0
  269. package/src/server/maintenance.js +54 -0
  270. package/src/server/repository.d.ts +534 -0
  271. package/src/server/repository.js +219 -0
  272. package/src/setup-command.d.ts +10 -0
  273. package/src/setup-command.js +52 -0
  274. package/src/stage-environment.d.ts +1 -0
  275. package/src/stage-environment.js +35 -0
  276. package/src/stage-supervisor.mjs +95 -0
  277. package/src/studio-command.d.ts +7 -0
  278. package/src/studio-command.js +47 -0
  279. package/src/studio-control.d.ts +5 -0
  280. package/src/studio-control.js +207 -0
  281. package/src/studio-review.d.ts +24 -0
  282. package/src/studio-review.js +64 -0
  283. package/src/studio-worker.d.ts +1 -0
  284. package/src/studio-worker.js +48 -0
  285. package/src/system-config.d.ts +7 -0
  286. package/src/system-config.js +70 -0
  287. package/src/terminal-reporter.d.ts +13 -0
  288. package/src/terminal-reporter.js +93 -0
  289. package/src/vendor/gmail.d.ts +45 -0
  290. package/src/vendor/gmail.js +193 -0
  291. package/src/watch-command.d.ts +16 -0
  292. package/src/watch-command.js +93 -0
  293. package/src/watch-state.d.ts +4 -0
  294. package/src/watch-state.js +53 -0
  295. package/src/worker/execution-error.d.ts +5 -0
  296. package/src/worker/execution-error.js +10 -0
  297. package/src/worker/execution.d.ts +24 -0
  298. package/src/worker/execution.js +190 -0
  299. package/src/worker/index.d.ts +8 -0
  300. package/src/worker/index.js +40 -0
  301. package/src/worker/prune.d.ts +3 -0
  302. package/src/worker/prune.js +22 -0
  303. package/src/worker/quarantine-notifications.d.ts +8 -0
  304. package/src/worker/quarantine-notifications.js +89 -0
  305. package/src/worker/queue.d.ts +65 -0
  306. package/src/worker/queue.js +438 -0
  307. package/src/worker/result-notifications.d.ts +28 -0
  308. package/src/worker/result-notifications.js +347 -0
  309. package/src/worker/store.d.ts +4 -0
  310. package/src/worker/store.js +46 -0
  311. package/src/worker/worker.d.ts +21 -0
  312. package/src/worker/worker.js +140 -0
  313. package/README.md +0 -3
package/LICENSE ADDED
@@ -0,0 +1,204 @@
1
+ Copyright 2026 Corvo AI (酷沃科技股份有限公司)
2
+
3
+
4
+ Apache License
5
+ Version 2.0, January 2004
6
+ http://www.apache.org/licenses/
7
+
8
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9
+
10
+ 1. Definitions.
11
+
12
+ "License" shall mean the terms and conditions for use, reproduction,
13
+ and distribution as defined by Sections 1 through 9 of this document.
14
+
15
+ "Licensor" shall mean the copyright owner or entity authorized by
16
+ the copyright owner that is granting the License.
17
+
18
+ "Legal Entity" shall mean the union of the acting entity and all
19
+ other entities that control, are controlled by, or are under common
20
+ control with that entity. For the purposes of this definition,
21
+ "control" means (i) the power, direct or indirect, to cause the
22
+ direction or management of such entity, whether by contract or
23
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
24
+ outstanding shares, or (iii) beneficial ownership of such entity.
25
+
26
+ "You" (or "Your") shall mean an individual or Legal Entity
27
+ exercising permissions granted by this License.
28
+
29
+ "Source" form shall mean the preferred form for making modifications,
30
+ including but not limited to software source code, documentation
31
+ source, and configuration files.
32
+
33
+ "Object" form shall mean any form resulting from mechanical
34
+ transformation or translation of a Source form, including but
35
+ not limited to compiled object code, generated documentation,
36
+ and conversions to other media types.
37
+
38
+ "Work" shall mean the work of authorship, whether in Source or
39
+ Object form, made available under the License, as indicated by a
40
+ copyright notice that is included in or attached to the work
41
+ (an example is provided in the Appendix below).
42
+
43
+ "Derivative Works" shall mean any work, whether in Source or Object
44
+ form, that is based on (or derived from) the Work and for which the
45
+ editorial revisions, annotations, elaborations, or other modifications
46
+ represent, as a whole, an original work of authorship. For the purposes
47
+ of this License, Derivative Works shall not include works that remain
48
+ separable from, or merely link (or bind by name) to the interfaces of,
49
+ the Work and Derivative Works thereof.
50
+
51
+ "Contribution" shall mean any work of authorship, including
52
+ the original version of the Work and any modifications or additions
53
+ to that Work or Derivative Works thereof, that is intentionally
54
+ submitted to Licensor for inclusion in the Work by the copyright owner
55
+ or by an individual or Legal Entity authorized to submit on behalf of
56
+ the copyright owner. For the purposes of this definition, "submitted"
57
+ means any form of electronic, verbal, or written communication sent
58
+ to the Licensor or its representatives, including but not limited to
59
+ communication on electronic mailing lists, source code control systems,
60
+ and issue tracking systems that are managed by, or on behalf of, the
61
+ Licensor for the purpose of discussing and improving the Work, but
62
+ excluding communication that is conspicuously marked or otherwise
63
+ designated in writing by the copyright owner as "Not a Contribution."
64
+
65
+ "Contributor" shall mean Licensor and any individual or Legal Entity
66
+ on behalf of whom a Contribution has been received by Licensor and
67
+ subsequently incorporated within the Work.
68
+
69
+ 2. Grant of Copyright License. Subject to the terms and conditions of
70
+ this License, each Contributor hereby grants to You a perpetual,
71
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72
+ copyright license to reproduce, prepare Derivative Works of,
73
+ publicly display, publicly perform, sublicense, and distribute the
74
+ Work and such Derivative Works in Source or Object form.
75
+
76
+ 3. Grant of Patent License. Subject to the terms and conditions of
77
+ this License, each Contributor hereby grants to You a perpetual,
78
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79
+ (except as stated in this section) patent license to make, have made,
80
+ use, offer to sell, sell, import, and otherwise transfer the Work,
81
+ where such license applies only to those patent claims licensable
82
+ by such Contributor that are necessarily infringed by their
83
+ Contribution(s) alone or by combination of their Contribution(s)
84
+ with the Work to which such Contribution(s) was submitted. If You
85
+ institute patent litigation against any entity (including a
86
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
87
+ or a Contribution incorporated within the Work constitutes direct
88
+ or contributory patent infringement, then any patent licenses
89
+ granted to You under this License for that Work shall terminate
90
+ as of the date such litigation is filed.
91
+
92
+ 4. Redistribution. You may reproduce and distribute copies of the
93
+ Work or Derivative Works thereof in any medium, with or without
94
+ modifications, and in Source or Object form, provided that You
95
+ meet the following conditions:
96
+
97
+ (a) You must give any other recipients of the Work or
98
+ Derivative Works a copy of this License; and
99
+
100
+ (b) You must cause any modified files to carry prominent notices
101
+ stating that You changed the files; and
102
+
103
+ (c) You must retain, in the Source form of any Derivative Works
104
+ that You distribute, all copyright, patent, trademark, and
105
+ attribution notices from the Source form of the Work,
106
+ excluding those notices that do not pertain to any part of
107
+ the Derivative Works; and
108
+
109
+ (d) If the Work includes a "NOTICE" text file as part of its
110
+ distribution, then any Derivative Works that You distribute must
111
+ include a readable copy of the attribution notices contained
112
+ within such NOTICE file, excluding those notices that do not
113
+ pertain to any part of the Derivative Works, in at least one
114
+ of the following places: within a NOTICE text file distributed
115
+ as part of the Derivative Works; within the Source form or
116
+ documentation, if provided along with the Derivative Works; or,
117
+ within a display generated by the Derivative Works, if and
118
+ wherever such third-party notices normally appear. The contents
119
+ of the NOTICE file are for informational purposes only and
120
+ do not modify the License. You may add Your own attribution
121
+ notices within Derivative Works that You distribute, alongside
122
+ or as an addendum to the NOTICE text from the Work, provided
123
+ that such additional attribution notices cannot be construed
124
+ as modifying the License.
125
+
126
+ You may add Your own copyright statement to Your modifications and
127
+ may provide additional or different license terms and conditions
128
+ for use, reproduction, or distribution of Your modifications, or
129
+ for any such Derivative Works as a whole, provided Your use,
130
+ reproduction, and distribution of the Work otherwise complies with
131
+ the conditions stated in this License.
132
+
133
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
134
+ any Contribution intentionally submitted for inclusion in the Work
135
+ by You to the Licensor shall be under the terms and conditions of
136
+ this License, without any additional terms or conditions.
137
+ Notwithstanding the above, nothing herein shall supersede or modify
138
+ the terms of any separate license agreement you may have executed
139
+ with Licensor regarding such Contributions.
140
+
141
+ 6. Trademarks. This License does not grant permission to use the trade
142
+ names, trademarks, service marks, or product names of the Licensor,
143
+ except as required for reasonable and customary use in describing the
144
+ origin of the Work and reproducing the content of the NOTICE file.
145
+
146
+ 7. Disclaimer of Warranty. Unless required by applicable law or
147
+ agreed to in writing, Licensor provides the Work (and each
148
+ Contributor provides its Contributions) on an "AS IS" BASIS,
149
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
150
+ implied, including, without limitation, any warranties or conditions
151
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
152
+ PARTICULAR PURPOSE. You are solely responsible for determining the
153
+ appropriateness of using or redistributing the Work and assume any
154
+ risks associated with Your exercise of permissions under this License.
155
+
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+
168
+ 9. Accepting Warranty or Additional Liability. While redistributing
169
+ the Work or Derivative Works thereof, You may choose to offer,
170
+ and charge a fee for, acceptance of support, warranty, indemnity,
171
+ or other liability obligations and/or rights consistent with this
172
+ License. However, in accepting such obligations, You may act only
173
+ on Your own behalf and on Your sole responsibility, not on behalf
174
+ of any other Contributor, and only if You agree to indemnify,
175
+ defend, and hold each Contributor harmless for any liability
176
+ incurred by, or claims asserted against, such Contributor by reason
177
+ of your accepting any such warranty or additional liability.
178
+
179
+ END OF TERMS AND CONDITIONS
180
+
181
+ APPENDIX: How to apply the Apache License to your work.
182
+
183
+ To apply the Apache License to your work, attach the following
184
+ boilerplate notice, with the fields enclosed by brackets "[]"
185
+ replaced with your own identifying information. (Don't include
186
+ the brackets!) The text should be enclosed in the appropriate
187
+ comment syntax for the file format. We also recommend that a
188
+ file or class name and description of purpose be included on the
189
+ same "printed page" as the copyright notice for easier
190
+ identification within third-party archives.
191
+
192
+ Copyright [yyyy] [name of copyright owner]
193
+
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+
198
+ http://www.apache.org/licenses/LICENSE-2.0
199
+
200
+ Unless required by applicable law or agreed to in writing, software
201
+ distributed under the License is distributed on an "AS IS" BASIS,
202
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203
+ See the License for the specific language governing permissions and
204
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,7 @@
1
+ open-qa
2
+ Copyright 2026 Corvo AI (酷沃科技股份有限公司)
3
+
4
+ Licensed under the Apache License, Version 2.0.
5
+ Third-party components retain their own copyright and license notices.
6
+ See THIRD_PARTY.md and THIRD_PARTY_NOTICES.md in package distributions,
7
+ and apps/qa/scripts/distribution-notices.md in source distributions.
package/THIRD_PARTY.md ADDED
@@ -0,0 +1,12 @@
1
+ # Third-party notices
2
+
3
+ | Material | Retained notice |
4
+ | -------------------------------------- | ----------------------------------------------------------------------------------------------- |
5
+ | Studio UI primitives (shadcn/ui) | apps/qa-studio/src/ui/SHADCN-LICENSE.txt (MIT); src/ui/SHADCN-LICENSE.txt in the Studio package |
6
+ | Geist test fonts | Adjacent LICENSE.txt (SIL OFL) |
7
+ | Bundled dependencies and runtime fonts | Dependency package LICENSE/NOTICE files inside the Studio runtime archive |
8
+ | rrweb report runtime | Inline legal notices in the generated report bundle |
9
+
10
+ Registry dependencies retain their respective licenses. Synthetic media reproduction steps are recorded in
11
+ apps/qa/docs/public-fixtures.md. Installed dependency inventory is provided as
12
+ CycloneDX SBOM evidence alongside release artifacts.
@@ -0,0 +1,11 @@
1
+ # open-qa distribution sources and notices
2
+
3
+ Copyright 2026 Corvo AI (酷沃科技股份有限公司). Licensed under Apache-2.0.
4
+ The Gmail adapter and QA status vocabulary are maintained with the framework
5
+ and preserve the stage/CLI boundary.
6
+
7
+ Studio includes shadcn/ui primitives under MIT, with the full notice in
8
+ src/ui/SHADCN-LICENSE.txt. Its standalone archive retains dependency package
9
+ metadata, licenses and Geist font assets selected by Next's tracer. Registry
10
+ dependencies retain their own licenses. Report bundling preserves inline legal
11
+ notices from rrweb. See LICENSE, NOTICE and THIRD_PARTY.md.
@@ -0,0 +1,158 @@
1
+ CREATE SCHEMA "qa";
2
+ --> statement-breakpoint
3
+ CREATE TABLE "qa"."artifacts" (
4
+ "project_id" text NOT NULL,
5
+ "run_id" text NOT NULL,
6
+ "path" text NOT NULL,
7
+ "kind" text NOT NULL,
8
+ "object_key" text NOT NULL,
9
+ "bytes" bigint NOT NULL,
10
+ "sha256" text NOT NULL,
11
+ CONSTRAINT "artifacts_project_id_run_id_path_pk" PRIMARY KEY("project_id","run_id","path")
12
+ );
13
+ --> statement-breakpoint
14
+ CREATE TABLE "qa"."batches" (
15
+ "project_id" text NOT NULL,
16
+ "id" text NOT NULL,
17
+ "trigger" text NOT NULL,
18
+ "target" text,
19
+ "commit" text,
20
+ "created_by" text,
21
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
22
+ CONSTRAINT "batches_project_id_id_pk" PRIMARY KEY("project_id","id")
23
+ );
24
+ --> statement-breakpoint
25
+ CREATE TABLE "qa"."credentials" (
26
+ "project_id" text NOT NULL,
27
+ "user_id" text NOT NULL,
28
+ "provider" text NOT NULL,
29
+ "secret_ref" text NOT NULL,
30
+ CONSTRAINT "credentials_project_id_user_id_provider_pk" PRIMARY KEY("project_id","user_id","provider")
31
+ );
32
+ --> statement-breakpoint
33
+ CREATE TABLE "qa"."event_chunks" (
34
+ "project_id" text NOT NULL,
35
+ "run_id" text NOT NULL,
36
+ "id" text NOT NULL,
37
+ "object_key" text NOT NULL,
38
+ "sha256" text NOT NULL,
39
+ "count" integer NOT NULL,
40
+ "bytes" integer NOT NULL,
41
+ "first_seq" bigint NOT NULL,
42
+ "last_seq" bigint NOT NULL,
43
+ "first_t" double precision NOT NULL,
44
+ "last_t" double precision NOT NULL,
45
+ "state" text DEFAULT 'uploading' NOT NULL,
46
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
47
+ CONSTRAINT "event_chunks_project_id_run_id_id_pk" PRIMARY KEY("project_id","run_id","id"),
48
+ CONSTRAINT "chunk_state" CHECK ("qa"."event_chunks"."state" IN ('uploading','committed','abandoned','cleaned')),
49
+ CONSTRAINT "chunk_range" CHECK ("qa"."event_chunks"."count" > 0 AND "qa"."event_chunks"."bytes" > 0 AND "qa"."event_chunks"."first_seq" > 0 AND "qa"."event_chunks"."last_seq" >= "qa"."event_chunks"."first_seq" AND "qa"."event_chunks"."last_t" >= "qa"."event_chunks"."first_t")
50
+ );
51
+ --> statement-breakpoint
52
+ CREATE TABLE "qa"."events" (
53
+ "project_id" text NOT NULL,
54
+ "run_id" text NOT NULL,
55
+ "seq" bigint NOT NULL,
56
+ "t" double precision NOT NULL,
57
+ "kind" text NOT NULL,
58
+ "actor" text,
59
+ "step" text,
60
+ "chunk_id" text NOT NULL,
61
+ "offset" integer NOT NULL,
62
+ CONSTRAINT "events_project_id_run_id_seq_pk" PRIMARY KEY("project_id","run_id","seq")
63
+ );
64
+ --> statement-breakpoint
65
+ CREATE TABLE "qa"."jobs" (
66
+ "project_id" text NOT NULL,
67
+ "id" text NOT NULL,
68
+ "run_id" text NOT NULL,
69
+ "state" text DEFAULT 'queued' NOT NULL,
70
+ "available_at" timestamp with time zone DEFAULT now() NOT NULL,
71
+ "attempts" integer DEFAULT 0 NOT NULL,
72
+ CONSTRAINT "jobs_project_id_id_pk" PRIMARY KEY("project_id","id")
73
+ );
74
+ --> statement-breakpoint
75
+ CREATE TABLE "qa"."lanes" (
76
+ "project_id" text NOT NULL,
77
+ "run_id" text NOT NULL,
78
+ "actor" text NOT NULL,
79
+ "status" text NOT NULL,
80
+ "started_at" double precision NOT NULL,
81
+ "finished_at" double precision,
82
+ CONSTRAINT "lanes_project_id_run_id_actor_pk" PRIMARY KEY("project_id","run_id","actor")
83
+ );
84
+ --> statement-breakpoint
85
+ CREATE TABLE "qa"."lease_claims" (
86
+ "project_id" text NOT NULL,
87
+ "identity" text NOT NULL,
88
+ "lease_id" text NOT NULL,
89
+ CONSTRAINT "lease_claims_project_id_identity_pk" PRIMARY KEY("project_id","identity")
90
+ );
91
+ --> statement-breakpoint
92
+ CREATE TABLE "qa"."lease_resources" (
93
+ "project_id" text NOT NULL,
94
+ "id" text NOT NULL,
95
+ "kind" text NOT NULL,
96
+ "canonical_id" text NOT NULL,
97
+ "secret_ref" text NOT NULL,
98
+ CONSTRAINT "lease_resources_project_id_id_pk" PRIMARY KEY("project_id","id")
99
+ );
100
+ --> statement-breakpoint
101
+ CREATE TABLE "qa"."leases" (
102
+ "project_id" text NOT NULL,
103
+ "id" text NOT NULL,
104
+ "run_id" text NOT NULL,
105
+ "actor" text NOT NULL,
106
+ "owner" text NOT NULL,
107
+ "epoch" bigserial NOT NULL,
108
+ "state" text DEFAULT 'active' NOT NULL,
109
+ "expires_at" timestamp with time zone NOT NULL,
110
+ "allocations" jsonb NOT NULL,
111
+ CONSTRAINT "leases_project_id_id_pk" PRIMARY KEY("project_id","id"),
112
+ CONSTRAINT "lease_state" CHECK ("qa"."leases"."state" IN ('active','quarantined','released'))
113
+ );
114
+ --> statement-breakpoint
115
+ CREATE TABLE "qa"."runs" (
116
+ "project_id" text NOT NULL,
117
+ "id" text NOT NULL,
118
+ "batch_id" text,
119
+ "flow" text NOT NULL,
120
+ "started_at" double precision NOT NULL,
121
+ "metadata" jsonb,
122
+ "phase" text DEFAULT 'queued' NOT NULL,
123
+ "verdict" text,
124
+ "finished_at" double precision,
125
+ "reason" text,
126
+ "event_count" integer DEFAULT 0 NOT NULL,
127
+ "last_seq" bigint DEFAULT 0 NOT NULL,
128
+ "last_t" double precision DEFAULT 0 NOT NULL,
129
+ "event_bytes" bigint DEFAULT 0 NOT NULL,
130
+ "writer_lease_id" text,
131
+ CONSTRAINT "runs_project_id_id_pk" PRIMARY KEY("project_id","id"),
132
+ CONSTRAINT "run_cursor_nonnegative" CHECK ("qa"."runs"."last_seq" >= 0 AND "qa"."runs"."last_t" >= 0 AND "qa"."runs"."event_count" >= 0 AND "qa"."runs"."event_bytes" >= 0)
133
+ );
134
+ --> statement-breakpoint
135
+ CREATE TABLE "qa"."step_runs" (
136
+ "project_id" text NOT NULL,
137
+ "run_id" text NOT NULL,
138
+ "actor" text NOT NULL,
139
+ "step" text NOT NULL,
140
+ "seq" bigint NOT NULL,
141
+ "status" text NOT NULL,
142
+ "started_at" double precision NOT NULL,
143
+ "finished_at" double precision,
144
+ CONSTRAINT "step_runs_project_id_run_id_seq_pk" PRIMARY KEY("project_id","run_id","seq")
145
+ );
146
+ --> statement-breakpoint
147
+ ALTER TABLE "qa"."artifacts" ADD CONSTRAINT "artifacts_project_id_run_id_runs_project_id_id_fk" FOREIGN KEY ("project_id","run_id") REFERENCES "qa"."runs"("project_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
148
+ ALTER TABLE "qa"."event_chunks" ADD CONSTRAINT "event_chunks_project_id_run_id_runs_project_id_id_fk" FOREIGN KEY ("project_id","run_id") REFERENCES "qa"."runs"("project_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
149
+ ALTER TABLE "qa"."events" ADD CONSTRAINT "events_project_id_run_id_chunk_id_event_chunks_project_id_run_id_id_fk" FOREIGN KEY ("project_id","run_id","chunk_id") REFERENCES "qa"."event_chunks"("project_id","run_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
150
+ ALTER TABLE "qa"."jobs" ADD CONSTRAINT "jobs_project_id_run_id_runs_project_id_id_fk" FOREIGN KEY ("project_id","run_id") REFERENCES "qa"."runs"("project_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
151
+ ALTER TABLE "qa"."lanes" ADD CONSTRAINT "lanes_project_id_run_id_runs_project_id_id_fk" FOREIGN KEY ("project_id","run_id") REFERENCES "qa"."runs"("project_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
152
+ ALTER TABLE "qa"."lease_claims" ADD CONSTRAINT "lease_claims_project_id_lease_id_leases_project_id_id_fk" FOREIGN KEY ("project_id","lease_id") REFERENCES "qa"."leases"("project_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
153
+ ALTER TABLE "qa"."runs" ADD CONSTRAINT "runs_project_id_batch_id_batches_project_id_id_fk" FOREIGN KEY ("project_id","batch_id") REFERENCES "qa"."batches"("project_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
154
+ ALTER TABLE "qa"."step_runs" ADD CONSTRAINT "step_runs_project_id_run_id_runs_project_id_id_fk" FOREIGN KEY ("project_id","run_id") REFERENCES "qa"."runs"("project_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
155
+ CREATE UNIQUE INDEX "event_object_key" ON "qa"."event_chunks" USING btree ("object_key");--> statement-breakpoint
156
+ CREATE INDEX "jobs_available" ON "qa"."jobs" USING btree ("project_id","state","available_at");--> statement-breakpoint
157
+ CREATE INDEX "resource_kinds" ON "qa"."lease_resources" USING btree ("project_id","kind");--> statement-breakpoint
158
+ CREATE INDEX "runs_recent" ON "qa"."runs" USING btree ("project_id","started_at","id");
@@ -0,0 +1,3 @@
1
+ ALTER TABLE "qa"."runs" ADD COLUMN "heartbeat_at" timestamp with time zone;--> statement-breakpoint
2
+ ALTER TABLE "qa"."runs" ADD COLUMN "cost_usd" double precision DEFAULT 0 NOT NULL;--> statement-breakpoint
3
+ ALTER TABLE "qa"."runs" ADD COLUMN "classification" text;
@@ -0,0 +1,5 @@
1
+ DROP INDEX "qa"."runs_recent";--> statement-breakpoint
2
+ ALTER TABLE "qa"."event_chunks" ADD COLUMN "cleaned_at" timestamp with time zone;--> statement-breakpoint
3
+ -- Give already-cleaned tombstones one bounded late-upload recovery window.
4
+ UPDATE "qa"."event_chunks" SET "cleaned_at" = clock_timestamp() WHERE "state" = 'cleaned';--> statement-breakpoint
5
+ CREATE INDEX "runs_recent" ON "qa"."runs" USING btree ("project_id","started_at" DESC NULLS LAST,"id" COLLATE "C");
@@ -0,0 +1,9 @@
1
+ CREATE TABLE "qa"."cache_entries" (
2
+ "project_id" text NOT NULL,
3
+ "cache_key" text NOT NULL,
4
+ "version" integer NOT NULL,
5
+ "entry" jsonb NOT NULL,
6
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
7
+ CONSTRAINT "cache_entries_project_id_cache_key_version_pk" PRIMARY KEY("project_id","cache_key","version"),
8
+ CONSTRAINT "cache_version_positive" CHECK ("qa"."cache_entries"."version" > 0)
9
+ );
@@ -0,0 +1 @@
1
+ ALTER TABLE "qa"."credentials" ADD COLUMN "expires_at" timestamp with time zone;
@@ -0,0 +1,19 @@
1
+ CREATE TABLE "qa"."read_publications" (
2
+ "project_id" text NOT NULL,
3
+ "kind" text NOT NULL,
4
+ "document" jsonb NOT NULL,
5
+ CONSTRAINT "read_publications_project_id_kind_pk" PRIMARY KEY("project_id","kind")
6
+ );
7
+ --> statement-breakpoint
8
+ CREATE TABLE "qa"."server_submissions" (
9
+ "project_id" text NOT NULL,
10
+ "principal_id" text NOT NULL,
11
+ "idempotency_key" text NOT NULL,
12
+ "fingerprint" text NOT NULL,
13
+ "batch_id" text NOT NULL,
14
+ "response" jsonb NOT NULL,
15
+ CONSTRAINT "server_submissions_project_id_principal_id_idempotency_key_pk" PRIMARY KEY("project_id","principal_id","idempotency_key")
16
+ );
17
+ --> statement-breakpoint
18
+ ALTER TABLE "qa"."server_submissions" ADD CONSTRAINT "server_submissions_project_id_batch_id_batches_project_id_id_fk" FOREIGN KEY ("project_id","batch_id") REFERENCES "qa"."batches"("project_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
19
+ CREATE UNIQUE INDEX "submission_batch" ON "qa"."server_submissions" USING btree ("project_id","batch_id");
@@ -0,0 +1,3 @@
1
+ ALTER TABLE "qa"."server_submissions" ADD COLUMN "created_at" timestamp with time zone DEFAULT now() NOT NULL;--> statement-breakpoint
2
+ UPDATE "qa"."server_submissions" SET "created_at" = ("response"->>'createdAt')::timestamptz;--> statement-breakpoint
3
+ CREATE INDEX "submission_created" ON "qa"."server_submissions" USING btree ("project_id","created_at" DESC NULLS LAST,"batch_id");
@@ -0,0 +1,19 @@
1
+ CREATE TABLE "qa"."findings" (
2
+ "project_id" text NOT NULL,
3
+ "run_id" text NOT NULL,
4
+ "ordinal" integer NOT NULL,
5
+ "actor" text NOT NULL,
6
+ "step" text NOT NULL,
7
+ "category" text NOT NULL,
8
+ "severity" text NOT NULL,
9
+ "description" text NOT NULL,
10
+ "event_seqs" jsonb NOT NULL,
11
+ "shots" jsonb NOT NULL,
12
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
13
+ CONSTRAINT "findings_project_id_run_id_ordinal_pk" PRIMARY KEY("project_id","run_id","ordinal"),
14
+ CONSTRAINT "finding_ordinal_positive" CHECK ("qa"."findings"."ordinal" > 0),
15
+ CONSTRAINT "finding_severity" CHECK ("qa"."findings"."severity" IN ('low','medium','high')),
16
+ CONSTRAINT "finding_category" CHECK ("qa"."findings"."category" IN ('scope','other'))
17
+ );
18
+ --> statement-breakpoint
19
+ ALTER TABLE "qa"."findings" ADD CONSTRAINT "findings_project_id_run_id_runs_project_id_id_fk" FOREIGN KEY ("project_id","run_id") REFERENCES "qa"."runs"("project_id","id") ON DELETE no action ON UPDATE no action;
@@ -0,0 +1,14 @@
1
+ CREATE TABLE "qa"."classification_labels" (
2
+ "project_id" text NOT NULL,
3
+ "run_id" text NOT NULL,
4
+ "ordinal" integer NOT NULL,
5
+ "category" text NOT NULL,
6
+ "reason" text NOT NULL,
7
+ "modified_by" text NOT NULL,
8
+ "modified_at" double precision NOT NULL,
9
+ "predicted" jsonb,
10
+ CONSTRAINT "classification_labels_project_id_run_id_ordinal_pk" PRIMARY KEY("project_id","run_id","ordinal"),
11
+ CONSTRAINT "classification_label_category" CHECK ("qa"."classification_labels"."category" IN ('corvo-bug','test-case','env','flaky','agent'))
12
+ );
13
+ --> statement-breakpoint
14
+ ALTER TABLE "qa"."classification_labels" ADD CONSTRAINT "classification_labels_project_id_run_id_runs_project_id_id_fk" FOREIGN KEY ("project_id","run_id") REFERENCES "qa"."runs"("project_id","id") ON DELETE no action ON UPDATE no action;
@@ -0,0 +1,20 @@
1
+ CREATE TABLE "qa"."worker_slots" (
2
+ "id" integer PRIMARY KEY NOT NULL,
3
+ "project_id" text,
4
+ "job_id" text,
5
+ CONSTRAINT "worker_slot_range" CHECK ("qa"."worker_slots"."id" BETWEEN 1 AND 8),
6
+ CONSTRAINT "worker_slot_pair" CHECK (("qa"."worker_slots"."project_id" IS NULL) = ("qa"."worker_slots"."job_id" IS NULL))
7
+ );
8
+ --> statement-breakpoint
9
+ ALTER TABLE "qa"."jobs" ADD COLUMN "owner" text;--> statement-breakpoint
10
+ ALTER TABLE "qa"."jobs" ADD COLUMN "epoch" bigserial NOT NULL;--> statement-breakpoint
11
+ ALTER TABLE "qa"."jobs" ADD COLUMN "lease_until" timestamp with time zone;--> statement-breakpoint
12
+ ALTER TABLE "qa"."jobs" ADD COLUMN "retry_of" text;--> statement-breakpoint
13
+ ALTER TABLE "qa"."jobs" ADD COLUMN "cleaned_at" timestamp with time zone;--> statement-breakpoint
14
+ ALTER TABLE "qa"."jobs" ADD COLUMN "verified_revision" text;--> statement-breakpoint
15
+ ALTER TABLE "qa"."jobs" ADD COLUMN "infrastructure_failure" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
16
+ CREATE UNIQUE INDEX "worker_slot_job" ON "qa"."worker_slots" USING btree ("project_id","job_id");--> statement-breakpoint
17
+ CREATE UNIQUE INDEX "job_run" ON "qa"."jobs" USING btree ("project_id","run_id");--> statement-breakpoint
18
+ CREATE UNIQUE INDEX "job_retry" ON "qa"."jobs" USING btree ("project_id","retry_of");--> statement-breakpoint
19
+ ALTER TABLE "qa"."jobs" ADD CONSTRAINT "job_attempt" CHECK ("qa"."jobs"."attempts" IN (0,1));--> statement-breakpoint
20
+ INSERT INTO qa.worker_slots(id) SELECT generate_series(1,8);
@@ -0,0 +1,13 @@
1
+ CREATE TABLE "qa"."result_notifications" (
2
+ "project_id" text NOT NULL,
3
+ "batch_id" text NOT NULL,
4
+ "channel" text NOT NULL,
5
+ "context" jsonb NOT NULL,
6
+ "completed_at" timestamp with time zone,
7
+ "available_at" timestamp with time zone DEFAULT now() NOT NULL,
8
+ CONSTRAINT "result_notifications_project_id_batch_id_channel_pk" PRIMARY KEY("project_id","batch_id","channel"),
9
+ CONSTRAINT "result_notification_channel" CHECK ("qa"."result_notifications"."channel" IN ('commit','pr','discord'))
10
+ );
11
+ --> statement-breakpoint
12
+ ALTER TABLE "qa"."result_notifications" ADD CONSTRAINT "result_notifications_project_id_batch_id_batches_project_id_id_fk" FOREIGN KEY ("project_id","batch_id") REFERENCES "qa"."batches"("project_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
13
+ CREATE INDEX "result_notifications_pending" ON "qa"."result_notifications" USING btree ("available_at") WHERE "qa"."result_notifications"."completed_at" IS NULL;
@@ -0,0 +1,5 @@
1
+ DROP INDEX "qa"."result_notifications_pending";--> statement-breakpoint
2
+ ALTER TABLE "qa"."result_notifications" ADD COLUMN "abandoned_at" timestamp with time zone;--> statement-breakpoint
3
+ ALTER TABLE "qa"."result_notifications" ADD COLUMN "attempts" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
4
+ CREATE INDEX "result_notifications_pending" ON "qa"."result_notifications" USING btree ("available_at") WHERE "qa"."result_notifications"."completed_at" IS NULL AND "qa"."result_notifications"."abandoned_at" IS NULL;--> statement-breakpoint
5
+ ALTER TABLE "qa"."result_notifications" ADD CONSTRAINT "result_notification_attempts" CHECK ("qa"."result_notifications"."attempts" BETWEEN 0 AND 5);
@@ -0,0 +1,44 @@
1
+ CREATE TABLE "qa"."result_notification_flows" (
2
+ "project_id" text NOT NULL,
3
+ "batch_id" text NOT NULL,
4
+ "channel" text DEFAULT 'pr' NOT NULL,
5
+ "flow" text NOT NULL,
6
+ "outcome" text,
7
+ "completed_at" timestamp with time zone,
8
+ "abandoned_at" timestamp with time zone,
9
+ "attempts" integer DEFAULT 0 NOT NULL,
10
+ "available_at" timestamp with time zone DEFAULT now() NOT NULL,
11
+ CONSTRAINT "result_notification_flows_project_id_batch_id_flow_pk" PRIMARY KEY("project_id","batch_id","flow"),
12
+ CONSTRAINT "result_notification_flow_channel" CHECK ("qa"."result_notification_flows"."channel" = 'pr'),
13
+ CONSTRAINT "result_notification_flow_attempts" CHECK ("qa"."result_notification_flows"."attempts" BETWEEN 0 AND 5),
14
+ CONSTRAINT "result_notification_flow_outcome" CHECK ("qa"."result_notification_flows"."outcome" IN ('delivered','superseded')),
15
+ CONSTRAINT "result_notification_flow_completion" CHECK (("qa"."result_notification_flows"."outcome" IS NULL) = ("qa"."result_notification_flows"."completed_at" IS NULL))
16
+ );
17
+ --> statement-breakpoint
18
+ ALTER TABLE "qa"."result_notification_flows" ADD CONSTRAINT "result_notification_flows_project_id_batch_id_channel_result_notifications_project_id_batch_id_channel_fk" FOREIGN KEY ("project_id","batch_id","channel") REFERENCES "qa"."result_notifications"("project_id","batch_id","channel") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
19
+ CREATE INDEX "result_notification_flow_delivered" ON "qa"."result_notification_flows" USING btree ("project_id","flow") WHERE "qa"."result_notification_flows"."outcome" = 'delivered';--> statement-breakpoint
20
+ -- Completed legacy receipts cover all their final flows, either by delivery or supersession.
21
+ -- Preserve pending/abandoned budgets; their partial external successes cannot be inferred.
22
+ WITH legacy AS (
23
+ SELECT DISTINCT n.project_id,n.batch_id,n.channel,n.context,r.flow,
24
+ n.completed_at,n.abandoned_at,n.attempts,n.available_at,b.created_at
25
+ FROM qa.result_notifications n
26
+ JOIN qa.batches b ON b.project_id=n.project_id AND b.id=n.batch_id
27
+ JOIN qa.runs r ON r.project_id=n.project_id AND r.batch_id=n.batch_id
28
+ WHERE n.channel='pr' AND n.context->>'source'='new-flow'
29
+ AND NOT EXISTS (SELECT 1 FROM qa.jobs j WHERE j.project_id=r.project_id AND j.retry_of=r.id)
30
+ ), completed AS (
31
+ SELECT project_id,batch_id,flow,
32
+ row_number() OVER (
33
+ PARTITION BY project_id,context->>'repository',context->>'pullRequest',flow
34
+ ORDER BY created_at DESC,batch_id DESC
35
+ ) AS position
36
+ FROM legacy WHERE completed_at IS NOT NULL
37
+ )
38
+ INSERT INTO qa.result_notification_flows
39
+ (project_id,batch_id,channel,flow,outcome,completed_at,abandoned_at,attempts,available_at)
40
+ SELECT l.project_id,l.batch_id,l.channel,l.flow,
41
+ CASE WHEN c.position=1 THEN 'delivered' WHEN c.position>1 THEN 'superseded' ELSE NULL END,
42
+ l.completed_at,l.abandoned_at,l.attempts,l.available_at
43
+ FROM legacy l LEFT JOIN completed c
44
+ ON c.project_id=l.project_id AND c.batch_id=l.batch_id AND c.flow=l.flow;
@@ -0,0 +1,35 @@
1
+ CREATE TABLE "qa"."flow_results" (
2
+ "project_id" text NOT NULL,
3
+ "execution_id" text NOT NULL,
4
+ "flow" text NOT NULL,
5
+ "quarantined" integer NOT NULL,
6
+ CONSTRAINT "flow_results_project_id_execution_id_pk" PRIMARY KEY("project_id","execution_id"),
7
+ CONSTRAINT "flow_result_quarantined" CHECK ("qa"."flow_results"."quarantined" IN (0,1))
8
+ );
9
+ --> statement-breakpoint
10
+ CREATE TABLE "qa"."flow_statuses" (
11
+ "project_id" text NOT NULL,
12
+ "flow" text NOT NULL,
13
+ "status" text DEFAULT 'active' NOT NULL,
14
+ "flaky_streak" integer DEFAULT 0 NOT NULL,
15
+ "generation" integer DEFAULT 0 NOT NULL,
16
+ "owner" text,
17
+ "latest_repeat" jsonb,
18
+ CONSTRAINT "flow_statuses_project_id_flow_pk" PRIMARY KEY("project_id","flow"),
19
+ CONSTRAINT "flow_status" CHECK ("qa"."flow_statuses"."status" IN ('active','quarantined')),
20
+ CONSTRAINT "flow_streak" CHECK ("qa"."flow_statuses"."flaky_streak" >= 0 AND "qa"."flow_statuses"."generation" >= 0)
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE TABLE "qa"."quarantine_notifications" (
24
+ "project_id" text NOT NULL,
25
+ "flow" text NOT NULL,
26
+ "generation" integer NOT NULL,
27
+ "run_id" text NOT NULL,
28
+ "owner" text,
29
+ "completed_at" timestamp with time zone,
30
+ "abandoned_at" timestamp with time zone,
31
+ "attempts" integer DEFAULT 0 NOT NULL,
32
+ "available_at" timestamp with time zone DEFAULT now() NOT NULL,
33
+ CONSTRAINT "quarantine_notifications_project_id_flow_generation_pk" PRIMARY KEY("project_id","flow","generation"),
34
+ CONSTRAINT "quarantine_notification_attempts" CHECK ("qa"."quarantine_notifications"."attempts" BETWEEN 0 AND 5)
35
+ );
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "qa"."runs" ADD COLUMN "usage" jsonb;--> statement-breakpoint
2
+ ALTER TABLE "qa"."runs" ADD COLUMN "error_reason" text;
@@ -0,0 +1,9 @@
1
+ ALTER TABLE "qa"."flow_statuses" DROP CONSTRAINT "flow_status";--> statement-breakpoint
2
+ ALTER TABLE "qa"."flow_statuses" ALTER COLUMN "status" SET DEFAULT 'draft';--> statement-breakpoint
3
+ ALTER TABLE "qa"."flow_statuses" ADD COLUMN "first_run_id" text;--> statement-breakpoint
4
+ ALTER TABLE "qa"."flow_statuses" ADD COLUMN "first_run_revision" text;--> statement-breakpoint
5
+ ALTER TABLE "qa"."flow_statuses" ADD COLUMN "first_run_at" timestamp with time zone;--> statement-breakpoint
6
+ ALTER TABLE "qa"."flow_statuses" ADD COLUMN "accepted_at" timestamp with time zone;--> statement-breakpoint
7
+ ALTER TABLE "qa"."flow_statuses" ADD COLUMN "accepted_by" text;--> statement-breakpoint
8
+ ALTER TABLE "qa"."flow_statuses" ADD COLUMN "retired_at" timestamp with time zone;--> statement-breakpoint
9
+ ALTER TABLE "qa"."flow_statuses" ADD CONSTRAINT "flow_status" CHECK ("qa"."flow_statuses"."status" IN ('draft','review','active','quarantined','retired'));