@descryy/core 0.3.0 → 0.5.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 (362) hide show
  1. package/dist/budget/reply.d.ts +11 -46
  2. package/dist/budget/reply.d.ts.map +1 -1
  3. package/dist/budget/reply.js +10 -39
  4. package/dist/budget/reply.js.map +1 -1
  5. package/dist/budget/size.d.ts +2 -21
  6. package/dist/budget/size.d.ts.map +1 -1
  7. package/dist/budget/size.js +3 -24
  8. package/dist/budget/size.js.map +1 -1
  9. package/dist/capabilities/preconditions.d.ts +7 -68
  10. package/dist/capabilities/preconditions.d.ts.map +1 -1
  11. package/dist/capabilities/preconditions.js +6 -57
  12. package/dist/capabilities/preconditions.js.map +1 -1
  13. package/dist/contracts/engine.d.ts +26 -12
  14. package/dist/contracts/engine.d.ts.map +1 -1
  15. package/dist/contracts/engine.js +28 -11
  16. package/dist/contracts/engine.js.map +1 -1
  17. package/dist/contracts/index.d.ts +1 -1
  18. package/dist/contracts/index.d.ts.map +1 -1
  19. package/dist/contracts/index.js.map +1 -1
  20. package/dist/contracts/orphans.d.ts +28 -77
  21. package/dist/contracts/orphans.d.ts.map +1 -1
  22. package/dist/contracts/orphans.js +124 -94
  23. package/dist/contracts/orphans.js.map +1 -1
  24. package/dist/contracts/paths.d.ts +4 -114
  25. package/dist/contracts/paths.d.ts.map +1 -1
  26. package/dist/contracts/paths.js +7 -140
  27. package/dist/contracts/paths.js.map +1 -1
  28. package/dist/contracts/shapes.d.ts +13 -66
  29. package/dist/contracts/shapes.d.ts.map +1 -1
  30. package/dist/contracts/shapes.js +20 -91
  31. package/dist/contracts/shapes.js.map +1 -1
  32. package/dist/governance/budget.d.ts +12 -48
  33. package/dist/governance/budget.d.ts.map +1 -1
  34. package/dist/governance/budget.js +12 -48
  35. package/dist/governance/budget.js.map +1 -1
  36. package/dist/governance/candidate-boundary.d.ts +4 -32
  37. package/dist/governance/candidate-boundary.d.ts.map +1 -1
  38. package/dist/governance/candidate-boundary.js +4 -32
  39. package/dist/governance/candidate-boundary.js.map +1 -1
  40. package/dist/governance/escalation.d.ts +7 -45
  41. package/dist/governance/escalation.d.ts.map +1 -1
  42. package/dist/governance/escalation.js +7 -45
  43. package/dist/governance/escalation.js.map +1 -1
  44. package/dist/governance/fact-boundary.d.ts +7 -49
  45. package/dist/governance/fact-boundary.d.ts.map +1 -1
  46. package/dist/governance/fact-boundary.js +5 -43
  47. package/dist/governance/fact-boundary.js.map +1 -1
  48. package/dist/governance/finding-funnel.d.ts +11 -72
  49. package/dist/governance/finding-funnel.d.ts.map +1 -1
  50. package/dist/governance/finding-funnel.js +9 -68
  51. package/dist/governance/finding-funnel.js.map +1 -1
  52. package/dist/graph/build.d.ts +13 -75
  53. package/dist/graph/build.d.ts.map +1 -1
  54. package/dist/graph/build.js +0 -0
  55. package/dist/graph/build.js.map +1 -1
  56. package/dist/graph/cross-language.d.ts +4 -43
  57. package/dist/graph/cross-language.d.ts.map +1 -1
  58. package/dist/graph/cross-language.js +9 -77
  59. package/dist/graph/cross-language.js.map +1 -1
  60. package/dist/graph/index.d.ts +1 -1
  61. package/dist/graph/index.d.ts.map +1 -1
  62. package/dist/graph/merge.d.ts +8 -76
  63. package/dist/graph/merge.d.ts.map +1 -1
  64. package/dist/graph/merge.js +27 -77
  65. package/dist/graph/merge.js.map +1 -1
  66. package/dist/graph/observed-tests.d.ts +7 -68
  67. package/dist/graph/observed-tests.d.ts.map +1 -1
  68. package/dist/graph/observed-tests.js +5 -60
  69. package/dist/graph/observed-tests.js.map +1 -1
  70. package/dist/graph/persist.d.ts +2 -25
  71. package/dist/graph/persist.d.ts.map +1 -1
  72. package/dist/graph/persist.js +2 -25
  73. package/dist/graph/persist.js.map +1 -1
  74. package/dist/graph/runtime-confirmation.d.ts +14 -91
  75. package/dist/graph/runtime-confirmation.d.ts.map +1 -1
  76. package/dist/graph/runtime-confirmation.js +19 -103
  77. package/dist/graph/runtime-confirmation.js.map +1 -1
  78. package/dist/ledger/mint.d.ts +9 -43
  79. package/dist/ledger/mint.d.ts.map +1 -1
  80. package/dist/ledger/mint.js +15 -65
  81. package/dist/ledger/mint.js.map +1 -1
  82. package/dist/ledger/resolve.d.ts +13 -81
  83. package/dist/ledger/resolve.d.ts.map +1 -1
  84. package/dist/ledger/resolve.js +13 -76
  85. package/dist/ledger/resolve.js.map +1 -1
  86. package/dist/multipr/fingerprint.d.ts +5 -46
  87. package/dist/multipr/fingerprint.d.ts.map +1 -1
  88. package/dist/multipr/fingerprint.js +22 -74
  89. package/dist/multipr/fingerprint.js.map +1 -1
  90. package/dist/multipr/hidden-dependency.d.ts +13 -73
  91. package/dist/multipr/hidden-dependency.d.ts.map +1 -1
  92. package/dist/multipr/hidden-dependency.js +12 -63
  93. package/dist/multipr/hidden-dependency.js.map +1 -1
  94. package/dist/multipr/mechanical.d.ts +25 -160
  95. package/dist/multipr/mechanical.d.ts.map +1 -1
  96. package/dist/multipr/mechanical.js +21 -137
  97. package/dist/multipr/mechanical.js.map +1 -1
  98. package/dist/multipr/migration-heads.d.ts +18 -105
  99. package/dist/multipr/migration-heads.d.ts.map +1 -1
  100. package/dist/multipr/migration-heads.js +15 -84
  101. package/dist/multipr/migration-heads.js.map +1 -1
  102. package/dist/multipr/overlap.d.ts +16 -94
  103. package/dist/multipr/overlap.d.ts.map +1 -1
  104. package/dist/multipr/overlap.js +25 -105
  105. package/dist/multipr/overlap.js.map +1 -1
  106. package/dist/multipr/scope-store.d.ts +15 -80
  107. package/dist/multipr/scope-store.d.ts.map +1 -1
  108. package/dist/multipr/scope-store.js +17 -87
  109. package/dist/multipr/scope-store.js.map +1 -1
  110. package/dist/multipr/superseded.d.ts +10 -95
  111. package/dist/multipr/superseded.d.ts.map +1 -1
  112. package/dist/multipr/superseded.js +7 -60
  113. package/dist/multipr/superseded.js.map +1 -1
  114. package/dist/query/confirmed-facts.d.ts +12 -58
  115. package/dist/query/confirmed-facts.d.ts.map +1 -1
  116. package/dist/query/confirmed-facts.js +8 -47
  117. package/dist/query/confirmed-facts.js.map +1 -1
  118. package/dist/query/declared-value-closure.d.ts +13 -104
  119. package/dist/query/declared-value-closure.d.ts.map +1 -1
  120. package/dist/query/declared-value-closure.js +15 -104
  121. package/dist/query/declared-value-closure.js.map +1 -1
  122. package/dist/query/memory.d.ts +5 -9
  123. package/dist/query/memory.d.ts.map +1 -1
  124. package/dist/query/memory.js +31 -15
  125. package/dist/query/memory.js.map +1 -1
  126. package/dist/query/prominence.d.ts +6 -55
  127. package/dist/query/prominence.d.ts.map +1 -1
  128. package/dist/query/prominence.js +6 -55
  129. package/dist/query/prominence.js.map +1 -1
  130. package/dist/query/provider.d.ts +28 -81
  131. package/dist/query/provider.d.ts.map +1 -1
  132. package/dist/query/provider.js +8 -29
  133. package/dist/query/provider.js.map +1 -1
  134. package/dist/query/queries.d.ts +15 -65
  135. package/dist/query/queries.d.ts.map +1 -1
  136. package/dist/query/queries.js +43 -100
  137. package/dist/query/queries.js.map +1 -1
  138. package/dist/query/refusal-fetch.d.ts +8 -85
  139. package/dist/query/refusal-fetch.d.ts.map +1 -1
  140. package/dist/query/refusal-fetch.js +11 -93
  141. package/dist/query/refusal-fetch.js.map +1 -1
  142. package/dist/query/refusal-questions.d.ts +17 -92
  143. package/dist/query/refusal-questions.d.ts.map +1 -1
  144. package/dist/query/refusal-questions.js +14 -78
  145. package/dist/query/refusal-questions.js.map +1 -1
  146. package/dist/query/resolution-floor.d.ts +3 -23
  147. package/dist/query/resolution-floor.d.ts.map +1 -1
  148. package/dist/query/resolution-floor.js +3 -23
  149. package/dist/query/resolution-floor.js.map +1 -1
  150. package/dist/query/root-cause-score.d.ts +11 -161
  151. package/dist/query/root-cause-score.d.ts.map +1 -1
  152. package/dist/query/root-cause-score.js +6 -137
  153. package/dist/query/root-cause-score.js.map +1 -1
  154. package/dist/query/row-closure-picture.d.ts +5 -67
  155. package/dist/query/row-closure-picture.d.ts.map +1 -1
  156. package/dist/query/row-closure-picture.js +6 -67
  157. package/dist/query/row-closure-picture.js.map +1 -1
  158. package/dist/query/similar-incidents.d.ts +6 -41
  159. package/dist/query/similar-incidents.d.ts.map +1 -1
  160. package/dist/query/similar-incidents.js +15 -69
  161. package/dist/query/similar-incidents.js.map +1 -1
  162. package/dist/query/sqlite.d.ts +3 -7
  163. package/dist/query/sqlite.d.ts.map +1 -1
  164. package/dist/query/sqlite.js +13 -16
  165. package/dist/query/sqlite.js.map +1 -1
  166. package/dist/query/test-coverage.d.ts +5 -45
  167. package/dist/query/test-coverage.d.ts.map +1 -1
  168. package/dist/query/test-coverage.js +10 -53
  169. package/dist/query/test-coverage.js.map +1 -1
  170. package/dist/query/traverse.d.ts +22 -126
  171. package/dist/query/traverse.d.ts.map +1 -1
  172. package/dist/query/traverse.js +0 -0
  173. package/dist/query/traverse.js.map +1 -1
  174. package/dist/query/unresolved.d.ts +19 -164
  175. package/dist/query/unresolved.d.ts.map +1 -1
  176. package/dist/query/unresolved.js +11 -138
  177. package/dist/query/unresolved.js.map +1 -1
  178. package/dist/query/verification-status.d.ts +12 -109
  179. package/dist/query/verification-status.d.ts.map +1 -1
  180. package/dist/query/verification-status.js +9 -99
  181. package/dist/query/verification-status.js.map +1 -1
  182. package/dist/recording/migrate.d.ts +4 -10
  183. package/dist/recording/migrate.d.ts.map +1 -1
  184. package/dist/recording/migrate.js +4 -10
  185. package/dist/recording/migrate.js.map +1 -1
  186. package/dist/recording/reader.d.ts +2 -7
  187. package/dist/recording/reader.d.ts.map +1 -1
  188. package/dist/recording/reader.js +2 -7
  189. package/dist/recording/reader.js.map +1 -1
  190. package/dist/recording/redact.d.ts +6 -57
  191. package/dist/recording/redact.d.ts.map +1 -1
  192. package/dist/recording/redact.js +8 -64
  193. package/dist/recording/redact.js.map +1 -1
  194. package/dist/recording/schema.d.ts +3 -38
  195. package/dist/recording/schema.d.ts.map +1 -1
  196. package/dist/recording/schema.js +3 -38
  197. package/dist/recording/schema.js.map +1 -1
  198. package/dist/recording/writer.d.ts +11 -74
  199. package/dist/recording/writer.d.ts.map +1 -1
  200. package/dist/recording/writer.js +3 -43
  201. package/dist/recording/writer.js.map +1 -1
  202. package/dist/scoping/fanout.d.ts +6 -68
  203. package/dist/scoping/fanout.d.ts.map +1 -1
  204. package/dist/scoping/fanout.js +6 -68
  205. package/dist/scoping/fanout.js.map +1 -1
  206. package/dist/scoping/score.d.ts +20 -70
  207. package/dist/scoping/score.d.ts.map +1 -1
  208. package/dist/scoping/score.js +20 -70
  209. package/dist/scoping/score.js.map +1 -1
  210. package/dist/scoping/tiers.d.ts +4 -16
  211. package/dist/scoping/tiers.d.ts.map +1 -1
  212. package/dist/scoping/tiers.js +4 -16
  213. package/dist/scoping/tiers.js.map +1 -1
  214. package/dist/scoping/traverse.d.ts +3 -25
  215. package/dist/scoping/traverse.d.ts.map +1 -1
  216. package/dist/scoping/traverse.js +14 -49
  217. package/dist/scoping/traverse.js.map +1 -1
  218. package/dist/scoping/weights.d.ts +10 -74
  219. package/dist/scoping/weights.d.ts.map +1 -1
  220. package/dist/scoping/weights.js +14 -86
  221. package/dist/scoping/weights.js.map +1 -1
  222. package/dist/sources/confirmed/incidents.d.ts +5 -35
  223. package/dist/sources/confirmed/incidents.d.ts.map +1 -1
  224. package/dist/sources/confirmed/incidents.js +14 -48
  225. package/dist/sources/confirmed/incidents.js.map +1 -1
  226. package/dist/sources/git/diff.d.ts +71 -65
  227. package/dist/sources/git/diff.d.ts.map +1 -1
  228. package/dist/sources/git/diff.js +136 -83
  229. package/dist/sources/git/diff.js.map +1 -1
  230. package/dist/sources/git/env.d.ts +7 -0
  231. package/dist/sources/git/env.d.ts.map +1 -1
  232. package/dist/sources/git/env.js +10 -11
  233. package/dist/sources/git/env.js.map +1 -1
  234. package/dist/sources/git/history.d.ts +64 -84
  235. package/dist/sources/git/history.d.ts.map +1 -1
  236. package/dist/sources/git/history.js +141 -112
  237. package/dist/sources/git/history.js.map +1 -1
  238. package/dist/sources/git/incidents.d.ts +13 -75
  239. package/dist/sources/git/incidents.d.ts.map +1 -1
  240. package/dist/sources/git/incidents.js +21 -91
  241. package/dist/sources/git/incidents.js.map +1 -1
  242. package/dist/sources/git/index.d.ts +5 -3
  243. package/dist/sources/git/index.d.ts.map +1 -1
  244. package/dist/sources/git/index.js +3 -2
  245. package/dist/sources/git/index.js.map +1 -1
  246. package/dist/sources/git/source.d.ts +9 -79
  247. package/dist/sources/git/source.d.ts.map +1 -1
  248. package/dist/sources/git/source.js +0 -0
  249. package/dist/sources/git/source.js.map +1 -1
  250. package/dist/sources/migrations/across-change.d.ts +94 -0
  251. package/dist/sources/migrations/across-change.d.ts.map +1 -0
  252. package/dist/sources/migrations/across-change.js +278 -0
  253. package/dist/sources/migrations/across-change.js.map +1 -0
  254. package/dist/sources/migrations/dialects.d.ts +20 -36
  255. package/dist/sources/migrations/dialects.d.ts.map +1 -1
  256. package/dist/sources/migrations/dialects.js +11 -36
  257. package/dist/sources/migrations/dialects.js.map +1 -1
  258. package/dist/sources/migrations/index.d.ts +3 -1
  259. package/dist/sources/migrations/index.d.ts.map +1 -1
  260. package/dist/sources/migrations/index.js +2 -1
  261. package/dist/sources/migrations/index.js.map +1 -1
  262. package/dist/sources/migrations/read.d.ts +14 -79
  263. package/dist/sources/migrations/read.d.ts.map +1 -1
  264. package/dist/sources/migrations/read.js +14 -89
  265. package/dist/sources/migrations/read.js.map +1 -1
  266. package/dist/sources/workspace/workspace.d.ts +6 -42
  267. package/dist/sources/workspace/workspace.d.ts.map +1 -1
  268. package/dist/sources/workspace/workspace.js +10 -53
  269. package/dist/sources/workspace/workspace.js.map +1 -1
  270. package/dist/store/driver/driver.d.ts +9 -38
  271. package/dist/store/driver/driver.d.ts.map +1 -1
  272. package/dist/store/driver/driver.js +4 -22
  273. package/dist/store/driver/driver.js.map +1 -1
  274. package/dist/store/driver/node-sqlite.d.ts +3 -12
  275. package/dist/store/driver/node-sqlite.d.ts.map +1 -1
  276. package/dist/store/driver/node-sqlite.js +4 -18
  277. package/dist/store/driver/node-sqlite.js.map +1 -1
  278. package/dist/store/index.d.ts +2 -7
  279. package/dist/store/index.d.ts.map +1 -1
  280. package/dist/store/index.js +4 -10
  281. package/dist/store/index.js.map +1 -1
  282. package/dist/store/migrate.d.ts +14 -50
  283. package/dist/store/migrate.d.ts.map +1 -1
  284. package/dist/store/migrate.js +15 -52
  285. package/dist/store/migrate.js.map +1 -1
  286. package/dist/store/reader.d.ts +19 -84
  287. package/dist/store/reader.d.ts.map +1 -1
  288. package/dist/store/reader.js +25 -92
  289. package/dist/store/reader.js.map +1 -1
  290. package/dist/store/schema.d.ts +14 -76
  291. package/dist/store/schema.d.ts.map +1 -1
  292. package/dist/store/schema.js +14 -76
  293. package/dist/store/schema.js.map +1 -1
  294. package/dist/store/writer.d.ts +14 -88
  295. package/dist/store/writer.d.ts.map +1 -1
  296. package/dist/store/writer.js +29 -123
  297. package/dist/store/writer.js.map +1 -1
  298. package/dist/tiers/certify.d.ts +46 -281
  299. package/dist/tiers/certify.d.ts.map +1 -1
  300. package/dist/tiers/certify.js +46 -226
  301. package/dist/tiers/certify.js.map +1 -1
  302. package/dist/tiers/ladder.d.ts +7 -51
  303. package/dist/tiers/ladder.d.ts.map +1 -1
  304. package/dist/tiers/ladder.js +13 -89
  305. package/dist/tiers/ladder.js.map +1 -1
  306. package/dist/validation/attributes.d.ts +47 -0
  307. package/dist/validation/attributes.d.ts.map +1 -0
  308. package/dist/validation/attributes.js +130 -0
  309. package/dist/validation/attributes.js.map +1 -0
  310. package/dist/validation/config-graph.d.ts +7 -56
  311. package/dist/validation/config-graph.d.ts.map +1 -1
  312. package/dist/validation/config-graph.js +15 -61
  313. package/dist/validation/config-graph.js.map +1 -1
  314. package/dist/validation/env.d.ts +53 -2
  315. package/dist/validation/env.d.ts.map +1 -1
  316. package/dist/validation/env.js +99 -4
  317. package/dist/validation/env.js.map +1 -1
  318. package/dist/validation/index.d.ts +5 -1
  319. package/dist/validation/index.d.ts.map +1 -1
  320. package/dist/validation/index.js +3 -1
  321. package/dist/validation/index.js.map +1 -1
  322. package/dist/validation/join-substitution.d.ts +22 -120
  323. package/dist/validation/join-substitution.d.ts.map +1 -1
  324. package/dist/validation/join-substitution.js +13 -90
  325. package/dist/validation/join-substitution.js.map +1 -1
  326. package/dist/validation/migration-integrity.d.ts +72 -0
  327. package/dist/validation/migration-integrity.d.ts.map +1 -0
  328. package/dist/validation/migration-integrity.js +238 -0
  329. package/dist/validation/migration-integrity.js.map +1 -0
  330. package/dist/validation/migrations.d.ts +23 -88
  331. package/dist/validation/migrations.d.ts.map +1 -1
  332. package/dist/validation/migrations.js +20 -79
  333. package/dist/validation/migrations.js.map +1 -1
  334. package/dist/validation/nodes.d.ts +3 -1
  335. package/dist/validation/nodes.d.ts.map +1 -1
  336. package/dist/validation/nodes.js +3 -1
  337. package/dist/validation/nodes.js.map +1 -1
  338. package/dist/validation/rollback.d.ts +10 -73
  339. package/dist/validation/rollback.d.ts.map +1 -1
  340. package/dist/validation/rollback.js +23 -81
  341. package/dist/validation/rollback.js.map +1 -1
  342. package/dist/validation/route-drift.d.ts +9 -62
  343. package/dist/validation/route-drift.d.ts.map +1 -1
  344. package/dist/validation/route-drift.js +7 -52
  345. package/dist/validation/route-drift.js.map +1 -1
  346. package/dist/validation/sources.d.ts +16 -94
  347. package/dist/validation/sources.d.ts.map +1 -1
  348. package/dist/validation/sources.js +51 -147
  349. package/dist/validation/sources.js.map +1 -1
  350. package/dist/worker/pool.d.ts +6 -45
  351. package/dist/worker/pool.d.ts.map +1 -1
  352. package/dist/worker/pool.js +5 -42
  353. package/dist/worker/pool.js.map +1 -1
  354. package/dist/worker/protocol.d.ts +7 -20
  355. package/dist/worker/protocol.d.ts.map +1 -1
  356. package/dist/worker/protocol.js +3 -10
  357. package/dist/worker/protocol.js.map +1 -1
  358. package/dist/worker/traversal.worker.d.ts +2 -21
  359. package/dist/worker/traversal.worker.d.ts.map +1 -1
  360. package/dist/worker/traversal.worker.js +4 -23
  361. package/dist/worker/traversal.worker.js.map +1 -1
  362. package/package.json +11 -2
@@ -1,71 +1,7 @@
1
1
  /**
2
- * The backing for `refusal_fetch` — `ai-tool-contract.md` §5.4, §8 endpoint 14.
3
- *
4
- * ## The premise this corrects
5
- *
6
- * `ai-layer-plan.md` §3 originally claimed this tool was cheap because
7
- * "`askableHandle` exists in core and nothing serves it." Checked against
8
- * `refusal-questions.ts` rather than taken on the plan's word, both halves
9
- * were false: `askableHandle` is the *askable predicate* — `blockedBy` only
10
- * for `refusalClass === "value-unknown"`, `null` for `capability-gap` /
11
- * `out-of-scope` / `varies-per-call` / unset — and it is already served, by
12
- * `packages/mcp/src/tools/questions.ts` via `groupRefusalsIntoQuestions`.
13
- * The contract's own §5.4 records the correction; this module is the new
14
- * work it points at.
15
- *
16
- * ## Why `groupRefusalsIntoQuestions` cannot be reused here
17
- *
18
- * That grouper drops every row that is not `value-unknown` **by design** —
19
- * correct for its own purpose (a question queue only wants rows a human
20
- * sentence can close), wrong for this one. A `refusal_fetch` that silently
21
- * returned only the askable subset would be the empty-denominator defect
22
- * (`ai-tool-contract.md` §1's "count over something that was not there,
23
- * presented as a count of zero") wearing technique 4's clothes — the same
24
- * defect class this project has already hit three times elsewhere
25
- * (shopizer's 0-of-370 route count, airbyte's "not on disk", koa's silent
26
- * `routers.size === 0`). This module therefore counts and pages **every**
27
- * `UnresolvedRef`, of every `refusalClass` and unset alike.
28
- *
29
- * ## Call-site trap, named so it is not rediscovered the expensive way
30
- *
31
- * `store/reader.ts#unresolvedRefs` defaults `classified: true`, which
32
- * restricts to `attrs IS NOT NULL` — exactly the rows a producer has
33
- * classified at all. A caller that wires this module up to that reader
34
- * without passing `{ classified: false }` will silently exclude every
35
- * *unclassified* row from `count`, reproducing the same defect this module
36
- * exists to prevent, one call site later. `summariseRefusals`/
37
- * `fetchRefusalPage` cannot detect that mistake — they only know the
38
- * population they were handed — so the honesty of `count` here is only as
39
- * good as the completeness of what a caller passes in.
40
- *
41
- * ## The handle
42
- *
43
- * Stateless and self-describing (a base64url-encoded cursor plus a content
44
- * fingerprint of the population it was issued against), not a session-cache
45
- * lookup — so redemption is correct across process restarts and does not
46
- * need this module to keep anything in memory between calls. An MCP surface
47
- * that wants a prettier, shorter token (the contract's own illustrative
48
- * `ref_9f2c1a`) is free to wrap this in a session cache; that is a
49
- * presentation choice for P27, not a correctness requirement for this
50
- * module.
51
- *
52
- * `UnresolvedRef` carries no stable id once it has crossed the store
53
- * boundary (`store/reader.ts#toUnresolvedRef` does not carry the row's
54
- * content-hash `id` column into the IR shape), so this module derives its
55
- * own deterministic ordering key from the fields the type does carry. That
56
- * key is what makes "same handle + same underlying population → same page
57
- * ordering every time" true regardless of what order the caller's array
58
- * happens to be in — a concatenation from several producers, or a
59
- * differently-ordered SQL read, must not change which row lands on which
60
- * page.
61
- *
62
- * Redeeming a handle that cannot be decoded, or whose population fingerprint
63
- * no longer matches what is being read, is `refused` with a named reason —
64
- * never a page that happens to be empty, and never a page silently drawn
65
- * from the wrong cursor position. That is the rule the whole contract rests
66
- * on (§1: `refused` is a fact about Descry, never a guess dressed as one),
67
- * and this endpoint is the easiest place in the system to violate it
68
- * silently.
2
+ * Backing for `refusal_fetch` (ai-tool-contract.md §5.4, §8 endpoint 14).
3
+ * `groupRefusalsIntoQuestions` drops non-`value-unknown` rows by design — that
4
+ * would be an empty-denominator defect (§1) here, so this counts/pages every UnresolvedRef. Caller trap: reader.ts defaults `classified: true`. Handle is fingerprinted; a mismatch is `refused`, never a wrong page (§1).
69
5
  */
70
6
  import type { ResultState, UnresolvedRef } from "@descryy/ir";
71
7
  /** `refusals` in the envelope (`ai-tool-contract.md` §5.4): `{ count, exemplar, handle }`. */
@@ -77,12 +13,8 @@ export interface RefusalSummary {
77
13
  /** Opaque; redeem with {@link fetchRefusalPage}. `null` only when `count === 0` — there is nothing to page through. */
78
14
  readonly handle: string | null;
79
15
  }
80
- /**
81
- * Summarise a population of refusal rows into the one-line shape the
82
- * envelope carries. `refs` must already be the complete population the
83
- * caller intends to disclose — see the module header's call-site trap for
84
- * the classic way to under-supply it.
85
- */
16
+ /** Summarise refusal rows into the envelope's one-line shape. `refs` must
17
+ * already be the complete population — see header's call-site trap. */
86
18
  export declare function summariseRefusals(refs: readonly UnresolvedRef[], pageSize?: number): RefusalSummary;
87
19
  export interface RefusalPageOk {
88
20
  readonly state: Extract<ResultState, "ok">;
@@ -98,17 +30,8 @@ export interface RefusalPageRefused {
98
30
  readonly reason: string;
99
31
  }
100
32
  export type RefusalPage = RefusalPageOk | RefusalPageRefused;
101
- /**
102
- * Redeem a handle against the current population. `refs` need not be
103
- * pre-sorted or supplied in the same order as the call that minted the
104
- * handle — ordering is re-derived deterministically every time.
105
- *
106
- * Three distinct ways to be `refused`, each named: the handle cannot be
107
- * decoded at all; the population's content fingerprint no longer matches
108
- * (the graph moved since the handle was issued); or the cursor position the
109
- * handle names does not exist in the current population (only reachable via
110
- * a handle not issued by this module's own chain, since a well-formed
111
- * `nextHandle` is never offered past the end).
112
- */
33
+ /** Redeem a handle; `refs` need not be pre-sorted, ordering is re-derived
34
+ * every time. Refuses for one of three named reasons: undecodable handle,
35
+ * population fingerprint mismatch, or an out-of-range cursor. */
113
36
  export declare function fetchRefusalPage(refs: readonly UnresolvedRef[], handle: string): RefusalPage;
114
37
  //# sourceMappingURL=refusal-fetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refusal-fetch.d.ts","sourceRoot":"","sources":["../../src/query/refusal-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA8E9D,8FAA8F;AAC9F,MAAM,WAAW,cAAc;IAC7B,oGAAoG;IACpG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6IAA6I;IAC7I,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI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GAAG,IAAI,CAAC;CAChC;AAED;wEACwE;AACxE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,SAAS,aAAa,EAAE,EAC9B,QAAQ,GAAE,MAA0B,GACnC,cAAc,CAgBhB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,4GAA4G;IAC5G,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAChD,oFAAoF;IACpF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAE7D;;kEAEkE;AAClE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,aAAa,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAoC5F"}
@@ -1,71 +1,7 @@
1
1
  /**
2
- * The backing for `refusal_fetch` — `ai-tool-contract.md` §5.4, §8 endpoint 14.
3
- *
4
- * ## The premise this corrects
5
- *
6
- * `ai-layer-plan.md` §3 originally claimed this tool was cheap because
7
- * "`askableHandle` exists in core and nothing serves it." Checked against
8
- * `refusal-questions.ts` rather than taken on the plan's word, both halves
9
- * were false: `askableHandle` is the *askable predicate* — `blockedBy` only
10
- * for `refusalClass === "value-unknown"`, `null` for `capability-gap` /
11
- * `out-of-scope` / `varies-per-call` / unset — and it is already served, by
12
- * `packages/mcp/src/tools/questions.ts` via `groupRefusalsIntoQuestions`.
13
- * The contract's own §5.4 records the correction; this module is the new
14
- * work it points at.
15
- *
16
- * ## Why `groupRefusalsIntoQuestions` cannot be reused here
17
- *
18
- * That grouper drops every row that is not `value-unknown` **by design** —
19
- * correct for its own purpose (a question queue only wants rows a human
20
- * sentence can close), wrong for this one. A `refusal_fetch` that silently
21
- * returned only the askable subset would be the empty-denominator defect
22
- * (`ai-tool-contract.md` §1's "count over something that was not there,
23
- * presented as a count of zero") wearing technique 4's clothes — the same
24
- * defect class this project has already hit three times elsewhere
25
- * (shopizer's 0-of-370 route count, airbyte's "not on disk", koa's silent
26
- * `routers.size === 0`). This module therefore counts and pages **every**
27
- * `UnresolvedRef`, of every `refusalClass` and unset alike.
28
- *
29
- * ## Call-site trap, named so it is not rediscovered the expensive way
30
- *
31
- * `store/reader.ts#unresolvedRefs` defaults `classified: true`, which
32
- * restricts to `attrs IS NOT NULL` — exactly the rows a producer has
33
- * classified at all. A caller that wires this module up to that reader
34
- * without passing `{ classified: false }` will silently exclude every
35
- * *unclassified* row from `count`, reproducing the same defect this module
36
- * exists to prevent, one call site later. `summariseRefusals`/
37
- * `fetchRefusalPage` cannot detect that mistake — they only know the
38
- * population they were handed — so the honesty of `count` here is only as
39
- * good as the completeness of what a caller passes in.
40
- *
41
- * ## The handle
42
- *
43
- * Stateless and self-describing (a base64url-encoded cursor plus a content
44
- * fingerprint of the population it was issued against), not a session-cache
45
- * lookup — so redemption is correct across process restarts and does not
46
- * need this module to keep anything in memory between calls. An MCP surface
47
- * that wants a prettier, shorter token (the contract's own illustrative
48
- * `ref_9f2c1a`) is free to wrap this in a session cache; that is a
49
- * presentation choice for P27, not a correctness requirement for this
50
- * module.
51
- *
52
- * `UnresolvedRef` carries no stable id once it has crossed the store
53
- * boundary (`store/reader.ts#toUnresolvedRef` does not carry the row's
54
- * content-hash `id` column into the IR shape), so this module derives its
55
- * own deterministic ordering key from the fields the type does carry. That
56
- * key is what makes "same handle + same underlying population → same page
57
- * ordering every time" true regardless of what order the caller's array
58
- * happens to be in — a concatenation from several producers, or a
59
- * differently-ordered SQL read, must not change which row lands on which
60
- * page.
61
- *
62
- * Redeeming a handle that cannot be decoded, or whose population fingerprint
63
- * no longer matches what is being read, is `refused` with a named reason —
64
- * never a page that happens to be empty, and never a page silently drawn
65
- * from the wrong cursor position. That is the rule the whole contract rests
66
- * on (§1: `refused` is a fact about Descry, never a guess dressed as one),
67
- * and this endpoint is the easiest place in the system to violate it
68
- * silently.
2
+ * Backing for `refusal_fetch` (ai-tool-contract.md §5.4, §8 endpoint 14).
3
+ * `groupRefusalsIntoQuestions` drops non-`value-unknown` rows by design — that
4
+ * would be an empty-denominator defect (§1) here, so this counts/pages every UnresolvedRef. Caller trap: reader.ts defaults `classified: true`. Handle is fingerprinted; a mismatch is `refused`, never a wrong page (§1).
69
5
  */
70
6
  import { createHash } from "node:crypto";
71
7
  const DEFAULT_PAGE_SIZE = 50;
@@ -80,14 +16,9 @@ function isHandlePayload(value) {
80
16
  typeof v["pageSize"] === "number" &&
81
17
  typeof v["populationHash"] === "string");
82
18
  }
83
- /**
84
- * A deterministic ordering key for one refusal row, built from every field
85
- * `UnresolvedRef` carries except `attrs` — the same fields the store's own
86
- * `unresolved_refs.id` content hash is built from (`schema.ts`'s own
87
- * comment: classification is not part of what makes two refusals the same
88
- * refusal). Restated here rather than imported, because the store's `id`
89
- * never crosses into the `UnresolvedRef` shape this module receives.
90
- */
19
+ /** Deterministic ordering key from every field but `attrs` — mirrors the
20
+ * store's `unresolved_refs.id` hash, restated since `id` never crosses into
21
+ * the `UnresolvedRef` shape this module receives. */
91
22
  function sortKey(ref) {
92
23
  return [
93
24
  ref.fromNodeId,
@@ -131,12 +62,8 @@ function decodeHandle(handle) {
131
62
  return null;
132
63
  }
133
64
  }
134
- /**
135
- * Summarise a population of refusal rows into the one-line shape the
136
- * envelope carries. `refs` must already be the complete population the
137
- * caller intends to disclose — see the module header's call-site trap for
138
- * the classic way to under-supply it.
139
- */
65
+ /** Summarise refusal rows into the envelope's one-line shape. `refs` must
66
+ * already be the complete population — see header's call-site trap. */
140
67
  export function summariseRefusals(refs, pageSize = DEFAULT_PAGE_SIZE) {
141
68
  if (refs.length === 0) {
142
69
  return { count: 0, exemplar: null, handle: null };
@@ -154,18 +81,9 @@ export function summariseRefusals(refs, pageSize = DEFAULT_PAGE_SIZE) {
154
81
  }),
155
82
  };
156
83
  }
157
- /**
158
- * Redeem a handle against the current population. `refs` need not be
159
- * pre-sorted or supplied in the same order as the call that minted the
160
- * handle — ordering is re-derived deterministically every time.
161
- *
162
- * Three distinct ways to be `refused`, each named: the handle cannot be
163
- * decoded at all; the population's content fingerprint no longer matches
164
- * (the graph moved since the handle was issued); or the cursor position the
165
- * handle names does not exist in the current population (only reachable via
166
- * a handle not issued by this module's own chain, since a well-formed
167
- * `nextHandle` is never offered past the end).
168
- */
84
+ /** Redeem a handle; `refs` need not be pre-sorted, ordering is re-derived
85
+ * every time. Refuses for one of three named reasons: undecodable handle,
86
+ * population fingerprint mismatch, or an out-of-range cursor. */
169
87
  export function fetchRefusalPage(refs, handle) {
170
88
  const payload = decodeHandle(handle);
171
89
  if (payload === null) {
@@ -1 +1 @@
1
- {"version":3,"file":"refusal-fetch.js","sourceRoot":"","sources":["../../src/query/refusal-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,aAAa,GAAG,MAAM,CAAC;AAS7B,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,OAAO,CACL,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,QAAQ;QAC1B,OAAO,CAAC,CAAC,QA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AE,UAAU,EAAE,CAAC;AACnE,CAAC"}
@@ -1,53 +1,8 @@
1
- /**
2
- * The grouper — turns classified refusal rows into questions a person can
3
- * actually answer.
4
- *
5
- * DEC-242 gave `UnresolvedRef` a machine-readable handle (`attrs.blockedBy`)
6
- * and a producer-declared answerability class (`attrs.refusalClass`). Neither
7
- * one is a question by itself: a ledger of 136 rows is still 136 rows until
8
- * something collapses the ones that share a cause into one thing to ask.
9
- * That collapse is all this module does.
10
- *
11
- * ## The filter is the whole point
12
- *
13
- * Only `"value-unknown"` rows become questions. `"capability-gap"`,
14
- * `"out-of-scope"`, `"varies-per-call"` and **unset** never do — DEC-242's own
15
- * measurement is why: 92 of 95 real C#/Java refusal rows are
16
- * `"capability-gap"`, and asking a human to resolve one of those, or a
17
- * `"varies-per-call"` row (*"what is `url`?"*), is a category error, not an
18
- * unanswered question. Unset is the sharpest trap: it looks identical to
19
- * `"value-unknown"` in shape (a row, a `rawTarget`, a `reason`) and is
20
- * silently the majority case until every producer sets the field. Defaulting
21
- * it to askable is exactly how an unaudited row reaches a user.
22
- *
23
- * ## Grouping key is `(repo, blockedBy)`, and this file only ever sees one repo
24
- *
25
- * `env.BACKEND_API_BASE_URL` in `sherpa-cf-worker` and the byte-identical
26
- * string in a different repository are different facts about different
27
- * runtimes — DEC-223 §3 already committed to exact-match scoped to one repo,
28
- * and measured the failure mode directly (both repos use the same env var
29
- * name for different backends). `groupRefusalsIntoQuestions` takes one repo's
30
- * rows and returns that repo's questions; it has no way to merge across
31
- * repos because it never sees more than one. `groupRefusalsAcrossRepos` is the
32
- * only entry point that touches more than one repo's rows, and it keeps them
33
- * in separate groups by construction — see its own doc for what that means in
34
- * practice, and the test that proves it.
35
- *
36
- * ## What this does not do
37
- *
38
- * It does not run config resolution. DEC-242's ordering constraint —
39
- * `refusalClass` is assigned only after a producer checks `.env` files,
40
- * deploy config and the like — is the producer's job, upstream of this
41
- * module entirely. A `"value-unknown"` row reaching here is trusted at face
42
- * value; second-guessing it here would duplicate work a producer already did
43
- * or silently paper over one that skipped it, and neither is this module's
44
- * business to detect.
45
- *
46
- * It does not store, dedupe against a previously-answered `ConfirmedFact`
47
- * (DEC-223 §3), or decide where a question surfaces. It is the piece in
48
- * between: rows in, questions out, with everything dropped along the way
49
- * counted rather than discarded.
50
- */
1
+ /** Groups classified refusal rows (DEC-242's `blockedBy`/`refusalClass`)
2
+ * into questions. Only `"value-unknown"` qualifies — measured 92/95 real
3
+ * C#/Java rows are `"capability-gap"`; unset defaults to non-askable.
4
+ * One repo at a time (DEC-223 §3); never resolves config or dedupes
5
+ * against a stored fact — that's upstream/downstream of this module. */
51
6
  import type { UnresolvedRef } from "@descryy/ir";
52
7
  /** One call site behind a question — enough for a reader to go look, not just a count. */
53
8
  export interface RefusalSite {
@@ -63,20 +18,9 @@ export interface RefusalQuestion {
63
18
  readonly blockedBy: string;
64
19
  readonly sites: readonly RefusalSite[];
65
20
  }
66
- /**
67
- * What every accepted row not made into a question was instead, one bucket
68
- * per cause. Never a single "dropped" count — `dropped["unset"]` and
69
- * `dropped["capability-gap"]` are different facts with different remedies,
70
- * and collapsing them would recreate the conflation DEC-223's own
71
- * `query/unresolved.ts` header already measured once.
72
- *
73
- * `"value-unknown-no-handle"` is its own bucket rather than folded into
74
- * `"value-unknown"`: a row can legally declare itself askable while naming no
75
- * expression to ask about (`attrs.blockedBy` absent or `null`, DEC-242) — a
76
- * producer contradiction, not the same thing as a row this module correctly
77
- * turned into a question, and not the same thing as a row a producer
78
- * correctly marked unanswerable either.
79
- */
21
+ /** Why an accepted row didn't become a question, bucketed by cause —
22
+ * `unset` vs `capability-gap` need different fixes, never one count.
23
+ * `"value-unknown-no-handle"`: askable but no `blockedBy` (DEC-242), a producer contradiction. */
80
24
  export interface RefusalDropCounts {
81
25
  readonly [refusalClass: string]: number;
82
26
  }
@@ -86,36 +30,17 @@ export interface GroupingResult {
86
30
  readonly questions: readonly RefusalQuestion[];
87
31
  readonly dropped: RefusalDropCounts;
88
32
  }
89
- /**
90
- * The askable predicate, exported so a second consumer (DEC-244's
91
- * `applyDeclaredValues`) does not re-derive it a third time — `unresolved.ts`
92
- * and this file already had one independent copy each before DEC-244, and a
93
- * third divergent copy is exactly the drift DEC-098's own guard-omission
94
- * incident (§3.1) named. Returns the row's `blockedBy` when, and only when,
95
- * this row is `"value-unknown"` with a non-empty handle to ask about — `null`
96
- * for every other case, unset included.
97
- */
33
+ /** The askable predicate — exported so a second consumer (DEC-244) doesn't
34
+ * re-derive it a third time (drift DEC-098 §3.1 named). Returns `blockedBy`
35
+ * only for `"value-unknown"` rows with a non-empty handle, else `null`. */
98
36
  export declare function askableHandle(ref: UnresolvedRef): string | null;
99
- /**
100
- * Group one repository's refusal rows into questions.
101
- *
102
- * The reconciliation this makes checkable: every row in `refs` is accounted
103
- * for in exactly one place — a site under some question's `sites`, or a count
104
- * under `dropped` — so `totalRows === sum(dropped) + sum(questions[].sites.length)`
105
- * always. The DEC-241-shaped law, one level down again.
106
- */
37
+ /** Groups one repo's refusal rows into questions. Every row lands in exactly
38
+ * one place — a site or a `dropped` count — so `totalRows === sum(dropped) +
39
+ * sum(questions[].sites.length)` always (DEC-241-shaped law). */
107
40
  export declare function groupRefusalsIntoQuestions(repo: string, refs: readonly UnresolvedRef[]): GroupingResult;
108
- /**
109
- * Group several repositories' rows without ever merging across them.
110
- *
111
- * This exists because the risk this module guards against is a *caller's*
112
- * mistake, not this file's: nothing stops a consumer from concatenating two
113
- * repos' `unresolved` arrays before calling `groupRefusalsIntoQuestions` once,
114
- * and a byte-identical `blockedBy` string would then merge two unrelated
115
- * facts into one question (DEC-223 §3's measured failure). This function is
116
- * the version of the API where that mistake cannot be made — one
117
- * `GroupingResult` per repo, always, however many repos come in.
118
- */
41
+ /** Groups several repos' rows without merging across them — guards against
42
+ * a caller concatenating repos first, where a byte-identical `blockedBy`
43
+ * would wrongly merge two facts (DEC-223 §3). One result per repo, always. */
119
44
  export declare function groupRefusalsAcrossRepos(inputs: readonly {
120
45
  readonly repo: string;
121
46
  readonly refs: readonly UnresolvedRef[];
@@ -1 +1 @@
1
- {"version":3,"file":"refusal-questions.d.ts","sourceRoot":"","sources":["../../src/query/refusal-questions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,0FAA0F;AAC1F,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,qGAAqG;AACrG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;CACxC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;CACzC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;CACrC;AAYD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,aAAa,EA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,MAAM,GAAG,IAAI,CAE/D;AAED;;kEAEkE;AAClE,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,aAAa,EAAE,GAC7B,cAAc,CA6BhB;AAED;;+EAE+E;AAC/E,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,EAAE,GACpF,SAAS,cAAc,EAAE,CAE3B"}
@@ -1,53 +1,8 @@
1
- /**
2
- * The grouper — turns classified refusal rows into questions a person can
3
- * actually answer.
4
- *
5
- * DEC-242 gave `UnresolvedRef` a machine-readable handle (`attrs.blockedBy`)
6
- * and a producer-declared answerability class (`attrs.refusalClass`). Neither
7
- * one is a question by itself: a ledger of 136 rows is still 136 rows until
8
- * something collapses the ones that share a cause into one thing to ask.
9
- * That collapse is all this module does.
10
- *
11
- * ## The filter is the whole point
12
- *
13
- * Only `"value-unknown"` rows become questions. `"capability-gap"`,
14
- * `"out-of-scope"`, `"varies-per-call"` and **unset** never do — DEC-242's own
15
- * measurement is why: 92 of 95 real C#/Java refusal rows are
16
- * `"capability-gap"`, and asking a human to resolve one of those, or a
17
- * `"varies-per-call"` row (*"what is `url`?"*), is a category error, not an
18
- * unanswered question. Unset is the sharpest trap: it looks identical to
19
- * `"value-unknown"` in shape (a row, a `rawTarget`, a `reason`) and is
20
- * silently the majority case until every producer sets the field. Defaulting
21
- * it to askable is exactly how an unaudited row reaches a user.
22
- *
23
- * ## Grouping key is `(repo, blockedBy)`, and this file only ever sees one repo
24
- *
25
- * `env.BACKEND_API_BASE_URL` in `sherpa-cf-worker` and the byte-identical
26
- * string in a different repository are different facts about different
27
- * runtimes — DEC-223 §3 already committed to exact-match scoped to one repo,
28
- * and measured the failure mode directly (both repos use the same env var
29
- * name for different backends). `groupRefusalsIntoQuestions` takes one repo's
30
- * rows and returns that repo's questions; it has no way to merge across
31
- * repos because it never sees more than one. `groupRefusalsAcrossRepos` is the
32
- * only entry point that touches more than one repo's rows, and it keeps them
33
- * in separate groups by construction — see its own doc for what that means in
34
- * practice, and the test that proves it.
35
- *
36
- * ## What this does not do
37
- *
38
- * It does not run config resolution. DEC-242's ordering constraint —
39
- * `refusalClass` is assigned only after a producer checks `.env` files,
40
- * deploy config and the like — is the producer's job, upstream of this
41
- * module entirely. A `"value-unknown"` row reaching here is trusted at face
42
- * value; second-guessing it here would duplicate work a producer already did
43
- * or silently paper over one that skipped it, and neither is this module's
44
- * business to detect.
45
- *
46
- * It does not store, dedupe against a previously-answered `ConfirmedFact`
47
- * (DEC-223 §3), or decide where a question surfaces. It is the piece in
48
- * between: rows in, questions out, with everything dropped along the way
49
- * counted rather than discarded.
50
- */
1
+ /** Groups classified refusal rows (DEC-242's `blockedBy`/`refusalClass`)
2
+ * into questions. Only `"value-unknown"` qualifies — measured 92/95 real
3
+ * C#/Java rows are `"capability-gap"`; unset defaults to non-askable.
4
+ * One repo at a time (DEC-223 §3); never resolves config or dedupes
5
+ * against a stored fact — that's upstream/downstream of this module. */
51
6
  function classOf(ref) {
52
7
  const cls = ref.attrs?.["refusalClass"];
53
8
  return typeof cls === "string" ? cls : "unset";
@@ -56,26 +11,15 @@ function handleOf(ref) {
56
11
  const blockedBy = ref.attrs?.["blockedBy"];
57
12
  return typeof blockedBy === "string" && blockedBy !== "" ? blockedBy : null;
58
13
  }
59
- /**
60
- * The askable predicate, exported so a second consumer (DEC-244's
61
- * `applyDeclaredValues`) does not re-derive it a third time — `unresolved.ts`
62
- * and this file already had one independent copy each before DEC-244, and a
63
- * third divergent copy is exactly the drift DEC-098's own guard-omission
64
- * incident (§3.1) named. Returns the row's `blockedBy` when, and only when,
65
- * this row is `"value-unknown"` with a non-empty handle to ask about — `null`
66
- * for every other case, unset included.
67
- */
14
+ /** The askable predicate — exported so a second consumer (DEC-244) doesn't
15
+ * re-derive it a third time (drift DEC-098 §3.1 named). Returns `blockedBy`
16
+ * only for `"value-unknown"` rows with a non-empty handle, else `null`. */
68
17
  export function askableHandle(ref) {
69
18
  return classOf(ref) === "value-unknown" ? handleOf(ref) : null;
70
19
  }
71
- /**
72
- * Group one repository's refusal rows into questions.
73
- *
74
- * The reconciliation this makes checkable: every row in `refs` is accounted
75
- * for in exactly one place — a site under some question's `sites`, or a count
76
- * under `dropped` — so `totalRows === sum(dropped) + sum(questions[].sites.length)`
77
- * always. The DEC-241-shaped law, one level down again.
78
- */
20
+ /** Groups one repo's refusal rows into questions. Every row lands in exactly
21
+ * one place — a site or a `dropped` count — so `totalRows === sum(dropped) +
22
+ * sum(questions[].sites.length)` always (DEC-241-shaped law). */
79
23
  export function groupRefusalsIntoQuestions(repo, refs) {
80
24
  const groups = new Map();
81
25
  const dropped = {};
@@ -105,17 +49,9 @@ export function groupRefusalsIntoQuestions(repo, refs) {
105
49
  .sort((a, b) => b.sites.length - a.sites.length || a.blockedBy.localeCompare(b.blockedBy));
106
50
  return { repo, totalRows: refs.length, questions, dropped };
107
51
  }
108
- /**
109
- * Group several repositories' rows without ever merging across them.
110
- *
111
- * This exists because the risk this module guards against is a *caller's*
112
- * mistake, not this file's: nothing stops a consumer from concatenating two
113
- * repos' `unresolved` arrays before calling `groupRefusalsIntoQuestions` once,
114
- * and a byte-identical `blockedBy` string would then merge two unrelated
115
- * facts into one question (DEC-223 §3's measured failure). This function is
116
- * the version of the API where that mistake cannot be made — one
117
- * `GroupingResult` per repo, always, however many repos come in.
118
- */
52
+ /** Groups several repos' rows without merging across them — guards against
53
+ * a caller concatenating repos first, where a byte-identical `blockedBy`
54
+ * would wrongly merge two facts (DEC-223 §3). One result per repo, always. */
119
55
  export function groupRefusalsAcrossRepos(inputs) {
120
56
  return inputs.map(({ repo, refs }) => groupRefusalsIntoQuestions(repo, refs));
121
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"refusal-questions.js","sourceRoot":"","sources":["../../src/query/refusal-questions.ts"],"names":[],"m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9D,CAAC;AAED;;+EAE+E;AAC/E,MAAM,UAAU,wBAAwB,CACtC,MAAqF;IAErF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,0BAA0B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAChF,CAAC"}
@@ -1,27 +1,7 @@
1
1
  /**
2
- * A running minimum over resolution levels that knows the difference between
3
- * "the weakest evidence was R4" and "there was no evidence."
4
- *
5
- * The bug it removes, found in UAT: `propagation` refused an answer — no edge
6
- * of any walked type touched the node, so the traversal followed nothing — and
7
- * stamped that reply `resolutionFloor: 4`, `reliabilityCap: "A"`. The strongest
8
- * tier in the system, on a walk that examined zero edges. Nothing computed it;
9
- * it was the identity value of a `let floor = 4` running minimum, surviving
10
- * untouched because the loop that would have lowered it never ran.
11
- *
12
- * That is the empty-denominator failure this project catches everywhere else,
13
- * appearing in the resolution axis: a reply that found nothing and a reply
14
- * resting on runtime-witnessed evidence produced the same number, and the
15
- * number is the one that reliability class is derived from — so the reply that
16
- * knew least was labelled most trustworthy.
17
- *
18
- * R0 is the answer for the empty case, and it is not a new convention:
19
- * `minimumResolution` in `@descryy/ir` already returns R0 over an empty graph
20
- * path, ratified by DEC-NEXT-empty-graph-path-resolution-floor (option A —
21
- * "no hop resolved anything, so nothing above R0 has been established"), and
22
- * `coChanges`/`similarIncidents` already special-case their own empty sets to
23
- * 0 by hand. This makes the same rule the default rather than something each
24
- * call site has to remember.
2
+ * Running minimum over resolution levels — distinguishes "weakest was R4" from "no evidence." UAT bug:
3
+ * `propagation` stamped a zero-edge walk `resolutionFloor: 4` (identity value of an untouched `let
4
+ * floor = 4`). R0 is now the empty-case default (DEC-NEXT-empty-graph-path-resolution-floor, option A).
25
5
  */
26
6
  import type { ResolutionLevel } from "@descryy/ir";
27
7
  export interface ResolutionFloor {
@@ -1 +1 @@
1
- {"version":3,"file":"resolution-floor.d.ts","sourceRoot":"","sources":["../../src/query/resolution-floor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,OAAO,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IAC3C,wEAAwE;IACxE,KAAK,IAAI,eAAe,CAAC;IACzB,iFAAiF;IACjF,QAAQ,IAAI,OAAO,CAAC;CACrB;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAWvD"}
1
+ {"version":3,"file":"resolution-floor.d.ts","sourceRoot":"","sources":["../../src/query/resolution-floor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,OAAO,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IAC3C,wEAAwE;IACxE,KAAK,IAAI,eAAe,CAAC;IACzB,iFAAiF;IACjF,QAAQ,IAAI,OAAO,CAAC;CACrB;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAWvD"}
@@ -1,27 +1,7 @@
1
1
  /**
2
- * A running minimum over resolution levels that knows the difference between
3
- * "the weakest evidence was R4" and "there was no evidence."
4
- *
5
- * The bug it removes, found in UAT: `propagation` refused an answer — no edge
6
- * of any walked type touched the node, so the traversal followed nothing — and
7
- * stamped that reply `resolutionFloor: 4`, `reliabilityCap: "A"`. The strongest
8
- * tier in the system, on a walk that examined zero edges. Nothing computed it;
9
- * it was the identity value of a `let floor = 4` running minimum, surviving
10
- * untouched because the loop that would have lowered it never ran.
11
- *
12
- * That is the empty-denominator failure this project catches everywhere else,
13
- * appearing in the resolution axis: a reply that found nothing and a reply
14
- * resting on runtime-witnessed evidence produced the same number, and the
15
- * number is the one that reliability class is derived from — so the reply that
16
- * knew least was labelled most trustworthy.
17
- *
18
- * R0 is the answer for the empty case, and it is not a new convention:
19
- * `minimumResolution` in `@descryy/ir` already returns R0 over an empty graph
20
- * path, ratified by DEC-NEXT-empty-graph-path-resolution-floor (option A —
21
- * "no hop resolved anything, so nothing above R0 has been established"), and
22
- * `coChanges`/`similarIncidents` already special-case their own empty sets to
23
- * 0 by hand. This makes the same rule the default rather than something each
24
- * call site has to remember.
2
+ * Running minimum over resolution levels — distinguishes "weakest was R4" from "no evidence." UAT bug:
3
+ * `propagation` stamped a zero-edge walk `resolutionFloor: 4` (identity value of an untouched `let
4
+ * floor = 4`). R0 is now the empty-case default (DEC-NEXT-empty-graph-path-resolution-floor, option A).
25
5
  */
26
6
  export function createResolutionFloor() {
27
7
  let lowest = 4;
@@ -1 +1 @@
1
- {"version":3,"file":"resolution-floor.js","sourceRoot":"","sources":["../../src/query/resolution-floor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAaH,MAAM,UAAU,qBAAqB;IACnC,IAAI,MAAM,GAAoB,CAAC,CAAC;IAChC,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,OAAO;QACL,OAAO,CAAC,UAAU;YAChB,IAAI,CAAC,IAAI,IAAI,UAAU,GAAG,MAAM;gBAAE,MAAM,GAAG,UAAU,CAAC;YACtD,IAAI,GAAG,IAAI,CAAC;QACd,CAAC;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI;KACrB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"resolution-floor.js","sourceRoot":"","sources":["../../src/query/resolution-floor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,MAAM,UAAU,qBAAqB;IACnC,IAAI,MAAM,GAAoB,CAAC,CAAC;IAChC,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,OAAO;QACL,OAAO,CAAC,UAAU;YAChB,IAAI,CAAC,IAAI,IAAI,UAAU,GAAG,MAAM;gBAAE,MAAM,GAAG,UAAU,CAAC;YACtD,IAAI,GAAG,IAAI,CAAC;QACd,CAAC;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI;KACrB,CAAC;AACJ,CAAC"}