@descryy/core 0.1.0

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 (366) hide show
  1. package/LICENSE +21 -0
  2. package/dist/capabilities/index.d.ts +3 -0
  3. package/dist/capabilities/index.d.ts.map +1 -0
  4. package/dist/capabilities/index.js +2 -0
  5. package/dist/capabilities/index.js.map +1 -0
  6. package/dist/capabilities/preconditions.d.ts +99 -0
  7. package/dist/capabilities/preconditions.d.ts.map +1 -0
  8. package/dist/capabilities/preconditions.js +94 -0
  9. package/dist/capabilities/preconditions.js.map +1 -0
  10. package/dist/contracts/engine.d.ts +90 -0
  11. package/dist/contracts/engine.d.ts.map +1 -0
  12. package/dist/contracts/engine.js +291 -0
  13. package/dist/contracts/engine.js.map +1 -0
  14. package/dist/contracts/index.d.ts +9 -0
  15. package/dist/contracts/index.d.ts.map +1 -0
  16. package/dist/contracts/index.js +5 -0
  17. package/dist/contracts/index.js.map +1 -0
  18. package/dist/contracts/orphans.d.ts +96 -0
  19. package/dist/contracts/orphans.d.ts.map +1 -0
  20. package/dist/contracts/orphans.js +241 -0
  21. package/dist/contracts/orphans.js.map +1 -0
  22. package/dist/contracts/paths.d.ts +132 -0
  23. package/dist/contracts/paths.d.ts.map +1 -0
  24. package/dist/contracts/paths.js +245 -0
  25. package/dist/contracts/paths.js.map +1 -0
  26. package/dist/contracts/shapes.d.ts +99 -0
  27. package/dist/contracts/shapes.d.ts.map +1 -0
  28. package/dist/contracts/shapes.js +196 -0
  29. package/dist/contracts/shapes.js.map +1 -0
  30. package/dist/governance/budget.d.ts +89 -0
  31. package/dist/governance/budget.d.ts.map +1 -0
  32. package/dist/governance/budget.js +101 -0
  33. package/dist/governance/budget.js.map +1 -0
  34. package/dist/governance/candidate-boundary.d.ts +49 -0
  35. package/dist/governance/candidate-boundary.d.ts.map +1 -0
  36. package/dist/governance/candidate-boundary.js +51 -0
  37. package/dist/governance/candidate-boundary.js.map +1 -0
  38. package/dist/governance/escalation.d.ts +63 -0
  39. package/dist/governance/escalation.d.ts.map +1 -0
  40. package/dist/governance/escalation.js +72 -0
  41. package/dist/governance/escalation.js.map +1 -0
  42. package/dist/governance/fact-boundary.d.ts +77 -0
  43. package/dist/governance/fact-boundary.d.ts.map +1 -0
  44. package/dist/governance/fact-boundary.js +91 -0
  45. package/dist/governance/fact-boundary.js.map +1 -0
  46. package/dist/governance/finding-funnel.d.ts +109 -0
  47. package/dist/governance/finding-funnel.d.ts.map +1 -0
  48. package/dist/governance/finding-funnel.js +137 -0
  49. package/dist/governance/finding-funnel.js.map +1 -0
  50. package/dist/governance/index.d.ts +11 -0
  51. package/dist/governance/index.d.ts.map +1 -0
  52. package/dist/governance/index.js +6 -0
  53. package/dist/governance/index.js.map +1 -0
  54. package/dist/graph/build.d.ts +127 -0
  55. package/dist/graph/build.d.ts.map +1 -0
  56. package/dist/graph/build.js +0 -0
  57. package/dist/graph/build.js.map +1 -0
  58. package/dist/graph/cross-language.d.ts +70 -0
  59. package/dist/graph/cross-language.d.ts.map +1 -0
  60. package/dist/graph/cross-language.js +104 -0
  61. package/dist/graph/cross-language.js.map +1 -0
  62. package/dist/graph/index.d.ts +11 -0
  63. package/dist/graph/index.d.ts.map +1 -0
  64. package/dist/graph/index.js +6 -0
  65. package/dist/graph/index.js.map +1 -0
  66. package/dist/graph/merge.d.ts +95 -0
  67. package/dist/graph/merge.d.ts.map +1 -0
  68. package/dist/graph/merge.js +131 -0
  69. package/dist/graph/merge.js.map +1 -0
  70. package/dist/graph/persist.d.ts +42 -0
  71. package/dist/graph/persist.d.ts.map +1 -0
  72. package/dist/graph/persist.js +52 -0
  73. package/dist/graph/persist.js.map +1 -0
  74. package/dist/graph/runtime-confirmation.d.ts +169 -0
  75. package/dist/graph/runtime-confirmation.d.ts.map +1 -0
  76. package/dist/graph/runtime-confirmation.js +318 -0
  77. package/dist/graph/runtime-confirmation.js.map +1 -0
  78. package/dist/index.d.ts +18 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +19 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/ledger/index.d.ts +5 -0
  83. package/dist/ledger/index.d.ts.map +1 -0
  84. package/dist/ledger/index.js +3 -0
  85. package/dist/ledger/index.js.map +1 -0
  86. package/dist/ledger/mint.d.ts +81 -0
  87. package/dist/ledger/mint.d.ts.map +1 -0
  88. package/dist/ledger/mint.js +138 -0
  89. package/dist/ledger/mint.js.map +1 -0
  90. package/dist/ledger/resolve.d.ts +124 -0
  91. package/dist/ledger/resolve.d.ts.map +1 -0
  92. package/dist/ledger/resolve.js +290 -0
  93. package/dist/ledger/resolve.js.map +1 -0
  94. package/dist/multipr/fingerprint.d.ts +56 -0
  95. package/dist/multipr/fingerprint.d.ts.map +1 -0
  96. package/dist/multipr/fingerprint.js +169 -0
  97. package/dist/multipr/fingerprint.js.map +1 -0
  98. package/dist/multipr/hidden-dependency.d.ts +120 -0
  99. package/dist/multipr/hidden-dependency.d.ts.map +1 -0
  100. package/dist/multipr/hidden-dependency.js +185 -0
  101. package/dist/multipr/hidden-dependency.js.map +1 -0
  102. package/dist/multipr/index.d.ts +14 -0
  103. package/dist/multipr/index.d.ts.map +1 -0
  104. package/dist/multipr/index.js +8 -0
  105. package/dist/multipr/index.js.map +1 -0
  106. package/dist/multipr/mechanical.d.ts +239 -0
  107. package/dist/multipr/mechanical.d.ts.map +1 -0
  108. package/dist/multipr/mechanical.js +333 -0
  109. package/dist/multipr/mechanical.js.map +1 -0
  110. package/dist/multipr/migration-heads.d.ts +160 -0
  111. package/dist/multipr/migration-heads.d.ts.map +1 -0
  112. package/dist/multipr/migration-heads.js +212 -0
  113. package/dist/multipr/migration-heads.js.map +1 -0
  114. package/dist/multipr/overlap.d.ts +186 -0
  115. package/dist/multipr/overlap.d.ts.map +1 -0
  116. package/dist/multipr/overlap.js +254 -0
  117. package/dist/multipr/overlap.js.map +1 -0
  118. package/dist/multipr/scope-store.d.ts +105 -0
  119. package/dist/multipr/scope-store.d.ts.map +1 -0
  120. package/dist/multipr/scope-store.js +182 -0
  121. package/dist/multipr/scope-store.js.map +1 -0
  122. package/dist/multipr/superseded.d.ts +133 -0
  123. package/dist/multipr/superseded.d.ts.map +1 -0
  124. package/dist/multipr/superseded.js +128 -0
  125. package/dist/multipr/superseded.js.map +1 -0
  126. package/dist/query/confirmed-facts.d.ts +56 -0
  127. package/dist/query/confirmed-facts.d.ts.map +1 -0
  128. package/dist/query/confirmed-facts.js +64 -0
  129. package/dist/query/confirmed-facts.js.map +1 -0
  130. package/dist/query/declared-value-closure.d.ts +126 -0
  131. package/dist/query/declared-value-closure.d.ts.map +1 -0
  132. package/dist/query/declared-value-closure.js +156 -0
  133. package/dist/query/declared-value-closure.js.map +1 -0
  134. package/dist/query/index.d.ts +28 -0
  135. package/dist/query/index.d.ts.map +1 -0
  136. package/dist/query/index.js +15 -0
  137. package/dist/query/index.js.map +1 -0
  138. package/dist/query/memory.d.ts +20 -0
  139. package/dist/query/memory.d.ts.map +1 -0
  140. package/dist/query/memory.js +55 -0
  141. package/dist/query/memory.js.map +1 -0
  142. package/dist/query/provider.d.ts +127 -0
  143. package/dist/query/provider.d.ts.map +1 -0
  144. package/dist/query/provider.js +54 -0
  145. package/dist/query/provider.js.map +1 -0
  146. package/dist/query/queries.d.ts +119 -0
  147. package/dist/query/queries.d.ts.map +1 -0
  148. package/dist/query/queries.js +267 -0
  149. package/dist/query/queries.js.map +1 -0
  150. package/dist/query/refusal-fetch.d.ts +114 -0
  151. package/dist/query/refusal-fetch.d.ts.map +1 -0
  152. package/dist/query/refusal-fetch.js +200 -0
  153. package/dist/query/refusal-fetch.js.map +1 -0
  154. package/dist/query/refusal-questions.d.ts +123 -0
  155. package/dist/query/refusal-questions.d.ts.map +1 -0
  156. package/dist/query/refusal-questions.js +122 -0
  157. package/dist/query/refusal-questions.js.map +1 -0
  158. package/dist/query/root-cause-score.d.ts +218 -0
  159. package/dist/query/root-cause-score.d.ts.map +1 -0
  160. package/dist/query/root-cause-score.js +251 -0
  161. package/dist/query/root-cause-score.js.map +1 -0
  162. package/dist/query/row-closure-picture.d.ts +108 -0
  163. package/dist/query/row-closure-picture.d.ts.map +1 -0
  164. package/dist/query/row-closure-picture.js +131 -0
  165. package/dist/query/row-closure-picture.js.map +1 -0
  166. package/dist/query/similar-incidents.d.ts +76 -0
  167. package/dist/query/similar-incidents.d.ts.map +1 -0
  168. package/dist/query/similar-incidents.js +169 -0
  169. package/dist/query/similar-incidents.js.map +1 -0
  170. package/dist/query/sqlite.d.ts +13 -0
  171. package/dist/query/sqlite.d.ts.map +1 -0
  172. package/dist/query/sqlite.js +54 -0
  173. package/dist/query/sqlite.js.map +1 -0
  174. package/dist/query/traverse.d.ts +110 -0
  175. package/dist/query/traverse.d.ts.map +1 -0
  176. package/dist/query/traverse.js +0 -0
  177. package/dist/query/traverse.js.map +1 -0
  178. package/dist/query/unresolved.d.ts +195 -0
  179. package/dist/query/unresolved.d.ts.map +1 -0
  180. package/dist/query/unresolved.js +225 -0
  181. package/dist/query/unresolved.js.map +1 -0
  182. package/dist/query/verification-status.d.ts +134 -0
  183. package/dist/query/verification-status.d.ts.map +1 -0
  184. package/dist/query/verification-status.js +163 -0
  185. package/dist/query/verification-status.js.map +1 -0
  186. package/dist/recording/index.d.ts +26 -0
  187. package/dist/recording/index.d.ts.map +1 -0
  188. package/dist/recording/index.js +30 -0
  189. package/dist/recording/index.js.map +1 -0
  190. package/dist/recording/migrate.d.ts +22 -0
  191. package/dist/recording/migrate.d.ts.map +1 -0
  192. package/dist/recording/migrate.js +51 -0
  193. package/dist/recording/migrate.js.map +1 -0
  194. package/dist/recording/reader.d.ts +27 -0
  195. package/dist/recording/reader.d.ts.map +1 -0
  196. package/dist/recording/reader.js +55 -0
  197. package/dist/recording/reader.js.map +1 -0
  198. package/dist/recording/redact.d.ts +63 -0
  199. package/dist/recording/redact.d.ts.map +1 -0
  200. package/dist/recording/redact.js +98 -0
  201. package/dist/recording/redact.js.map +1 -0
  202. package/dist/recording/schema.d.ts +41 -0
  203. package/dist/recording/schema.d.ts.map +1 -0
  204. package/dist/recording/schema.js +104 -0
  205. package/dist/recording/schema.js.map +1 -0
  206. package/dist/recording/writer.d.ts +120 -0
  207. package/dist/recording/writer.d.ts.map +1 -0
  208. package/dist/recording/writer.js +81 -0
  209. package/dist/recording/writer.js.map +1 -0
  210. package/dist/scoping/fanout.d.ts +86 -0
  211. package/dist/scoping/fanout.d.ts.map +1 -0
  212. package/dist/scoping/fanout.js +95 -0
  213. package/dist/scoping/fanout.js.map +1 -0
  214. package/dist/scoping/index.d.ts +10 -0
  215. package/dist/scoping/index.d.ts.map +1 -0
  216. package/dist/scoping/index.js +6 -0
  217. package/dist/scoping/index.js.map +1 -0
  218. package/dist/scoping/score.d.ts +83 -0
  219. package/dist/scoping/score.d.ts.map +1 -0
  220. package/dist/scoping/score.js +125 -0
  221. package/dist/scoping/score.js.map +1 -0
  222. package/dist/scoping/tiers.d.ts +32 -0
  223. package/dist/scoping/tiers.d.ts.map +1 -0
  224. package/dist/scoping/tiers.js +35 -0
  225. package/dist/scoping/tiers.js.map +1 -0
  226. package/dist/scoping/traverse.d.ts +60 -0
  227. package/dist/scoping/traverse.d.ts.map +1 -0
  228. package/dist/scoping/traverse.js +172 -0
  229. package/dist/scoping/traverse.js.map +1 -0
  230. package/dist/scoping/weights.d.ts +97 -0
  231. package/dist/scoping/weights.d.ts.map +1 -0
  232. package/dist/scoping/weights.js +167 -0
  233. package/dist/scoping/weights.js.map +1 -0
  234. package/dist/sources/git/diff.d.ts +53 -0
  235. package/dist/sources/git/diff.d.ts.map +1 -0
  236. package/dist/sources/git/diff.js +140 -0
  237. package/dist/sources/git/diff.js.map +1 -0
  238. package/dist/sources/git/env.d.ts +2 -0
  239. package/dist/sources/git/env.d.ts.map +1 -0
  240. package/dist/sources/git/env.js +21 -0
  241. package/dist/sources/git/env.js.map +1 -0
  242. package/dist/sources/git/history.d.ts +140 -0
  243. package/dist/sources/git/history.d.ts.map +1 -0
  244. package/dist/sources/git/history.js +314 -0
  245. package/dist/sources/git/history.js.map +1 -0
  246. package/dist/sources/git/index.d.ts +7 -0
  247. package/dist/sources/git/index.d.ts.map +1 -0
  248. package/dist/sources/git/index.js +4 -0
  249. package/dist/sources/git/index.js.map +1 -0
  250. package/dist/sources/git/source.d.ts +95 -0
  251. package/dist/sources/git/source.d.ts.map +1 -0
  252. package/dist/sources/git/source.js +0 -0
  253. package/dist/sources/git/source.js.map +1 -0
  254. package/dist/sources/migrations/dialects.d.ts +59 -0
  255. package/dist/sources/migrations/dialects.d.ts.map +1 -0
  256. package/dist/sources/migrations/dialects.js +84 -0
  257. package/dist/sources/migrations/dialects.js.map +1 -0
  258. package/dist/sources/migrations/index.d.ts +3 -0
  259. package/dist/sources/migrations/index.d.ts.map +1 -0
  260. package/dist/sources/migrations/index.js +2 -0
  261. package/dist/sources/migrations/index.js.map +1 -0
  262. package/dist/sources/migrations/read.d.ts +113 -0
  263. package/dist/sources/migrations/read.d.ts.map +1 -0
  264. package/dist/sources/migrations/read.js +270 -0
  265. package/dist/sources/migrations/read.js.map +1 -0
  266. package/dist/sources/workspace/index.d.ts +3 -0
  267. package/dist/sources/workspace/index.d.ts.map +1 -0
  268. package/dist/sources/workspace/index.js +2 -0
  269. package/dist/sources/workspace/index.js.map +1 -0
  270. package/dist/sources/workspace/workspace.d.ts +64 -0
  271. package/dist/sources/workspace/workspace.d.ts.map +1 -0
  272. package/dist/sources/workspace/workspace.js +294 -0
  273. package/dist/sources/workspace/workspace.js.map +1 -0
  274. package/dist/store/driver/driver.d.ts +82 -0
  275. package/dist/store/driver/driver.d.ts.map +1 -0
  276. package/dist/store/driver/driver.js +31 -0
  277. package/dist/store/driver/driver.js.map +1 -0
  278. package/dist/store/driver/node-sqlite.d.ts +28 -0
  279. package/dist/store/driver/node-sqlite.d.ts.map +1 -0
  280. package/dist/store/driver/node-sqlite.js +188 -0
  281. package/dist/store/driver/node-sqlite.js.map +1 -0
  282. package/dist/store/index.d.ts +33 -0
  283. package/dist/store/index.d.ts.map +1 -0
  284. package/dist/store/index.js +46 -0
  285. package/dist/store/index.js.map +1 -0
  286. package/dist/store/migrate.d.ts +68 -0
  287. package/dist/store/migrate.d.ts.map +1 -0
  288. package/dist/store/migrate.js +140 -0
  289. package/dist/store/migrate.js.map +1 -0
  290. package/dist/store/reader.d.ts +127 -0
  291. package/dist/store/reader.d.ts.map +1 -0
  292. package/dist/store/reader.js +269 -0
  293. package/dist/store/reader.js.map +1 -0
  294. package/dist/store/schema.d.ts +87 -0
  295. package/dist/store/schema.d.ts.map +1 -0
  296. package/dist/store/schema.js +322 -0
  297. package/dist/store/schema.js.map +1 -0
  298. package/dist/store/writer.d.ts +116 -0
  299. package/dist/store/writer.d.ts.map +1 -0
  300. package/dist/store/writer.js +279 -0
  301. package/dist/store/writer.js.map +1 -0
  302. package/dist/tiers/certify.d.ts +375 -0
  303. package/dist/tiers/certify.d.ts.map +1 -0
  304. package/dist/tiers/certify.js +434 -0
  305. package/dist/tiers/certify.js.map +1 -0
  306. package/dist/tiers/index.d.ts +5 -0
  307. package/dist/tiers/index.d.ts.map +1 -0
  308. package/dist/tiers/index.js +3 -0
  309. package/dist/tiers/index.js.map +1 -0
  310. package/dist/tiers/ladder.d.ts +73 -0
  311. package/dist/tiers/ladder.d.ts.map +1 -0
  312. package/dist/tiers/ladder.js +197 -0
  313. package/dist/tiers/ladder.js.map +1 -0
  314. package/dist/validation/config-graph.d.ts +104 -0
  315. package/dist/validation/config-graph.d.ts.map +1 -0
  316. package/dist/validation/config-graph.js +205 -0
  317. package/dist/validation/config-graph.js.map +1 -0
  318. package/dist/validation/env.d.ts +243 -0
  319. package/dist/validation/env.d.ts.map +1 -0
  320. package/dist/validation/env.js +447 -0
  321. package/dist/validation/env.js.map +1 -0
  322. package/dist/validation/index.d.ts +16 -0
  323. package/dist/validation/index.d.ts.map +1 -0
  324. package/dist/validation/index.js +9 -0
  325. package/dist/validation/index.js.map +1 -0
  326. package/dist/validation/join-substitution.d.ts +186 -0
  327. package/dist/validation/join-substitution.d.ts.map +1 -0
  328. package/dist/validation/join-substitution.js +191 -0
  329. package/dist/validation/join-substitution.js.map +1 -0
  330. package/dist/validation/migrations.d.ts +133 -0
  331. package/dist/validation/migrations.d.ts.map +1 -0
  332. package/dist/validation/migrations.js +315 -0
  333. package/dist/validation/migrations.js.map +1 -0
  334. package/dist/validation/nodes.d.ts +32 -0
  335. package/dist/validation/nodes.d.ts.map +1 -0
  336. package/dist/validation/nodes.js +45 -0
  337. package/dist/validation/nodes.js.map +1 -0
  338. package/dist/validation/rollback.d.ts +124 -0
  339. package/dist/validation/rollback.d.ts.map +1 -0
  340. package/dist/validation/rollback.js +302 -0
  341. package/dist/validation/rollback.js.map +1 -0
  342. package/dist/validation/route-drift.d.ts +108 -0
  343. package/dist/validation/route-drift.d.ts.map +1 -0
  344. package/dist/validation/route-drift.js +103 -0
  345. package/dist/validation/route-drift.js.map +1 -0
  346. package/dist/validation/sources.d.ts +153 -0
  347. package/dist/validation/sources.d.ts.map +1 -0
  348. package/dist/validation/sources.js +409 -0
  349. package/dist/validation/sources.js.map +1 -0
  350. package/dist/worker/index.d.ts +5 -0
  351. package/dist/worker/index.d.ts.map +1 -0
  352. package/dist/worker/index.js +3 -0
  353. package/dist/worker/index.js.map +1 -0
  354. package/dist/worker/pool.d.ts +73 -0
  355. package/dist/worker/pool.d.ts.map +1 -0
  356. package/dist/worker/pool.js +203 -0
  357. package/dist/worker/pool.js.map +1 -0
  358. package/dist/worker/protocol.d.ts +91 -0
  359. package/dist/worker/protocol.d.ts.map +1 -0
  360. package/dist/worker/protocol.js +19 -0
  361. package/dist/worker/protocol.js.map +1 -0
  362. package/dist/worker/traversal.worker.d.ts +25 -0
  363. package/dist/worker/traversal.worker.d.ts.map +1 -0
  364. package/dist/worker/traversal.worker.js +124 -0
  365. package/dist/worker/traversal.worker.js.map +1 -0
  366. package/package.json +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fingerprint.js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ACd,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,QAAQ;QACzC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,QAAQ;QACvC,0EAA0E;QAC1E,kEAAkE;QAClE,wEAAwE;QACxE,sEAAsE;QACtE,yBAAyB;QACzB,UAAU,EAAE,CAAC;KACd,CAAC,CAAC,CAAC;IAEJ,KAAK,CAAC,IAAI,CACR,GAAG,UAAU,CAAC,MAAM,6BAA6B,IAAI,WAAW,IAAI,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK;QAChG,4FAA4F;QAC5F,8FAA8F,CACjG,CAAC;IACF,KAAK,CAAC,IAAI,CACR,8FAA8F;QAC5F,4FAA4F;QAC5F,0BAA0B,CAC7B,CAAC;IAEF,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;AACxD,CAAC"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * §14.8 — the historically coupled file that was **not** touched.
3
+ *
4
+ * `CHANGES_WITH` queried in the opposite direction from diff scoping. Scoping
5
+ * asks *what else does this change reach*; this asks *what usually moves with
6
+ * this and did not this time*.
7
+ *
8
+ * ## Why this is the first multi-PR check built
9
+ *
10
+ * §14.8 calls it nearly free, and the reason is worth stating rather than
11
+ * assuming: **the edges already exist**, it needs no per-PR storage, and it
12
+ * works at R0 in any language with no adapter beyond file paths. For a
13
+ * repository whose language has no adapter at all, this is the check that
14
+ * still fires. Every other check in §14 needs either a persisted per-PR
15
+ * subgraph (§14.2) or a UI framework extractor (§14.7).
16
+ *
17
+ * ## Everything here is Class C and that is not a limitation to be fixed
18
+ *
19
+ * DEC-033 is explicit: co-change is evidence about **people**, not about
20
+ * program structure. *"These two files usually change together"* is a hint for
21
+ * a human, never a claim about what breaks. The git source emits at R0,
22
+ * §11A.5 caps any finding resting on it at C, and no amount of support count
23
+ * changes that — a pair that co-changed two hundred times is a stronger hint
24
+ * and still a hint.
25
+ *
26
+ * So this module reports a *nudge* and says so in the words it hands back. A
27
+ * caller that renders these as defects has broken principle 4 at the last
28
+ * gate, and the note travels with the finding to make that hard.
29
+ *
30
+ * ## The empty answer is two different answers
31
+ *
32
+ * A pull request with no hidden dependencies and a graph that never read any
33
+ * history produce **the same empty list**. That conflation is the single most
34
+ * expensive defect this project has: an absent carrier read as an empty one
35
+ * shipped three static-validation checks dead, and a shape reader that
36
+ * filtered for the wrong spelling answered "no fields" for 77 of 77 nodes
37
+ * that visibly declared them.
38
+ *
39
+ * So `analysed` is false when the graph holds no `CHANGES_WITH` edge for any
40
+ * changed file, and the caller is told *the history was not read* rather than
41
+ * *nothing is coupled*. A repository younger than the support floor, a graph
42
+ * built without the git source, and a genuinely uncoupled change are three
43
+ * different statements.
44
+ */
45
+ import type { IRNode } from "@descryy/ir";
46
+ import type { ReliabilityClass } from "@descryy/ir";
47
+ import type { AdjacencyProvider, QueryResult } from "../query/provider.ts";
48
+ /** A file that historically moves with the change and did not move this time. */
49
+ export interface HiddenDependency {
50
+ /** The coupled file that was not touched. */
51
+ readonly node: IRNode;
52
+ /** Which changed files it is coupled to, most-supported first. */
53
+ readonly coupledTo: readonly {
54
+ readonly node: IRNode;
55
+ /** Commits in which the two changed together. */
56
+ readonly support: number;
57
+ /** `support / max(times either file changed)`, as observed. */
58
+ readonly observedConfidence: number;
59
+ }[];
60
+ /** The strongest support across `coupledTo` — what the ranking uses. */
61
+ readonly strongestSupport: number;
62
+ /** Always `"C"`. Present so a caller cannot render this without it. */
63
+ readonly reliability: ReliabilityClass;
64
+ /** The sentence that must travel with the finding. */
65
+ readonly disclosure: string;
66
+ }
67
+ export interface HiddenDependencyReport {
68
+ readonly findings: readonly HiddenDependency[];
69
+ /** The count before `limit` capped it — P27's disclosed remainder: a structured field, not only a prose note. */
70
+ readonly findingsTotal: number;
71
+ /**
72
+ * False when no changed file had a single `CHANGES_WITH` edge.
73
+ *
74
+ * **An empty `findings` with `analysed: false` means the history was not
75
+ * read, not that nothing is coupled.** The two are different answers to
76
+ * different questions and collapsing them is §20.2's second category
77
+ * swallowing its fourth.
78
+ */
79
+ readonly analysed: boolean;
80
+ readonly checked: {
81
+ /** Changed paths the caller supplied. */
82
+ readonly changed: number;
83
+ /** Of those, how many resolved to a `FILE` node in the graph. */
84
+ readonly resolved: number;
85
+ /** Of those, how many carried at least one co-change edge. */
86
+ readonly withHistory: number;
87
+ /** Coupled files considered before the support floor and the cap. */
88
+ readonly candidates: number;
89
+ };
90
+ /**
91
+ * Changed paths with no `FILE` node in the graph.
92
+ *
93
+ * Not "these have no hidden dependencies" — nothing looked at them. A path
94
+ * the graph never read is a path with no blast radius only if you conflate
95
+ * the two.
96
+ */
97
+ readonly unresolvedChanged: readonly string[];
98
+ }
99
+ export interface HiddenDependencyOptions {
100
+ /**
101
+ * Minimum co-change support to surface. Defaults to the edge's own floor,
102
+ * because an edge that exists already cleared DEC-033's support and
103
+ * confidence floors — raising it here is a second, separate judgement and
104
+ * belongs to the caller.
105
+ */
106
+ readonly minSupport?: number;
107
+ /**
108
+ * Hard cap on findings, per rule 5. Truncation is reported, never silent.
109
+ */
110
+ readonly limit?: number;
111
+ }
112
+ /**
113
+ * Files coupled to the change that the change did not touch.
114
+ *
115
+ * @param changedIds `FILE` node ids the pull request touched
116
+ * @param unresolvedChanged paths the caller could not resolve to a node — passed
117
+ * in rather than discovered, because only the caller knows what it asked for
118
+ */
119
+ export declare function findHiddenDependencies(provider: AdjacencyProvider, changedIds: readonly string[], unresolvedChanged?: readonly string[], options?: HiddenDependencyOptions): QueryResult<HiddenDependencyReport>;
120
+ //# sourceMappingURL=hidden-dependency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hidden-dependency.d.ts","sourceRoot":"","sources":["../../src/multipr/hidden-dependency.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AC,UAAU,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAuCD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,iBAAiB,GAAE,SAAS,MAAM,EAAO,EACzC,OAAO,GAAE,uBAA4B,GACpC,WAAW,CAAC,sBAAsB,CAAC,CAyHrC"}
@@ -0,0 +1,185 @@
1
+ /**
2
+ * §14.8 — the historically coupled file that was **not** touched.
3
+ *
4
+ * `CHANGES_WITH` queried in the opposite direction from diff scoping. Scoping
5
+ * asks *what else does this change reach*; this asks *what usually moves with
6
+ * this and did not this time*.
7
+ *
8
+ * ## Why this is the first multi-PR check built
9
+ *
10
+ * §14.8 calls it nearly free, and the reason is worth stating rather than
11
+ * assuming: **the edges already exist**, it needs no per-PR storage, and it
12
+ * works at R0 in any language with no adapter beyond file paths. For a
13
+ * repository whose language has no adapter at all, this is the check that
14
+ * still fires. Every other check in §14 needs either a persisted per-PR
15
+ * subgraph (§14.2) or a UI framework extractor (§14.7).
16
+ *
17
+ * ## Everything here is Class C and that is not a limitation to be fixed
18
+ *
19
+ * DEC-033 is explicit: co-change is evidence about **people**, not about
20
+ * program structure. *"These two files usually change together"* is a hint for
21
+ * a human, never a claim about what breaks. The git source emits at R0,
22
+ * §11A.5 caps any finding resting on it at C, and no amount of support count
23
+ * changes that — a pair that co-changed two hundred times is a stronger hint
24
+ * and still a hint.
25
+ *
26
+ * So this module reports a *nudge* and says so in the words it hands back. A
27
+ * caller that renders these as defects has broken principle 4 at the last
28
+ * gate, and the note travels with the finding to make that hard.
29
+ *
30
+ * ## The empty answer is two different answers
31
+ *
32
+ * A pull request with no hidden dependencies and a graph that never read any
33
+ * history produce **the same empty list**. That conflation is the single most
34
+ * expensive defect this project has: an absent carrier read as an empty one
35
+ * shipped three static-validation checks dead, and a shape reader that
36
+ * filtered for the wrong spelling answered "no fields" for 77 of 77 nodes
37
+ * that visibly declared them.
38
+ *
39
+ * So `analysed` is false when the graph holds no `CHANGES_WITH` edge for any
40
+ * changed file, and the caller is told *the history was not read* rather than
41
+ * *nothing is coupled*. A repository younger than the support floor, a graph
42
+ * built without the git source, and a genuinely uncoupled change are three
43
+ * different statements.
44
+ */
45
+ import { reliabilityCap, reliabilityNote } from "@descryy/ir";
46
+ const DEFAULT_LIMIT = 10;
47
+ /**
48
+ * `CHANGES_WITH` is stored in one canonical direction (DEC-036), so both
49
+ * directions must be walked. Reading only `outgoing` halves the answer and
50
+ * produces no error — the same silent-halving shape as an undirected edge
51
+ * traversed one way in scoping, which is why `traverse.ts` carries the same
52
+ * set.
53
+ */
54
+ function coupledNeighbours(provider, id) {
55
+ const out = [];
56
+ const seen = new Set();
57
+ const options = { types: ["CHANGES_WITH"] };
58
+ const walk = (edges, other) => {
59
+ for (const edge of edges) {
60
+ const id2 = other(edge);
61
+ if (id2 === id || seen.has(id2))
62
+ continue;
63
+ seen.add(id2);
64
+ const raw = edge.attrs ?? {};
65
+ out.push({
66
+ id: id2,
67
+ support: typeof raw["support"] === "number" ? raw["support"] : 0,
68
+ observedConfidence: typeof raw["observedConfidence"] === "number" ? raw["observedConfidence"] : 0,
69
+ });
70
+ }
71
+ };
72
+ walk(provider.outgoing(id, options), (e) => e.to);
73
+ walk(provider.incoming(id, options), (e) => e.from);
74
+ return out;
75
+ }
76
+ /**
77
+ * Files coupled to the change that the change did not touch.
78
+ *
79
+ * @param changedIds `FILE` node ids the pull request touched
80
+ * @param unresolvedChanged paths the caller could not resolve to a node — passed
81
+ * in rather than discovered, because only the caller knows what it asked for
82
+ */
83
+ export function findHiddenDependencies(provider, changedIds, unresolvedChanged = [], options = {}) {
84
+ const limit = options.limit ?? DEFAULT_LIMIT;
85
+ const minSupport = options.minSupport ?? 0;
86
+ const changed = new Set(changedIds);
87
+ const changedNodes = new Map();
88
+ for (const id of changed) {
89
+ const node = provider.node(id);
90
+ if (node !== undefined)
91
+ changedNodes.set(id, node);
92
+ }
93
+ // candidate id -> the changed files it is coupled to
94
+ const candidates = new Map();
95
+ let withHistory = 0;
96
+ for (const [id, node] of changedNodes) {
97
+ const neighbours = coupledNeighbours(provider, id);
98
+ if (neighbours.length > 0)
99
+ withHistory += 1;
100
+ for (const n of neighbours) {
101
+ // The coupled file WAS touched. That is the check passing, not a finding.
102
+ if (changed.has(n.id))
103
+ continue;
104
+ if (n.support < minSupport)
105
+ continue;
106
+ let entry = candidates.get(n.id);
107
+ if (entry === undefined) {
108
+ entry = { node: provider.node(n.id) ?? null, links: [] };
109
+ candidates.set(n.id, entry);
110
+ }
111
+ entry.links.push({ node, support: n.support, observedConfidence: n.observedConfidence });
112
+ }
113
+ }
114
+ // R0 evidence, and the claim is name-level: this file is or is not in the
115
+ // diff. §11A.5 caps it at C either way — R0's name-level row is still C, and
116
+ // only R2 buys the A carve-out. Computed rather than written down so that a
117
+ // change to the table cannot leave this stale.
118
+ const reliability = reliabilityCap(0, true);
119
+ const disclosure = `${reliabilityNote(0, true)} Co-change is evidence about how people have edited ` +
120
+ "this repository, not about what the program does — a strongly coupled pair is a " +
121
+ "stronger hint and is still a hint.";
122
+ const findings = [];
123
+ for (const [, entry] of candidates) {
124
+ if (entry.node === null)
125
+ continue;
126
+ const links = [...entry.links].sort((a, b) => b.support - a.support);
127
+ findings.push({
128
+ node: entry.node,
129
+ coupledTo: links.map((l) => ({
130
+ node: l.node,
131
+ support: l.support,
132
+ observedConfidence: l.observedConfidence,
133
+ })),
134
+ strongestSupport: links[0]?.support ?? 0,
135
+ reliability,
136
+ disclosure,
137
+ });
138
+ }
139
+ findings.sort((a, b) => b.strongestSupport - a.strongestSupport || a.node.file.localeCompare(b.node.file));
140
+ const kept = findings.slice(0, limit);
141
+ const truncated = findings.length > limit;
142
+ // The baseline precondition. Nothing was read, so nothing can be concluded —
143
+ // and "no hidden dependencies" is a conclusion.
144
+ const analysed = withHistory > 0;
145
+ const notes = [];
146
+ if (!analysed) {
147
+ notes.push("No co-change history was found for any changed file, so this check did not run. " +
148
+ "That is not a finding that nothing is coupled: a graph built without the git " +
149
+ "history source, a repository with fewer commits than the support floor, and a " +
150
+ "genuinely uncoupled change are three different situations and this answer " +
151
+ "cannot tell them apart.");
152
+ }
153
+ if (unresolvedChanged.length > 0) {
154
+ notes.push(`${unresolvedChanged.length} changed path(s) have no node in the graph and were not ` +
155
+ "examined: " +
156
+ `${unresolvedChanged.slice(0, 5).join(", ")}${unresolvedChanged.length > 5 ? ", …" : ""}. ` +
157
+ "Nothing looked at them, which is not the same as finding nothing in them.");
158
+ }
159
+ if (truncated) {
160
+ notes.push(`${findings.length} coupled files were surfaced and the ${kept.length} with the ` +
161
+ "strongest history are reported.");
162
+ }
163
+ if (analysed && kept.length > 0) {
164
+ notes.push(disclosure);
165
+ }
166
+ const stamp = { ...provider.baseStamp(), resolutionFloor: 0 };
167
+ return {
168
+ data: {
169
+ findings: kept,
170
+ findingsTotal: findings.length,
171
+ analysed,
172
+ checked: {
173
+ changed: changedIds.length,
174
+ resolved: changedNodes.size,
175
+ withHistory,
176
+ candidates: candidates.size,
177
+ },
178
+ unresolvedChanged,
179
+ },
180
+ stamp,
181
+ truncated,
182
+ notes,
183
+ };
184
+ }
185
+ //# sourceMappingURL=hidden-dependency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hidden-dependency.js","sourceRoot":"","sources":["../../src/multipr/hidden-dependency.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAGH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAA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AAM,wCAAwC,IAAI,CAAC,MAAM,YAAY;YAC/E,iCAAiC,CACpC,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC;IAED,MAAM,KAAK,GAAe,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;IAE1E,OAAO;QACL,IAAI,EAAE;YACJ,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,QAAQ,CAAC,MAAM;YAC9B,QAAQ;YACR,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU,CAAC,MAAM;gBAC1B,QAAQ,EAAE,YAAY,CAAC,IAAI;gBAC3B,WAAW;gBACX,UAAU,EAAE,UAAU,CAAC,IAAI;aAC5B;YACD,iBAAiB;SAClB;QACD,KAAK;QACL,SAAS;QACT,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { findHiddenDependencies } from "./hidden-dependency.ts";
2
+ export type { HiddenDependency, HiddenDependencyReport, HiddenDependencyOptions, } from "./hidden-dependency.ts";
3
+ export { findOverlaps, NODE_TYPE_WEIGHTS, DEFAULT_CONFLICT_THRESHOLD } from "./overlap.ts";
4
+ export type { DiffType, PrScope, PrScopeEntry, SharedNode, OverlapFinding, OverlapReport, OverlapOptions, IncomparablePair, } from "./overlap.ts";
5
+ export { ScopeStore, ScopeDecodeError } from "./scope-store.ts";
6
+ export { findSuperseded } from "./superseded.ts";
7
+ export { supersededCandidates } from "./fingerprint.ts";
8
+ export type { CandidateReport } from "./fingerprint.ts";
9
+ export type { SupersededCandidate, SupersededReport, SupersededOptions, NodeComparison, NodeVerdict, } from "./superseded.ts";
10
+ export { classifyOverlaps, applyMechanical, pairReliability, CONTEXT_LINES } from "./mechanical.ts";
11
+ export type { DiffHunk, MechanicalVerdict, KeepBothResolution, MechanicalClassification, MechanicalReport, MechanicalOptions, ApplyOutcome, ApplyHooks, } from "./mechanical.ts";
12
+ export { findMigrationHeadConflicts } from "./migration-heads.ts";
13
+ export type { MigrationRecord, MigrationHead, HeadConflict, CrossPrDependency, MigrationHeadReport, MigrationHeadOptions, } from "./migration-heads.ts";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/multipr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC3F,YAAY,EACV,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,UAAU,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpG,YAAY,EACV,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,EACV,eAAe,EACf,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { findHiddenDependencies } from "./hidden-dependency.js";
2
+ export { findOverlaps, NODE_TYPE_WEIGHTS, DEFAULT_CONFLICT_THRESHOLD } from "./overlap.js";
3
+ export { ScopeStore, ScopeDecodeError } from "./scope-store.js";
4
+ export { findSuperseded } from "./superseded.js";
5
+ export { supersededCandidates } from "./fingerprint.js";
6
+ export { classifyOverlaps, applyMechanical, pairReliability, CONTEXT_LINES } from "./mechanical.js";
7
+ export { findMigrationHeadConflicts } from "./migration-heads.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/multipr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAMhE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAW3F,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AASxD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAWpG,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,239 @@
1
+ /**
2
+ * §14.4 — is this overlap two people adding lines, or two people disagreeing?
3
+ *
4
+ * `overlap.ts` surfaces a shared node and stops, and says why it stops: *"§14.4's
5
+ * mechanical-versus-semantic classification needs the actual diff lines at the
6
+ * shared node, which this module never sees … Guessing 'mechanical' without
7
+ * reading the lines would be the one place in this system where a wrong guess
8
+ * edits somebody's branch."* This is that module, and it reads the lines.
9
+ *
10
+ * ## The bar here is higher than anywhere else in §14, not lower
11
+ *
12
+ * §14.4 is the **single documented exception** to approval-before-code-change
13
+ * (§9, rule 8). Every other check in this package tells a human to look at
14
+ * something. A `MECHANICAL` verdict may be **auto-applied** — it edits a branch
15
+ * without asking.
16
+ *
17
+ * So rule 2 inverts in consequence, and the asymmetry is the whole design:
18
+ *
19
+ * > A missed mechanical resolution costs a human thirty seconds of `git
20
+ * > mergetool`. A false one silently rewrites two people's work into something
21
+ * > neither wrote and reports success.
22
+ *
23
+ * `MECHANICAL` is therefore claimed **only when every condition is affirmatively
24
+ * established**, never when nothing contradicts it. Absent hunks, a hunk whose
25
+ * shape cannot be read, a file this module cannot reason about — each produces
26
+ * `UNCLASSIFIABLE` with a reason, and `UNCLASSIFIABLE` never auto-applies.
27
+ * `SEMANTIC` is the answer when the lines were read and disagree; that is a
28
+ * different sentence from "the lines were not read", and the two are kept apart
29
+ * for the reason they are kept apart everywhere else in this package.
30
+ *
31
+ * ## What "only add new, non-overlapping lines" has to mean to be safe
32
+ *
33
+ * §14.4's diamond asks whether both changes *"only add new, non-overlapping
34
+ * lines"*. Read literally that is a test on the post-image, and the post-images
35
+ * of two branches are not comparable — they are two different files. The test
36
+ * that means anything is on the **base**:
37
+ *
38
+ * 1. **Every hunk on both sides is a pure insertion** — it consumes zero base
39
+ * lines (`baseLines === 0`). One modified or deleted base line anywhere at
40
+ * this node makes the whole overlap `SEMANTIC`. Not "the modified hunks are
41
+ * semantic and the rest are mechanical": a partially auto-applied overlap is
42
+ * a merge nobody reviewed.
43
+ *
44
+ * 2. **No two insertion points from opposite sides fall within the context
45
+ * window.** Two insertions at base lines 10 and 12 do not touch the same
46
+ * line and git still refuses them, because their three-line contexts
47
+ * overlap. Matching git's own margin rather than testing for exact equality
48
+ * is the difference between a rule about text and a rule about what the
49
+ * merge will actually do.
50
+ *
51
+ * The margin is `CONTEXT_LINES`, and it is deliberately the *conservative*
52
+ * direction: a real mechanical case inside the margin is reported `SEMANTIC` and
53
+ * a human resolves it in half a minute.
54
+ *
55
+ * ## Two claims, two different sources of authority — and only one of them
56
+ * gates the apply
57
+ *
58
+ * This finding rests on two separate things and it is worth being exact about
59
+ * which does what, because conflating them would either block safe applies or
60
+ * permit unsafe ones:
61
+ *
62
+ * | claim | rests on | governs |
63
+ * | --- | --- | --- |
64
+ * | *both changes touch this node* | the graph | whether this is **surfaced**, and the reliability class |
65
+ * | *these hunks merge without conflict* | the diff text | whether this may be **applied** |
66
+ *
67
+ * The reliability class follows `overlap.ts` — the weaker of the two sides'
68
+ * resolutions, per DEC-058 and §11A.5 — and it describes how much to trust that
69
+ * this overlap *matters*. It does not gate the apply, and that is not a
70
+ * loosening: if the graph were wrong about the node, "keep both non-adjacent
71
+ * pure insertions" is still exactly as safe, because the textual claim never
72
+ * depended on the graph being right. Gating the apply on the graph's resolution
73
+ * would be borrowing authority from the wrong evidence.
74
+ *
75
+ * A caller wanting the stricter rule can require class A itself. The point is
76
+ * that the module states which evidence carries which claim rather than folding
77
+ * both into one number.
78
+ *
79
+ * ## Verify-after is not a recommendation and is not expressible as one
80
+ *
81
+ * §14.4 makes the post-apply verification **mandatory** (§19). A `verifyAfter:
82
+ * true` field on a result would be advisory, and an advisory obligation is one
83
+ * `if` away from being skipped by a caller in a hurry.
84
+ *
85
+ * So the apply path is `applyMechanical(plan, { apply, verify })` and **both
86
+ * callbacks are required by the type**. There is no overload that applies
87
+ * without verifying. A `verify` returning false produces `"reverted"`, and a
88
+ * `verify` that throws produces `"verification-failed"` — which is *not* the
89
+ * same outcome and is not collapsed into it, because "the change broke
90
+ * something" and "we could not tell whether the change broke something" are the
91
+ * two categories §20.2 exists to keep apart.
92
+ */
93
+ import type { ResolutionLevel } from "@descryy/ir";
94
+ import type { ReliabilityClass } from "@descryy/ir";
95
+ import type { GraphStamp, QueryResult } from "../query/provider.ts";
96
+ import type { SharedNode } from "./overlap.ts";
97
+ /**
98
+ * git's default diff context. Two insertions closer than this on the base
99
+ * produce overlapping context and git declines to merge them, so this module
100
+ * declines too.
101
+ */
102
+ export declare const CONTEXT_LINES = 3;
103
+ /**
104
+ * One hunk of a change, described against the **base** image.
105
+ *
106
+ * Deliberately not a patch: this module never applies text, so it needs the
107
+ * *shape* of the change and not its content. Describing the shape against the
108
+ * base is what makes two branches comparable at all — their post-images are two
109
+ * different files and comparing those answers nothing.
110
+ */
111
+ export interface DiffHunk {
112
+ readonly file: string;
113
+ /** First base line the hunk touches, 1-indexed. For a pure insertion, the line it follows. */
114
+ readonly baseStart: number;
115
+ /**
116
+ * Base lines consumed. **Zero means a pure insertion**; anything above zero
117
+ * means at least one existing line was modified or deleted.
118
+ */
119
+ readonly baseLines: number;
120
+ /** Lines produced. Reported, never used for classification — see the docstring. */
121
+ readonly headLines: number;
122
+ }
123
+ export type MechanicalVerdict = "MECHANICAL" | "SEMANTIC" | "UNCLASSIFIABLE";
124
+ /** The resolution a `MECHANICAL` verdict proposes. Always "keep both". */
125
+ export interface KeepBothResolution {
126
+ readonly kind: "keep-both";
127
+ /**
128
+ * The two sides' hunks in base order — the order an applier must write them
129
+ * in. Deterministic so that applying twice is applying the same thing.
130
+ */
131
+ readonly order: readonly {
132
+ readonly side: "a" | "b";
133
+ readonly hunk: DiffHunk;
134
+ }[];
135
+ }
136
+ export interface MechanicalClassification {
137
+ readonly nodeId: string;
138
+ readonly verdict: MechanicalVerdict;
139
+ /**
140
+ * Why, in one sentence, always present — including for `MECHANICAL`.
141
+ *
142
+ * A verdict that explains only its refusals trains a reader to skim the
143
+ * approvals, which are the ones that edit a branch.
144
+ */
145
+ readonly reason: string;
146
+ /** Present only for `MECHANICAL`. */
147
+ readonly resolution?: KeepBothResolution;
148
+ /** From the graph: how much to trust that this overlap matters. Never gates the apply. */
149
+ readonly reliability: ReliabilityClass;
150
+ readonly resolution_level: ResolutionLevel;
151
+ /** Hunks read, per side. Zero on either side is a refusal, not a pass. */
152
+ readonly hunksRead: readonly [number, number];
153
+ /** The sentence that must travel with the finding. */
154
+ readonly disclosure: string;
155
+ }
156
+ export interface MechanicalReport {
157
+ readonly classifications: readonly MechanicalClassification[];
158
+ /**
159
+ * False when no shared node had hunks on **both** sides.
160
+ *
161
+ * An empty `classifications` with `analysed: false` means the diffs were not
162
+ * supplied, not that nothing was mechanical — the same distinction
163
+ * `hidden-dependency.ts` draws for co-change history, and for the same reason.
164
+ */
165
+ readonly analysed: boolean;
166
+ readonly checked: {
167
+ readonly shared: number;
168
+ readonly withHunksBothSides: number;
169
+ readonly mechanical: number;
170
+ readonly semantic: number;
171
+ readonly unclassifiable: number;
172
+ };
173
+ }
174
+ export interface MechanicalOptions {
175
+ /** Override git's context margin. Raising it is conservative; lowering it is not. */
176
+ readonly contextLines?: number;
177
+ readonly stamp?: GraphStamp;
178
+ }
179
+ /**
180
+ * Classify every surfaced overlap between two changes.
181
+ *
182
+ * @param shared the nodes `findOverlaps` surfaced — this module does not decide
183
+ * what is worth looking at, only what may be done about it
184
+ * @param aHunks side A's hunks, against the base both sides share
185
+ * @param bHunks side B's hunks, against the same base
186
+ */
187
+ export declare function classifyOverlaps(shared: readonly SharedNode[], aHunks: readonly DiffHunk[], bHunks: readonly DiffHunk[], options?: MechanicalOptions): QueryResult<MechanicalReport>;
188
+ /**
189
+ * What happened when a mechanical resolution was applied.
190
+ *
191
+ * `"reverted"` and `"verification-failed"` are separate on purpose. The first
192
+ * means verification ran and said no; the second means verification could not
193
+ * say. Collapsing them would report "the change was bad" for a case that is
194
+ * actually "we do not know", which is §20.2's second category swallowing its
195
+ * fourth — the most expensive defect shape in this project.
196
+ */
197
+ export type ApplyOutcome = {
198
+ readonly status: "applied";
199
+ readonly verified: true;
200
+ } | {
201
+ readonly status: "reverted";
202
+ readonly why: string;
203
+ } | {
204
+ readonly status: "verification-failed";
205
+ readonly why: string;
206
+ } | {
207
+ readonly status: "refused";
208
+ readonly why: string;
209
+ };
210
+ export interface ApplyHooks {
211
+ /** Perform the merge. Throwing is a refusal, not a crash — it is reported. */
212
+ readonly apply: (resolution: KeepBothResolution) => void | Promise<void>;
213
+ /** Mandatory. Return false to revert. There is no overload without this. */
214
+ readonly verify: () => boolean | Promise<boolean>;
215
+ /** Called when `verify` says no. Absent means the caller cannot undo, which is refused up front. */
216
+ readonly revert?: (() => void | Promise<void>) | undefined;
217
+ }
218
+ /**
219
+ * Apply one mechanical resolution, then verify — in that order, always both.
220
+ *
221
+ * The mandatory verification of §14.4/§19 is enforced by the *type*: `verify` is
222
+ * a required member of `ApplyHooks`, so a caller that wants to skip it has to
223
+ * write a function that lies, which is a different and more visible act than
224
+ * omitting an optional field.
225
+ *
226
+ * Refuses outright, before touching anything, when the verdict is not
227
+ * `MECHANICAL` or when no `revert` was supplied — auto-applying a change that
228
+ * cannot be undone if verification fails is the exception's precondition, not a
229
+ * detail of it.
230
+ */
231
+ export declare function applyMechanical(classification: MechanicalClassification, hooks: ApplyHooks): Promise<ApplyOutcome>;
232
+ /**
233
+ * The reliability class this module would report for a pair of resolutions.
234
+ *
235
+ * Exported so `overlap.ts`'s rule and this one cannot drift apart silently: both
236
+ * take the weaker of the two sides, per DEC-058.
237
+ */
238
+ export declare function pairReliability(a: ResolutionLevel, b: ResolutionLevel): ReliabilityClass;
239
+ //# sourceMappingURL=mechanical.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mechanical.d.ts","sourceRoot":"","sources":["../../src/multipr/mechanical.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO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