@telora/daemon 0.22.85 → 0.22.91

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 (317) hide show
  1. package/build-info.json +4 -3
  2. package/dist/backends/index.d.ts +1 -1
  3. package/dist/backends/index.d.ts.map +1 -1
  4. package/dist/backends/index.js +1 -1
  5. package/dist/backends/index.js.map +1 -1
  6. package/dist/backends/resolve.d.ts +37 -8
  7. package/dist/backends/resolve.d.ts.map +1 -1
  8. package/dist/backends/resolve.js +62 -28
  9. package/dist/backends/resolve.js.map +1 -1
  10. package/dist/ci/ci-escalation.d.ts +17 -1
  11. package/dist/ci/ci-escalation.d.ts.map +1 -1
  12. package/dist/ci/ci-escalation.js +51 -3
  13. package/dist/ci/ci-escalation.js.map +1 -1
  14. package/dist/ci/ci-red-attribution.d.ts +85 -0
  15. package/dist/ci/ci-red-attribution.d.ts.map +1 -0
  16. package/dist/ci/ci-red-attribution.js +108 -0
  17. package/dist/ci/ci-red-attribution.js.map +1 -0
  18. package/dist/ci/ci-sensor-loop.d.ts +84 -80
  19. package/dist/ci/ci-sensor-loop.d.ts.map +1 -1
  20. package/dist/ci/ci-sensor-loop.js +132 -129
  21. package/dist/ci/ci-sensor-loop.js.map +1 -1
  22. package/dist/cli/connect/config-write.d.ts +7 -4
  23. package/dist/cli/connect/config-write.d.ts.map +1 -1
  24. package/dist/cli/connect/config-write.js +13 -7
  25. package/dist/cli/connect/config-write.js.map +1 -1
  26. package/dist/cli/connect.d.ts.map +1 -1
  27. package/dist/cli/connect.js +11 -1
  28. package/dist/cli/connect.js.map +1 -1
  29. package/dist/cli/update-commands.d.ts.map +1 -1
  30. package/dist/cli/update-commands.js +2 -1
  31. package/dist/cli/update-commands.js.map +1 -1
  32. package/dist/completion/coverage-stabilized.d.ts.map +1 -1
  33. package/dist/completion/coverage-stabilized.js +1 -1
  34. package/dist/completion/coverage-stabilized.js.map +1 -1
  35. package/dist/completion/escalations.d.ts +40 -5
  36. package/dist/completion/escalations.d.ts.map +1 -1
  37. package/dist/completion/escalations.js +19 -11
  38. package/dist/completion/escalations.js.map +1 -1
  39. package/dist/completion/event-escalations.d.ts +12 -1
  40. package/dist/completion/event-escalations.d.ts.map +1 -1
  41. package/dist/completion/event-escalations.js +73 -37
  42. package/dist/completion/event-escalations.js.map +1 -1
  43. package/dist/completion/event.d.ts +4 -1
  44. package/dist/completion/event.d.ts.map +1 -1
  45. package/dist/completion/event.js +1 -1
  46. package/dist/completion/event.js.map +1 -1
  47. package/dist/completion/human-only-act.d.ts +1 -1
  48. package/dist/completion/human-only-act.js +1 -1
  49. package/dist/completion/machine-remediable-demotion.d.ts +28 -1
  50. package/dist/completion/machine-remediable-demotion.d.ts.map +1 -1
  51. package/dist/completion/machine-remediable-demotion.js +9 -6
  52. package/dist/completion/machine-remediable-demotion.js.map +1 -1
  53. package/dist/completion/read-only-pristine.d.ts.map +1 -1
  54. package/dist/completion/read-only-pristine.js +4 -0
  55. package/dist/completion/read-only-pristine.js.map +1 -1
  56. package/dist/completion/review-exit-deps.js +1 -1
  57. package/dist/completion/review-exit-deps.js.map +1 -1
  58. package/dist/completion/review-exit-escalations.d.ts +10 -0
  59. package/dist/completion/review-exit-escalations.d.ts.map +1 -1
  60. package/dist/completion/review-exit-escalations.js +38 -3
  61. package/dist/completion/review-exit-escalations.js.map +1 -1
  62. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  63. package/dist/completion/review-exit-phase.js +8 -7
  64. package/dist/completion/review-exit-phase.js.map +1 -1
  65. package/dist/completion/review-exit-shortfall.d.ts +5 -1
  66. package/dist/completion/review-exit-shortfall.d.ts.map +1 -1
  67. package/dist/completion/review-exit-shortfall.js +8 -3
  68. package/dist/completion/review-exit-shortfall.js.map +1 -1
  69. package/dist/completion/status-advance-phase.d.ts +2 -0
  70. package/dist/completion/status-advance-phase.d.ts.map +1 -1
  71. package/dist/completion/status-advance-phase.js +2 -1
  72. package/dist/completion/status-advance-phase.js.map +1 -1
  73. package/dist/completion/terminated-work-reconcile.js +2 -2
  74. package/dist/completion/terminated-work-reconcile.js.map +1 -1
  75. package/dist/delivery/delivery-advance-block.d.ts +3 -3
  76. package/dist/delivery/delivery-advance-block.d.ts.map +1 -1
  77. package/dist/delivery/delivery-advance-block.js +13 -8
  78. package/dist/delivery/delivery-advance-block.js.map +1 -1
  79. package/dist/delivery/delivery-lifecycle.d.ts +10 -0
  80. package/dist/delivery/delivery-lifecycle.d.ts.map +1 -1
  81. package/dist/delivery/delivery-lifecycle.js +12 -6
  82. package/dist/delivery/delivery-lifecycle.js.map +1 -1
  83. package/dist/delivery/delivery-merge-ops.d.ts.map +1 -1
  84. package/dist/delivery/delivery-merge-ops.js +39 -21
  85. package/dist/delivery/delivery-merge-ops.js.map +1 -1
  86. package/dist/delivery/external-hold.d.ts +8 -2
  87. package/dist/delivery/external-hold.d.ts.map +1 -1
  88. package/dist/delivery/external-hold.js +12 -5
  89. package/dist/delivery/external-hold.js.map +1 -1
  90. package/dist/delivery/operator-hold.d.ts +6 -1
  91. package/dist/delivery/operator-hold.d.ts.map +1 -1
  92. package/dist/delivery/operator-hold.js +31 -10
  93. package/dist/delivery/operator-hold.js.map +1 -1
  94. package/dist/delivery/paused-revival.d.ts +6 -0
  95. package/dist/delivery/paused-revival.d.ts.map +1 -1
  96. package/dist/delivery/paused-revival.js +3 -1
  97. package/dist/delivery/paused-revival.js.map +1 -1
  98. package/dist/directive/directive-dispatch.d.ts.map +1 -1
  99. package/dist/directive/directive-dispatch.js +6 -3
  100. package/dist/directive/directive-dispatch.js.map +1 -1
  101. package/dist/directive/directive-queue.d.ts.map +1 -1
  102. package/dist/directive/directive-queue.js +4 -1
  103. package/dist/directive/directive-queue.js.map +1 -1
  104. package/dist/drift/staleness-sensor.d.ts +20 -0
  105. package/dist/drift/staleness-sensor.d.ts.map +1 -1
  106. package/dist/drift/staleness-sensor.js +54 -21
  107. package/dist/drift/staleness-sensor.js.map +1 -1
  108. package/dist/drift/staleness.d.ts +18 -5
  109. package/dist/drift/staleness.d.ts.map +1 -1
  110. package/dist/drift/staleness.js +28 -15
  111. package/dist/drift/staleness.js.map +1 -1
  112. package/dist/focus/focus-executor.d.ts.map +1 -1
  113. package/dist/focus/focus-executor.js +6 -8
  114. package/dist/focus/focus-executor.js.map +1 -1
  115. package/dist/focus/focus-loop-registry.d.ts.map +1 -1
  116. package/dist/focus/focus-loop-registry.js +23 -13
  117. package/dist/focus/focus-loop-registry.js.map +1 -1
  118. package/dist/focus/focus-respawn-guard.d.ts.map +1 -1
  119. package/dist/focus/focus-respawn-guard.js +21 -4
  120. package/dist/focus/focus-respawn-guard.js.map +1 -1
  121. package/dist/focus/listener-auto-advance.d.ts.map +1 -1
  122. package/dist/focus/listener-auto-advance.js +10 -6
  123. package/dist/focus/listener-auto-advance.js.map +1 -1
  124. package/dist/focus/verify-open-issues.d.ts.map +1 -1
  125. package/dist/focus/verify-open-issues.js +21 -1
  126. package/dist/focus/verify-open-issues.js.map +1 -1
  127. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
  128. package/dist/focus-stage-lifecycle/wedge-watchdog.js +35 -14
  129. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
  130. package/dist/loops/index.d.ts.map +1 -1
  131. package/dist/loops/index.js +2 -1
  132. package/dist/loops/index.js.map +1 -1
  133. package/dist/merge/focus-merge.d.ts +1 -1
  134. package/dist/merge/focus-merge.d.ts.map +1 -1
  135. package/dist/merge/focus-merge.js +5 -1
  136. package/dist/merge/focus-merge.js.map +1 -1
  137. package/dist/merge/merge-back-loop.d.ts +2 -1
  138. package/dist/merge/merge-back-loop.d.ts.map +1 -1
  139. package/dist/merge/merge-back-loop.js +15 -12
  140. package/dist/merge/merge-back-loop.js.map +1 -1
  141. package/dist/merge/merge-conflict-escalation.d.ts.map +1 -1
  142. package/dist/merge/merge-conflict-escalation.js +4 -0
  143. package/dist/merge/merge-conflict-escalation.js.map +1 -1
  144. package/dist/nexus/return.d.ts +14 -15
  145. package/dist/nexus/return.d.ts.map +1 -1
  146. package/dist/nexus/return.js +41 -31
  147. package/dist/nexus/return.js.map +1 -1
  148. package/dist/prompt-sections/execution-sections.d.ts +13 -5
  149. package/dist/prompt-sections/execution-sections.d.ts.map +1 -1
  150. package/dist/prompt-sections/execution-sections.js +78 -18
  151. package/dist/prompt-sections/execution-sections.js.map +1 -1
  152. package/dist/prompt-sections/routing-decider-sections.d.ts +60 -0
  153. package/dist/prompt-sections/routing-decider-sections.d.ts.map +1 -0
  154. package/dist/prompt-sections/routing-decider-sections.js +197 -0
  155. package/dist/prompt-sections/routing-decider-sections.js.map +1 -0
  156. package/dist/queries/agent-resolvable-aging.d.ts +4 -3
  157. package/dist/queries/agent-resolvable-aging.d.ts.map +1 -1
  158. package/dist/queries/agent-resolvable-aging.js +5 -4
  159. package/dist/queries/agent-resolvable-aging.js.map +1 -1
  160. package/dist/queries/agent-resolvable-promotion.d.ts +172 -124
  161. package/dist/queries/agent-resolvable-promotion.d.ts.map +1 -1
  162. package/dist/queries/agent-resolvable-promotion.js +332 -307
  163. package/dist/queries/agent-resolvable-promotion.js.map +1 -1
  164. package/dist/queries/agent-resolvable-retirement.d.ts +105 -0
  165. package/dist/queries/agent-resolvable-retirement.d.ts.map +1 -0
  166. package/dist/queries/agent-resolvable-retirement.js +227 -0
  167. package/dist/queries/agent-resolvable-retirement.js.map +1 -0
  168. package/dist/queries/cause-key.d.ts +109 -0
  169. package/dist/queries/cause-key.d.ts.map +1 -1
  170. package/dist/queries/cause-key.js +93 -1
  171. package/dist/queries/cause-key.js.map +1 -1
  172. package/dist/queries/deliveries.d.ts +14 -0
  173. package/dist/queries/deliveries.d.ts.map +1 -1
  174. package/dist/queries/deliveries.js +20 -2
  175. package/dist/queries/deliveries.js.map +1 -1
  176. package/dist/queries/delivery-gate-state.d.ts +130 -5
  177. package/dist/queries/delivery-gate-state.d.ts.map +1 -1
  178. package/dist/queries/delivery-gate-state.js +111 -2
  179. package/dist/queries/delivery-gate-state.js.map +1 -1
  180. package/dist/queries/escalation-consumption.d.ts +95 -15
  181. package/dist/queries/escalation-consumption.d.ts.map +1 -1
  182. package/dist/queries/escalation-consumption.js +162 -24
  183. package/dist/queries/escalation-consumption.js.map +1 -1
  184. package/dist/queries/escalation-dispositions.d.ts +19 -7
  185. package/dist/queries/escalation-dispositions.d.ts.map +1 -1
  186. package/dist/queries/escalation-dispositions.js +7 -0
  187. package/dist/queries/escalation-dispositions.js.map +1 -1
  188. package/dist/queries/escalation-suppression.d.ts +63 -19
  189. package/dist/queries/escalation-suppression.d.ts.map +1 -1
  190. package/dist/queries/escalation-suppression.js +64 -35
  191. package/dist/queries/escalation-suppression.js.map +1 -1
  192. package/dist/queries/escalations.d.ts +127 -70
  193. package/dist/queries/escalations.d.ts.map +1 -1
  194. package/dist/queries/escalations.js +170 -188
  195. package/dist/queries/escalations.js.map +1 -1
  196. package/dist/queries/filing-observation.d.ts +82 -0
  197. package/dist/queries/filing-observation.d.ts.map +1 -0
  198. package/dist/queries/filing-observation.js +157 -0
  199. package/dist/queries/filing-observation.js.map +1 -0
  200. package/dist/queries/holds.d.ts +69 -2
  201. package/dist/queries/holds.d.ts.map +1 -1
  202. package/dist/queries/holds.js +106 -11
  203. package/dist/queries/holds.js.map +1 -1
  204. package/dist/queries/incident-correlation.d.ts +291 -0
  205. package/dist/queries/incident-correlation.d.ts.map +1 -0
  206. package/dist/queries/incident-correlation.js +408 -0
  207. package/dist/queries/incident-correlation.js.map +1 -0
  208. package/dist/queries/routing-measurement.d.ts +48 -1
  209. package/dist/queries/routing-measurement.d.ts.map +1 -1
  210. package/dist/queries/routing-measurement.js +64 -2
  211. package/dist/queries/routing-measurement.js.map +1 -1
  212. package/dist/queries/routing-quality.d.ts +8 -0
  213. package/dist/queries/routing-quality.d.ts.map +1 -1
  214. package/dist/queries/routing-quality.js +12 -3
  215. package/dist/queries/routing-quality.js.map +1 -1
  216. package/dist/queries/shared.js +1 -1
  217. package/dist/shell/crash-recovery.d.ts.map +1 -1
  218. package/dist/shell/crash-recovery.js +6 -6
  219. package/dist/shell/crash-recovery.js.map +1 -1
  220. package/dist/shell/heartbeat-metadata.d.ts +18 -0
  221. package/dist/shell/heartbeat-metadata.d.ts.map +1 -1
  222. package/dist/shell/heartbeat-metadata.js +24 -0
  223. package/dist/shell/heartbeat-metadata.js.map +1 -1
  224. package/dist/shell/heartbeat.d.ts.map +1 -1
  225. package/dist/shell/heartbeat.js +6 -17
  226. package/dist/shell/heartbeat.js.map +1 -1
  227. package/dist/shell/install-probe-tick.d.ts.map +1 -1
  228. package/dist/shell/install-probe-tick.js +3 -1
  229. package/dist/shell/install-probe-tick.js.map +1 -1
  230. package/dist/shell/model-resolution.d.ts +9 -4
  231. package/dist/shell/model-resolution.d.ts.map +1 -1
  232. package/dist/shell/model-resolution.js +46 -7
  233. package/dist/shell/model-resolution.js.map +1 -1
  234. package/dist/shell/unified-init.d.ts +24 -0
  235. package/dist/shell/unified-init.d.ts.map +1 -1
  236. package/dist/shell/unified-init.js +22 -17
  237. package/dist/shell/unified-init.js.map +1 -1
  238. package/dist/spawn/model-id-guards.d.ts +50 -0
  239. package/dist/spawn/model-id-guards.d.ts.map +1 -0
  240. package/dist/spawn/model-id-guards.js +110 -0
  241. package/dist/spawn/model-id-guards.js.map +1 -0
  242. package/dist/spawn/model-routing.d.ts +1 -43
  243. package/dist/spawn/model-routing.d.ts.map +1 -1
  244. package/dist/spawn/model-routing.js +3 -94
  245. package/dist/spawn/model-routing.js.map +1 -1
  246. package/dist/spawn/respawn-cycle-escalation.d.ts +10 -2
  247. package/dist/spawn/respawn-cycle-escalation.d.ts.map +1 -1
  248. package/dist/spawn/respawn-cycle-escalation.js +16 -2
  249. package/dist/spawn/respawn-cycle-escalation.js.map +1 -1
  250. package/dist/spawn/routing-decider-spawn.d.ts +93 -0
  251. package/dist/spawn/routing-decider-spawn.d.ts.map +1 -0
  252. package/dist/spawn/routing-decider-spawn.js +185 -0
  253. package/dist/spawn/routing-decider-spawn.js.map +1 -0
  254. package/dist/spawn/routing-decider.d.ts +42 -0
  255. package/dist/spawn/routing-decider.d.ts.map +1 -0
  256. package/dist/spawn/routing-decider.js +95 -0
  257. package/dist/spawn/routing-decider.js.map +1 -0
  258. package/dist/spawn/shared.d.ts +8 -0
  259. package/dist/spawn/shared.d.ts.map +1 -1
  260. package/dist/spawn/shared.js +1 -1
  261. package/dist/spawn/shared.js.map +1 -1
  262. package/dist/spawn/spawn-decision.d.ts +24 -16
  263. package/dist/spawn/spawn-decision.d.ts.map +1 -1
  264. package/dist/spawn/spawn-decision.js +28 -11
  265. package/dist/spawn/spawn-decision.js.map +1 -1
  266. package/dist/spawn/worktree-session.d.ts +23 -7
  267. package/dist/spawn/worktree-session.d.ts.map +1 -1
  268. package/dist/spawn/worktree-session.js +54 -22
  269. package/dist/spawn/worktree-session.js.map +1 -1
  270. package/dist/testing/fixtures/index.js +1 -1
  271. package/dist/types/index.js +1 -1
  272. package/dist/update/auto-update.d.ts +20 -3
  273. package/dist/update/auto-update.d.ts.map +1 -1
  274. package/dist/update/auto-update.js +8 -24
  275. package/dist/update/auto-update.js.map +1 -1
  276. package/dist/update/self-update.d.ts +43 -4
  277. package/dist/update/self-update.d.ts.map +1 -1
  278. package/dist/update/self-update.js +61 -38
  279. package/dist/update/self-update.js.map +1 -1
  280. package/dist/update/version-check.d.ts +29 -45
  281. package/dist/update/version-check.d.ts.map +1 -1
  282. package/dist/update/version-check.js +48 -79
  283. package/dist/update/version-check.js.map +1 -1
  284. package/dist/verify/failure-signature.d.ts +91 -0
  285. package/dist/verify/failure-signature.d.ts.map +1 -0
  286. package/dist/verify/failure-signature.js +233 -0
  287. package/dist/verify/failure-signature.js.map +1 -0
  288. package/dist/verify/shortfall-repeat.d.ts +12 -9
  289. package/dist/verify/shortfall-repeat.d.ts.map +1 -1
  290. package/dist/verify/shortfall-repeat.js +38 -14
  291. package/dist/verify/shortfall-repeat.js.map +1 -1
  292. package/dist/verify/stall-detectors.d.ts +19 -43
  293. package/dist/verify/stall-detectors.d.ts.map +1 -1
  294. package/dist/verify/stall-detectors.js +26 -101
  295. package/dist/verify/stall-detectors.js.map +1 -1
  296. package/dist/verify/unreviewed-settle-detector.d.ts +8 -0
  297. package/dist/verify/unreviewed-settle-detector.d.ts.map +1 -1
  298. package/dist/verify/unreviewed-settle-detector.js +15 -1
  299. package/dist/verify/unreviewed-settle-detector.js.map +1 -1
  300. package/dist/verify/verification-deps-default.d.ts.map +1 -1
  301. package/dist/verify/verification-deps-default.js +14 -2
  302. package/dist/verify/verification-deps-default.js.map +1 -1
  303. package/dist/verify/verification-evidence-unavailable-feedback.d.ts.map +1 -1
  304. package/dist/verify/verification-evidence-unavailable-feedback.js +8 -2
  305. package/dist/verify/verification-evidence-unavailable-feedback.js.map +1 -1
  306. package/dist/verify/verification-feedback.d.ts +62 -14
  307. package/dist/verify/verification-feedback.d.ts.map +1 -1
  308. package/dist/verify/verification-feedback.js +101 -28
  309. package/dist/verify/verification-feedback.js.map +1 -1
  310. package/dist/verify/verify-gate-stall.d.ts +116 -0
  311. package/dist/verify/verify-gate-stall.d.ts.map +1 -0
  312. package/dist/verify/verify-gate-stall.js +169 -0
  313. package/dist/verify/verify-gate-stall.js.map +1 -0
  314. package/dist/verify/verify-restatement.d.ts.map +1 -1
  315. package/dist/verify/verify-restatement.js +2 -1
  316. package/dist/verify/verify-restatement.js.map +1 -1
  317. package/package.json +3 -3
@@ -0,0 +1,408 @@
1
+ // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
+ // Pinned by: packages/daemon/src/queries/incident-correlation.test.ts
3
+ // PINNED-BY-END
4
+ import { appendSymptom, computeCauseKey, incidentKey, isIncidentSymptom, INBOUND_NOTIFICATION_KINDS, INCIDENT_SYMPTOM_ACT_MAX, INCIDENT_SYMPTOM_CAP, } from './cause-key.js';
5
+ import { DISPOSITION_AGENT_RESOLVABLE } from './escalation-dispositions.js';
6
+ import { conditionHead, readHumanAct, readObservation } from './filing-observation.js';
7
+ /** Open statuses an incident can be attached to (pending / in_review). */
8
+ const INCIDENT_OPEN_STATUSES = ['pending', 'in_review'];
9
+ /**
10
+ * Kinds whose OWN open row is read BY KIND as a HOLD, released by a kind-keyed
11
+ * close-half: team_failure (the respawn guard), review_coverage_incomplete (the
12
+ * respawn guard, any disposition), review_handoff_exhausted (the state cascade's
13
+ * breaker hold). Absorbing one into another row would silently drop the hold, and
14
+ * absorbing another condition into one would be closed by the hold's own
15
+ * close-half -- so they never correlate in either direction (their rows still
16
+ * carry the shared incident_key).
17
+ */
18
+ export const INCIDENT_HOLD_KINDS = new Set([
19
+ 'team_failure',
20
+ 'review_coverage_incomplete',
21
+ 'review_handoff_exhausted',
22
+ ]);
23
+ function metaOf(row) {
24
+ return row.metadata ?? null;
25
+ }
26
+ function nonBlankString(value) {
27
+ return typeof value === 'string' && value.trim() !== '' ? value : null;
28
+ }
29
+ /** Pure: the incident key a metadata bag carries, or null. */
30
+ export function readIncidentKey(metadata) {
31
+ if (!metadata || typeof metadata !== 'object')
32
+ return null;
33
+ return nonBlankString(metadata.incident_key);
34
+ }
35
+ /** Pure: the well-formed symptoms a metadata bag carries (malformed entries dropped). */
36
+ export function readSymptoms(metadata) {
37
+ if (!metadata || typeof metadata !== 'object')
38
+ return [];
39
+ const raw = metadata.symptoms;
40
+ return Array.isArray(raw) ? raw.filter(isIncidentSymptom) : [];
41
+ }
42
+ /**
43
+ * Pure: the branch a filing is about, read from what the site already carries --
44
+ * anchor.branch (merge + stuck-branch filings), then metadata.branch_name
45
+ * (stuck_focus_branch), then metadata.branch (ci_run_red).
46
+ */
47
+ export function filingBranch(input) {
48
+ const meta = input.metadata ?? null;
49
+ return nonBlankString(input.anchor?.branch) ?? nonBlankString(meta?.branch_name) ?? nonBlankString(meta?.branch);
50
+ }
51
+ /**
52
+ * Pure: the incident key a filing is stamped with. An inbound notification kind
53
+ * never joins an incident. An incident_key already in the filing's metadata wins
54
+ * (a filing that carries its source's key forward); otherwise the key is
55
+ * derived from the RESOLVED provenance (delivery -> focus -> branch|product).
56
+ */
57
+ export function resolveFilingIncidentKey(input, provenance) {
58
+ const kind = input.escalationKind ?? null;
59
+ if (kind && INBOUND_NOTIFICATION_KINDS.has(kind))
60
+ return null;
61
+ const carried = readIncidentKey(input.metadata);
62
+ if (carried)
63
+ return carried;
64
+ return incidentKey({
65
+ deliveryId: provenance.deliveryId,
66
+ focusId: provenance.focusId,
67
+ branch: filingBranch(input),
68
+ productId: provenance.productId,
69
+ }, kind);
70
+ }
71
+ /** Pure: a proposed act bounded for a symptom (INCIDENT_SYMPTOM_ACT_MAX), or null when none was proposed. */
72
+ function symptomProposedAct(act) {
73
+ if (!act)
74
+ return null;
75
+ if (act.act.length <= INCIDENT_SYMPTOM_ACT_MAX)
76
+ return act;
77
+ return { kind: act.kind, act: `${act.act.slice(0, INCIDENT_SYMPTOM_ACT_MAX - 3)}...` };
78
+ }
79
+ /**
80
+ * Pure: one filing's observation as an incident symptom. A filing with no
81
+ * metadata.cause_key (a direct createEscalation site) gets a deterministic
82
+ * kind-scoped stand-in, so a re-observation maps to the same symptom. The routed
83
+ * observation's proposed disposition AND proposed human act ride on the symptom, so
84
+ * neither is lost when the filing attaches to another row: every absorbed
85
+ * detector's proposal reaches the routing decider, not only the opener's. A
86
+ * metadata.human_act is carried too, but the daemon chokepoint never writes one, so
87
+ * no daemon filing's symptom has it.
88
+ */
89
+ export function filingSymptom(input, key, observedAt) {
90
+ const causeKey = nonBlankString(input.metadata?.cause_key) ??
91
+ computeCauseKey(input.escalationKind ?? 'unkeyed', { incident: key });
92
+ const act = readHumanAct(input.metadata?.human_act);
93
+ const observation = readObservation(input.metadata);
94
+ const proposed = observation?.proposed_disposition;
95
+ const proposedAct = symptomProposedAct(observation?.proposed_human_act);
96
+ return {
97
+ cause_key: causeKey,
98
+ escalation_kind: input.escalationKind ?? null,
99
+ head: conditionHead(input.description),
100
+ observed_at: observedAt,
101
+ ...(act ? { human_act: act } : {}),
102
+ ...(proposed ? { proposed_disposition: proposed } : {}),
103
+ ...(proposedAct ? { proposed_human_act: proposedAct } : {}),
104
+ };
105
+ }
106
+ /**
107
+ * Pure: stamp a filing's metadata with its incident key and append its own
108
+ * symptom to whatever symptoms it already carries (none for a fresh row, so the
109
+ * opener is the first entry; a carried list otherwise).
110
+ * A null key leaves the metadata untouched.
111
+ */
112
+ export function stampIncidentMetadata(input, key, observedAt) {
113
+ if (!key)
114
+ return input.metadata;
115
+ return {
116
+ ...(input.metadata ?? {}),
117
+ incident_key: key,
118
+ symptoms: appendSymptom(readSymptoms(input.metadata), filingSymptom(input, key, observedAt)),
119
+ };
120
+ }
121
+ function isOpenRow(row) {
122
+ return !row.status || INCIDENT_OPEN_STATUSES.includes(row.status);
123
+ }
124
+ function rowKind(row) {
125
+ return nonBlankString(row.escalationKind) ?? nonBlankString(metaOf(row)?.kind);
126
+ }
127
+ /** Pure: a row sits in the machine lane (agent_resolvable); everything else is human-facing. */
128
+ export function isMachineLaneRow(row) {
129
+ return row.disposition === DISPOSITION_AGENT_RESOLVABLE;
130
+ }
131
+ /** Pure: the cause keys recorded as symptoms on an OPEN row (idempotency survives correlation). */
132
+ export function openRowSymptomCauseKeys(row) {
133
+ return isOpenRow(row) ? readSymptoms(metaOf(row)).map((s) => s.cause_key) : [];
134
+ }
135
+ /** Pure: whether a filing may correlate at all (contract rule 4). */
136
+ export function filingMayCorrelate(input) {
137
+ if (input.escalationKind && INCIDENT_HOLD_KINDS.has(input.escalationKind))
138
+ return false;
139
+ return nonBlankString(input.targetProductId) === null;
140
+ }
141
+ /**
142
+ * Pure: the OPEN row of incident `key` in the filing's lane (contract rule 1), or
143
+ * null. Lane = the SENT disposition (null and undefined are one lane). Hold-kind
144
+ * rows are never a target. Among several, the oldest wins (createdAt ascending;
145
+ * rows without one keep list order, which escalation_list returns newest-first, so
146
+ * a later entry is older).
147
+ */
148
+ export function findLaneIncidentRow(rows, key, disposition) {
149
+ let best = null;
150
+ for (const [index, row] of rows.entries()) {
151
+ if (!isOpenRow(row) || readIncidentKey(metaOf(row)) !== key)
152
+ continue;
153
+ if ((row.disposition ?? null) !== (disposition ?? null))
154
+ continue;
155
+ const kind = rowKind(row);
156
+ if (kind !== null && INCIDENT_HOLD_KINDS.has(kind))
157
+ continue;
158
+ const candidate = { row, index };
159
+ if (best === null || isOlderCandidate(candidate, best))
160
+ best = candidate;
161
+ }
162
+ return best?.row ?? null;
163
+ }
164
+ function isOlderCandidate(a, b) {
165
+ const createdA = a.row.createdAt ?? null;
166
+ const createdB = b.row.createdAt ?? null;
167
+ if (createdA && createdB && createdA !== createdB)
168
+ return createdA < createdB;
169
+ return a.index > b.index;
170
+ }
171
+ /** Pure: whether a row already carries `causeKey` -- its own, its original, or a symptom's. */
172
+ export function rowCarriesCause(row, causeKey) {
173
+ const meta = metaOf(row);
174
+ if (meta?.cause_key === causeKey || meta?.original_cause_key === causeKey)
175
+ return true;
176
+ return readSymptoms(meta).some((s) => s.cause_key === causeKey);
177
+ }
178
+ /** The default correlation I/O over a callApi (escalation_list + escalation_update). */
179
+ export function incidentIoOver(call) {
180
+ return {
181
+ listOpenRows: async ({ focusId }) => {
182
+ const res = await call('escalation_list', {
183
+ fields: { statuses: INCIDENT_OPEN_STATUSES, ...(focusId ? { focusId } : {}) },
184
+ limit: 500,
185
+ });
186
+ return res?.escalations ?? [];
187
+ },
188
+ updateMetadata: async (escalationId, metadata) => {
189
+ await call('escalation_update', { escalationId, fields: { metadata } });
190
+ },
191
+ };
192
+ }
193
+ /**
194
+ * Correlate one filing onto its incident (the contract in the module header):
195
+ * attach to the open lane row, report a re-observed cause, or tell the chokepoint
196
+ * to file the row. Never throws -- a failed read or write degrades to open_row /
197
+ * attach_failed, and the chokepoint files the row.
198
+ */
199
+ export async function correlateFiling(input, io) {
200
+ const openRow = { outcome: 'open_row', incidentRowId: null, note: null, warn: false };
201
+ if (!filingMayCorrelate(input.filing))
202
+ return openRow;
203
+ let rows;
204
+ try {
205
+ rows = await io.listOpenRows(input.focusId ? { focusId: input.focusId } : {});
206
+ }
207
+ catch (err) {
208
+ return { ...openRow, note: `Incident read for ${input.key} failed; filing its own row: ${err.message}`, warn: true };
209
+ }
210
+ const row = findLaneIncidentRow(rows, input.key, input.disposition);
211
+ if (!row)
212
+ return openRow;
213
+ const symptom = filingSymptom(input.filing, input.key, input.observedAt);
214
+ const where = `incident ${input.key} (escalation ${row.id})`;
215
+ if (rowCarriesCause(row, symptom.cause_key)) {
216
+ return { outcome: 'already_carried', incidentRowId: row.id, note: `"${symptom.cause_key}" is already carried by ${where}; nothing filed`, warn: false };
217
+ }
218
+ try {
219
+ await io.updateMetadata(row.id, { symptoms: appendSymptom(readSymptoms(metaOf(row)), symptom) });
220
+ return { outcome: 'attached', incidentRowId: row.id, note: `Correlated "${symptom.cause_key}" onto ${where}`, warn: false };
221
+ }
222
+ catch (err) {
223
+ return { outcome: 'attach_failed', incidentRowId: row.id, note: `Attach to ${where} failed; filing its own row: ${err.message}`, warn: true };
224
+ }
225
+ }
226
+ /**
227
+ * Pure: whether a row answers for `kind` in a DEDUP read: its own column kind,
228
+ * the legacy metadata.kind, a hand-off row's metadata.originalKind or
229
+ * original_cause_key, or any symptom correlated onto it (by kind or by a cause key
230
+ * minted for the kind, `<kind>::...`). Hold reads must NOT use this -- a handed-off
231
+ * or absorbed condition has no close-half that would clear a hold keyed on it.
232
+ */
233
+ export function rowAnswersForKind(row, kind) {
234
+ if (row.escalationKind === kind)
235
+ return true;
236
+ const meta = metaOf(row);
237
+ if (meta?.kind === kind || meta?.originalKind === kind)
238
+ return true;
239
+ if (typeof meta?.original_cause_key === 'string' && meta.original_cause_key.startsWith(`${kind}::`))
240
+ return true;
241
+ return readSymptoms(meta).some((s) => symptomAnswersForKind(s, kind));
242
+ }
243
+ /** Pure: a symptom is an observation of `kind` -- by its kind, or by a cause key minted for the kind (`<kind>::...`). */
244
+ export function symptomAnswersForKind(symptom, kind) {
245
+ return symptom.escalation_kind === kind || symptom.cause_key.startsWith(`${kind}::`);
246
+ }
247
+ /**
248
+ * Pure: whether a row is about `deliveryId` in a DEDUP read: the delivery_id
249
+ * column, the metadata fallbacks, or an incident key naming the delivery (a
250
+ * historic promotion refile is anchored to the focus, so only its carried key names it).
251
+ */
252
+ export function rowNamesDelivery(row, deliveryId) {
253
+ if (row.deliveryId === deliveryId)
254
+ return true;
255
+ const meta = metaOf(row);
256
+ if (meta?.deliveryId === deliveryId || meta?.delivery_id === deliveryId)
257
+ return true;
258
+ return readIncidentKey(meta) === incidentKey({ deliveryId });
259
+ }
260
+ // ── Open-row kind predicates (the queries/escalations.ts dedup + close-half reads) ──
261
+ /**
262
+ * Pure: an OPEN row of `kind` on `focusId` -- the typed focus_id + escalation_kind
263
+ * columns, or (back-compat, a row filed before the column promotion)
264
+ * metadata.focusId + metadata.kind. With `matchCorrelated` (DEDUP reads only), also
265
+ * a row on the focus answering for the kind as a hand-off row or a correlated
266
+ * symptom (rowAnswersForKind).
267
+ */
268
+ export function isOpenFocusKindRow(row, focusId, kind, matchCorrelated = false) {
269
+ if (!isOpenRow(row))
270
+ return false;
271
+ const meta = metaOf(row);
272
+ if (matchCorrelated)
273
+ return (row.focusId === focusId || meta?.focusId === focusId) && rowAnswersForKind(row, kind);
274
+ if (row.focusId === focusId && row.escalationKind === kind)
275
+ return true;
276
+ return meta?.focusId === focusId && meta?.kind === kind;
277
+ }
278
+ /**
279
+ * Pure: an OPEN worktree-dirty-class row for `focusId` whose kind is in `kinds`.
280
+ * Shared by hasOpenWorktreeDirtyEscalation (dedup, matchCorrelated) and
281
+ * resolveOpenWorktreeDirtyEscalations (auto-close, never correlated: it must not
282
+ * close a row whose own condition is a different one) so both agree on what counts.
283
+ *
284
+ * The status re-check is defense-in-depth. The live escalation_list handler
285
+ * already honors the `statuses` filter server-side, but the invariant "a RESOLVED
286
+ * worktree-dirty row must never suppress (or be re-resolved as) a legitimate new
287
+ * escalation" must hold however the rows were fetched (custom `kinds`, a future
288
+ * caller that forgets the statuses filter, etc.).
289
+ */
290
+ export function isOpenWorktreeDirtyMatch(row, focusId, kinds, matchCorrelated = false) {
291
+ return [...kinds].some((kind) => isOpenFocusKindRow(row, focusId, kind, matchCorrelated));
292
+ }
293
+ /** Pure: the well-formed cleared-symptom records a metadata bag carries. */
294
+ export function readClearedSymptoms(metadata) {
295
+ if (!metadata || typeof metadata !== 'object')
296
+ return [];
297
+ const raw = metadata.cleared_symptoms;
298
+ if (!Array.isArray(raw))
299
+ return [];
300
+ return raw.filter((v) => {
301
+ if (!v || typeof v !== 'object')
302
+ return false;
303
+ const c = v;
304
+ return nonBlankString(c.cause_key) !== null && (c.escalation_kind === null || typeof c.escalation_kind === 'string') &&
305
+ typeof c.cleared_at === 'string' && typeof c.resolution_class === 'string';
306
+ });
307
+ }
308
+ /**
309
+ * Pure: the cause keys that are a row's OWN -- its metadata.cause_key, a hand-off
310
+ * row's original_cause_key, and the kind-scoped stand-in its opening symptom got
311
+ * when filed without a cause key (filingSymptom). Never retired by retirement.
312
+ */
313
+ export function rowOwnCauseKeys(row) {
314
+ const meta = metaOf(row);
315
+ const own = new Set();
316
+ for (const k of [meta?.cause_key, meta?.original_cause_key].map(nonBlankString))
317
+ if (k)
318
+ own.add(k);
319
+ const key = readIncidentKey(meta);
320
+ if (key) {
321
+ own.add(computeCauseKey(nonBlankString(row.escalationKind) ?? 'unkeyed', { incident: key }));
322
+ own.add(computeCauseKey(rowKind(row) ?? 'unkeyed', { incident: key }));
323
+ }
324
+ return own;
325
+ }
326
+ function rowInClearingScope(row, scope) {
327
+ if (!scope.focusId && !scope.productId)
328
+ return false;
329
+ const meta = metaOf(row);
330
+ if (scope.focusId && row.focusId !== scope.focusId && meta?.focusId !== scope.focusId)
331
+ return false;
332
+ if (!scope.productId)
333
+ return true;
334
+ return row.productId === scope.productId || meta?.productId === scope.productId || meta?.product_id === scope.productId;
335
+ }
336
+ function symptomMatchesClearing(symptom, clearing) {
337
+ if (clearing.causeKeys?.includes(symptom.cause_key))
338
+ return true;
339
+ return (clearing.kinds ?? []).some((kind) => symptomAnswersForKind(symptom, kind));
340
+ }
341
+ /**
342
+ * Pure: the metadata patch that retires a clearing's matching absorbed symptoms from
343
+ * one row -- the remaining metadata.symptoms plus metadata.cleared_symptoms with each
344
+ * retired one appended (de-duped by cause key, newest kept, bounded to
345
+ * INCIDENT_SYMPTOM_CAP) -- or null when the row is closed, out of scope, or carries
346
+ * nothing to retire. The row's own opening symptom is never retired.
347
+ */
348
+ export function symptomRetirementPatch(row, clearing, clearedAt) {
349
+ if (!isOpenRow(row) || !rowInClearingScope(row, clearing.scope))
350
+ return null;
351
+ const meta = metaOf(row);
352
+ const own = rowOwnCauseKeys(row);
353
+ const symptoms = readSymptoms(meta);
354
+ const retired = symptoms.filter((s) => !own.has(s.cause_key) && symptomMatchesClearing(s, clearing));
355
+ if (retired.length === 0)
356
+ return null;
357
+ const retiredKeys = new Set(retired.map((s) => s.cause_key));
358
+ const cleared = [
359
+ ...readClearedSymptoms(meta).filter((c) => !retiredKeys.has(c.cause_key)),
360
+ ...retired.map((s) => ({ cause_key: s.cause_key, escalation_kind: s.escalation_kind, cleared_at: clearedAt, resolution_class: clearing.resolutionClass })),
361
+ ];
362
+ return {
363
+ symptoms: symptoms.filter((s) => !retiredKeys.has(s.cause_key)),
364
+ cleared_symptoms: cleared.slice(Math.max(0, cleared.length - INCIDENT_SYMPTOM_CAP)),
365
+ };
366
+ }
367
+ /**
368
+ * Retire a clearing's matching absorbed symptoms from the OPEN rows in its scope
369
+ * (contract rule 6). `rows` reuses rows the close-half already read for the scope
370
+ * (no second read); omitted, the open rows are read, narrowed by scope.focusId.
371
+ * `skipIds` are the close-half's own rows (being resolved, not rewritten). A clearing
372
+ * of hold kinds only reads nothing -- a hold kind is never absorbed (rule 4).
373
+ * Best-effort and never throws: a failed read or write becomes a warning and the
374
+ * pass continues. The write reads-then-writes like an attach (not atomic).
375
+ */
376
+ export async function retireClearedSymptoms(clearing, io, opts = {}) {
377
+ const outcome = { retired: 0, warnings: [] };
378
+ const absorbable = (clearing.kinds ?? []).some((k) => !INCIDENT_HOLD_KINDS.has(k)) || (clearing.causeKeys ?? []).length > 0;
379
+ if (!absorbable || (!clearing.scope.focusId && !clearing.scope.productId))
380
+ return outcome;
381
+ let rows;
382
+ try {
383
+ rows = opts.rows ?? (await io.listOpenRows(clearing.scope.focusId ? { focusId: clearing.scope.focusId } : {}));
384
+ }
385
+ catch (err) {
386
+ outcome.warnings.push(`Symptom retirement read failed; absorbed symptoms left in place: ${err.message}`);
387
+ return outcome;
388
+ }
389
+ const skip = new Set(opts.skipIds ?? []);
390
+ const clearedAt = opts.clearedAt ?? new Date().toISOString();
391
+ for (const row of rows) {
392
+ if (skip.has(row.id))
393
+ continue;
394
+ const patch = symptomRetirementPatch(row, clearing, clearedAt);
395
+ if (!patch)
396
+ continue;
397
+ const count = readSymptoms(metaOf(row)).length - patch.symptoms.length;
398
+ try {
399
+ await io.updateMetadata(row.id, { ...patch });
400
+ outcome.retired += count;
401
+ }
402
+ catch (err) {
403
+ outcome.warnings.push(`Retiring ${count} cleared symptom(s) from escalation ${row.id} failed: ${err.message}`);
404
+ }
405
+ }
406
+ return outcome;
407
+ }
408
+ //# sourceMappingURL=incident-correlation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"incident-correlation.js","sourceRoot":"","sources":["../../src/queries/incident-correlation.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,sEAAsE;AACtE,gBAAgB;AA+DhB,OAAO,EACL,aAAa,EACb,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,GAErB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAiB,MAAM,yBAAyB,CAAC;AAGtG,0EAA0E;AAC1E,MAAM,sBAAsB,GAAsB,CAAC,SAAS,EAA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C,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;YAC9C,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,KAAK,uCAAuC,GAAG,CAAC,EAAE,YAAa,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5H,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -2,7 +2,52 @@
2
2
  export interface ResolvedEscalationRow {
3
3
  disposition: string | null;
4
4
  resolutionClass: string | null;
5
+ /** The row's own escalation id, when read (lets a source row judged directly win over its carrier). */
6
+ id?: string;
7
+ /**
8
+ * Set when this row IS a hand-off out of the machine lane -- a routing decider's
9
+ * human-facing filing (metadata.originalEscalationId) or a historic promotion
10
+ * refile: the id of the machine-lane filing it was handed off from. The row is then judged against that
11
+ * filing's declared disposition, not its own needs_operator (see resolvePromotionLineage).
12
+ */
13
+ promotedFrom?: string;
14
+ /**
15
+ * Ids of OTHER machine-lane filings whose promotion was correlated onto this row
16
+ * as a symptom instead of filing its own refile (incident correlation is
17
+ * focus-scoped, so a second promotion on a focus attached to the first open
18
+ * needs_operator row there). Historic only: a routing decider's MCP filing never
19
+ * passes the incident reducer. Each is judged with this row's resolver.
20
+ */
21
+ absorbedPromotions?: readonly string[];
5
22
  }
23
+ /**
24
+ * Pure: expand a resolved sample into JUDGMENT UNITS, one per filing whose
25
+ * resolver the row witnesses. This is what lets the mis-route rate see the
26
+ * machine lane's dominant hand-back path, PROMOTION:
27
+ *
28
+ * an agent_resolvable filing no agent clears is handed to a routing decider,
29
+ * which files a needs_operator row carrying its lineage, and the source is closed
30
+ * auto_swept (no actor -- never judged); when an operator resolves that
31
+ * row, judging it as needs_operator + operator_action reads "correctly
32
+ * routed", so a lane whose work all ages out and is handed to a human would
33
+ * measure a mis-route rate of ~0.
34
+ *
35
+ * Instead a promoted refile (promotedFrom) is judged against its SOURCE's declared
36
+ * disposition (agent_resolvable) with the refile's own resolution class: closed
37
+ * operator_action it is a machine-lane hand-back (mis-route), closed agent_session
38
+ * the machine lane still cleared it (correct), closed auto_swept / declined it
39
+ * carries no actor (unjudged) -- the same resolverActorOf mapping as any row. A row
40
+ * that absorbed other promotions contributes one agent_resolvable unit per absorbed
41
+ * source, in addition to its own unit.
42
+ *
43
+ * One judgment per source filing: a source already witnessed by a carrier is not
44
+ * counted twice, and when the SOURCE row itself is in the sample with an actor
45
+ * class (an agent closed it while its promotion symptom sat on a human row), that
46
+ * direct close is the witness and the carrier's unit for it is dropped. The source
47
+ * row's own auto_swept promotion close carries no actor, so it never double-counts.
48
+ * Units carry no lineage fields, so the function is idempotent.
49
+ */
50
+ export declare function resolvePromotionLineage(rows: readonly ResolvedEscalationRow[]): ResolvedEscalationRow[];
6
51
  export interface MisRouteResult {
7
52
  /** Rows where both a declared owner and an actual resolver were observable. */
8
53
  judged: number;
@@ -17,7 +62,9 @@ export interface MisRouteResult {
17
62
  * Only rows whose ACTUAL resolver is observable (resolution_class in
18
63
  * agent_session / operator_action / external_change) AND whose disposition maps
19
64
  * to a declared owner are judged. A row with no resolver signal (e.g. auto_swept,
20
- * declined_invalid) or no disposition is not counted either way.
65
+ * declined_invalid) or no disposition is not counted either way. Promotion
66
+ * lineage is applied first (resolvePromotionLineage): a promoted refile is judged
67
+ * against the machine-lane filing it was promoted from.
21
68
  */
22
69
  export declare function computeMisRouteRate(rows: readonly ResolvedEscalationRow[]): MisRouteResult;
23
70
  export interface ActWorthyResult {
@@ -1 +1 @@
1
- {"version":3,"file":"routing-measurement.d.ts","sourceRoot":"","sources":["../../src/queries/routing-measurement.ts"],"names":[],"mappings":"AAkFA,iDAAiD;AACjD,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,qBAAqB,EAAE,GAAG,cAAc,CAW1F;AAED,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,qBAAqB,EAAE,GAAG,eAAe,CAS7F"}
1
+ {"version":3,"file":"routing-measurement.d.ts","sourceRoot":"","sources":["../../src/queries/routing-measurement.ts"],"names":[],"mappings":"AAkFA,iDAAiD;AACjD,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,uGAAuG;IACvG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,SAAS,qBAAqB,EAAE,GAAG,qBAAqB,EAAE,CAqBvG;AAED,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,qBAAqB,EAAE,GAAG,cAAc,CAW1F;AAED,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,qBAAqB,EAAE,GAAG,eAAe,CAS7F"}
@@ -42,18 +42,80 @@ function declaredOwnerOf(disposition) {
42
42
  }
43
43
  /** Resolution classes meaning the filing was NOT worth acting on. */
44
44
  const NON_ACTWORTHY_CLASSES = ['declined_invalid', 'duplicate'];
45
+ /**
46
+ * The disposition every promotion source was filed with. By construction: the
47
+ * promotion reads only open agent_resolvable rows (toAgentResolvableItems /
48
+ * toOrgAgentResolvableItems), so a refile's lineage always points back into the
49
+ * machine lane.
50
+ */
51
+ const PROMOTION_SOURCE_DISPOSITION = 'agent_resolvable';
52
+ /**
53
+ * Pure: expand a resolved sample into JUDGMENT UNITS, one per filing whose
54
+ * resolver the row witnesses. This is what lets the mis-route rate see the
55
+ * machine lane's dominant hand-back path, PROMOTION:
56
+ *
57
+ * an agent_resolvable filing no agent clears is handed to a routing decider,
58
+ * which files a needs_operator row carrying its lineage, and the source is closed
59
+ * auto_swept (no actor -- never judged); when an operator resolves that
60
+ * row, judging it as needs_operator + operator_action reads "correctly
61
+ * routed", so a lane whose work all ages out and is handed to a human would
62
+ * measure a mis-route rate of ~0.
63
+ *
64
+ * Instead a promoted refile (promotedFrom) is judged against its SOURCE's declared
65
+ * disposition (agent_resolvable) with the refile's own resolution class: closed
66
+ * operator_action it is a machine-lane hand-back (mis-route), closed agent_session
67
+ * the machine lane still cleared it (correct), closed auto_swept / declined it
68
+ * carries no actor (unjudged) -- the same resolverActorOf mapping as any row. A row
69
+ * that absorbed other promotions contributes one agent_resolvable unit per absorbed
70
+ * source, in addition to its own unit.
71
+ *
72
+ * One judgment per source filing: a source already witnessed by a carrier is not
73
+ * counted twice, and when the SOURCE row itself is in the sample with an actor
74
+ * class (an agent closed it while its promotion symptom sat on a human row), that
75
+ * direct close is the witness and the carrier's unit for it is dropped. The source
76
+ * row's own auto_swept promotion close carries no actor, so it never double-counts.
77
+ * Units carry no lineage fields, so the function is idempotent.
78
+ */
79
+ export function resolvePromotionLineage(rows) {
80
+ const directlyJudged = new Set();
81
+ for (const row of rows) {
82
+ if (row.id !== undefined && resolverActorOf(row.resolutionClass) !== null)
83
+ directlyJudged.add(row.id);
84
+ }
85
+ const witnessed = new Set();
86
+ const units = [];
87
+ const sourceUnit = (sourceId, resolutionClass) => {
88
+ if (directlyJudged.has(sourceId) || witnessed.has(sourceId))
89
+ return;
90
+ witnessed.add(sourceId);
91
+ units.push({ disposition: PROMOTION_SOURCE_DISPOSITION, resolutionClass });
92
+ };
93
+ for (const row of rows) {
94
+ if (row.promotedFrom !== undefined) {
95
+ sourceUnit(row.promotedFrom, row.resolutionClass);
96
+ }
97
+ else {
98
+ units.push({ disposition: row.disposition, resolutionClass: row.resolutionClass });
99
+ }
100
+ for (const sourceId of row.absorbedPromotions ?? [])
101
+ sourceUnit(sourceId, row.resolutionClass);
102
+ }
103
+ return units;
104
+ }
45
105
  /**
46
106
  * The share of judgeable filings that were routed to the wrong owner.
47
107
  *
48
108
  * Only rows whose ACTUAL resolver is observable (resolution_class in
49
109
  * agent_session / operator_action / external_change) AND whose disposition maps
50
110
  * to a declared owner are judged. A row with no resolver signal (e.g. auto_swept,
51
- * declined_invalid) or no disposition is not counted either way.
111
+ * declined_invalid) or no disposition is not counted either way. Promotion
112
+ * lineage is applied first (resolvePromotionLineage): a promoted refile is judged
113
+ * against the machine-lane filing it was promoted from.
52
114
  */
53
115
  export function computeMisRouteRate(rows) {
54
116
  let judged = 0;
55
117
  let misRouted = 0;
56
- for (const row of rows) {
118
+ for (const row of resolvePromotionLineage(rows)) {
57
119
  const actor = resolverActorOf(row.resolutionClass);
58
120
  const declared = declaredOwnerOf(row.disposition);
59
121
  if (actor === null || declared === null)
@@ -1 +1 @@
1
- {"version":3,"file":"routing-measurement.js","sourceRoot":"","sources":["../../src/queries/routing-measurement.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,qEAAqE;AACrE,gBAAgB;AAoChB;;;;;GAKG;AACH,SAAS,eAAe,CAAC,eAA0C;IACjE,QAAQ,eAAe,EAAE,CAAC;QACxB,KAAK,eAAe;YAClB,OAAO,SAAS,CAAC;QACnB,KAAK,iBAAiB;YACpB,OAAO,OAAO,CAAC;QACjB,KAAK,iBAAiB;YACpB,OAAO,UAAU,CAAC;QACpB;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,WAAsC;IAC7D,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,kBAAkB;YACrB,OAAO,SAAS,CAAC;QACnB,KAAK,gBAAgB;YACnB,OAAO,OAAO,CAAC;QACjB,yEAAyE;QACzE,4EAA4E;QAC5E,KAAK,cAAc,CAAC;QACpB,KAAK,qBAAqB;YACxB,OAAO,OAAO,CAAC;QACjB,KAAK,eAAe;YAClB,OAAO,UAAU,CAAC;QACpB;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED,qEAAqE;AACrE,MAAM,qBAAqB,GAAsB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;AAiBnF;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAsC;IACxE,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,WAAW,CAAC,CA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AWD;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAsC;IAC1E,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,GAAG,CAAC,eAAe,IAAI,IAAI,IAAI,GAAG,CAAC,eAAe,KAAK,EAAE;YAAE,SAAS;QACxE,UAAU,IAAI,CAAC,CAAC;QAChB,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,eAAe,CAAC;YAAE,SAAS,IAAI,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,UAAU,EAAE,CAAC;AACzF,CAAC"}
@@ -26,6 +26,14 @@ export interface MachineLaneMisRoute {
26
26
  * agent_resolvable-filed rows that a non-machine actor actually resolved.
27
27
  * Reuses computeMisRouteRate over the agent_resolvable-filed subset, so the one
28
28
  * canonical mis-route definition serves both the general measure and this gate.
29
+ *
30
+ * The subset is taken AFTER promotion lineage (resolvePromotionLineage): a
31
+ * needs_operator row handed out of the machine lane (a routing decider's filing, or
32
+ * a historic promotion refile) belongs to that lane, so
33
+ * an operator closing it counts as the lane handing its work back -- the dominant
34
+ * real hand-back path, which a filter on the refile's own disposition would miss.
35
+ * Lineage units carry no lineage fields, so computeMisRouteRate re-applying it is
36
+ * the identity.
29
37
  */
30
38
  export declare function machineLaneMisRoute(rows: readonly RoutingSampleRow[]): MachineLaneMisRoute;
31
39
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"routing-quality.d.ts","sourceRoot":"","sources":["../../src/queries/routing-quality.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAiE,KAAK,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEnI;;;;;GAKG;AACH,eAAO,MA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