@gpustack/loopwright 0.0.0-stage → 0.0.3

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 (477) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +356 -2
  3. package/bin/loopwright.js +3 -0
  4. package/node_modules/@loopwright/agent-pi/dist/adapter-v2.d.ts +9 -0
  5. package/node_modules/@loopwright/agent-pi/dist/adapter-v2.js +122 -0
  6. package/node_modules/@loopwright/agent-pi/dist/adapter.d.ts +30 -0
  7. package/node_modules/@loopwright/agent-pi/dist/adapter.js +340 -0
  8. package/node_modules/@loopwright/agent-pi/dist/admission.d.ts +25 -0
  9. package/node_modules/@loopwright/agent-pi/dist/admission.js +65 -0
  10. package/node_modules/@loopwright/agent-pi/dist/artifacts.d.ts +15 -0
  11. package/node_modules/@loopwright/agent-pi/dist/artifacts.js +76 -0
  12. package/node_modules/@loopwright/agent-pi/dist/boundary.d.ts +18 -0
  13. package/node_modules/@loopwright/agent-pi/dist/boundary.js +113 -0
  14. package/node_modules/@loopwright/agent-pi/dist/broker-channel.d.ts +4 -0
  15. package/node_modules/@loopwright/agent-pi/dist/broker-channel.js +121 -0
  16. package/node_modules/@loopwright/agent-pi/dist/candidate.d.ts +96 -0
  17. package/node_modules/@loopwright/agent-pi/dist/candidate.js +1712 -0
  18. package/node_modules/@loopwright/agent-pi/dist/capture.d.ts +39 -0
  19. package/node_modules/@loopwright/agent-pi/dist/capture.js +146 -0
  20. package/node_modules/@loopwright/agent-pi/dist/cas.d.ts +51 -0
  21. package/node_modules/@loopwright/agent-pi/dist/cas.js +836 -0
  22. package/node_modules/@loopwright/agent-pi/dist/catalog-api.d.ts +3 -0
  23. package/node_modules/@loopwright/agent-pi/dist/catalog-api.js +2 -0
  24. package/node_modules/@loopwright/agent-pi/dist/catalog.d.ts +39 -0
  25. package/node_modules/@loopwright/agent-pi/dist/catalog.js +280 -0
  26. package/node_modules/@loopwright/agent-pi/dist/circuit-breaker-limits.d.ts +9 -0
  27. package/node_modules/@loopwright/agent-pi/dist/circuit-breaker-limits.js +12 -0
  28. package/node_modules/@loopwright/agent-pi/dist/containers.d.ts +29 -0
  29. package/node_modules/@loopwright/agent-pi/dist/containers.js +160 -0
  30. package/node_modules/@loopwright/agent-pi/dist/context.d.ts +56 -0
  31. package/node_modules/@loopwright/agent-pi/dist/context.js +351 -0
  32. package/node_modules/@loopwright/agent-pi/dist/daemon.d.ts +8 -0
  33. package/node_modules/@loopwright/agent-pi/dist/daemon.js +52 -0
  34. package/node_modules/@loopwright/agent-pi/dist/deadline.d.ts +6 -0
  35. package/node_modules/@loopwright/agent-pi/dist/deadline.js +18 -0
  36. package/node_modules/@loopwright/agent-pi/dist/decode-capture.d.ts +39 -0
  37. package/node_modules/@loopwright/agent-pi/dist/decode-capture.js +287 -0
  38. package/node_modules/@loopwright/agent-pi/dist/descriptor.d.ts +12 -0
  39. package/node_modules/@loopwright/agent-pi/dist/descriptor.js +17 -0
  40. package/node_modules/@loopwright/agent-pi/dist/docker-absence.d.ts +2 -0
  41. package/node_modules/@loopwright/agent-pi/dist/docker-absence.js +9 -0
  42. package/node_modules/@loopwright/agent-pi/dist/errors.d.ts +7 -0
  43. package/node_modules/@loopwright/agent-pi/dist/errors.js +19 -0
  44. package/node_modules/@loopwright/agent-pi/dist/event-sequence.d.ts +6 -0
  45. package/node_modules/@loopwright/agent-pi/dist/event-sequence.js +64 -0
  46. package/node_modules/@loopwright/agent-pi/dist/events.d.ts +19 -0
  47. package/node_modules/@loopwright/agent-pi/dist/events.js +132 -0
  48. package/node_modules/@loopwright/agent-pi/dist/execution-guard.d.ts +9 -0
  49. package/node_modules/@loopwright/agent-pi/dist/execution-guard.js +25 -0
  50. package/node_modules/@loopwright/agent-pi/dist/execution-lease.d.ts +24 -0
  51. package/node_modules/@loopwright/agent-pi/dist/execution-lease.js +316 -0
  52. package/node_modules/@loopwright/agent-pi/dist/execution.d.ts +32 -0
  53. package/node_modules/@loopwright/agent-pi/dist/execution.js +476 -0
  54. package/node_modules/@loopwright/agent-pi/dist/external-mcp.d.ts +87 -0
  55. package/node_modules/@loopwright/agent-pi/dist/external-mcp.js +526 -0
  56. package/node_modules/@loopwright/agent-pi/dist/factory-bootstrap.d.ts +15 -0
  57. package/node_modules/@loopwright/agent-pi/dist/factory-bootstrap.js +74 -0
  58. package/node_modules/@loopwright/agent-pi/dist/host-session.d.ts +51 -0
  59. package/node_modules/@loopwright/agent-pi/dist/host-session.js +2094 -0
  60. package/node_modules/@loopwright/agent-pi/dist/http-mcp.d.ts +32 -0
  61. package/node_modules/@loopwright/agent-pi/dist/http-mcp.js +353 -0
  62. package/node_modules/@loopwright/agent-pi/dist/index.d.ts +7 -0
  63. package/node_modules/@loopwright/agent-pi/dist/index.js +4 -0
  64. package/node_modules/@loopwright/agent-pi/dist/lifecycle.d.ts +13 -0
  65. package/node_modules/@loopwright/agent-pi/dist/lifecycle.js +11 -0
  66. package/node_modules/@loopwright/agent-pi/dist/mcp-process.d.ts +35 -0
  67. package/node_modules/@loopwright/agent-pi/dist/mcp-process.js +92 -0
  68. package/node_modules/@loopwright/agent-pi/dist/mcp-transport.d.ts +25 -0
  69. package/node_modules/@loopwright/agent-pi/dist/mcp-transport.js +63 -0
  70. package/node_modules/@loopwright/agent-pi/dist/mcp.d.ts +23 -0
  71. package/node_modules/@loopwright/agent-pi/dist/mcp.js +212 -0
  72. package/node_modules/@loopwright/agent-pi/dist/operation.d.ts +5 -0
  73. package/node_modules/@loopwright/agent-pi/dist/operation.js +28 -0
  74. package/node_modules/@loopwright/agent-pi/dist/policy-v2.d.ts +10 -0
  75. package/node_modules/@loopwright/agent-pi/dist/policy-v2.js +64 -0
  76. package/node_modules/@loopwright/agent-pi/dist/policy.d.ts +13 -0
  77. package/node_modules/@loopwright/agent-pi/dist/policy.js +260 -0
  78. package/node_modules/@loopwright/agent-pi/dist/preflight.d.ts +60 -0
  79. package/node_modules/@loopwright/agent-pi/dist/preflight.js +700 -0
  80. package/node_modules/@loopwright/agent-pi/dist/progress-summary.d.ts +1 -0
  81. package/node_modules/@loopwright/agent-pi/dist/progress-summary.js +119 -0
  82. package/node_modules/@loopwright/agent-pi/dist/protocol.d.ts +17 -0
  83. package/node_modules/@loopwright/agent-pi/dist/protocol.js +131 -0
  84. package/node_modules/@loopwright/agent-pi/dist/provider.d.ts +62 -0
  85. package/node_modules/@loopwright/agent-pi/dist/provider.js +217 -0
  86. package/node_modules/@loopwright/agent-pi/dist/receipt.d.ts +3 -0
  87. package/node_modules/@loopwright/agent-pi/dist/receipt.js +64 -0
  88. package/node_modules/@loopwright/agent-pi/dist/recovery.d.ts +6 -0
  89. package/node_modules/@loopwright/agent-pi/dist/recovery.js +188 -0
  90. package/node_modules/@loopwright/agent-pi/dist/resources.d.ts +13 -0
  91. package/node_modules/@loopwright/agent-pi/dist/resources.js +81 -0
  92. package/node_modules/@loopwright/agent-pi/dist/response.d.ts +20 -0
  93. package/node_modules/@loopwright/agent-pi/dist/response.js +259 -0
  94. package/node_modules/@loopwright/agent-pi/dist/runtime-profile.d.ts +6 -0
  95. package/node_modules/@loopwright/agent-pi/dist/runtime-profile.js +37 -0
  96. package/node_modules/@loopwright/agent-pi/dist/sdk-worker.d.ts +14 -0
  97. package/node_modules/@loopwright/agent-pi/dist/sdk-worker.js +633 -0
  98. package/node_modules/@loopwright/agent-pi/dist/sender.d.ts +46 -0
  99. package/node_modules/@loopwright/agent-pi/dist/sender.js +553 -0
  100. package/node_modules/@loopwright/agent-pi/dist/session-host.d.ts +21 -0
  101. package/node_modules/@loopwright/agent-pi/dist/session-host.js +315 -0
  102. package/node_modules/@loopwright/agent-pi/dist/snapshot-transfer.d.ts +14 -0
  103. package/node_modules/@loopwright/agent-pi/dist/snapshot-transfer.js +102 -0
  104. package/node_modules/@loopwright/agent-pi/dist/snapshot.d.ts +19 -0
  105. package/node_modules/@loopwright/agent-pi/dist/snapshot.js +121 -0
  106. package/node_modules/@loopwright/agent-pi/dist/tool-process.d.ts +32 -0
  107. package/node_modules/@loopwright/agent-pi/dist/tool-process.js +85 -0
  108. package/node_modules/@loopwright/agent-pi/dist/tool-worker.d.ts +2 -0
  109. package/node_modules/@loopwright/agent-pi/dist/tool-worker.js +105 -0
  110. package/node_modules/@loopwright/agent-pi/dist/tools.d.ts +36 -0
  111. package/node_modules/@loopwright/agent-pi/dist/tools.js +128 -0
  112. package/node_modules/@loopwright/agent-pi/dist/types-v2.d.ts +71 -0
  113. package/node_modules/@loopwright/agent-pi/dist/types-v2.js +1 -0
  114. package/node_modules/@loopwright/agent-pi/dist/types.d.ts +314 -0
  115. package/node_modules/@loopwright/agent-pi/dist/types.js +1 -0
  116. package/node_modules/@loopwright/agent-pi/dist/usage.d.ts +18 -0
  117. package/node_modules/@loopwright/agent-pi/dist/usage.js +314 -0
  118. package/node_modules/@loopwright/agent-pi/dist/workspace-mcp.d.ts +27 -0
  119. package/node_modules/@loopwright/agent-pi/dist/workspace-mcp.js +142 -0
  120. package/node_modules/@loopwright/agent-pi/package.json +24 -0
  121. package/node_modules/@loopwright/agent-pi/runtime/Dockerfile +8 -0
  122. package/node_modules/@loopwright/agent-pi/runtime/seccomp.json +1 -0
  123. package/node_modules/@loopwright/cli/dist/arguments.d.ts +19 -0
  124. package/node_modules/@loopwright/cli/dist/arguments.js +358 -0
  125. package/node_modules/@loopwright/cli/dist/closure.d.ts +93 -0
  126. package/node_modules/@loopwright/cli/dist/closure.js +230 -0
  127. package/node_modules/@loopwright/cli/dist/draft.d.ts +9 -0
  128. package/node_modules/@loopwright/cli/dist/draft.js +106 -0
  129. package/node_modules/@loopwright/cli/dist/failure-matrix.d.ts +9 -0
  130. package/node_modules/@loopwright/cli/dist/failure-matrix.js +701 -0
  131. package/node_modules/@loopwright/cli/dist/index.d.ts +6 -0
  132. package/node_modules/@loopwright/cli/dist/index.js +5 -0
  133. package/node_modules/@loopwright/cli/dist/main.d.ts +22 -0
  134. package/node_modules/@loopwright/cli/dist/main.js +1855 -0
  135. package/node_modules/@loopwright/cli/package.json +16 -0
  136. package/node_modules/@loopwright/controller/dist/acceptance.d.ts +43 -0
  137. package/node_modules/@loopwright/controller/dist/acceptance.js +446 -0
  138. package/node_modules/@loopwright/controller/dist/benchmark-gate.d.ts +273 -0
  139. package/node_modules/@loopwright/controller/dist/benchmark-gate.js +3147 -0
  140. package/node_modules/@loopwright/controller/dist/budget-observations.d.ts +25 -0
  141. package/node_modules/@loopwright/controller/dist/budget-observations.js +139 -0
  142. package/node_modules/@loopwright/controller/dist/bundle.d.ts +26 -0
  143. package/node_modules/@loopwright/controller/dist/bundle.js +64 -0
  144. package/node_modules/@loopwright/controller/dist/capture.d.ts +89 -0
  145. package/node_modules/@loopwright/controller/dist/capture.js +587 -0
  146. package/node_modules/@loopwright/controller/dist/compile.d.ts +3 -0
  147. package/node_modules/@loopwright/controller/dist/compile.js +402 -0
  148. package/node_modules/@loopwright/controller/dist/config.d.ts +22 -0
  149. package/node_modules/@loopwright/controller/dist/config.js +255 -0
  150. package/node_modules/@loopwright/controller/dist/controller.d.ts +177 -0
  151. package/node_modules/@loopwright/controller/dist/controller.js +2135 -0
  152. package/node_modules/@loopwright/controller/dist/credentials.d.ts +29 -0
  153. package/node_modules/@loopwright/controller/dist/credentials.js +189 -0
  154. package/node_modules/@loopwright/controller/dist/deadlines.d.ts +18 -0
  155. package/node_modules/@loopwright/controller/dist/deadlines.js +71 -0
  156. package/node_modules/@loopwright/controller/dist/errors.d.ts +27 -0
  157. package/node_modules/@loopwright/controller/dist/errors.js +41 -0
  158. package/node_modules/@loopwright/controller/dist/events.d.ts +52 -0
  159. package/node_modules/@loopwright/controller/dist/events.js +228 -0
  160. package/node_modules/@loopwright/controller/dist/files.d.ts +51 -0
  161. package/node_modules/@loopwright/controller/dist/files.js +386 -0
  162. package/node_modules/@loopwright/controller/dist/finalize.d.ts +25 -0
  163. package/node_modules/@loopwright/controller/dist/finalize.js +32 -0
  164. package/node_modules/@loopwright/controller/dist/gate.d.ts +84 -0
  165. package/node_modules/@loopwright/controller/dist/gate.js +640 -0
  166. package/node_modules/@loopwright/controller/dist/git-objects.d.ts +11 -0
  167. package/node_modules/@loopwright/controller/dist/git-objects.js +59 -0
  168. package/node_modules/@loopwright/controller/dist/git-reader.d.ts +17 -0
  169. package/node_modules/@loopwright/controller/dist/git-reader.js +40 -0
  170. package/node_modules/@loopwright/controller/dist/handlers.d.ts +6 -0
  171. package/node_modules/@loopwright/controller/dist/handlers.js +45 -0
  172. package/node_modules/@loopwright/controller/dist/handoff.d.ts +71 -0
  173. package/node_modules/@loopwright/controller/dist/handoff.js +554 -0
  174. package/node_modules/@loopwright/controller/dist/index.d.ts +41 -0
  175. package/node_modules/@loopwright/controller/dist/index.js +21 -0
  176. package/node_modules/@loopwright/controller/dist/inspect.d.ts +30 -0
  177. package/node_modules/@loopwright/controller/dist/inspect.js +372 -0
  178. package/node_modules/@loopwright/controller/dist/interpolation.d.ts +9 -0
  179. package/node_modules/@loopwright/controller/dist/interpolation.js +79 -0
  180. package/node_modules/@loopwright/controller/dist/ownership.d.ts +41 -0
  181. package/node_modules/@loopwright/controller/dist/ownership.js +666 -0
  182. package/node_modules/@loopwright/controller/dist/parser.d.ts +5 -0
  183. package/node_modules/@loopwright/controller/dist/parser.js +200 -0
  184. package/node_modules/@loopwright/controller/dist/progress.d.ts +41 -0
  185. package/node_modules/@loopwright/controller/dist/progress.js +904 -0
  186. package/node_modules/@loopwright/controller/dist/publication.d.ts +60 -0
  187. package/node_modules/@loopwright/controller/dist/publication.js +329 -0
  188. package/node_modules/@loopwright/controller/dist/reconcile.d.ts +26 -0
  189. package/node_modules/@loopwright/controller/dist/reconcile.js +1378 -0
  190. package/node_modules/@loopwright/controller/dist/recovery.d.ts +10 -0
  191. package/node_modules/@loopwright/controller/dist/recovery.js +315 -0
  192. package/node_modules/@loopwright/controller/dist/refusal-record.d.ts +43 -0
  193. package/node_modules/@loopwright/controller/dist/refusal-record.js +150 -0
  194. package/node_modules/@loopwright/controller/dist/registry.d.ts +6 -0
  195. package/node_modules/@loopwright/controller/dist/registry.js +374 -0
  196. package/node_modules/@loopwright/controller/dist/repair.d.ts +31 -0
  197. package/node_modules/@loopwright/controller/dist/repair.js +102 -0
  198. package/node_modules/@loopwright/controller/dist/report.d.ts +64 -0
  199. package/node_modules/@loopwright/controller/dist/report.js +596 -0
  200. package/node_modules/@loopwright/controller/dist/retained.d.ts +284 -0
  201. package/node_modules/@loopwright/controller/dist/retained.js +193 -0
  202. package/node_modules/@loopwright/controller/dist/rules.d.ts +31 -0
  203. package/node_modules/@loopwright/controller/dist/rules.js +110 -0
  204. package/node_modules/@loopwright/controller/dist/run-eval.d.ts +115 -0
  205. package/node_modules/@loopwright/controller/dist/run-eval.js +959 -0
  206. package/node_modules/@loopwright/controller/dist/scheduler.d.ts +10 -0
  207. package/node_modules/@loopwright/controller/dist/scheduler.js +41 -0
  208. package/node_modules/@loopwright/controller/dist/schema.d.ts +17 -0
  209. package/node_modules/@loopwright/controller/dist/schema.js +78 -0
  210. package/node_modules/@loopwright/controller/dist/source.d.ts +69 -0
  211. package/node_modules/@loopwright/controller/dist/source.js +872 -0
  212. package/node_modules/@loopwright/controller/dist/step.d.ts +38 -0
  213. package/node_modules/@loopwright/controller/dist/step.js +1776 -0
  214. package/node_modules/@loopwright/controller/dist/storage.d.ts +90 -0
  215. package/node_modules/@loopwright/controller/dist/storage.js +1345 -0
  216. package/node_modules/@loopwright/controller/dist/submission.d.ts +51 -0
  217. package/node_modules/@loopwright/controller/dist/submission.js +292 -0
  218. package/node_modules/@loopwright/controller/dist/types.d.ts +585 -0
  219. package/node_modules/@loopwright/controller/dist/types.js +9 -0
  220. package/node_modules/@loopwright/controller/dist/verification.d.ts +124 -0
  221. package/node_modules/@loopwright/controller/dist/verification.js +1308 -0
  222. package/node_modules/@loopwright/controller/dist/verifier-protocol.d.ts +105 -0
  223. package/node_modules/@loopwright/controller/dist/verifier-protocol.js +1312 -0
  224. package/node_modules/@loopwright/controller/dist/verifier-worker.d.ts +1 -0
  225. package/node_modules/@loopwright/controller/dist/verifier-worker.js +33 -0
  226. package/node_modules/@loopwright/controller/package.json +12 -0
  227. package/node_modules/@loopwright/core/dist/acceptance.d.ts +108 -0
  228. package/node_modules/@loopwright/core/dist/acceptance.js +327 -0
  229. package/node_modules/@loopwright/core/dist/artifacts.d.ts +63 -0
  230. package/node_modules/@loopwright/core/dist/artifacts.js +356 -0
  231. package/node_modules/@loopwright/core/dist/boundary.d.ts +21 -0
  232. package/node_modules/@loopwright/core/dist/boundary.js +484 -0
  233. package/node_modules/@loopwright/core/dist/contracts.d.ts +287 -0
  234. package/node_modules/@loopwright/core/dist/contracts.js +694 -0
  235. package/node_modules/@loopwright/core/dist/diagnostics.d.ts +21 -0
  236. package/node_modules/@loopwright/core/dist/diagnostics.js +51 -0
  237. package/node_modules/@loopwright/core/dist/evidence.d.ts +92 -0
  238. package/node_modules/@loopwright/core/dist/evidence.js +85 -0
  239. package/node_modules/@loopwright/core/dist/graph.d.ts +8 -0
  240. package/node_modules/@loopwright/core/dist/graph.js +44 -0
  241. package/node_modules/@loopwright/core/dist/identity.d.ts +162 -0
  242. package/node_modules/@loopwright/core/dist/identity.js +80 -0
  243. package/node_modules/@loopwright/core/dist/index.d.ts +30 -0
  244. package/node_modules/@loopwright/core/dist/index.js +39 -0
  245. package/node_modules/@loopwright/core/dist/limits.d.ts +99 -0
  246. package/node_modules/@loopwright/core/dist/limits.js +59 -0
  247. package/node_modules/@loopwright/core/dist/results.d.ts +161 -0
  248. package/node_modules/@loopwright/core/dist/results.js +98 -0
  249. package/node_modules/@loopwright/core/dist/scope.d.ts +13 -0
  250. package/node_modules/@loopwright/core/dist/scope.js +154 -0
  251. package/node_modules/@loopwright/core/dist/scrubber.d.ts +13 -0
  252. package/node_modules/@loopwright/core/dist/scrubber.js +63 -0
  253. package/node_modules/@loopwright/core/dist/usage.d.ts +68 -0
  254. package/node_modules/@loopwright/core/dist/usage.js +56 -0
  255. package/node_modules/@loopwright/core/package.json +12 -0
  256. package/node_modules/@loopwright/decisions/dist/benchmark.d.ts +23 -0
  257. package/node_modules/@loopwright/decisions/dist/benchmark.js +337 -0
  258. package/node_modules/@loopwright/decisions/dist/client.d.ts +74 -0
  259. package/node_modules/@loopwright/decisions/dist/client.js +292 -0
  260. package/node_modules/@loopwright/decisions/dist/index.d.ts +15 -0
  261. package/node_modules/@loopwright/decisions/dist/index.js +8 -0
  262. package/node_modules/@loopwright/decisions/dist/nodes.d.ts +63 -0
  263. package/node_modules/@loopwright/decisions/dist/nodes.js +282 -0
  264. package/node_modules/@loopwright/decisions/dist/primitives.d.ts +36 -0
  265. package/node_modules/@loopwright/decisions/dist/primitives.js +300 -0
  266. package/node_modules/@loopwright/decisions/dist/redaction.d.ts +23 -0
  267. package/node_modules/@loopwright/decisions/dist/redaction.js +146 -0
  268. package/node_modules/@loopwright/decisions/dist/router.d.ts +55 -0
  269. package/node_modules/@loopwright/decisions/dist/router.js +248 -0
  270. package/node_modules/@loopwright/decisions/dist/schema.d.ts +25 -0
  271. package/node_modules/@loopwright/decisions/dist/schema.js +536 -0
  272. package/node_modules/@loopwright/decisions/dist/types.d.ts +394 -0
  273. package/node_modules/@loopwright/decisions/dist/types.js +80 -0
  274. package/node_modules/@loopwright/decisions/package.json +12 -0
  275. package/node_modules/@loopwright/github-app/dist/action.d.ts +90 -0
  276. package/node_modules/@loopwright/github-app/dist/action.js +2429 -0
  277. package/node_modules/@loopwright/github-app/dist/config.d.ts +23 -0
  278. package/node_modules/@loopwright/github-app/dist/config.js +297 -0
  279. package/node_modules/@loopwright/github-app/dist/digests.d.ts +1 -0
  280. package/node_modules/@loopwright/github-app/dist/digests.js +1 -0
  281. package/node_modules/@loopwright/github-app/dist/index.d.ts +14 -0
  282. package/node_modules/@loopwright/github-app/dist/index.js +13 -0
  283. package/node_modules/@loopwright/github-app/dist/models-config.d.ts +1 -0
  284. package/node_modules/@loopwright/github-app/dist/models-config.js +1 -0
  285. package/node_modules/@loopwright/github-app/dist/output-format.d.ts +1 -0
  286. package/node_modules/@loopwright/github-app/dist/output-format.js +1 -0
  287. package/node_modules/@loopwright/github-app/dist/preflight.d.ts +1 -0
  288. package/node_modules/@loopwright/github-app/dist/preflight.js +1 -0
  289. package/node_modules/@loopwright/github-app/dist/publisher.d.ts +58 -0
  290. package/node_modules/@loopwright/github-app/dist/publisher.js +1368 -0
  291. package/node_modules/@loopwright/github-app/dist/qualification.d.ts +1 -0
  292. package/node_modules/@loopwright/github-app/dist/qualification.js +1 -0
  293. package/node_modules/@loopwright/github-app/dist/sandbox.d.ts +1 -0
  294. package/node_modules/@loopwright/github-app/dist/sandbox.js +1 -0
  295. package/node_modules/@loopwright/github-app/dist/schema.d.ts +1 -0
  296. package/node_modules/@loopwright/github-app/dist/schema.js +1 -0
  297. package/node_modules/@loopwright/github-app/dist/service.d.ts +52 -0
  298. package/node_modules/@loopwright/github-app/dist/service.js +1658 -0
  299. package/node_modules/@loopwright/github-app/dist/suite-pr-lookup.d.ts +90 -0
  300. package/node_modules/@loopwright/github-app/dist/suite-pr-lookup.js +392 -0
  301. package/node_modules/@loopwright/github-app/dist/taskpack.d.ts +1 -0
  302. package/node_modules/@loopwright/github-app/dist/taskpack.js +1 -0
  303. package/node_modules/@loopwright/github-app/dist/tenant-queue.d.ts +44 -0
  304. package/node_modules/@loopwright/github-app/dist/tenant-queue.js +423 -0
  305. package/node_modules/@loopwright/github-app/dist/token-broker.d.ts +50 -0
  306. package/node_modules/@loopwright/github-app/dist/token-broker.js +262 -0
  307. package/node_modules/@loopwright/github-app/dist/turnkey-memory.d.ts +35 -0
  308. package/node_modules/@loopwright/github-app/dist/turnkey-memory.js +1654 -0
  309. package/node_modules/@loopwright/github-app/dist/turnkey.d.ts +16 -0
  310. package/node_modules/@loopwright/github-app/dist/turnkey.js +34 -0
  311. package/node_modules/@loopwright/github-app/dist/types.d.ts +220 -0
  312. package/node_modules/@loopwright/github-app/dist/types.js +14 -0
  313. package/node_modules/@loopwright/github-app/dist/upstreams.d.ts +13 -0
  314. package/node_modules/@loopwright/github-app/dist/upstreams.js +65 -0
  315. package/node_modules/@loopwright/github-app/dist/webhook.d.ts +34 -0
  316. package/node_modules/@loopwright/github-app/dist/webhook.js +241 -0
  317. package/node_modules/@loopwright/github-app/dist/yaml.d.ts +1 -0
  318. package/node_modules/@loopwright/github-app/dist/yaml.js +1 -0
  319. package/node_modules/@loopwright/github-app/package.json +12 -0
  320. package/node_modules/@loopwright/hardware-runner/dist/config.d.ts +48 -0
  321. package/node_modules/@loopwright/hardware-runner/dist/config.js +719 -0
  322. package/node_modules/@loopwright/hardware-runner/dist/evaluator.d.ts +230 -0
  323. package/node_modules/@loopwright/hardware-runner/dist/evaluator.js +3178 -0
  324. package/node_modules/@loopwright/hardware-runner/dist/index.d.ts +13 -0
  325. package/node_modules/@loopwright/hardware-runner/dist/index.js +9 -0
  326. package/node_modules/@loopwright/hardware-runner/dist/provenance.d.ts +128 -0
  327. package/node_modules/@loopwright/hardware-runner/dist/provenance.js +1500 -0
  328. package/node_modules/@loopwright/hardware-runner/dist/queue.d.ts +81 -0
  329. package/node_modules/@loopwright/hardware-runner/dist/queue.js +1081 -0
  330. package/node_modules/@loopwright/hardware-runner/dist/relay-server.d.ts +13 -0
  331. package/node_modules/@loopwright/hardware-runner/dist/relay-server.js +2997 -0
  332. package/node_modules/@loopwright/hardware-runner/dist/types.d.ts +239 -0
  333. package/node_modules/@loopwright/hardware-runner/dist/types.js +12 -0
  334. package/node_modules/@loopwright/hardware-runner/dist/worker.d.ts +49 -0
  335. package/node_modules/@loopwright/hardware-runner/dist/worker.js +1648 -0
  336. package/node_modules/@loopwright/hardware-runner/package.json +12 -0
  337. package/node_modules/@loopwright/memory/dist/cas.d.ts +21 -0
  338. package/node_modules/@loopwright/memory/dist/cas.js +510 -0
  339. package/node_modules/@loopwright/memory/dist/compaction.d.ts +18 -0
  340. package/node_modules/@loopwright/memory/dist/compaction.js +110 -0
  341. package/node_modules/@loopwright/memory/dist/finalizer.d.ts +23 -0
  342. package/node_modules/@loopwright/memory/dist/finalizer.js +538 -0
  343. package/node_modules/@loopwright/memory/dist/index.d.ts +9 -0
  344. package/node_modules/@loopwright/memory/dist/index.js +8 -0
  345. package/node_modules/@loopwright/memory/dist/schema.d.ts +36 -0
  346. package/node_modules/@loopwright/memory/dist/schema.js +510 -0
  347. package/node_modules/@loopwright/memory/dist/selector.d.ts +7 -0
  348. package/node_modules/@loopwright/memory/dist/selector.js +157 -0
  349. package/node_modules/@loopwright/memory/dist/store.d.ts +51 -0
  350. package/node_modules/@loopwright/memory/dist/store.js +554 -0
  351. package/node_modules/@loopwright/memory/dist/types.d.ts +442 -0
  352. package/node_modules/@loopwright/memory/dist/types.js +8 -0
  353. package/node_modules/@loopwright/memory/dist/verifier.d.ts +5 -0
  354. package/node_modules/@loopwright/memory/dist/verifier.js +328 -0
  355. package/node_modules/@loopwright/memory/package.json +12 -0
  356. package/node_modules/@loopwright/state/dist/admission.d.ts +321 -0
  357. package/node_modules/@loopwright/state/dist/admission.js +199 -0
  358. package/node_modules/@loopwright/state/dist/boundary.d.ts +53 -0
  359. package/node_modules/@loopwright/state/dist/boundary.js +194 -0
  360. package/node_modules/@loopwright/state/dist/checkpoint.d.ts +16 -0
  361. package/node_modules/@loopwright/state/dist/checkpoint.js +84 -0
  362. package/node_modules/@loopwright/state/dist/clock.d.ts +8 -0
  363. package/node_modules/@loopwright/state/dist/clock.js +27 -0
  364. package/node_modules/@loopwright/state/dist/connection.d.ts +55 -0
  365. package/node_modules/@loopwright/state/dist/connection.js +391 -0
  366. package/node_modules/@loopwright/state/dist/errors.d.ts +13 -0
  367. package/node_modules/@loopwright/state/dist/errors.js +34 -0
  368. package/node_modules/@loopwright/state/dist/index.d.ts +3 -0
  369. package/node_modules/@loopwright/state/dist/index.js +1 -0
  370. package/node_modules/@loopwright/state/dist/journal.d.ts +119 -0
  371. package/node_modules/@loopwright/state/dist/journal.js +72 -0
  372. package/node_modules/@loopwright/state/dist/model.d.ts +40 -0
  373. package/node_modules/@loopwright/state/dist/model.js +58 -0
  374. package/node_modules/@loopwright/state/dist/ownership.d.ts +14 -0
  375. package/node_modules/@loopwright/state/dist/ownership.js +45 -0
  376. package/node_modules/@loopwright/state/dist/pages.d.ts +11 -0
  377. package/node_modules/@loopwright/state/dist/pages.js +41 -0
  378. package/node_modules/@loopwright/state/dist/receipts.d.ts +33 -0
  379. package/node_modules/@loopwright/state/dist/receipts.js +97 -0
  380. package/node_modules/@loopwright/state/dist/schema.d.ts +28 -0
  381. package/node_modules/@loopwright/state/dist/schema.js +41 -0
  382. package/node_modules/@loopwright/state/dist/settlement.d.ts +10 -0
  383. package/node_modules/@loopwright/state/dist/settlement.js +129 -0
  384. package/node_modules/@loopwright/state/dist/store.d.ts +52 -0
  385. package/node_modules/@loopwright/state/dist/store.js +100 -0
  386. package/node_modules/@loopwright/state/dist/types.d.ts +315 -0
  387. package/node_modules/@loopwright/state/dist/types.js +1 -0
  388. package/node_modules/@loopwright/state/package.json +12 -0
  389. package/node_modules/@loopwright/taskpack/dist/baseline-align.d.ts +195 -0
  390. package/node_modules/@loopwright/taskpack/dist/baseline-align.js +1847 -0
  391. package/node_modules/@loopwright/taskpack/dist/digests.d.ts +61 -0
  392. package/node_modules/@loopwright/taskpack/dist/digests.js +715 -0
  393. package/node_modules/@loopwright/taskpack/dist/index.d.ts +18 -0
  394. package/node_modules/@loopwright/taskpack/dist/index.js +17 -0
  395. package/node_modules/@loopwright/taskpack/dist/models-config.d.ts +112 -0
  396. package/node_modules/@loopwright/taskpack/dist/models-config.js +1026 -0
  397. package/node_modules/@loopwright/taskpack/dist/output-format.d.ts +28 -0
  398. package/node_modules/@loopwright/taskpack/dist/output-format.js +157 -0
  399. package/node_modules/@loopwright/taskpack/dist/preflight.d.ts +130 -0
  400. package/node_modules/@loopwright/taskpack/dist/preflight.js +1497 -0
  401. package/node_modules/@loopwright/taskpack/dist/qualification.d.ts +23 -0
  402. package/node_modules/@loopwright/taskpack/dist/qualification.js +120 -0
  403. package/node_modules/@loopwright/taskpack/dist/sandbox.d.ts +121 -0
  404. package/node_modules/@loopwright/taskpack/dist/sandbox.js +2642 -0
  405. package/node_modules/@loopwright/taskpack/dist/schema.d.ts +197 -0
  406. package/node_modules/@loopwright/taskpack/dist/schema.js +4189 -0
  407. package/node_modules/@loopwright/taskpack/dist/scrubber.d.ts +47 -0
  408. package/node_modules/@loopwright/taskpack/dist/scrubber.js +283 -0
  409. package/node_modules/@loopwright/taskpack/dist/suite.d.ts +124 -0
  410. package/node_modules/@loopwright/taskpack/dist/suite.js +3256 -0
  411. package/node_modules/@loopwright/taskpack/dist/taskpack.d.ts +154 -0
  412. package/node_modules/@loopwright/taskpack/dist/taskpack.js +3634 -0
  413. package/node_modules/@loopwright/taskpack/dist/turnkey-memory.d.ts +122 -0
  414. package/node_modules/@loopwright/taskpack/dist/turnkey-memory.js +483 -0
  415. package/node_modules/@loopwright/taskpack/dist/turnkey.d.ts +437 -0
  416. package/node_modules/@loopwright/taskpack/dist/turnkey.js +7335 -0
  417. package/node_modules/@loopwright/taskpack/dist/types.d.ts +1274 -0
  418. package/node_modules/@loopwright/taskpack/dist/types.js +99 -0
  419. package/node_modules/@loopwright/taskpack/dist/upstreams.d.ts +261 -0
  420. package/node_modules/@loopwright/taskpack/dist/upstreams.js +2242 -0
  421. package/node_modules/@loopwright/taskpack/dist/yaml.d.ts +18 -0
  422. package/node_modules/@loopwright/taskpack/dist/yaml.js +167 -0
  423. package/node_modules/@loopwright/taskpack/package.json +12 -0
  424. package/node_modules/@loopwright/taskpack-runner/dist/compile-taskpack.d.ts +137 -0
  425. package/node_modules/@loopwright/taskpack-runner/dist/compile-taskpack.js +474 -0
  426. package/node_modules/@loopwright/taskpack-runner/dist/corpus.d.ts +8 -0
  427. package/node_modules/@loopwright/taskpack-runner/dist/corpus.js +129 -0
  428. package/node_modules/@loopwright/taskpack-runner/dist/index.d.ts +13 -0
  429. package/node_modules/@loopwright/taskpack-runner/dist/index.js +7 -0
  430. package/node_modules/@loopwright/taskpack-runner/dist/intake.d.ts +149 -0
  431. package/node_modules/@loopwright/taskpack-runner/dist/intake.js +135 -0
  432. package/node_modules/@loopwright/taskpack-runner/dist/parity.d.ts +130 -0
  433. package/node_modules/@loopwright/taskpack-runner/dist/parity.js +927 -0
  434. package/node_modules/@loopwright/taskpack-runner/dist/python-bridge.d.ts +68 -0
  435. package/node_modules/@loopwright/taskpack-runner/dist/python-bridge.js +517 -0
  436. package/node_modules/@loopwright/taskpack-runner/dist/service.d.ts +149 -0
  437. package/node_modules/@loopwright/taskpack-runner/dist/service.js +1796 -0
  438. package/node_modules/@loopwright/taskpack-runner/dist/types.d.ts +29 -0
  439. package/node_modules/@loopwright/taskpack-runner/dist/types.js +11 -0
  440. package/node_modules/@loopwright/taskpack-runner/package.json +12 -0
  441. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/README.md +77 -0
  442. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/docs/support-records.md +57 -0
  443. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/docs/supported-runners.md +98 -0
  444. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/manifest.json +205 -0
  445. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/expand_matrix.sh +273 -0
  446. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/matrix.yaml +280 -0
  447. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/resolve_dockerfile.sh +24 -0
  448. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pyproject.toml +46 -0
  449. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/runtime_runner/runner.py.json +5270 -0
  450. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/discovery/legacy-support.md +86 -0
  451. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/github/service.py +401 -0
  452. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/proposals/analysis.json +95 -0
  453. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/proposals/ready.json +109 -0
  454. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_assemble.py +263 -0
  455. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_check_draft.py +333 -0
  456. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_checks.py +1099 -0
  457. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_discovery.py +817 -0
  458. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_proposal.py +658 -0
  459. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_publish.py +987 -0
  460. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_summary.py +107 -0
  461. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/agent.py +610 -0
  462. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/assemble.py +84 -0
  463. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/check_draft.py +94 -0
  464. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/checks.py +1002 -0
  465. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/discovery.py +789 -0
  466. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/model.py +557 -0
  467. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/progress.py +174 -0
  468. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/analysis.md +40 -0
  469. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/proposal.md +65 -0
  470. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/repair.md +17 -0
  471. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/proposal.py +903 -0
  472. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/publish.py +997 -0
  473. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/summary.py +131 -0
  474. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/tool-versions.json +133 -0
  475. package/node_modules/package-lock.json +3025 -0
  476. package/package-lock.json +3025 -0
  477. package/package.json +52 -4
@@ -0,0 +1,1002 @@
1
+ """
2
+ Credential-free checks apply candidate data in disposable exact-source clones.
3
+
4
+ No candidate tests, hooks, agent settings, Docker builds, or matrix shell scripts
5
+ are executed. Manifest evidence is checked for consistency, not reclassified as
6
+ measured runtime compatibility. Missing upstream source remains unverified.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import copy
12
+ import hashlib
13
+ import json
14
+ import os
15
+ import re
16
+ import shutil
17
+ import subprocess
18
+ import tempfile
19
+ from pathlib import Path
20
+
21
+ from tools.auto_sync.discovery import (
22
+ BACKENDS,
23
+ SERVICES,
24
+ canonical_variant,
25
+ parse_support,
26
+ version,
27
+ )
28
+ from tools.auto_sync.proposal import (
29
+ ProposalError,
30
+ allowed_path,
31
+ load_json,
32
+ patch_paths,
33
+ require,
34
+ validate_proposal,
35
+ )
36
+
37
+ # A package choice is keyed by its canonical name, but the installed
38
+ # distribution can carry a backend-qualified name for the same recipe pin.
39
+ _PACKAGE_ALIASES = {
40
+ "mooncake-transfer-engine": "mooncake",
41
+ "mooncake-transfer-engine-rocm": "mooncake",
42
+ }
43
+
44
+
45
+ def _run(argv, env, *, cwd=None, text=None):
46
+ try:
47
+ result = subprocess.run( # noqa: S603 - argv is trusted; candidate content goes to stdin.
48
+ argv,
49
+ cwd=cwd,
50
+ env=env,
51
+ input=text,
52
+ text=True,
53
+ capture_output=True,
54
+ timeout=300,
55
+ check=False,
56
+ )
57
+ except (OSError, subprocess.TimeoutExpired) as exc:
58
+ msg = f"static check failed: {exc}"
59
+ raise ProposalError(msg) from exc
60
+ require(result.returncode == 0, f"static check failed: {result.stderr.strip()}")
61
+ return result.stdout
62
+
63
+
64
+ def _git(env, repo, *args, text=None):
65
+ return _run(
66
+ [
67
+ "git",
68
+ "-c",
69
+ "core.hooksPath=/dev/null",
70
+ "-c",
71
+ "core.fsmonitor=false",
72
+ "-c",
73
+ "core.attributesFile=/dev/null",
74
+ "-C",
75
+ str(repo),
76
+ *args,
77
+ ],
78
+ env,
79
+ text=text,
80
+ )
81
+
82
+
83
+ def _clone(repo, sha, target, env):
84
+ require(Path(repo).is_dir(), "source repository is unavailable")
85
+ actual = _git(env, repo, "rev-parse", "--verify", sha + "^{commit}").strip()
86
+ require(actual == sha, "source revision is not the exact declared commit")
87
+ _run(
88
+ [
89
+ "git",
90
+ "-c",
91
+ "core.hooksPath=/dev/null",
92
+ "clone",
93
+ "--quiet",
94
+ "--no-checkout",
95
+ "--no-hardlinks",
96
+ "--no-recurse-submodules",
97
+ "--template=",
98
+ "--",
99
+ str(Path(repo).resolve()),
100
+ str(target),
101
+ ],
102
+ env,
103
+ )
104
+ _git(env, target, "checkout", "--quiet", "--detach", sha)
105
+
106
+
107
+ def _safe_file(root, path):
108
+ current = root
109
+ for part in Path(path).parts:
110
+ current /= part
111
+ require(not current.is_symlink(), f"symlink in candidate path: {path}")
112
+ require(
113
+ current.resolve().is_relative_to(root.resolve()),
114
+ f"escaping candidate path: {path}",
115
+ )
116
+ return current
117
+
118
+
119
+ def _matrix(repo, env):
120
+ path = _safe_file(repo, "pack/matrix.yaml")
121
+ # Go yq's fixed identity expression reads YAML, without shell or env expansion.
122
+ value = load_json(
123
+ _run(["yq", "eval", "--output-format", "json", ".", str(path)], env),
124
+ )
125
+ require(
126
+ isinstance(value, dict)
127
+ and set(value) == {"rules"}
128
+ and isinstance(value["rules"], list),
129
+ "invalid matrix rules",
130
+ )
131
+ for rule in value["rules"]:
132
+ require(
133
+ isinstance(rule, dict)
134
+ and {"backend", "services"} <= rule.keys()
135
+ and rule.keys() <= {"backend", "services", "platforms", "args"},
136
+ "invalid matrix rule fields",
137
+ )
138
+ require(rule["backend"] in BACKENDS.values(), "unknown matrix backend")
139
+ services = rule["services"]
140
+ require(
141
+ isinstance(services, list)
142
+ and services
143
+ and all(s in SERVICES for s in services)
144
+ and len(set(services)) == len(services),
145
+ "invalid matrix services",
146
+ )
147
+ platforms = rule.get("platforms", ["linux/amd64", "linux/arm64"])
148
+ require(
149
+ isinstance(platforms, list)
150
+ and platforms
151
+ and len(set(platforms)) == len(platforms)
152
+ and all(
153
+ isinstance(p, str)
154
+ and re.fullmatch(r"linux/(amd64|arm64)(/v[0-9]+)?", p)
155
+ for p in platforms
156
+ ),
157
+ "invalid matrix platforms",
158
+ )
159
+ args = rule.get("args", [])
160
+ require(isinstance(args, list), "invalid matrix arguments")
161
+ names = []
162
+ for argument in args:
163
+ require(
164
+ isinstance(argument, str)
165
+ and re.fullmatch(r"[A-Z][A-Z0-9_]*=[A-Za-z0-9_./:+@,=-]*", argument),
166
+ "unsafe matrix argument",
167
+ )
168
+ names.append(argument.split("=", 1)[0])
169
+ require(len(names) == len(set(names)), "duplicate matrix arguments")
170
+ return value["rules"]
171
+
172
+
173
+ def _check_matrix_scope(before, after, rows):
174
+ selected = {(r["backend"], r["service"]) for r in rows}
175
+
176
+ def unrelated(rules):
177
+ return [
178
+ dict(rule, services=[service])
179
+ for rule in rules
180
+ for service in rule["services"]
181
+ if (rule["backend"], service) not in selected
182
+ ]
183
+
184
+ require(
185
+ unrelated(before) == unrelated(after),
186
+ "matrix changes an unselected combination",
187
+ )
188
+
189
+
190
+ def _arguments(repo, rule, service):
191
+ path = _safe_file(repo, f"pack/{rule['backend']}/Dockerfile.{service}")
192
+ require(path.is_file(), "selected recipe is missing")
193
+ return recipe_arguments(path.read_text(), rule.get("args", []))
194
+
195
+
196
+ def recipe_arguments(text, overrides=()):
197
+ """Effective ARG defaults from recipe text plus matrix rule overrides."""
198
+ defaults = {}
199
+ for line in text.splitlines():
200
+ if line.startswith("FROM "):
201
+ break
202
+ match = re.fullmatch(r"ARG ([A-Z][A-Z0-9_]*)=(.*)", line)
203
+ if match:
204
+ defaults[match[1]] = match[2].strip('"')
205
+ defaults.update(argument.split("=", 1) for argument in overrides)
206
+
207
+ def expand(name, stack=()):
208
+ require(
209
+ name not in stack and name in defaults,
210
+ "unknown or cyclic Dockerfile argument",
211
+ )
212
+ raw = defaults[name]
213
+ return re.sub(
214
+ r"\$\{([A-Z][A-Z0-9_]*)\}",
215
+ lambda m: expand(m[1], (*stack, name)),
216
+ raw,
217
+ )
218
+
219
+ # This expands only named ARG references as strings. It never runs shell expressions.
220
+ return {name: expand(name) for name in defaults}
221
+
222
+
223
+ def _image(repo, backend, service, args):
224
+ stages = {}
225
+ for line in (
226
+ _safe_file(repo, f"pack/{backend}/Dockerfile.{service}")
227
+ .read_text()
228
+ .splitlines()
229
+ ):
230
+ if not line.upper().startswith("FROM "):
231
+ continue
232
+ match = re.fullmatch(r"FROM\s+(\S+)\s+AS\s+(\S+)\s*", line, re.IGNORECASE)
233
+ require(
234
+ match is not None,
235
+ "unsupported FROM expression; image evidence cannot be bound",
236
+ )
237
+ reference = re.sub(
238
+ r"\$\{([A-Z][A-Z0-9_]*)\}",
239
+ lambda m: args.get(m[1], m[0]),
240
+ match[1],
241
+ )
242
+ require(
243
+ "$" not in reference and match[2] not in stages,
244
+ "unresolved or duplicate image stage",
245
+ )
246
+ stages[match[2]] = stages.get(reference, reference)
247
+ require(service in stages, "selected service stage is missing")
248
+ return stages[service]
249
+
250
+
251
+ def _configurations(repo, rules):
252
+ result = {}
253
+ for rule in rules:
254
+ if rule["backend"] not in {"cuda", "rocm", "cann"}:
255
+ continue
256
+ for service in rule["services"]:
257
+ if service not in {"vllm", "sglang"}:
258
+ continue
259
+ args = _arguments(repo, rule, service)
260
+ backend = rule["backend"]
261
+ variant = canonical_variant(
262
+ backend,
263
+ args.get("CANN_ARCHS", "") if backend == "cann" else "",
264
+ )
265
+ runtime = str(version(args.get(f"{backend.upper()}_VERSION")))
266
+ for platform in rule.get("platforms", ["linux/amd64", "linux/arm64"]):
267
+ key = (backend, service, variant, runtime, platform)
268
+ require(key not in result, "duplicate effective matrix combination")
269
+ result[key] = args
270
+ return result
271
+
272
+
273
+ def _row_key(row):
274
+ return (
275
+ row["backend"],
276
+ row["service"],
277
+ row["variant"],
278
+ str(version(row["runtime"])),
279
+ row["platform"],
280
+ )
281
+
282
+
283
+ def _changed_configurations(before, after, rows, paths):
284
+ touched = {
285
+ (r["backend"], r["service"])
286
+ for r in rows
287
+ if f"pack/{r['backend']}/Dockerfile.{r['service']}" in paths
288
+ or any(p.startswith(f"pack/{r['backend']}/patches/") for p in paths)
289
+ }
290
+ changed = {
291
+ key
292
+ for key, args in after.items()
293
+ if before.get(key) != args or key[:2] in touched
294
+ }
295
+ missing = sorted(changed - {_row_key(r) for r in rows})
296
+ require(
297
+ not missing,
298
+ "changed matrix combination lacks compatibility evidence: "
299
+ + ", ".join(
300
+ f"{backend}/{service} ({variant or '-'} {runtime} {platform})"
301
+ for backend, service, variant, runtime, platform in missing
302
+ )
303
+ + "; retire a variant that cannot follow a changed shared recipe by removing its matrix rules",
304
+ )
305
+ return changed
306
+
307
+
308
+ def _check_rows(repo, rules, rows, baseline, ascend_pairs):
309
+ for row in rows:
310
+ matching = []
311
+ for rule in rules:
312
+ if (
313
+ rule["backend"] != row["backend"]
314
+ or row["service"] not in rule["services"]
315
+ ):
316
+ continue
317
+ args = _arguments(repo, rule, row["service"])
318
+ backend, service = row["backend"].upper(), row["service"].upper()
319
+ variant = canonical_variant(
320
+ row["backend"],
321
+ args.get("CANN_ARCHS", "") if row["backend"] == "cann" else "",
322
+ )
323
+ runtime = args.get(f"{backend}_VERSION")
324
+ if (
325
+ variant == row["variant"]
326
+ and runtime is not None
327
+ and version(runtime) == version(row["runtime"])
328
+ ):
329
+ matching.append((rule, args))
330
+ require(
331
+ bool(matching),
332
+ "compatibility row has no matching matrix runtime/variant",
333
+ )
334
+ for rule, args in matching:
335
+ require(
336
+ row["platform"]
337
+ in rule.get("platforms", ["linux/amd64", "linux/arm64"]),
338
+ "compatibility platform is absent from the matrix",
339
+ )
340
+ service = row["service"].upper()
341
+ require(
342
+ version(args.get(f"{service}_VERSION"))
343
+ == version(row["engine_version"]),
344
+ "compatibility engine differs from the effective matrix pin",
345
+ )
346
+ image = _image(repo, row["backend"], row["service"], args)
347
+ require(
348
+ image == row["base_image"],
349
+ "base image evidence differs from the effective recipe",
350
+ )
351
+ if row["backend"] == "cann" and row["service"] == "vllm":
352
+ pair = ascend_pairs.get(str(version(row["plugin_version"])))
353
+ require(
354
+ isinstance(pair, dict)
355
+ and isinstance(pair.get("source"), str)
356
+ and pair["source"].startswith("https://"),
357
+ "Ascend plugin lacks controller-supplied upstream pairing evidence",
358
+ )
359
+ require(
360
+ version(pair.get("engine_version"))
361
+ == version(row["engine_version"]),
362
+ "Ascend plugin and engine differ from the upstream pairing evidence",
363
+ )
364
+ if "@sha256:" in image:
365
+ require(
366
+ image.split("@", 1)[1] == row["manifest"]["digest"],
367
+ "pinned image and manifest digest disagree",
368
+ )
369
+ for field, name in (
370
+ ("python", "PYTHON_VERSION"),
371
+ ("torch", f"{service}_TORCH_VERSION"),
372
+ ):
373
+ if row[field] is not None:
374
+ require(
375
+ name in args and version(args[name]) == version(row[field]),
376
+ f"compatibility {field} differs from the effective recipe",
377
+ )
378
+ packages = {}
379
+ for p in row["packages"]:
380
+ key = _PACKAGE_ALIASES.get(p["name"].lower(), p["name"].lower())
381
+ require(key not in packages, "duplicate additional packages")
382
+ packages[key] = p
383
+ if any(
384
+ Path(patch["path"]).parts[3] == "vllm_omni"
385
+ and patch["disposition"] != "remove"
386
+ and patch["source_revision"] is not None
387
+ for patch in row["patches"]
388
+ ):
389
+ require(
390
+ bool(args.get(f"{service}_OMNI_COMMIT")),
391
+ "verified Omni patch source lacks an effective recipe pin",
392
+ )
393
+ for package, suffix in (
394
+ ("lmcache", "LMCACHE_VERSION"),
395
+ ("mooncake", "MOONCAKE_VERSION"),
396
+ ("lmcache-ascend", "LMCACHE_ASCEND_VERSION"),
397
+ ("lmcache-ascend", "LMCACHE_ASCEND_COMMIT"),
398
+ ("vllm-omni", "OMNI_COMMIT"),
399
+ ("diffusers", "DIFFUSERS_VERSION"),
400
+ ):
401
+ key = f"{service}_{suffix}"
402
+ if key not in args:
403
+ continue
404
+ require(
405
+ package in packages,
406
+ f"additional package choice is missing: {package}",
407
+ )
408
+ choice = packages[package]
409
+ if choice["decision"] == "disable":
410
+ require(
411
+ args[key] == "",
412
+ "disabled additional package remains enabled",
413
+ )
414
+ else:
415
+ require(
416
+ args[key] == choice["version"],
417
+ "additional package differs from the effective recipe pin",
418
+ )
419
+ previous = baseline.get(_row_key(row))
420
+ predecessors = (
421
+ [previous]
422
+ if previous is not None
423
+ else [
424
+ args
425
+ for key, args in baseline.items()
426
+ if key[:3] == _row_key(row)[:3] and key[4] == row["platform"]
427
+ ]
428
+ )
429
+ if predecessors:
430
+ require(
431
+ row["old_engine_version"] is not None
432
+ and version(row["old_engine_version"])
433
+ in {
434
+ version(args[f"{row['service'].upper()}_VERSION"])
435
+ for args in predecessors
436
+ },
437
+ "old engine report differs from the frozen head",
438
+ )
439
+ else:
440
+ require(
441
+ row["old_engine_version"] is None,
442
+ "new combination has no prior engine version",
443
+ )
444
+ # Every selected platform of this exact combination needs its own evidence.
445
+ expected = {
446
+ platform
447
+ for rule, _ in matching
448
+ for platform in rule.get("platforms", ["linux/amd64", "linux/arm64"])
449
+ }
450
+ reported = {
451
+ r["platform"]
452
+ for r in rows
453
+ if all(
454
+ r[k] == row[k]
455
+ for k in (
456
+ "backend",
457
+ "service",
458
+ "variant",
459
+ "runtime",
460
+ "engine_version",
461
+ "base_image",
462
+ )
463
+ )
464
+ }
465
+ require(
466
+ expected <= reported,
467
+ "compatibility rows omit selected platform evidence",
468
+ )
469
+
470
+
471
+ def _support_key(row):
472
+ runtime = version(row["runtime"])
473
+ return (
474
+ row["backend"],
475
+ row["service"],
476
+ row["variant"],
477
+ version(".".join(map(str, runtime.release[:2]))),
478
+ version(row["engine_version"]),
479
+ version(row["plugin_version"]) if row["plugin_version"] else None,
480
+ )
481
+
482
+
483
+ def _check_support(before, after, rows, changed, protected):
484
+ previous = parse_support(before, require_explicit=True)
485
+ records = parse_support(after, require_explicit=True)
486
+ immutable = [r for r in previous if r["status"] != "prepared" or r in protected]
487
+ require(
488
+ all(r in records for r in immutable),
489
+ "candidate support removes previously accepted support metadata",
490
+ )
491
+ for record in records:
492
+ if record in previous:
493
+ continue
494
+ require(
495
+ record["status"] == "prepared",
496
+ "candidate support cannot fabricate published metadata",
497
+ )
498
+ require(
499
+ record["runtime"] == str(_support_key(record)[3]),
500
+ "new support runtime line must match the catalog major.minor version",
501
+ )
502
+ platforms = {
503
+ r["platform"] for r in rows if _support_key(r) == _support_key(record)
504
+ }
505
+ require(
506
+ set(record["platforms"]) == platforms,
507
+ "prepared record differs from checked configuration and platforms",
508
+ )
509
+ scopes = {tuple(_support_key(r)[:4]) for r in rows}
510
+ require(
511
+ all(r in records or tuple(_support_key(r)[:4]) in scopes for r in previous),
512
+ "candidate removes unrelated proposal support",
513
+ )
514
+ for row in rows:
515
+ if _row_key(row) in changed:
516
+ require(
517
+ any(
518
+ _support_key(r) == _support_key(row)
519
+ and row["platform"] in r["platforms"]
520
+ for r in records
521
+ ),
522
+ "changed configuration lacks a matching prepared support record",
523
+ )
524
+
525
+
526
+ def _source_patch_checks(repo, group, sources, scratch, env):
527
+ outcomes = []
528
+ checked = set()
529
+ for row in group["rows"]:
530
+ stacks = {}
531
+ for decision in sorted(row["patches"], key=lambda item: item["path"]):
532
+ key = decision["source_repository"], decision["source_revision"]
533
+ stacks.setdefault(key, []).append(decision)
534
+ for (upstream, revision), decisions in stacks.items():
535
+ identity = (
536
+ upstream,
537
+ revision,
538
+ tuple((d["path"], d["disposition"]) for d in decisions),
539
+ )
540
+ if identity in checked:
541
+ continue
542
+ checked.add(identity)
543
+ work = None
544
+ source = sources.get(upstream)
545
+ if source is not None and revision is not None:
546
+ try:
547
+ _git(env, source, "cat-file", "-e", revision + "^{commit}")
548
+ except ProposalError:
549
+ pass
550
+ else:
551
+ work = scratch / f"source-{len(checked)}"
552
+ _clone(source, revision, work, env)
553
+ for decision in decisions:
554
+ patch = _safe_file(repo, decision["path"])
555
+ outcome = {
556
+ "path": decision["path"],
557
+ "source_repository": upstream,
558
+ "source_revision": revision,
559
+ "status": "unverified",
560
+ "reason": "Exact upstream source is unavailable.",
561
+ }
562
+ if decision["disposition"] == "remove":
563
+ require(not patch.exists(), "removed patch still exists")
564
+ outcome.update(
565
+ status="passed",
566
+ reason="Removed patch needs no application check.",
567
+ )
568
+ else:
569
+ require(
570
+ patch.is_file(),
571
+ f"declared patch is missing: {decision['path']}",
572
+ )
573
+ if work is not None:
574
+ content = patch.read_text()
575
+ _git(
576
+ env,
577
+ work,
578
+ "apply",
579
+ "--check",
580
+ "--whitespace=error",
581
+ "-",
582
+ text=content,
583
+ )
584
+ _git(
585
+ env,
586
+ work,
587
+ "apply",
588
+ "--whitespace=error",
589
+ "-",
590
+ text=content,
591
+ )
592
+ outcome.update(
593
+ status="passed",
594
+ reason="Applied in recipe order against the exact source revision.",
595
+ )
596
+ outcomes.append(outcome)
597
+ return outcomes
598
+
599
+
600
+ def _check_patch_dispositions(before, after, paths, group):
601
+ decisions = {d["path"]: d for row in group["rows"] for d in row["patches"]}
602
+ for path in paths:
603
+ if path.endswith(".patch"):
604
+ require(path in decisions, f"changed patch lacks a disposition: {path}")
605
+ disposition = decisions[path]["disposition"]
606
+ existed = _safe_file(before, path).exists()
607
+ exists = _safe_file(after, path).exists()
608
+ require(
609
+ (disposition == "add" and not existed and exists)
610
+ or (disposition == "adapt" and existed and exists)
611
+ or (disposition == "remove" and existed and not exists),
612
+ "patch changes disagree with disposition",
613
+ )
614
+ # Every patch of an affected component needs a decision, including retained patches.
615
+ for row in group["rows"]:
616
+ root = before / "pack" / row["backend"] / "patches"
617
+ components = {row["service"]}
618
+ if row["service"] == "vllm":
619
+ components |= {"vllm_ascend", "vllm_omni"}
620
+ for component in components:
621
+ directory = _safe_file(before, str((root / component).relative_to(before)))
622
+ for patch in directory.rglob("*.patch"):
623
+ path = str(patch.relative_to(before))
624
+ _safe_file(before, path)
625
+ require(
626
+ path in decisions,
627
+ f"affected existing patch lacks a disposition: {path}",
628
+ )
629
+
630
+
631
+ def _lmcache_versions(repo, rules):
632
+ versions = set()
633
+ for backend in ("cuda", "rocm"):
634
+ for service in ("vllm", "sglang"):
635
+ path = _safe_file(repo, f"pack/{backend}/Dockerfile.{service}")
636
+ if path.is_file():
637
+ versions.update(
638
+ re.findall(
639
+ r"^ARG (?:VLLM|SGLANG)_LMCACHE_VERSION=([^\s]+)$",
640
+ path.read_text(),
641
+ re.MULTILINE,
642
+ ),
643
+ )
644
+ for rule in rules:
645
+ if rule["backend"] in {"cuda", "rocm"}:
646
+ for service in rule["services"]:
647
+ if service in {"vllm", "sglang"}:
648
+ value = _arguments(repo, rule, service).get(
649
+ f"{service.upper()}_LMCACHE_VERSION",
650
+ )
651
+ if value:
652
+ versions.add(value)
653
+ return versions
654
+
655
+
656
+ def check_applied_group(
657
+ *,
658
+ base,
659
+ work,
660
+ group,
661
+ paths,
662
+ previous_tree,
663
+ before_matrix,
664
+ before_configs,
665
+ before_support,
666
+ before_lmcache,
667
+ protected,
668
+ ascend_pairs,
669
+ env,
670
+ ):
671
+ # New files are untracked until staged in this disposable clone.
672
+ _git(env, work, "add", "--", *paths)
673
+ actual = _git(
674
+ env,
675
+ work,
676
+ "diff",
677
+ "--cached",
678
+ previous_tree,
679
+ "--name-only",
680
+ "-z",
681
+ ).split("\0")
682
+ require(
683
+ set(filter(None, actual)) == set(paths),
684
+ "patch paths disagree with applied changes",
685
+ )
686
+ for path in paths:
687
+ _safe_file(work, path)
688
+ after_matrix = _matrix(work, env)
689
+ _check_matrix_scope(before_matrix, after_matrix, group["rows"])
690
+ changed = _changed_configurations(
691
+ before_configs,
692
+ _configurations(work, after_matrix),
693
+ group["rows"],
694
+ paths,
695
+ )
696
+ _check_rows(
697
+ work,
698
+ after_matrix,
699
+ group["rows"],
700
+ _configurations(base, _matrix(base, env)),
701
+ ascend_pairs,
702
+ )
703
+ require(
704
+ re.search(
705
+ r"\]\((?:\./)?docs/supported-runners\.md(?:#[^)]*)?\)",
706
+ _safe_file(work, "README.md").read_text(),
707
+ ),
708
+ "README lost its authoritative support link",
709
+ )
710
+ _check_support(
711
+ before_support,
712
+ _safe_file(work, "docs/support-records.md").read_text(),
713
+ group["rows"],
714
+ changed,
715
+ protected,
716
+ )
717
+ after_lmcache = _lmcache_versions(work, after_matrix)
718
+ require(
719
+ after_lmcache == before_lmcache or len(after_lmcache) <= 1,
720
+ "LMCache cross-image protocol pins diverge",
721
+ )
722
+
723
+
724
+ def _check_group(base, work, group, sources, scratch, env, protected, ascend_pairs):
725
+ previous_tree = _git(env, work, "write-tree").strip()
726
+ paths = patch_paths(group["patch"], group["rows"])
727
+ for path in paths:
728
+ allowed_path(path, group["rows"])
729
+ _safe_file(work, path)
730
+ before_matrix = _matrix(work, env)
731
+ before_configs = _configurations(work, before_matrix)
732
+ before_support = _safe_file(work, "docs/support-records.md").read_text()
733
+ before_lmcache = _lmcache_versions(work, before_matrix)
734
+ _git(env, work, "apply", "--check", "--whitespace=error", "-", text=group["patch"])
735
+ _git(env, work, "apply", "--whitespace=error", "-", text=group["patch"])
736
+ check_applied_group(
737
+ base=base,
738
+ work=work,
739
+ group=group,
740
+ paths=paths,
741
+ previous_tree=previous_tree,
742
+ before_matrix=before_matrix,
743
+ before_configs=before_configs,
744
+ before_support=before_support,
745
+ before_lmcache=before_lmcache,
746
+ protected=protected,
747
+ ascend_pairs=ascend_pairs,
748
+ env=env,
749
+ )
750
+ _check_patch_dispositions(base, work, paths, group)
751
+ return {
752
+ "status": "passed",
753
+ "paths": paths,
754
+ "patches": _source_patch_checks(work, group, sources, scratch, env),
755
+ "checks": [
756
+ "Exact-head git apply",
757
+ "Allowed paths and regular files",
758
+ "Trusted static data validation",
759
+ ],
760
+ "runtime": "unverified",
761
+ }
762
+
763
+
764
+ def report_digest(artifact):
765
+ """Bind all candidate outcomes and reports to the frozen identity and patch."""
766
+ content = {
767
+ key: artifact[key]
768
+ for key in (
769
+ "schema_version",
770
+ "identity",
771
+ "candidates",
772
+ "groups",
773
+ "patch_digest",
774
+ )
775
+ }
776
+ return hashlib.sha256(
777
+ json.dumps(
778
+ content,
779
+ sort_keys=True,
780
+ separators=(",", ":"),
781
+ allow_nan=False,
782
+ ).encode(),
783
+ ).hexdigest()
784
+
785
+
786
+ def verify_artifact(
787
+ artifact: dict,
788
+ expected_identity: dict,
789
+ *,
790
+ engine_prereleases: set | None = None,
791
+ prerelease_packages: set | None = None,
792
+ ) -> dict:
793
+ """
794
+ Check transport integrity and return proposal data for clean-runner rechecks.
795
+
796
+ Digests bind the patch and reports; they do not authenticate agent assertions.
797
+ Call validate_candidate again before granting publication credentials.
798
+ """
799
+ try:
800
+ fields = {
801
+ "schema_version",
802
+ "identity",
803
+ "candidates",
804
+ "groups",
805
+ "patch",
806
+ "patch_digest",
807
+ "report_digest",
808
+ }
809
+ require(
810
+ isinstance(artifact, dict) and set(artifact) == fields,
811
+ "invalid checked artifact fields",
812
+ )
813
+ require(
814
+ artifact["identity"] == expected_identity,
815
+ "checked artifact identity differs from frozen identity",
816
+ )
817
+ require(
818
+ hashlib.sha256(artifact["patch"].encode()).hexdigest()
819
+ == artifact["patch_digest"],
820
+ "checked artifact patch digest mismatch",
821
+ )
822
+ require(
823
+ report_digest(artifact) == artifact["report_digest"],
824
+ "checked artifact report digest mismatch",
825
+ )
826
+ require(
827
+ artifact["patch"]
828
+ == "".join(
829
+ g["patch"] for g in artifact["groups"] if g["status"] == "ready"
830
+ ),
831
+ "checked artifact contains an unapproved patch",
832
+ )
833
+ raw = copy.deepcopy(
834
+ {
835
+ key: artifact[key]
836
+ for key in ("schema_version", "identity", "candidates", "groups")
837
+ },
838
+ )
839
+ for group in raw["groups"]:
840
+ validation = group.pop("validation")
841
+ require(isinstance(validation, dict), "group validation is missing")
842
+ if group["status"] == "ready":
843
+ require(
844
+ validation.get("status") == "passed"
845
+ and validation.get("runtime") == "unverified",
846
+ "ready group lacks trusted static checks",
847
+ )
848
+ return validate_proposal(
849
+ raw,
850
+ expected_identity,
851
+ engine_prereleases=engine_prereleases,
852
+ prerelease_packages=prerelease_packages,
853
+ )
854
+ except (ValueError, TypeError, KeyError, AttributeError) as exc:
855
+ if isinstance(exc, ProposalError):
856
+ raise
857
+ msg = f"malformed checked artifact: {exc}"
858
+ raise ProposalError(msg) from exc
859
+
860
+
861
+ def validate_candidate(
862
+ repo: Path,
863
+ proposal: dict,
864
+ expected_identity: dict,
865
+ *,
866
+ sources: dict | None = None,
867
+ ascend_pairs: dict | None = None,
868
+ engine_prereleases: set | None = None,
869
+ prerelease_packages: set | None = None,
870
+ ) -> dict:
871
+ """
872
+ Return checked data and only accepted groups' patch; malformed data raises.
873
+
874
+ ``repo`` is a clean trusted local object store containing default and head
875
+ commits. ``sources`` maps upstream repository names to local exact-source
876
+ object stores. It never authorizes a checkout's moving HEAD as evidence.
877
+ ``ascend_pairs`` uses discovery's sourced plugin-to-stable-engine mapping.
878
+ The controller supplies it independently of proposal data. Neither an image
879
+ tag nor a README RC marker establishes the installed plugin version.
880
+ Individual static failures remain in their group's report and assessment.
881
+ Publication must verify identity and recompute checks on its clean runner.
882
+ """
883
+ data = validate_proposal(
884
+ proposal,
885
+ expected_identity,
886
+ engine_prereleases=engine_prereleases,
887
+ prerelease_packages=prerelease_packages,
888
+ )
889
+ with tempfile.TemporaryDirectory(prefix="runner-proposal-") as temporary:
890
+ scratch = Path(temporary)
891
+ home = scratch / "home"
892
+ home.mkdir()
893
+ env = {
894
+ "PATH": os.environ.get("PATH", os.defpath),
895
+ "HOME": str(home),
896
+ "TMPDIR": str(scratch),
897
+ "LANG": "C.UTF-8",
898
+ "GIT_CONFIG_NOSYSTEM": "1",
899
+ "GIT_CONFIG_GLOBAL": "/dev/null",
900
+ "GIT_TERMINAL_PROMPT": "0",
901
+ "GIT_ASKPASS": "/usr/bin/false",
902
+ "SSH_ASKPASS": "/usr/bin/false",
903
+ }
904
+ for tool in ("git", "yq"):
905
+ require(
906
+ shutil.which(tool, path=env["PATH"]) is not None,
907
+ f"trusted check tool is missing: {tool}",
908
+ )
909
+ # Verify both revisions even when discovery and proposal head are equal.
910
+ for sha in {expected_identity["default_sha"], expected_identity["head_sha"]}:
911
+ try:
912
+ actual = _git(
913
+ env,
914
+ repo,
915
+ "rev-parse",
916
+ "--verify",
917
+ sha + "^{commit}",
918
+ ).strip()
919
+ except ProposalError as exc:
920
+ msg = "frozen source revision is unavailable"
921
+ raise ProposalError(msg) from exc
922
+ require(actual == sha, "frozen source revision is not exact")
923
+ base = scratch / "base"
924
+ _clone(repo, expected_identity["head_sha"], base, env)
925
+ protected = parse_support(
926
+ _git(
927
+ env,
928
+ repo,
929
+ "show",
930
+ expected_identity["default_sha"] + ":docs/support-records.md",
931
+ ),
932
+ require_explicit=True,
933
+ )
934
+ groups = {group["id"]: group for group in data["groups"]}
935
+ pending = set(groups)
936
+ accepted = []
937
+ checked_groups = []
938
+ finished = set()
939
+ while pending:
940
+ available = [
941
+ g
942
+ for g in data["groups"]
943
+ if g["id"] in pending and set(g["depends_on"]) <= finished
944
+ ]
945
+ for group in available:
946
+ checked_groups.append(group)
947
+ pending.remove(group["id"])
948
+ finished.add(group["id"])
949
+ if group["status"] != "ready":
950
+ group["validation"] = {
951
+ "status": "skipped",
952
+ "reason": group["reason"],
953
+ }
954
+ continue
955
+ if any(
956
+ groups[name]["status"] != "ready" for name in group["depends_on"]
957
+ ):
958
+ group.update(
959
+ status="blocked",
960
+ validation={
961
+ "status": "skipped",
962
+ "reason": "Required compatibility group was rejected.",
963
+ },
964
+ )
965
+ continue
966
+ work = scratch / f"group-{group['id']}"
967
+ _clone(repo, expected_identity["head_sha"], work, env)
968
+ for previous in accepted:
969
+ _git(env, work, "apply", "-", text=previous["patch"])
970
+ # Commit-free staging makes comparison relative to preceding accepted groups.
971
+ _git(env, work, "add", "-A")
972
+ try:
973
+ group["validation"] = _check_group(
974
+ base,
975
+ work,
976
+ group,
977
+ sources or {},
978
+ scratch / group["id"],
979
+ env,
980
+ protected,
981
+ ascend_pairs or {},
982
+ )
983
+ except (OSError, ValueError, TypeError, KeyError) as exc:
984
+ group.update(
985
+ status="failed",
986
+ validation={"status": "failed", "error": str(exc)},
987
+ )
988
+ else:
989
+ accepted.append(group)
990
+ data["groups"] = checked_groups
991
+ for candidate in data["candidates"]:
992
+ states = {groups[name]["status"] for name in candidate["groups"]}
993
+ if states:
994
+ candidate["status"] = next(
995
+ status
996
+ for status in ("ready", "failed", "blocked", "unchanged")
997
+ if status in states
998
+ )
999
+ data["patch"] = "".join(group["patch"] for group in accepted)
1000
+ data["patch_digest"] = hashlib.sha256(data["patch"].encode()).hexdigest()
1001
+ data["report_digest"] = report_digest(data)
1002
+ return data