@mastra/factory 0.29.0-alpha.6 → 0.29.0-alpha.8

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 (149) hide show
  1. package/README.md +50 -20
  2. package/dist/boards/board-events.d.ts +23 -0
  3. package/dist/boards/board-events.d.ts.map +1 -1
  4. package/dist/boards/board-events.js +37 -3
  5. package/dist/boards/board-events.js.map +1 -1
  6. package/dist/boards/board-writes.d.ts +6 -4
  7. package/dist/boards/board-writes.d.ts.map +1 -1
  8. package/dist/boards/board-writes.js +9 -6
  9. package/dist/boards/board-writes.js.map +1 -1
  10. package/dist/boards/intake-routing.d.ts +30 -16
  11. package/dist/boards/intake-routing.d.ts.map +1 -1
  12. package/dist/boards/intake-routing.js +41 -28
  13. package/dist/boards/intake-routing.js.map +1 -1
  14. package/dist/boards/project-boards.d.ts +15 -0
  15. package/dist/boards/project-boards.d.ts.map +1 -1
  16. package/dist/boards/project-boards.js +43 -7
  17. package/dist/boards/project-boards.js.map +1 -1
  18. package/dist/factory.d.ts +4 -14
  19. package/dist/factory.d.ts.map +1 -1
  20. package/dist/factory.js +22 -15
  21. package/dist/factory.js.map +1 -1
  22. package/dist/integrations/github/integration.d.ts.map +1 -1
  23. package/dist/integrations/github/integration.js +101 -0
  24. package/dist/integrations/github/integration.js.map +1 -1
  25. package/dist/integrations/github/rules.d.ts.map +1 -1
  26. package/dist/integrations/github/rules.js +7 -3
  27. package/dist/integrations/github/rules.js.map +1 -1
  28. package/dist/integrations/github/sandbox.d.ts +7 -1
  29. package/dist/integrations/github/sandbox.d.ts.map +1 -1
  30. package/dist/integrations/github/sandbox.js +15 -1
  31. package/dist/integrations/github/sandbox.js.map +1 -1
  32. package/dist/integrations/github/session-subscriptions.js +1 -1
  33. package/dist/integrations/github/session-subscriptions.js.map +1 -1
  34. package/dist/integrations/gitlab/rules.d.ts.map +1 -1
  35. package/dist/integrations/gitlab/rules.js +2 -1
  36. package/dist/integrations/gitlab/rules.js.map +1 -1
  37. package/dist/integrations/gitlab/session-subscriptions.js +1 -1
  38. package/dist/integrations/gitlab/session-subscriptions.js.map +1 -1
  39. package/dist/integrations/slack/channel-reply-processor.d.ts +1 -0
  40. package/dist/integrations/slack/channel-reply-processor.d.ts.map +1 -1
  41. package/dist/integrations/slack/channel-reply-processor.js +4 -1
  42. package/dist/integrations/slack/channel-reply-processor.js.map +1 -1
  43. package/dist/integrations/slack/run-error-card.js +6 -1
  44. package/dist/integrations/slack/run-error-card.js.map +1 -1
  45. package/dist/links.d.ts +4 -2
  46. package/dist/links.d.ts.map +1 -1
  47. package/dist/links.js +5 -3
  48. package/dist/links.js.map +1 -1
  49. package/dist/routes/boards.d.ts +1 -1
  50. package/dist/routes/boards.d.ts.map +1 -1
  51. package/dist/routes/boards.js.map +1 -1
  52. package/dist/routes/contracts.d.ts +32 -5
  53. package/dist/routes/contracts.d.ts.map +1 -1
  54. package/dist/routes/contracts.js +36 -9
  55. package/dist/routes/contracts.js.map +1 -1
  56. package/dist/routes/intake-check.d.ts.map +1 -1
  57. package/dist/routes/intake-check.js +3 -1
  58. package/dist/routes/intake-check.js.map +1 -1
  59. package/dist/routes/intake-routes.d.ts +0 -3
  60. package/dist/routes/intake-routes.d.ts.map +1 -1
  61. package/dist/routes/intake-routes.js +1 -1
  62. package/dist/routes/intake-routes.js.map +1 -1
  63. package/dist/routes/skills.d.ts +1 -1
  64. package/dist/routes/skills.d.ts.map +1 -1
  65. package/dist/routes/skills.js +92 -28
  66. package/dist/routes/skills.js.map +1 -1
  67. package/dist/routes/surface.d.ts +0 -3
  68. package/dist/routes/surface.d.ts.map +1 -1
  69. package/dist/routes/surface.js +0 -1
  70. package/dist/routes/surface.js.map +1 -1
  71. package/dist/rules/dispatch-errors.d.ts +6 -0
  72. package/dist/rules/dispatch-errors.d.ts.map +1 -1
  73. package/dist/rules/dispatch-errors.js +10 -1
  74. package/dist/rules/dispatch-errors.js.map +1 -1
  75. package/dist/rules/dispatcher.d.ts.map +1 -1
  76. package/dist/rules/dispatcher.js +74 -32
  77. package/dist/rules/dispatcher.js.map +1 -1
  78. package/dist/rules/event-rules.d.ts +3 -2
  79. package/dist/rules/event-rules.d.ts.map +1 -1
  80. package/dist/rules/event-rules.js +5 -3
  81. package/dist/rules/event-rules.js.map +1 -1
  82. package/dist/rules/public-failure-reason.d.ts +11 -0
  83. package/dist/rules/public-failure-reason.d.ts.map +1 -0
  84. package/dist/rules/public-failure-reason.js +136 -0
  85. package/dist/rules/public-failure-reason.js.map +1 -0
  86. package/dist/rules/transition-service.d.ts +13 -0
  87. package/dist/rules/transition-service.d.ts.map +1 -1
  88. package/dist/rules/transition-service.js +5 -1
  89. package/dist/rules/transition-service.js.map +1 -1
  90. package/dist/rules/types.d.ts +12 -0
  91. package/dist/rules/types.d.ts.map +1 -1
  92. package/dist/rules/types.js.map +1 -1
  93. package/dist/rules/validation.d.ts.map +1 -1
  94. package/dist/rules/validation.js +11 -2
  95. package/dist/rules/validation.js.map +1 -1
  96. package/dist/run-error.d.ts +1 -1
  97. package/dist/run-error.d.ts.map +1 -1
  98. package/dist/run-error.js +21 -12
  99. package/dist/run-error.js.map +1 -1
  100. package/dist/session/environment-state-processor.d.ts.map +1 -1
  101. package/dist/session/environment-state-processor.js +6 -2
  102. package/dist/session/environment-state-processor.js.map +1 -1
  103. package/dist/session/session-row-view.js +1 -1
  104. package/dist/session/session-row-view.js.map +1 -1
  105. package/dist/session/source-control-tools.d.ts.map +1 -1
  106. package/dist/session/source-control-tools.js +5 -3
  107. package/dist/session/source-control-tools.js.map +1 -1
  108. package/dist/skills/app-skills.d.ts +3 -2
  109. package/dist/skills/app-skills.d.ts.map +1 -1
  110. package/dist/skills/app-skills.js +5 -3
  111. package/dist/skills/app-skills.js.map +1 -1
  112. package/dist/skills/catalog.d.ts +23 -4
  113. package/dist/skills/catalog.d.ts.map +1 -1
  114. package/dist/skills/catalog.js +61 -28
  115. package/dist/skills/catalog.js.map +1 -1
  116. package/dist/storage/domains/audit/actions.d.ts +1 -1
  117. package/dist/storage/domains/audit/actions.d.ts.map +1 -1
  118. package/dist/storage/domains/audit/actions.js +6 -1
  119. package/dist/storage/domains/audit/actions.js.map +1 -1
  120. package/dist/storage/domains/boards/base.d.ts +12 -0
  121. package/dist/storage/domains/boards/base.d.ts.map +1 -1
  122. package/dist/storage/domains/boards/base.js +3 -0
  123. package/dist/storage/domains/boards/base.js.map +1 -1
  124. package/dist/storage/domains/boards/schemas.d.ts.map +1 -1
  125. package/dist/storage/domains/boards/schemas.js +4 -0
  126. package/dist/storage/domains/boards/schemas.js.map +1 -1
  127. package/dist/storage/domains/skill-overrides/base.d.ts +28 -4
  128. package/dist/storage/domains/skill-overrides/base.d.ts.map +1 -1
  129. package/dist/storage/domains/skill-overrides/base.js +54 -1
  130. package/dist/storage/domains/skill-overrides/base.js.map +1 -1
  131. package/dist/storage/domains/work-items/base.d.ts +2 -0
  132. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  133. package/dist/storage/domains/work-items/base.js +13 -5
  134. package/dist/storage/domains/work-items/base.js.map +1 -1
  135. package/dist/tools/audit-events-tool.d.ts +1 -1
  136. package/dist/tools/read-tools.d.ts.map +1 -1
  137. package/dist/tools/read-tools.js +0 -1
  138. package/dist/tools/read-tools.js.map +1 -1
  139. package/dist/tools/work-item-tools.d.ts.map +1 -1
  140. package/dist/tools/work-item-tools.js +0 -3
  141. package/dist/tools/work-item-tools.js.map +1 -1
  142. package/dist/work-items/create-work-item.d.ts.map +1 -1
  143. package/dist/work-items/create-work-item.js +2 -1
  144. package/dist/work-items/create-work-item.js.map +1 -1
  145. package/dist/workspace.d.ts +5 -1
  146. package/dist/workspace.d.ts.map +1 -1
  147. package/dist/workspace.js +69 -9
  148. package/dist/workspace.js.map +1 -1
  149. package/package.json +8 -8
@@ -6,7 +6,7 @@ import type { BoardEventFacts, RouteArrivals } from './board-events.js';
6
6
  import type { BoardRegistry, InstalledBoard } from './registry.js';
7
7
  /** Reads a project's intake routes and intake order, and logs how intake decided each arrival. */
8
8
  export type IntakeRoutesReader = Pick<StoredBoardsStorage, 'listIntakeRoutes' | 'readIntakeOrder' | 'recordIntakeDecision' | 'resolveNotRouted' | 'intakeEvaluator'>;
9
- type IntakeRoute = Pick<StoredIntakeRouteRecord, 'id' | 'enabled' | 'when' | 'on' | 'pullRequestOpenedMovesOnly'> & {
9
+ type IntakeRoute = Pick<StoredIntakeRouteRecord, 'id' | 'enabled' | 'when' | 'on' | 'pullRequestOpenedMovesOnly' | 'outsiderPullRequestsGated'> & {
10
10
  target: Pick<StoredIntakeRouteRecord['target'], 'boardKey' | 'phaseKey' | 'joinClosedIssue'> & {
11
11
  moveToBoardKey?: string | null;
12
12
  };
@@ -26,13 +26,13 @@ export declare const INTAKE_ROUTE_METADATA_KEY = "intakeRouteId";
26
26
  /** Whether an intake route chose this card's board when it arrived. */
27
27
  export declare function placedByIntakeRoute(item: Pick<Card, 'metadata'>): boolean;
28
28
  export type IntakeTargetProblem = {
29
- code: 'unknown_board' | 'unknown_phase' | 'terminal_phase' | 'unreachable_phase' | 'join_on_event' | 'move_on_arrival';
29
+ code: 'unknown_board' | 'unknown_phase' | 'terminal_phase' | 'join_on_event' | 'move_on_arrival';
30
30
  message: string;
31
31
  };
32
32
  /**
33
33
  * Why a route's target can't take cards in this project, or undefined when it can. A route that
34
- * places new cards needs a phase they can reach; one that only moves existing cards on later
35
- * events, such as a close, may name any phase, terminal ones included.
34
+ * places new cards needs a phase on its own board that isn't terminal; one that only moves
35
+ * existing cards on later events, such as a close, may name any phase, terminal ones included.
36
36
  */
37
37
  export declare function intakeTargetProblem(registry: BoardRegistry, route: RouteArrivals & {
38
38
  target: {
@@ -95,20 +95,13 @@ export declare function arrivalRuleFacts(decision: Extract<FactoryCommitDecision
95
95
  * whatever this replica's evaluator: only that evaluator leaves an item Not routed.
96
96
  */
97
97
  export declare const ROUTE_AGAIN_KEY_PREFIX = "intake-route-again:";
98
- /** The env var that forces an evaluator on every project when the Factory's `intake.evaluator` option doesn't. */
98
+ /** The env var that forces an evaluator on every project, for deployments with projects from before intake order. */
99
99
  export declare const INTAKE_EVALUATOR_ENV = "FACTORY_INTAKE_EVALUATOR";
100
- /** An evaluator this process forces on every project, and what forced it. */
101
- export interface ForcedIntakeEvaluator {
102
- evaluator: IntakeEvaluator;
103
- source: 'option' | 'env';
104
- }
105
- /** Where a project's evaluator came from: forced, its own setting, or none (an older project). */
106
- export type IntakeEvaluatorSource = ForcedIntakeEvaluator['source'] | 'project' | 'legacy';
107
100
  /**
108
- * The evaluator this process forces on every project: the configured one, else a valid
109
- * `FACTORY_INTAKE_EVALUATOR`. Undefined when neither is set: each project uses its own.
101
+ * The evaluator this process forces on every project: a valid `FACTORY_INTAKE_EVALUATOR`.
102
+ * Undefined when it isn't set: each project uses its own.
110
103
  */
111
- export declare function intakeEvaluatorFrom(configured: IntakeEvaluator | undefined, env?: Record<string, string | undefined>): ForcedIntakeEvaluator | undefined;
104
+ export declare function intakeEvaluatorFrom(env?: Record<string, string | undefined>): IntakeEvaluator | undefined;
112
105
  /**
113
106
  * The evaluator that decides a project's arrivals: the forced one, else the project's setting
114
107
  * (`intake-order` for a project created since it shipped), else `route-list`.
@@ -190,10 +183,31 @@ export interface IntakeTrace {
190
183
  export declare function traceIntakeOrder({ routes, order, facts, registry }: Omit<IntakeQuery, 'evaluator'>, options?: {
191
184
  full?: boolean;
192
185
  }): IntakeTrace;
193
- /** The phase a route's card lands in: its named phase when new cards can reach it, else the board's first. */
186
+ /** The phase a route's card lands in: its named phase while it exists and isn't terminal, else the board's first. */
194
187
  export declare function landingPhase(board: InstalledBoard, phase: string | null | undefined): string;
188
+ /**
189
+ * The phase a retry of a filing decision resumes its card into: the route's phase while the card
190
+ * can work there, else the board's first phase. The route may have been retargeted since filing,
191
+ * and an issue card can't be forced into a review phase a filing would never have sent it to.
192
+ */
193
+ export declare function resumeLandingPhase(board: InstalledBoard, phase: string | null | undefined, facts: RuleFacts, carriesPullRequest?: boolean): string;
195
194
  /** Whether any route on the board, enabled or not, handles the event: then the routes own it. */
196
195
  export declare function routesHandleEvent(routes: readonly Pick<IntakeRoute, 'on' | 'target'>[], event: BoardEventFacts, board: Pick<InstalledBoard, 'id'>): boolean;
196
+ /**
197
+ * Whether the event is a pull request event that no trusted actor vouches for, and that doesn't
198
+ * settle the pull request. A run that such an event queues is compute and code execution on an
199
+ * outside actor's say-so: it waits for a person, whatever card it moves. A maintainer acting on
200
+ * an outside author's pull request is that vouch, so this reads the actor's trust, never the
201
+ * author's. Merging and closing settle the pull request either way, so they never count.
202
+ */
203
+ export declare function untrustedPullRequestEvent(event: BoardEventFacts): boolean;
204
+ /**
205
+ * Whether the event is an outside author's pull request event on an issue's card: an unsettling
206
+ * pull request event an untrusted author wrote, on a card that isn't the pull request's own. The
207
+ * legacy rule gate only ever held moves of linked cards back by the author's trust — what the
208
+ * rules' `pullRequest.trusted` tests — so it keeps both that scope and that signal.
209
+ */
210
+ export declare function untrustedLinkedPullRequestEvent(event: BoardEventFacts, cardFacts: RuleFacts): boolean;
197
211
  /** A card-move route that matched but can't take the card where it points, and why. */
198
212
  export interface SkippedEventRoute {
199
213
  routeId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"intake-routing.d.ts","sourceRoot":"","sources":["../../src/boards/intake-routing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAa,MAAM,wBAAwB,CAAC;AAExF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACvH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAWxE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGnE,k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I,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/B,aAAa,CAmCf"}
@@ -1,6 +1,6 @@
1
1
  import { evaluateRuleGroup, explainRuleGroup } from "../rules/rule-group.js";
2
2
  import { externalSourceForWorkItem } from "../rules/types.js";
3
- import { arrivalKind, arrivalKinds, eventMovesCard, eventRuleFacts, isPullRequestEvent } from "./board-events.js";
3
+ import { SETTLING_PULL_REQUEST_EVENTS, arrivalKind, arrivalKinds, eventMovesCard, eventRuleFacts, isPullRequestEvent, testsField } from "./board-events.js";
4
4
  import { cardRuleFacts } from "./card-facts.js";
5
5
  import { deriveIntakeOrder, reconcileIntakeOrder } from "./intake-order.js";
6
6
  import { boardFlow, boardForWorkItem, hasPullRequest, intakeTarget, isTerminalWorkItem } from "./semantics.js";
@@ -46,8 +46,8 @@ function placedByIntakeRoute(item) {
46
46
  }
47
47
  /**
48
48
  * Why a route's target can't take cards in this project, or undefined when it can. A route that
49
- * places new cards needs a phase they can reach; one that only moves existing cards on later
50
- * events, such as a close, may name any phase, terminal ones included.
49
+ * places new cards needs a phase on its own board that isn't terminal; one that only moves
50
+ * existing cards on later events, such as a close, may name any phase, terminal ones included.
51
51
  */
52
52
  function intakeTargetProblem(registry, route) {
53
53
  const { target } = route;
@@ -88,10 +88,6 @@ function intakeTargetProblem(registry, route) {
88
88
  code: "terminal_phase",
89
89
  message: `Phase "${target.phaseKey}" on board "${board.id}" is terminal; new cards can't land there.`
90
90
  };
91
- if (!board.allowsTransition(board.initialPhase, target.phaseKey)) return {
92
- code: "unreachable_phase",
93
- message: `Board "${board.id}" doesn't allow moving a card from its first phase "${board.initialPhase}" to "${target.phaseKey}".`
94
- };
95
91
  }
96
92
  /**
97
93
  * On a board that reviews pull requests a pull request card works only in the pull request review
@@ -169,22 +165,15 @@ async function arrivalRuleFacts(decision, context) {
169
165
  * whatever this replica's evaluator: only that evaluator leaves an item Not routed.
170
166
  */
171
167
  const ROUTE_AGAIN_KEY_PREFIX = "intake-route-again:";
172
- /** The env var that forces an evaluator on every project when the Factory's `intake.evaluator` option doesn't. */
168
+ /** The env var that forces an evaluator on every project, for deployments with projects from before intake order. */
173
169
  const INTAKE_EVALUATOR_ENV = "FACTORY_INTAKE_EVALUATOR";
174
170
  /**
175
- * The evaluator this process forces on every project: the configured one, else a valid
176
- * `FACTORY_INTAKE_EVALUATOR`. Undefined when neither is set: each project uses its own.
171
+ * The evaluator this process forces on every project: a valid `FACTORY_INTAKE_EVALUATOR`.
172
+ * Undefined when it isn't set: each project uses its own.
177
173
  */
178
- function intakeEvaluatorFrom(configured, env = process.env) {
179
- if (configured) return {
180
- evaluator: configured,
181
- source: "option"
182
- };
174
+ function intakeEvaluatorFrom(env = process.env) {
183
175
  const value = env[INTAKE_EVALUATOR_ENV];
184
- return value === "intake-order" || value === "route-list" ? {
185
- evaluator: value,
186
- source: "env"
187
- } : void 0;
176
+ return value === "intake-order" || value === "route-list" ? value : void 0;
188
177
  }
189
178
  /**
190
179
  * The evaluator that decides a project's arrivals: the forced one, else the project's setting
@@ -362,17 +351,41 @@ function resolveByRouteList({ routes, facts, registry }) {
362
351
  reason: "The project has no board to take it."
363
352
  };
364
353
  }
365
- /** The phase a route's card lands in: its named phase when new cards can reach it, else the board's first. */
354
+ /** The phase a route's card lands in: its named phase while it exists and isn't terminal, else the board's first. */
366
355
  function landingPhase(board, phase) {
367
- return phase && board.phaseKind(phase) !== void 0 && !board.isTerminal(phase) && board.allowsTransition(board.initialPhase, phase) ? phase : board.initialPhase;
356
+ return phase && board.phaseKind(phase) !== void 0 && !board.isTerminal(phase) ? phase : board.initialPhase;
357
+ }
358
+ /**
359
+ * The phase a retry of a filing decision resumes its card into: the route's phase while the card
360
+ * can work there, else the board's first phase. The route may have been retargeted since filing,
361
+ * and an issue card can't be forced into a review phase a filing would never have sent it to.
362
+ */
363
+ function resumeLandingPhase(board, phase, facts, carriesPullRequest = false) {
364
+ const landing = landingPhase(board, phase);
365
+ return placementTakesCard(board, landing, facts, carriesPullRequest) ? landing : board.initialPhase;
368
366
  }
369
367
  /** Whether any route on the board, enabled or not, handles the event: then the routes own it. */
370
368
  function routesHandleEvent(routes, event, board) {
371
369
  return routes.some((route) => route.target.boardKey === board.id && route.on.includes(event.type));
372
370
  }
373
- const SETTLING_PULL_REQUEST_EVENTS = /* @__PURE__ */ new Set(["pull_request.merged", "pull_request.closed"]);
374
- function testsField(group, field) {
375
- return group?.conditions.some((member) => "field" in member ? member.field === field : testsField(member, field)) ?? false;
371
+ /**
372
+ * Whether the event is a pull request event that no trusted actor vouches for, and that doesn't
373
+ * settle the pull request. A run that such an event queues is compute and code execution on an
374
+ * outside actor's say-so: it waits for a person, whatever card it moves. A maintainer acting on
375
+ * an outside author's pull request is that vouch, so this reads the actor's trust, never the
376
+ * author's. Merging and closing settle the pull request either way, so they never count.
377
+ */
378
+ function untrustedPullRequestEvent(event) {
379
+ return isPullRequestEvent(event.type) && !SETTLING_PULL_REQUEST_EVENTS.has(event.type) && event.actorTrusted !== true;
380
+ }
381
+ /**
382
+ * Whether the event is an outside author's pull request event on an issue's card: an unsettling
383
+ * pull request event an untrusted author wrote, on a card that isn't the pull request's own. The
384
+ * legacy rule gate only ever held moves of linked cards back by the author's trust — what the
385
+ * rules' `pullRequest.trusted` tests — so it keeps both that scope and that signal.
386
+ */
387
+ function untrustedLinkedPullRequestEvent(event, cardFacts) {
388
+ return cardFacts["source.kind"] !== "pull_request" && isPullRequestEvent(event.type) && !SETTLING_PULL_REQUEST_EVENTS.has(event.type) && event.pullRequestTrusted !== true;
376
389
  }
377
390
  /**
378
391
  * Every rule on the card's board whose `on` names the event, top to bottom, and what each
@@ -395,7 +408,7 @@ function traceEventRoute(routes, event, cardFacts, board, options, { full = fals
395
408
  "closedIssue.hasPullRequest": event.closedIssue.hasPullRequest
396
409
  } : {}
397
410
  };
398
- const untrustedLinkedPullRequest = isPullRequestEvent(event.type) && !SETTLING_PULL_REQUEST_EVENTS.has(event.type) && cardFacts["source.kind"] !== "pull_request" && pullRequestTrusted !== true;
411
+ const untrustedLinkedPullRequest = untrustedLinkedPullRequestEvent(event, cardFacts);
399
412
  const rules = [];
400
413
  let move;
401
414
  for (const route of routes) {
@@ -411,11 +424,11 @@ function traceEventRoute(routes, event, cardFacts, board, options, { full = fals
411
424
  });
412
425
  continue;
413
426
  }
414
- if (untrustedLinkedPullRequest && !testsField(route.when, "pullRequest.trusted")) {
427
+ if (untrustedLinkedPullRequest && route.outsiderPullRequestsGated && !testsField(route.when, "pullRequest.trusted")) {
415
428
  rules.push({
416
429
  ...named,
417
430
  outcome: "skipped",
418
- reason: "the pull request's author is an outsider, and this rule doesn't test pullRequest.trusted"
431
+ reason: "the pull request's author is an outsider, and this older rule skips outside authors' pull requests"
419
432
  });
420
433
  continue;
421
434
  }
@@ -540,6 +553,6 @@ function planEventMove(input, options = {}) {
540
553
  rules
541
554
  };
542
555
  }
543
- export { INTAKE_EVALUATOR_ENV, INTAKE_ORDER_SAMPLE, INTAKE_ROUTE_METADATA_KEY, ROUTE_AGAIN_KEY_PREFIX, arrivalRuleFacts, closedIssueRuleFacts, compareIntakeOrder, intakeEvaluatorFrom, intakeTargetProblem, landingPhase, placedByIntakeRoute, placesArrival, placesNewCards, planEventMove, projectIntakeEvaluator, resolveEventRoute, resolveIntake, resolveIntakePlacement, routesHandleEvent, traceEventRoute, traceIntakeOrder };
556
+ export { INTAKE_EVALUATOR_ENV, INTAKE_ORDER_SAMPLE, INTAKE_ROUTE_METADATA_KEY, ROUTE_AGAIN_KEY_PREFIX, arrivalRuleFacts, closedIssueRuleFacts, compareIntakeOrder, intakeEvaluatorFrom, intakeTargetProblem, landingPhase, placedByIntakeRoute, placesArrival, placesNewCards, planEventMove, projectIntakeEvaluator, resolveEventRoute, resolveIntake, resolveIntakePlacement, resumeLandingPhase, routesHandleEvent, traceEventRoute, traceIntakeOrder, untrustedLinkedPullRequestEvent, untrustedPullRequestEvent };
544
557
 
545
558
  //# sourceMappingURL=intake-routing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"intake-routing.js","names":[],"sources":["../../src/boards/intake-routing.ts"],"sourcesContent":["import { evaluateRuleGroup, explainRuleGroup } from '../rules/rule-group.js';\nimport type { FailedRuleCondition, RuleFacts, RuleGroup } from '../rules/rule-group.js';\nimport { externalSourceForWorkItem } from '../rules/types.js';\nimport type { FactoryCommitDecision } from '../rules/types.js';\nimport type { IntakeEvaluator, StoredBoardsStorage, StoredIntakeRouteRecord } from '../storage/domains/boards/base.js';\nimport type { Card } from '../storage/domains/work-items/base.js';\nimport type { BoardEventFacts, RouteArrivals } from './board-events.js';\nimport {\n arrivalKind,\n arrivalKinds,\n eventMovesCard,\n eventRuleFacts,\n isPullRequestEvent,\n LEGACY_ARRIVAL_EVENT,\n} from './board-events.js';\nimport { cardRuleFacts } from './card-facts.js';\nimport { deriveIntakeOrder, reconcileIntakeOrder } from './intake-order.js';\nimport type { BoardRegistry, InstalledBoard } from './registry.js';\nimport { boardFlow, boardForWorkItem, hasPullRequest, intakeTarget, isTerminalWorkItem } from './semantics.js';\n\n/** Reads a project's intake routes and intake order, and logs how intake decided each arrival. */\nexport type IntakeRoutesReader = Pick<\n StoredBoardsStorage,\n 'listIntakeRoutes' | 'readIntakeOrder' | 'recordIntakeDecision' | 'resolveNotRouted' | 'intakeEvaluator'\n>;\n\ntype IntakeRoute = Pick<StoredIntakeRouteRecord, 'id' | 'enabled' | 'when' | 'on' | 'pullRequestOpenedMovesOnly'> & {\n target: Pick<StoredIntakeRouteRecord['target'], 'boardKey' | 'phaseKey' | 'joinClosedIssue'> & {\n moveToBoardKey?: string | null;\n };\n} & Partial<Pick<StoredIntakeRouteRecord, 'name'>>;\n\n/** Whether the route places new cards, rather than only moving existing ones on later events. */\nexport function placesNewCards(route: RouteArrivals): boolean {\n return arrivalKinds(route).size > 0;\n}\n\n/**\n * Whether the route files this arrival: an issue by a `work_item.opened` route, a pull request with\n * no card by a `pull_request.opened` one, either by a legacy `work_item.created` one.\n */\nexport function placesArrival(route: RouteArrivals, facts: RuleFacts): boolean {\n return arrivalKinds(route).has(arrivalKind(facts));\n}\n\n/**\n * Why a route that files only issues, or only pull requests, passes over this arrival, put as the\n * `source.kind` condition it amounts to; undefined when the route files this kind.\n */\nfunction arrivalKindFailure(route: { on: readonly string[] }, facts: RuleFacts): FailedRuleCondition | undefined {\n if (placesArrival(route, facts)) return undefined;\n const actual = (facts['source.kind'] as FailedRuleCondition['actual'] | undefined) ?? null;\n return arrivalKind(facts) === 'pull_request'\n ? { field: 'source.kind', operator: 'not_equals', value: 'pull_request', actual }\n : { field: 'source.kind', operator: 'equals', value: 'pull_request', actual };\n}\n\n/**\n * Card metadata naming the intake route that placed the card. Label changes, rebinding its\n * source and replayed arrivals leave such a card where the route put it.\n */\nexport const INTAKE_ROUTE_METADATA_KEY = 'intakeRouteId';\n\n/** Whether an intake route chose this card's board when it arrived. */\nexport function placedByIntakeRoute(item: Pick<Card, 'metadata'>): boolean {\n return typeof item.metadata?.[INTAKE_ROUTE_METADATA_KEY] === 'string';\n}\n\nexport type IntakeTargetProblem = {\n code:\n | 'unknown_board'\n | 'unknown_phase'\n | 'terminal_phase'\n | 'unreachable_phase'\n | 'join_on_event'\n | 'move_on_arrival';\n message: string;\n};\n\n/**\n * Why a route's target can't take cards in this project, or undefined when it can. A route that\n * places new cards needs a phase they can reach; one that only moves existing cards on later\n * events, such as a close, may name any phase, terminal ones included.\n */\nexport function intakeTargetProblem(\n registry: BoardRegistry,\n route: RouteArrivals & {\n target: { boardKey: string; phaseKey?: string | null; joinClosedIssue?: boolean; moveToBoardKey?: string | null };\n },\n): IntakeTargetProblem | undefined {\n const { target } = route;\n const owner = registry.get(target.boardKey);\n if (!owner) {\n return { code: 'unknown_board', message: `Board \"${target.boardKey}\" is not installed in this project.` };\n }\n if (target.moveToBoardKey && (target.joinClosedIssue || placesNewCards(route))) {\n return {\n code: 'move_on_arrival',\n message:\n 'Only a route moving existing cards on later events can send them to another board: its `on` must not name an arrival event (`work_item.opened`, `pull_request.opened` or `work_item.created`).',\n };\n }\n const board = target.moveToBoardKey ? registry.get(target.moveToBoardKey) : owner;\n if (!board) {\n return { code: 'unknown_board', message: `Board \"${target.moveToBoardKey}\" is not installed in this project.` };\n }\n if (\n target.joinClosedIssue &&\n route.on.some(event => event !== 'pull_request.opened' && event !== LEGACY_ARRIVAL_EVENT)\n ) {\n return {\n code: 'join_on_event',\n message:\n 'A route that joins a pull request to the card of the issue it closes handles only pull requests arriving: its `on` must be `pull_request.opened` alone.',\n };\n }\n if (!target.phaseKey) return undefined;\n if (target.joinClosedIssue && board.phaseKind(target.phaseKey) === 'terminal') {\n return {\n code: 'terminal_phase',\n message: `Phase \"${target.phaseKey}\" on board \"${board.id}\" is terminal; a card a pull request joins can't move there.`,\n };\n }\n if (target.joinClosedIssue) {\n return board.phaseKind(target.phaseKey)\n ? undefined\n : { code: 'unknown_phase', message: `Board \"${board.id}\" has no phase \"${target.phaseKey}\".` };\n }\n const kind = board.phaseKind(target.phaseKey);\n if (!kind) {\n return { code: 'unknown_phase', message: `Board \"${board.id}\" has no phase \"${target.phaseKey}\".` };\n }\n if (!placesNewCards(route)) return undefined;\n if (kind === 'terminal') {\n return {\n code: 'terminal_phase',\n message: `Phase \"${target.phaseKey}\" on board \"${board.id}\" is terminal; new cards can't land there.`,\n };\n }\n if (!board.allowsTransition(board.initialPhase, target.phaseKey)) {\n return {\n code: 'unreachable_phase',\n message: `Board \"${board.id}\" doesn't allow moving a card from its first phase \"${board.initialPhase}\" to \"${target.phaseKey}\".`,\n };\n }\n return undefined;\n}\n\n/**\n * On a board that reviews pull requests a pull request card works only in the pull request review\n * phase (it may also rest or finish), and nothing else lands in that review: a card arriving here\n * carries no attached pull request yet, and an existing issue card enters it only with one on it.\n * `FactoryTransitionService` refuses any move that breaks this, so a route can't either.\n */\nfunction placementTakesCard(\n board: InstalledBoard,\n phase: string,\n facts: RuleFacts,\n carriesPullRequest = false,\n): boolean {\n const flow = boardFlow(board);\n const review = flow.pullRequestReview;\n if (!review) return true;\n if (facts['source.kind'] !== 'pull_request') {\n // A board that reviews pull requests but builds nothing (the retired Review board) holds only them.\n if (flow.build === undefined) return false;\n return phase !== review || carriesPullRequest;\n }\n return phase === review || board.phaseKind(phase) !== 'working';\n}\n\n/**\n * What an intake route can test about the issue a pull request closes: whether there is one with\n * a card, that card's phase, and whether a pull request already sits on it. `closedIssue` is the\n * card the provider rules found, read fresh; undefined when the pull request closes none.\n */\nexport function closedIssueRuleFacts(closedIssue: Pick<Card, 'stages' | 'workItem'> | undefined): RuleFacts {\n if (!closedIssue) return { 'pullRequest.closesIssue': false };\n return {\n 'pullRequest.closesIssue': true,\n 'item.hasIssue': true,\n ...(closedIssue.stages.length === 1 ? { 'closedIssue.phase': closedIssue.stages[0] } : {}),\n 'closedIssue.hasPullRequest': hasPullRequest(closedIssue),\n };\n}\n\n/**\n * Where a new card lands: the first enabled route that places new cards, whose condition matches\n * it and whose target can take it, on an installed board; a route without a phase, or whose phase\n * has since gone, lands it in the board's initial phase. Routes that once joined a pull request to\n * the card of the issue it closes place nothing: pull requests link to that card on their own.\n * Undefined leaves today's placement alone.\n */\nexport function resolveIntakePlacement(\n routes: readonly IntakeRoute[],\n facts: RuleFacts,\n registry: BoardRegistry,\n): { board: string; phase: string; routeId: string } | undefined {\n for (const route of routes) {\n if (!route.enabled || route.target.joinClosedIssue || !placesArrival(route, facts)) continue;\n if (!evaluateRuleGroup(route.when, facts)) continue;\n const board = registry.get(route.target.boardKey);\n if (!board) continue;\n const phase = landingPhase(board, route.target.phaseKey);\n if (!placementTakesCard(board, phase, facts)) continue;\n return { board: board.id, phase, routeId: route.id };\n }\n return undefined;\n}\n\n/** Where intake sends an arrival: placed on a board, or Not routed with the reason. */\nexport type IntakeResolution =\n | { outcome: 'placed'; board: string; phase: string; routeId: string | null }\n | { outcome: 'not_routed'; reason: string };\n\nexport interface IntakeQuery {\n evaluator: IntakeEvaluator;\n routes: readonly IntakeRoute[];\n /** Board keys in intake order; only the `intake-order` evaluator reads it. */\n order: readonly string[];\n facts: RuleFacts;\n registry: BoardRegistry;\n}\n\n/**\n * What intake rules test of an arrival: its own facts and, for a pull request closing an issue, that\n * issue's card as it is now (a finished card or one of another project counts as none). The\n * dispatcher and Route again both read an arrival through this, so they decide alike.\n */\nexport async function arrivalRuleFacts(\n decision: Extract<FactoryCommitDecision, { type: 'upsertLinkedWorkItem' }>,\n context: { factoryProjectId: string; registry: BoardRegistry; card(id: string): Promise<Card | null> },\n): Promise<RuleFacts> {\n const facts = cardRuleFacts({\n title: decision.title,\n metadata: decision.metadata ?? {},\n externalSource: externalSourceForWorkItem(decision.source, decision.sourceKey, decision.url ?? undefined),\n });\n if (!decision.closesIssue) return facts;\n const closed = await context.card(decision.closesIssue.workItemId);\n const open =\n closed && closed.factoryProjectId === context.factoryProjectId && !isTerminalWorkItem(context.registry, closed)\n ? closed\n : undefined;\n return { ...facts, ...closedIssueRuleFacts(open) };\n}\n\n/**\n * Prefixes the decision an admin's Route again commits. Such an arrival is resolved by intake order\n * whatever this replica's evaluator: only that evaluator leaves an item Not routed.\n */\nexport const ROUTE_AGAIN_KEY_PREFIX = 'intake-route-again:';\n\n/** The env var that forces an evaluator on every project when the Factory's `intake.evaluator` option doesn't. */\nexport const INTAKE_EVALUATOR_ENV = 'FACTORY_INTAKE_EVALUATOR';\n\n/** An evaluator this process forces on every project, and what forced it. */\nexport interface ForcedIntakeEvaluator {\n evaluator: IntakeEvaluator;\n source: 'option' | 'env';\n}\n\n/** Where a project's evaluator came from: forced, its own setting, or none (an older project). */\nexport type IntakeEvaluatorSource = ForcedIntakeEvaluator['source'] | 'project' | 'legacy';\n\n/**\n * The evaluator this process forces on every project: the configured one, else a valid\n * `FACTORY_INTAKE_EVALUATOR`. Undefined when neither is set: each project uses its own.\n */\nexport function intakeEvaluatorFrom(\n configured: IntakeEvaluator | undefined,\n env: Record<string, string | undefined> = process.env,\n): ForcedIntakeEvaluator | undefined {\n if (configured) return { evaluator: configured, source: 'option' };\n const value = env[INTAKE_EVALUATOR_ENV];\n return value === 'intake-order' || value === 'route-list' ? { evaluator: value, source: 'env' } : undefined;\n}\n\n/**\n * The evaluator that decides a project's arrivals: the forced one, else the project's setting\n * (`intake-order` for a project created since it shipped), else `route-list`.\n */\nexport async function projectIntakeEvaluator(\n forced: IntakeEvaluator | undefined,\n storage: Pick<StoredBoardsStorage, 'intakeEvaluator'>,\n scope: { orgId: string; factoryProjectId: string },\n): Promise<IntakeEvaluator> {\n return forced ?? (await storage.intakeEvaluator(scope)) ?? 'route-list';\n}\n\n/** Where intake sends an arrival, by the evaluator `query` names. Join routes never place here. */\nexport function resolveIntake(query: IntakeQuery): IntakeResolution {\n return query.evaluator === 'intake-order' ? resolveByIntakeOrder(query) : resolveByRouteList(query);\n}\n\n/** How many of a project's newest cards {@link compareIntakeOrder} reads. */\nexport const INTAKE_ORDER_SAMPLE = 200;\n\nexport interface IntakeOrderComparison {\n /** Cards compared: the project's newest, at most {@link INTAKE_ORDER_SAMPLE}. */\n compared: number;\n /** Of those, how many the intake order would place on another board than the route list does. */\n differing: number;\n /** Of those, how many no board's rules take under the intake order. */\n notRouted: number;\n}\n\n/**\n * Runs both evaluators over `cards` (newest first) as if each arrived now, so an admin sees what\n * switching to `order` changes before switching.\n */\nexport function compareIntakeOrder(\n query: Pick<IntakeQuery, 'routes' | 'order' | 'registry'> & { cards: readonly Card[] },\n): IntakeOrderComparison {\n const sample = query.cards.slice(0, INTAKE_ORDER_SAMPLE);\n let differing = 0;\n let notRouted = 0;\n for (const card of sample) {\n const base = { routes: query.routes, order: query.order, registry: query.registry, facts: cardRuleFacts(card) };\n const old = resolveIntake({ ...base, evaluator: 'route-list' });\n const next = resolveIntake({ ...base, evaluator: 'intake-order' });\n if (next.outcome === 'not_routed') notRouted += 1;\n if (placedOn(old) !== placedOn(next)) differing += 1;\n }\n return { compared: sample.length, differing, notRouted };\n}\n\nfunction placedOn(resolution: IntakeResolution): string | null {\n return resolution.outcome === 'placed' ? resolution.board : null;\n}\n\n/** How one intake rule answered an item, in the order intake asked it. */\nexport type IntakeRuleVerdict =\n /** It took the item: the first enabled rule, in intake order, that matched and whose phase takes it. */\n | { outcome: 'took' }\n /** It matched and its phase takes the item, but a rule asked earlier took it first. */\n | { outcome: 'lost'; to: { boardKey: string; routeId: string } }\n /** Its condition failed; `failed` names the conditions it failed on. */\n | { outcome: 'no_match'; failed: FailedRuleCondition[] }\n /** It matched, but its phase can't hold this kind of item (such as an issue in a pull request review phase). */\n | { outcome: 'phase_refuses' }\n /** It is switched off. */\n | { outcome: 'disabled' };\n\nexport type IntakeRuleTrace = IntakeRuleVerdict & {\n routeId: string;\n name: string | null;\n /** The phase the item would land in from this rule. */\n phase: string;\n};\n\nexport interface IntakeBoardTrace {\n boardKey: string;\n name: string;\n /** The board's rules that place new items, top to bottom. */\n rules: IntakeRuleTrace[];\n}\n\nexport interface IntakeTrace {\n resolution: IntakeResolution;\n /** Boards in the order intake asked them; with `full`, every board, even after one took the item. */\n boards: IntakeBoardTrace[];\n}\n\n/**\n * Asks boards in intake order, and inside each board its own rules top to bottom: the first\n * enabled placing rule that matches and whose phase can take the card decides. Nothing names a\n * board to fall back to; an arrival no board takes is Not routed. Filing stops at the winner;\n * `full` keeps asking every rule after it, so the dry run and tester can show which rules\n * matched but lost. Both read the same verdicts, so what they show is what filing does.\n */\nexport function traceIntakeOrder(\n { routes, order, facts, registry }: Omit<IntakeQuery, 'evaluator'>,\n options: { full?: boolean } = {},\n): IntakeTrace {\n const boards: IntakeBoardTrace[] = [];\n let resolution: Extract<IntakeResolution, { outcome: 'placed' }> | undefined;\n let winner: { boardKey: string; routeId: string } | undefined;\n // A code board isn't stored, so the stored order can lack it; it slots in as a new board does.\n const boardKeys = [...registry.keys()];\n const stored = order.length > 0 ? order : deriveIntakeOrder(routes, boardKeys);\n for (const boardKey of reconcileIntakeOrder(stored, boardKeys, routes)) {\n const board = registry.get(boardKey);\n if (!board) continue;\n const trace: IntakeBoardTrace = { boardKey: board.id, name: board.name, rules: [] };\n boards.push(trace);\n for (const route of routes) {\n if (route.target.boardKey !== boardKey || route.target.joinClosedIssue || !placesNewCards(route)) continue;\n const phase = landingPhase(board, route.target.phaseKey);\n const rule = { routeId: route.id, name: route.name ?? null, phase };\n if (!route.enabled) {\n trace.rules.push({ ...rule, outcome: 'disabled' });\n continue;\n }\n const kindFailed = arrivalKindFailure(route, facts);\n if (kindFailed) {\n trace.rules.push({ ...rule, outcome: 'no_match', failed: [kindFailed] });\n continue;\n }\n const explained = explainRuleGroup(route.when, facts);\n if (!explained.matched) {\n trace.rules.push({ ...rule, outcome: 'no_match', failed: explained.failed });\n continue;\n }\n if (!placementTakesCard(board, phase, facts)) {\n trace.rules.push({ ...rule, outcome: 'phase_refuses' });\n continue;\n }\n if (winner) {\n trace.rules.push({ ...rule, outcome: 'lost', to: winner });\n continue;\n }\n trace.rules.push({ ...rule, outcome: 'took' });\n winner = { boardKey: board.id, routeId: route.id };\n resolution = { outcome: 'placed', board: board.id, phase, routeId: route.id };\n if (!options.full) return { resolution, boards };\n }\n }\n if (resolution) return { resolution, boards };\n const checked = boards.map(board => board.name);\n return {\n resolution: {\n outcome: 'not_routed',\n reason:\n checked.length > 0\n ? `No board's intake rules match it (checked ${checked.join(', ')}).`\n : 'The project has no board to take it.',\n },\n boards,\n };\n}\n\nfunction resolveByIntakeOrder(query: IntakeQuery): IntakeResolution {\n return traceIntakeOrder(query).resolution;\n}\n\n/**\n * The old evaluator, kept behind the flag until every replica runs the new one: the first\n * matching route of the whole list, else the default board's first phase, else the first board.\n * The only place intake still names a default board; delete it with the flag.\n */\nfunction resolveByRouteList({ routes, facts, registry }: IntakeQuery): IntakeResolution {\n const placement = resolveIntakePlacement(routes, facts, registry);\n if (placement) return { outcome: 'placed', ...placement };\n const fallback = intakeTarget(registry);\n return fallback\n ? { outcome: 'placed', board: fallback.board, phase: fallback.initialPhase, routeId: null }\n : { outcome: 'not_routed', reason: 'The project has no board to take it.' };\n}\n\n/** The phase a route's card lands in: its named phase when new cards can reach it, else the board's first. */\nexport function landingPhase(board: InstalledBoard, phase: string | null | undefined): string {\n const usable =\n phase &&\n board.phaseKind(phase) !== undefined &&\n !board.isTerminal(phase) &&\n board.allowsTransition(board.initialPhase, phase);\n return usable ? phase : board.initialPhase;\n}\n\n/** Whether any route on the board, enabled or not, handles the event: then the routes own it. */\nexport function routesHandleEvent(\n routes: readonly Pick<IntakeRoute, 'on' | 'target'>[],\n event: BoardEventFacts,\n board: Pick<InstalledBoard, 'id'>,\n): boolean {\n return routes.some(route => route.target.boardKey === board.id && route.on.includes(event.type));\n}\n\nconst SETTLING_PULL_REQUEST_EVENTS = new Set<string>(['pull_request.merged', 'pull_request.closed']);\n\nfunction testsField(group: RuleGroup | null, field: string): boolean {\n return (\n group?.conditions.some(member => ('field' in member ? member.field === field : testsField(member, field))) ?? false\n );\n}\n\n/** A card-move route that matched but can't take the card where it points, and why. */\nexport interface SkippedEventRoute {\n routeId: string;\n /** The board the rule points the card to. */\n boardKey: string;\n reason: string;\n}\n\n/** A card move: the board, phase and rule an event sends the card to. */\nexport interface EventMove {\n board: string;\n phase: string;\n routeId: string;\n}\n\n/** What one card-move rule answered for an event. */\nexport type EventRuleVerdict =\n | { outcome: 'took' }\n | { outcome: 'lost'; to: { boardKey: string; routeId: string } }\n | { outcome: 'no_match'; failed: FailedRuleCondition[] }\n | { outcome: 'skipped'; reason: string }\n | { outcome: 'disabled' };\n\nexport type EventRuleTrace = { routeId: string; name: string | null } & EventRuleVerdict;\n\n/**\n * Every rule on the card's board whose `on` names the event, top to bottom, and what each\n * answered: the first enabled one whose `when` matches the card and the event, and whose target\n * can hold the card, moves it. The target is the route's own board unless it names another\n * (`moveToBoardKey`); a route without a phase moves the card to the target board's first phase.\n * A matching route whose target is gone or can't take the card is skipped and reported through\n * `onSkip`. Filing stops at the winner; `full` keeps asking, so the tester shows what it beat.\n */\nexport function traceEventRoute(\n routes: readonly IntakeRoute[],\n event: BoardEventFacts,\n cardFacts: RuleFacts,\n board: InstalledBoard,\n options: { registry: BoardRegistry; carriesPullRequest?: boolean; onSkip?: (skipped: SkippedEventRoute) => void },\n { full = false }: { full?: boolean } = {},\n): { move: EventMove | undefined; rules: EventRuleTrace[] } {\n const { 'pullRequest.trusted': workingPullRequestTrusted, ...rest } = cardFacts;\n // On a pull request event, `pullRequest.trusted` is that pull request's author, not the card's\n // working pull request's; an event that doesn't say is untrusted.\n const pullRequestTrusted = isPullRequestEvent(event.type) ? event.pullRequestTrusted : workingPullRequestTrusted;\n const facts: RuleFacts = {\n ...rest,\n ...(pullRequestTrusted !== undefined ? { 'pullRequest.trusted': pullRequestTrusted } : {}),\n ...eventRuleFacts(event),\n ...(event.closedIssue\n ? {\n 'pullRequest.closesIssue': true,\n ...(event.closedIssue.phase !== null ? { 'closedIssue.phase': event.closedIssue.phase } : {}),\n 'closedIssue.hasPullRequest': event.closedIssue.hasPullRequest,\n }\n : {}),\n };\n // An outsider's pull request linked to an issue's card moves the card only by a rule that asks\n // about the pull request's trust; one that doesn't was never written with outsiders in mind.\n // Merging and closing settle the pull request either way, so those still move the card.\n const untrustedLinkedPullRequest =\n isPullRequestEvent(event.type) &&\n !SETTLING_PULL_REQUEST_EVENTS.has(event.type) &&\n cardFacts['source.kind'] !== 'pull_request' &&\n pullRequestTrusted !== true;\n const rules: EventRuleTrace[] = [];\n let move: EventMove | undefined;\n for (const route of routes) {\n if (!route.on.includes(event.type) || route.target.boardKey !== board.id) continue;\n const named = { routeId: route.id, name: route.name ?? null };\n if (!route.enabled) {\n rules.push({ ...named, outcome: 'disabled' });\n continue;\n }\n // Not a skip the dispatcher logs: the rule was never meant for this pull request.\n if (untrustedLinkedPullRequest && !testsField(route.when, 'pullRequest.trusted')) {\n rules.push({\n ...named,\n outcome: 'skipped',\n reason: \"the pull request's author is an outsider, and this rule doesn't test pullRequest.trusted\",\n });\n continue;\n }\n const { matched, failed } = explainRuleGroup(route.when, facts);\n if (!matched) {\n rules.push({ ...named, outcome: 'no_match', failed });\n continue;\n }\n const targetKey = route.target.moveToBoardKey ?? board.id;\n const skip = (reason: string) => {\n // Filing never reaches a rule past the winner, so only those before it are logged.\n if (!move) options.onSkip?.({ routeId: route.id, boardKey: targetKey, reason });\n rules.push({ ...named, outcome: 'skipped', reason });\n };\n const target = targetKey === board.id ? board : options.registry.get(targetKey);\n if (!target) {\n skip(`board \"${targetKey}\" is not installed`);\n continue;\n }\n const phase = route.target.phaseKey ?? target.initialPhase;\n if (target.phaseKind(phase) === undefined) {\n skip(`board \"${target.id}\" has no phase \"${phase}\"`);\n continue;\n }\n if (!placementTakesCard(target, phase, facts, options.carriesPullRequest ?? false)) {\n skip(`phase \"${phase}\" on board \"${target.id}\" can't hold this card`);\n continue;\n }\n // A rule that could have taken the card, had an earlier one not.\n if (move) {\n rules.push({ ...named, outcome: 'lost', to: { boardKey: move.board, routeId: move.routeId } });\n continue;\n }\n move = { board: target.id, phase, routeId: route.id };\n rules.push({ ...named, outcome: 'took' });\n if (!full) break;\n }\n return { move, rules };\n}\n\n/** Where a status event moves an existing card, by {@link traceEventRoute}; undefined leaves it where it is. */\nexport function resolveEventRoute(\n routes: readonly IntakeRoute[],\n event: BoardEventFacts,\n cardFacts: RuleFacts,\n board: InstalledBoard,\n options: { registry: BoardRegistry; carriesPullRequest?: boolean; onSkip?: (skipped: SkippedEventRoute) => void },\n): EventMove | undefined {\n return traceEventRoute(routes, event, cardFacts, board, options).move;\n}\n\n/**\n * What a status event does to a card: `moves` it where a route sends it; `stays` when a route on\n * its board handles the event but none moves it anywhere new; `rule_default` when the\n * integration's own move (`fallback`, if any) applies because no route handles the event, or a\n * pull request event's route didn't take the card; `ignored` when the event can't move a card in\n * its state (a reopen of an unfinished card, a close of a finished one) or its board is gone.\n */\nexport type EventMovePlan = { rules: EventRuleTrace[] } & (\n | { outcome: 'moves'; move: EventMove }\n | { outcome: 'stays' }\n | { outcome: 'rule_default'; phase: string | null }\n | { outcome: 'ignored'; reason: string }\n);\n\n/** Decides a status event on a card the way the dispatcher files it; the tester replays events through it. */\nexport function planEventMove(\n input: {\n routes: readonly IntakeRoute[];\n event: BoardEventFacts;\n item: Card;\n registry: BoardRegistry;\n /** The integration's own move for this event, when it proposed one. */\n fallback?: { stage: string };\n onSkip?: (skipped: SkippedEventRoute) => void;\n },\n options: { full?: boolean } = {},\n): EventMovePlan {\n const { routes, event, item, registry, fallback } = input;\n const board = registry.get(boardForWorkItem(item));\n if (!board) return { outcome: 'ignored', reason: \"The card's board isn't installed.\", rules: [] };\n const stage = item.stages.length === 1 ? item.stages[0] : undefined;\n const finished = stage !== undefined && board.isTerminal(stage);\n if (!eventMovesCard(event.type, finished)) {\n return {\n outcome: 'ignored',\n reason: finished ? \"A finished card doesn't move on this event.\" : 'Only a finished card moves on this event.',\n rules: [],\n };\n }\n const defaulted = { outcome: 'rule_default' as const, phase: fallback?.stage ?? null };\n if (!routesHandleEvent(routes, event, board)) return { ...defaulted, rules: [] };\n const facts = { ...cardRuleFacts(item), ...(stage !== undefined ? { 'card.phase': stage } : {}) };\n const { move, rules } = traceEventRoute(\n routes,\n event,\n facts,\n board,\n { registry, carriesPullRequest: hasPullRequest(item), ...(input.onSkip && { onSkip: input.onSkip }) },\n options,\n );\n // A pull request event the rules already decided keeps that decision when no enabled route\n // takes the card: disabling or narrowing a route must not strand a merged card in review.\n if (!move) return fallback && isPullRequestEvent(event.type) ? { ...defaulted, rules } : { outcome: 'stays', rules };\n const crossesBoards = move.board !== board.id;\n // A route that agrees with the rule's own pull request move keeps it whole: its message, and\n // the re-entry that restarts a review in the phase the card already sits in.\n if (!crossesBoards && fallback && isPullRequestEvent(event.type) && move.phase === fallback.stage) {\n return { ...defaulted, rules };\n }\n if (!crossesBoards && stage === move.phase) return { outcome: 'stays', rules };\n return { outcome: 'moves', move, rules };\n}\n"],"mappings":";;;;;;;;AAiCA,SAAgB,eAAe,OAA+B;CAC5D,OAAO,aAAa,KAAK,CAAC,CAAC,OAAO;AACpC;;;;;AAMA,SAAgB,cAAc,OAAsB,OAA2B;CAC7E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Q,OAAO,KAAK,GAAG,OAAO;EAAE,GAAG;EAAW,OAAO,CAAC;CAAE;CAE/E,MAAM,EAAE,MAAM,UAAU,gBACtB,QACA,OACA;EAJc,GAAG,cAAc,IAAI;EAAG,GAAI,UAAU,KAAA,IAAY,EAAE,cAAc,MAAM,IAAI,CAAC;CAIvF,GACJ,OACA;EAAE;EAAU,oBAAoB,eAAe,IAAI;EAAG,GAAI,MAAM,UAAU,EAAE,QAAQ,MAAM,OAAO;CAAG,GACpG,OACF;CAGA,IAAI,CAAC,MAAM,OAAO,YAAY,mBAAmB,MAAM,IAAI,IAAI;EAAE,GAAG;EAAW;CAAM,IAAI;EAAE,SAAS;EAAS;CAAM;CACnH,MAAM,gBAAgB,KAAK,UAAU,MAAM;CAG3C,IAAI,CAAC,iBAAiB,YAAY,mBAAmB,MAAM,IAAI,KAAK,KAAK,UAAU,SAAS,OAC1F,OAAO;EAAE,GAAG;EAAW;CAAM;CAE/B,IAAI,CAAC,iBAAiB,UAAU,KAAK,OAAO,OAAO;EAAE,SAAS;EAAS;CAAM;CAC7E,OAAO;EAAE,SAAS;EAAS;EAAM;CAAM;AACzC"}
1
+ {"version":3,"file":"intake-routing.js","names":[],"sources":["../../src/boards/intake-routing.ts"],"sourcesContent":["import { evaluateRuleGroup, explainRuleGroup } from '../rules/rule-group.js';\nimport type { FailedRuleCondition, RuleFacts, RuleGroup } from '../rules/rule-group.js';\nimport { externalSourceForWorkItem } from '../rules/types.js';\nimport type { FactoryCommitDecision } from '../rules/types.js';\nimport type { IntakeEvaluator, StoredBoardsStorage, StoredIntakeRouteRecord } from '../storage/domains/boards/base.js';\nimport type { Card } from '../storage/domains/work-items/base.js';\nimport type { BoardEventFacts, RouteArrivals } from './board-events.js';\nimport {\n arrivalKind,\n arrivalKinds,\n eventMovesCard,\n eventRuleFacts,\n isPullRequestEvent,\n LEGACY_ARRIVAL_EVENT,\n SETTLING_PULL_REQUEST_EVENTS,\n testsField,\n} from './board-events.js';\nimport { cardRuleFacts } from './card-facts.js';\nimport { deriveIntakeOrder, reconcileIntakeOrder } from './intake-order.js';\nimport type { BoardRegistry, InstalledBoard } from './registry.js';\nimport { boardFlow, boardForWorkItem, hasPullRequest, intakeTarget, isTerminalWorkItem } from './semantics.js';\n\n/** Reads a project's intake routes and intake order, and logs how intake decided each arrival. */\nexport type IntakeRoutesReader = Pick<\n StoredBoardsStorage,\n 'listIntakeRoutes' | 'readIntakeOrder' | 'recordIntakeDecision' | 'resolveNotRouted' | 'intakeEvaluator'\n>;\n\ntype IntakeRoute = Pick<\n StoredIntakeRouteRecord,\n 'id' | 'enabled' | 'when' | 'on' | 'pullRequestOpenedMovesOnly' | 'outsiderPullRequestsGated'\n> & {\n target: Pick<StoredIntakeRouteRecord['target'], 'boardKey' | 'phaseKey' | 'joinClosedIssue'> & {\n moveToBoardKey?: string | null;\n };\n} & Partial<Pick<StoredIntakeRouteRecord, 'name'>>;\n\n/** Whether the route places new cards, rather than only moving existing ones on later events. */\nexport function placesNewCards(route: RouteArrivals): boolean {\n return arrivalKinds(route).size > 0;\n}\n\n/**\n * Whether the route files this arrival: an issue by a `work_item.opened` route, a pull request with\n * no card by a `pull_request.opened` one, either by a legacy `work_item.created` one.\n */\nexport function placesArrival(route: RouteArrivals, facts: RuleFacts): boolean {\n return arrivalKinds(route).has(arrivalKind(facts));\n}\n\n/**\n * Why a route that files only issues, or only pull requests, passes over this arrival, put as the\n * `source.kind` condition it amounts to; undefined when the route files this kind.\n */\nfunction arrivalKindFailure(route: { on: readonly string[] }, facts: RuleFacts): FailedRuleCondition | undefined {\n if (placesArrival(route, facts)) return undefined;\n const actual = (facts['source.kind'] as FailedRuleCondition['actual'] | undefined) ?? null;\n return arrivalKind(facts) === 'pull_request'\n ? { field: 'source.kind', operator: 'not_equals', value: 'pull_request', actual }\n : { field: 'source.kind', operator: 'equals', value: 'pull_request', actual };\n}\n\n/**\n * Card metadata naming the intake route that placed the card. Label changes, rebinding its\n * source and replayed arrivals leave such a card where the route put it.\n */\nexport const INTAKE_ROUTE_METADATA_KEY = 'intakeRouteId';\n\n/** Whether an intake route chose this card's board when it arrived. */\nexport function placedByIntakeRoute(item: Pick<Card, 'metadata'>): boolean {\n return typeof item.metadata?.[INTAKE_ROUTE_METADATA_KEY] === 'string';\n}\n\nexport type IntakeTargetProblem = {\n code: 'unknown_board' | 'unknown_phase' | 'terminal_phase' | 'join_on_event' | 'move_on_arrival';\n message: string;\n};\n\n/**\n * Why a route's target can't take cards in this project, or undefined when it can. A route that\n * places new cards needs a phase on its own board that isn't terminal; one that only moves\n * existing cards on later events, such as a close, may name any phase, terminal ones included.\n */\nexport function intakeTargetProblem(\n registry: BoardRegistry,\n route: RouteArrivals & {\n target: { boardKey: string; phaseKey?: string | null; joinClosedIssue?: boolean; moveToBoardKey?: string | null };\n },\n): IntakeTargetProblem | undefined {\n const { target } = route;\n const owner = registry.get(target.boardKey);\n if (!owner) {\n return { code: 'unknown_board', message: `Board \"${target.boardKey}\" is not installed in this project.` };\n }\n if (target.moveToBoardKey && (target.joinClosedIssue || placesNewCards(route))) {\n return {\n code: 'move_on_arrival',\n message:\n 'Only a route moving existing cards on later events can send them to another board: its `on` must not name an arrival event (`work_item.opened`, `pull_request.opened` or `work_item.created`).',\n };\n }\n const board = target.moveToBoardKey ? registry.get(target.moveToBoardKey) : owner;\n if (!board) {\n return { code: 'unknown_board', message: `Board \"${target.moveToBoardKey}\" is not installed in this project.` };\n }\n if (\n target.joinClosedIssue &&\n route.on.some(event => event !== 'pull_request.opened' && event !== LEGACY_ARRIVAL_EVENT)\n ) {\n return {\n code: 'join_on_event',\n message:\n 'A route that joins a pull request to the card of the issue it closes handles only pull requests arriving: its `on` must be `pull_request.opened` alone.',\n };\n }\n if (!target.phaseKey) return undefined;\n if (target.joinClosedIssue && board.phaseKind(target.phaseKey) === 'terminal') {\n return {\n code: 'terminal_phase',\n message: `Phase \"${target.phaseKey}\" on board \"${board.id}\" is terminal; a card a pull request joins can't move there.`,\n };\n }\n if (target.joinClosedIssue) {\n return board.phaseKind(target.phaseKey)\n ? undefined\n : { code: 'unknown_phase', message: `Board \"${board.id}\" has no phase \"${target.phaseKey}\".` };\n }\n const kind = board.phaseKind(target.phaseKey);\n if (!kind) {\n return { code: 'unknown_phase', message: `Board \"${board.id}\" has no phase \"${target.phaseKey}\".` };\n }\n if (!placesNewCards(route)) return undefined;\n if (kind === 'terminal') {\n return {\n code: 'terminal_phase',\n message: `Phase \"${target.phaseKey}\" on board \"${board.id}\" is terminal; new cards can't land there.`,\n };\n }\n return undefined;\n}\n\n/**\n * On a board that reviews pull requests a pull request card works only in the pull request review\n * phase (it may also rest or finish), and nothing else lands in that review: a card arriving here\n * carries no attached pull request yet, and an existing issue card enters it only with one on it.\n * `FactoryTransitionService` refuses any move that breaks this, so a route can't either.\n */\nfunction placementTakesCard(\n board: InstalledBoard,\n phase: string,\n facts: RuleFacts,\n carriesPullRequest = false,\n): boolean {\n const flow = boardFlow(board);\n const review = flow.pullRequestReview;\n if (!review) return true;\n if (facts['source.kind'] !== 'pull_request') {\n // A board that reviews pull requests but builds nothing (the retired Review board) holds only them.\n if (flow.build === undefined) return false;\n return phase !== review || carriesPullRequest;\n }\n return phase === review || board.phaseKind(phase) !== 'working';\n}\n\n/**\n * What an intake route can test about the issue a pull request closes: whether there is one with\n * a card, that card's phase, and whether a pull request already sits on it. `closedIssue` is the\n * card the provider rules found, read fresh; undefined when the pull request closes none.\n */\nexport function closedIssueRuleFacts(closedIssue: Pick<Card, 'stages' | 'workItem'> | undefined): RuleFacts {\n if (!closedIssue) return { 'pullRequest.closesIssue': false };\n return {\n 'pullRequest.closesIssue': true,\n 'item.hasIssue': true,\n ...(closedIssue.stages.length === 1 ? { 'closedIssue.phase': closedIssue.stages[0] } : {}),\n 'closedIssue.hasPullRequest': hasPullRequest(closedIssue),\n };\n}\n\n/**\n * Where a new card lands: the first enabled route that places new cards, whose condition matches\n * it and whose target can take it, on an installed board; a route without a phase, or whose phase\n * has since gone, lands it in the board's initial phase. Routes that once joined a pull request to\n * the card of the issue it closes place nothing: pull requests link to that card on their own.\n * Undefined leaves today's placement alone.\n */\nexport function resolveIntakePlacement(\n routes: readonly IntakeRoute[],\n facts: RuleFacts,\n registry: BoardRegistry,\n): { board: string; phase: string; routeId: string } | undefined {\n for (const route of routes) {\n if (!route.enabled || route.target.joinClosedIssue || !placesArrival(route, facts)) continue;\n if (!evaluateRuleGroup(route.when, facts)) continue;\n const board = registry.get(route.target.boardKey);\n if (!board) continue;\n const phase = landingPhase(board, route.target.phaseKey);\n if (!placementTakesCard(board, phase, facts)) continue;\n return { board: board.id, phase, routeId: route.id };\n }\n return undefined;\n}\n\n/** Where intake sends an arrival: placed on a board, or Not routed with the reason. */\nexport type IntakeResolution =\n | { outcome: 'placed'; board: string; phase: string; routeId: string | null }\n | { outcome: 'not_routed'; reason: string };\n\nexport interface IntakeQuery {\n evaluator: IntakeEvaluator;\n routes: readonly IntakeRoute[];\n /** Board keys in intake order; only the `intake-order` evaluator reads it. */\n order: readonly string[];\n facts: RuleFacts;\n registry: BoardRegistry;\n}\n\n/**\n * What intake rules test of an arrival: its own facts and, for a pull request closing an issue, that\n * issue's card as it is now (a finished card or one of another project counts as none). The\n * dispatcher and Route again both read an arrival through this, so they decide alike.\n */\nexport async function arrivalRuleFacts(\n decision: Extract<FactoryCommitDecision, { type: 'upsertLinkedWorkItem' }>,\n context: { factoryProjectId: string; registry: BoardRegistry; card(id: string): Promise<Card | null> },\n): Promise<RuleFacts> {\n const facts = cardRuleFacts({\n title: decision.title,\n metadata: decision.metadata ?? {},\n externalSource: externalSourceForWorkItem(decision.source, decision.sourceKey, decision.url ?? undefined),\n });\n if (!decision.closesIssue) return facts;\n const closed = await context.card(decision.closesIssue.workItemId);\n const open =\n closed && closed.factoryProjectId === context.factoryProjectId && !isTerminalWorkItem(context.registry, closed)\n ? closed\n : undefined;\n return { ...facts, ...closedIssueRuleFacts(open) };\n}\n\n/**\n * Prefixes the decision an admin's Route again commits. Such an arrival is resolved by intake order\n * whatever this replica's evaluator: only that evaluator leaves an item Not routed.\n */\nexport const ROUTE_AGAIN_KEY_PREFIX = 'intake-route-again:';\n\n/** The env var that forces an evaluator on every project, for deployments with projects from before intake order. */\nexport const INTAKE_EVALUATOR_ENV = 'FACTORY_INTAKE_EVALUATOR';\n\n/**\n * The evaluator this process forces on every project: a valid `FACTORY_INTAKE_EVALUATOR`.\n * Undefined when it isn't set: each project uses its own.\n */\nexport function intakeEvaluatorFrom(\n env: Record<string, string | undefined> = process.env,\n): IntakeEvaluator | undefined {\n const value = env[INTAKE_EVALUATOR_ENV];\n return value === 'intake-order' || value === 'route-list' ? value : undefined;\n}\n\n/**\n * The evaluator that decides a project's arrivals: the forced one, else the project's setting\n * (`intake-order` for a project created since it shipped), else `route-list`.\n */\nexport async function projectIntakeEvaluator(\n forced: IntakeEvaluator | undefined,\n storage: Pick<StoredBoardsStorage, 'intakeEvaluator'>,\n scope: { orgId: string; factoryProjectId: string },\n): Promise<IntakeEvaluator> {\n return forced ?? (await storage.intakeEvaluator(scope)) ?? 'route-list';\n}\n\n/** Where intake sends an arrival, by the evaluator `query` names. Join routes never place here. */\nexport function resolveIntake(query: IntakeQuery): IntakeResolution {\n return query.evaluator === 'intake-order' ? resolveByIntakeOrder(query) : resolveByRouteList(query);\n}\n\n/** How many of a project's newest cards {@link compareIntakeOrder} reads. */\nexport const INTAKE_ORDER_SAMPLE = 200;\n\nexport interface IntakeOrderComparison {\n /** Cards compared: the project's newest, at most {@link INTAKE_ORDER_SAMPLE}. */\n compared: number;\n /** Of those, how many the intake order would place on another board than the route list does. */\n differing: number;\n /** Of those, how many no board's rules take under the intake order. */\n notRouted: number;\n}\n\n/**\n * Runs both evaluators over `cards` (newest first) as if each arrived now, so an admin sees what\n * switching to `order` changes before switching.\n */\nexport function compareIntakeOrder(\n query: Pick<IntakeQuery, 'routes' | 'order' | 'registry'> & { cards: readonly Card[] },\n): IntakeOrderComparison {\n const sample = query.cards.slice(0, INTAKE_ORDER_SAMPLE);\n let differing = 0;\n let notRouted = 0;\n for (const card of sample) {\n const base = { routes: query.routes, order: query.order, registry: query.registry, facts: cardRuleFacts(card) };\n const old = resolveIntake({ ...base, evaluator: 'route-list' });\n const next = resolveIntake({ ...base, evaluator: 'intake-order' });\n if (next.outcome === 'not_routed') notRouted += 1;\n if (placedOn(old) !== placedOn(next)) differing += 1;\n }\n return { compared: sample.length, differing, notRouted };\n}\n\nfunction placedOn(resolution: IntakeResolution): string | null {\n return resolution.outcome === 'placed' ? resolution.board : null;\n}\n\n/** How one intake rule answered an item, in the order intake asked it. */\nexport type IntakeRuleVerdict =\n /** It took the item: the first enabled rule, in intake order, that matched and whose phase takes it. */\n | { outcome: 'took' }\n /** It matched and its phase takes the item, but a rule asked earlier took it first. */\n | { outcome: 'lost'; to: { boardKey: string; routeId: string } }\n /** Its condition failed; `failed` names the conditions it failed on. */\n | { outcome: 'no_match'; failed: FailedRuleCondition[] }\n /** It matched, but its phase can't hold this kind of item (such as an issue in a pull request review phase). */\n | { outcome: 'phase_refuses' }\n /** It is switched off. */\n | { outcome: 'disabled' };\n\nexport type IntakeRuleTrace = IntakeRuleVerdict & {\n routeId: string;\n name: string | null;\n /** The phase the item would land in from this rule. */\n phase: string;\n};\n\nexport interface IntakeBoardTrace {\n boardKey: string;\n name: string;\n /** The board's rules that place new items, top to bottom. */\n rules: IntakeRuleTrace[];\n}\n\nexport interface IntakeTrace {\n resolution: IntakeResolution;\n /** Boards in the order intake asked them; with `full`, every board, even after one took the item. */\n boards: IntakeBoardTrace[];\n}\n\n/**\n * Asks boards in intake order, and inside each board its own rules top to bottom: the first\n * enabled placing rule that matches and whose phase can take the card decides. Nothing names a\n * board to fall back to; an arrival no board takes is Not routed. Filing stops at the winner;\n * `full` keeps asking every rule after it, so the dry run and tester can show which rules\n * matched but lost. Both read the same verdicts, so what they show is what filing does.\n */\nexport function traceIntakeOrder(\n { routes, order, facts, registry }: Omit<IntakeQuery, 'evaluator'>,\n options: { full?: boolean } = {},\n): IntakeTrace {\n const boards: IntakeBoardTrace[] = [];\n let resolution: Extract<IntakeResolution, { outcome: 'placed' }> | undefined;\n let winner: { boardKey: string; routeId: string } | undefined;\n // A code board isn't stored, so the stored order can lack it; it slots in as a new board does.\n const boardKeys = [...registry.keys()];\n const stored = order.length > 0 ? order : deriveIntakeOrder(routes, boardKeys);\n for (const boardKey of reconcileIntakeOrder(stored, boardKeys, routes)) {\n const board = registry.get(boardKey);\n if (!board) continue;\n const trace: IntakeBoardTrace = { boardKey: board.id, name: board.name, rules: [] };\n boards.push(trace);\n for (const route of routes) {\n if (route.target.boardKey !== boardKey || route.target.joinClosedIssue || !placesNewCards(route)) continue;\n const phase = landingPhase(board, route.target.phaseKey);\n const rule = { routeId: route.id, name: route.name ?? null, phase };\n if (!route.enabled) {\n trace.rules.push({ ...rule, outcome: 'disabled' });\n continue;\n }\n const kindFailed = arrivalKindFailure(route, facts);\n if (kindFailed) {\n trace.rules.push({ ...rule, outcome: 'no_match', failed: [kindFailed] });\n continue;\n }\n const explained = explainRuleGroup(route.when, facts);\n if (!explained.matched) {\n trace.rules.push({ ...rule, outcome: 'no_match', failed: explained.failed });\n continue;\n }\n if (!placementTakesCard(board, phase, facts)) {\n trace.rules.push({ ...rule, outcome: 'phase_refuses' });\n continue;\n }\n if (winner) {\n trace.rules.push({ ...rule, outcome: 'lost', to: winner });\n continue;\n }\n trace.rules.push({ ...rule, outcome: 'took' });\n winner = { boardKey: board.id, routeId: route.id };\n resolution = { outcome: 'placed', board: board.id, phase, routeId: route.id };\n if (!options.full) return { resolution, boards };\n }\n }\n if (resolution) return { resolution, boards };\n const checked = boards.map(board => board.name);\n return {\n resolution: {\n outcome: 'not_routed',\n reason:\n checked.length > 0\n ? `No board's intake rules match it (checked ${checked.join(', ')}).`\n : 'The project has no board to take it.',\n },\n boards,\n };\n}\n\nfunction resolveByIntakeOrder(query: IntakeQuery): IntakeResolution {\n return traceIntakeOrder(query).resolution;\n}\n\n/**\n * The old evaluator, kept behind the flag until every replica runs the new one: the first\n * matching route of the whole list, else the default board's first phase, else the first board.\n * The only place intake still names a default board; delete it with the flag.\n */\nfunction resolveByRouteList({ routes, facts, registry }: IntakeQuery): IntakeResolution {\n const placement = resolveIntakePlacement(routes, facts, registry);\n if (placement) return { outcome: 'placed', ...placement };\n const fallback = intakeTarget(registry);\n return fallback\n ? { outcome: 'placed', board: fallback.board, phase: fallback.initialPhase, routeId: null }\n : { outcome: 'not_routed', reason: 'The project has no board to take it.' };\n}\n\n/** The phase a route's card lands in: its named phase while it exists and isn't terminal, else the board's first. */\nexport function landingPhase(board: InstalledBoard, phase: string | null | undefined): string {\n const usable = phase && board.phaseKind(phase) !== undefined && !board.isTerminal(phase);\n return usable ? phase : board.initialPhase;\n}\n\n/**\n * The phase a retry of a filing decision resumes its card into: the route's phase while the card\n * can work there, else the board's first phase. The route may have been retargeted since filing,\n * and an issue card can't be forced into a review phase a filing would never have sent it to.\n */\nexport function resumeLandingPhase(\n board: InstalledBoard,\n phase: string | null | undefined,\n facts: RuleFacts,\n carriesPullRequest = false,\n): string {\n const landing = landingPhase(board, phase);\n return placementTakesCard(board, landing, facts, carriesPullRequest) ? landing : board.initialPhase;\n}\n\n/** Whether any route on the board, enabled or not, handles the event: then the routes own it. */\nexport function routesHandleEvent(\n routes: readonly Pick<IntakeRoute, 'on' | 'target'>[],\n event: BoardEventFacts,\n board: Pick<InstalledBoard, 'id'>,\n): boolean {\n return routes.some(route => route.target.boardKey === board.id && route.on.includes(event.type));\n}\n\n/**\n * Whether the event is a pull request event that no trusted actor vouches for, and that doesn't\n * settle the pull request. A run that such an event queues is compute and code execution on an\n * outside actor's say-so: it waits for a person, whatever card it moves. A maintainer acting on\n * an outside author's pull request is that vouch, so this reads the actor's trust, never the\n * author's. Merging and closing settle the pull request either way, so they never count.\n */\nexport function untrustedPullRequestEvent(event: BoardEventFacts): boolean {\n return isPullRequestEvent(event.type) && !SETTLING_PULL_REQUEST_EVENTS.has(event.type) && event.actorTrusted !== true;\n}\n\n/**\n * Whether the event is an outside author's pull request event on an issue's card: an unsettling\n * pull request event an untrusted author wrote, on a card that isn't the pull request's own. The\n * legacy rule gate only ever held moves of linked cards back by the author's trust — what the\n * rules' `pullRequest.trusted` tests — so it keeps both that scope and that signal.\n */\nexport function untrustedLinkedPullRequestEvent(event: BoardEventFacts, cardFacts: RuleFacts): boolean {\n return (\n cardFacts['source.kind'] !== 'pull_request' &&\n isPullRequestEvent(event.type) &&\n !SETTLING_PULL_REQUEST_EVENTS.has(event.type) &&\n event.pullRequestTrusted !== true\n );\n}\n\n/** A card-move route that matched but can't take the card where it points, and why. */\nexport interface SkippedEventRoute {\n routeId: string;\n /** The board the rule points the card to. */\n boardKey: string;\n reason: string;\n}\n\n/** A card move: the board, phase and rule an event sends the card to. */\nexport interface EventMove {\n board: string;\n phase: string;\n routeId: string;\n}\n\n/** What one card-move rule answered for an event. */\nexport type EventRuleVerdict =\n | { outcome: 'took' }\n | { outcome: 'lost'; to: { boardKey: string; routeId: string } }\n | { outcome: 'no_match'; failed: FailedRuleCondition[] }\n | { outcome: 'skipped'; reason: string }\n | { outcome: 'disabled' };\n\nexport type EventRuleTrace = { routeId: string; name: string | null } & EventRuleVerdict;\n\n/**\n * Every rule on the card's board whose `on` names the event, top to bottom, and what each\n * answered: the first enabled one whose `when` matches the card and the event, and whose target\n * can hold the card, moves it. The target is the route's own board unless it names another\n * (`moveToBoardKey`); a route without a phase moves the card to the target board's first phase.\n * A matching route whose target is gone or can't take the card is skipped and reported through\n * `onSkip`. Filing stops at the winner; `full` keeps asking, so the tester shows what it beat.\n */\nexport function traceEventRoute(\n routes: readonly IntakeRoute[],\n event: BoardEventFacts,\n cardFacts: RuleFacts,\n board: InstalledBoard,\n options: { registry: BoardRegistry; carriesPullRequest?: boolean; onSkip?: (skipped: SkippedEventRoute) => void },\n { full = false }: { full?: boolean } = {},\n): { move: EventMove | undefined; rules: EventRuleTrace[] } {\n const { 'pullRequest.trusted': workingPullRequestTrusted, ...rest } = cardFacts;\n // On a pull request event, `pullRequest.trusted` is that pull request's author, not the card's\n // working pull request's; an event that doesn't say is untrusted.\n const pullRequestTrusted = isPullRequestEvent(event.type) ? event.pullRequestTrusted : workingPullRequestTrusted;\n const facts: RuleFacts = {\n ...rest,\n ...(pullRequestTrusted !== undefined ? { 'pullRequest.trusted': pullRequestTrusted } : {}),\n ...eventRuleFacts(event),\n ...(event.closedIssue\n ? {\n 'pullRequest.closesIssue': true,\n ...(event.closedIssue.phase !== null ? { 'closedIssue.phase': event.closedIssue.phase } : {}),\n 'closedIssue.hasPullRequest': event.closedIssue.hasPullRequest,\n }\n : {}),\n };\n // Rules decide outsiders' pull requests themselves: one that should only act for a maintainer\n // says so with a `pullRequest.trusted` condition. Only a rule stored before that\n // (`outsiderPullRequestsGated`) keeps the old gate: an outsider's pull request linked to an\n // issue's card moves the card only by a rule that asks about the pull request's trust. Merging\n // and closing settle the pull request either way, so those still move the card.\n const untrustedLinkedPullRequest = untrustedLinkedPullRequestEvent(event, cardFacts);\n const rules: EventRuleTrace[] = [];\n let move: EventMove | undefined;\n for (const route of routes) {\n if (!route.on.includes(event.type) || route.target.boardKey !== board.id) continue;\n const named = { routeId: route.id, name: route.name ?? null };\n if (!route.enabled) {\n rules.push({ ...named, outcome: 'disabled' });\n continue;\n }\n // Not a skip the dispatcher logs: the older rule was never meant for this pull request.\n if (\n untrustedLinkedPullRequest &&\n route.outsiderPullRequestsGated &&\n !testsField(route.when, 'pullRequest.trusted')\n ) {\n rules.push({\n ...named,\n outcome: 'skipped',\n reason: \"the pull request's author is an outsider, and this older rule skips outside authors' pull requests\",\n });\n continue;\n }\n const { matched, failed } = explainRuleGroup(route.when, facts);\n if (!matched) {\n rules.push({ ...named, outcome: 'no_match', failed });\n continue;\n }\n const targetKey = route.target.moveToBoardKey ?? board.id;\n const skip = (reason: string) => {\n // Filing never reaches a rule past the winner, so only those before it are logged.\n if (!move) options.onSkip?.({ routeId: route.id, boardKey: targetKey, reason });\n rules.push({ ...named, outcome: 'skipped', reason });\n };\n const target = targetKey === board.id ? board : options.registry.get(targetKey);\n if (!target) {\n skip(`board \"${targetKey}\" is not installed`);\n continue;\n }\n const phase = route.target.phaseKey ?? target.initialPhase;\n if (target.phaseKind(phase) === undefined) {\n skip(`board \"${target.id}\" has no phase \"${phase}\"`);\n continue;\n }\n if (!placementTakesCard(target, phase, facts, options.carriesPullRequest ?? false)) {\n skip(`phase \"${phase}\" on board \"${target.id}\" can't hold this card`);\n continue;\n }\n // A rule that could have taken the card, had an earlier one not.\n if (move) {\n rules.push({ ...named, outcome: 'lost', to: { boardKey: move.board, routeId: move.routeId } });\n continue;\n }\n move = { board: target.id, phase, routeId: route.id };\n rules.push({ ...named, outcome: 'took' });\n if (!full) break;\n }\n return { move, rules };\n}\n\n/** Where a status event moves an existing card, by {@link traceEventRoute}; undefined leaves it where it is. */\nexport function resolveEventRoute(\n routes: readonly IntakeRoute[],\n event: BoardEventFacts,\n cardFacts: RuleFacts,\n board: InstalledBoard,\n options: { registry: BoardRegistry; carriesPullRequest?: boolean; onSkip?: (skipped: SkippedEventRoute) => void },\n): EventMove | undefined {\n return traceEventRoute(routes, event, cardFacts, board, options).move;\n}\n\n/**\n * What a status event does to a card: `moves` it where a route sends it; `stays` when a route on\n * its board handles the event but none moves it anywhere new; `rule_default` when the\n * integration's own move (`fallback`, if any) applies because no route handles the event, or a\n * pull request event's route didn't take the card; `ignored` when the event can't move a card in\n * its state (a reopen of an unfinished card, a close of a finished one) or its board is gone.\n */\nexport type EventMovePlan = { rules: EventRuleTrace[] } & (\n | { outcome: 'moves'; move: EventMove }\n | { outcome: 'stays' }\n | { outcome: 'rule_default'; phase: string | null }\n | { outcome: 'ignored'; reason: string }\n);\n\n/** Decides a status event on a card the way the dispatcher files it; the tester replays events through it. */\nexport function planEventMove(\n input: {\n routes: readonly IntakeRoute[];\n event: BoardEventFacts;\n item: Card;\n registry: BoardRegistry;\n /** The integration's own move for this event, when it proposed one. */\n fallback?: { stage: string };\n onSkip?: (skipped: SkippedEventRoute) => void;\n },\n options: { full?: boolean } = {},\n): EventMovePlan {\n const { routes, event, item, registry, fallback } = input;\n const board = registry.get(boardForWorkItem(item));\n if (!board) return { outcome: 'ignored', reason: \"The card's board isn't installed.\", rules: [] };\n const stage = item.stages.length === 1 ? item.stages[0] : undefined;\n const finished = stage !== undefined && board.isTerminal(stage);\n if (!eventMovesCard(event.type, finished)) {\n return {\n outcome: 'ignored',\n reason: finished ? \"A finished card doesn't move on this event.\" : 'Only a finished card moves on this event.',\n rules: [],\n };\n }\n const defaulted = { outcome: 'rule_default' as const, phase: fallback?.stage ?? null };\n if (!routesHandleEvent(routes, event, board)) return { ...defaulted, rules: [] };\n const facts = { ...cardRuleFacts(item), ...(stage !== undefined ? { 'card.phase': stage } : {}) };\n const { move, rules } = traceEventRoute(\n routes,\n event,\n facts,\n board,\n { registry, carriesPullRequest: hasPullRequest(item), ...(input.onSkip && { onSkip: input.onSkip }) },\n options,\n );\n // A pull request event the rules already decided keeps that decision when no enabled route\n // takes the card: disabling or narrowing a route must not strand a merged card in review.\n if (!move) return fallback && isPullRequestEvent(event.type) ? { ...defaulted, rules } : { outcome: 'stays', rules };\n const crossesBoards = move.board !== board.id;\n // A route that agrees with the rule's own pull request move keeps it whole: its message, and\n // the re-entry that restarts a review in the phase the card already sits in.\n if (!crossesBoards && fallback && isPullRequestEvent(event.type) && move.phase === fallback.stage) {\n return { ...defaulted, rules };\n }\n if (!crossesBoards && stage === move.phase) return { outcome: 'stays', rules };\n return { outcome: 'moves', move, rules };\n}\n"],"mappings":";;;;;;;;AAsCA,SAAgB,eAAe,OAA+B;CAC5D,OAAO,aAAa,KAAK,CAAC,CAAC,OAAO;AACpC;;;;;AAMA,SAAgB,cAAc,OAAsB,OAA2B;CAC7E,OAAO,aAAa,KAAK,CAAC,CAAC,IAAI,YAAY,KAAK,CAAC;AACnD;;;;;AAMA,SAAS,mBAAmB,OAAkC,OAAmD;CAC/G,IAAI,cAAc,OAA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E;EAAU,oBAAoB,eAAe,IAAI;EAAG,GAAI,MAAM,UAAU,EAAE,QAAQ,MAAM,OAAO;CAAG,GACpG,OACF;CAGA,IAAI,CAAC,MAAM,OAAO,YAAY,mBAAmB,MAAM,IAAI,IAAI;EAAE,GAAG;EAAW;CAAM,IAAI;EAAE,SAAS;EAAS;CAAM;CACnH,MAAM,gBAAgB,KAAK,UAAU,MAAM;CAG3C,IAAI,CAAC,iBAAiB,YAAY,mBAAmB,MAAM,IAAI,KAAK,KAAK,UAAU,SAAS,OAC1F,OAAO;EAAE,GAAG;EAAW;CAAM;CAE/B,IAAI,CAAC,iBAAiB,UAAU,KAAK,OAAO,OAAO;EAAE,SAAS;EAAS;CAAM;CAC7E,OAAO;EAAE,SAAS;EAAS;EAAM;CAAM;AACzC"}
@@ -55,6 +55,14 @@ export interface ProjectBoardSource {
55
55
  }
56
56
  /** Accepts either a fixed registry (tests, standalone services) or a per-project source. */
57
57
  export declare function toBoardSource(boards: BoardRegistry | ProjectBoardSource | undefined): ProjectBoardSource;
58
+ /**
59
+ * The skills a project created (Settings › Skills), which its boards' runners may name besides the app's.
60
+ * `revision` moves whenever the project's skills change, so loads recheck the names only then.
61
+ */
62
+ export interface ProjectSkillNames {
63
+ revision(scope: StoredBoardScope): Promise<number>;
64
+ names(scope: StoredBoardScope): Promise<ReadonlySet<string>>;
65
+ }
58
66
  export interface ProjectBoardCacheOptions {
59
67
  /** The code boards, built-ins included when enabled. */
60
68
  codeRegistry: BoardRegistry;
@@ -76,6 +84,8 @@ export interface ProjectBoardCacheOptions {
76
84
  /** The phases cards sit in on each of the project's boards, which a board migration must not remove. */
77
85
  occupiedPhases?: (scope: StoredBoardScope, ops: FactoryStorageOps) => Promise<ReadonlyMap<string, ReadonlySet<string>> | null>;
78
86
  codeSkills?: readonly InlineSkill[];
87
+ /** The skills each project created. Without it, runners may only name the app's skills. */
88
+ projectSkills?: ProjectSkillNames;
79
89
  /**
80
90
  * Whether the project still uses the retired Review board (an open card is stored on it). Such
81
91
  * a project is served Review alongside its boards; without this, no project is.
@@ -146,6 +156,11 @@ export declare class ProjectBoardCache implements ProjectBoardSource {
146
156
  forProject(scope: StoredBoardScope): BoardRegistry;
147
157
  /** The code skills stored runners may name. */
148
158
  get codeSkills(): readonly InlineSkill[];
159
+ /**
160
+ * The skills the project created, which its runners may name besides the app's. Throws when they can't be
161
+ * read, so a board write fails with the storage error instead of refusing a skill the project has.
162
+ */
163
+ projectSkillNames(scope: StoredBoardScope): Promise<ReadonlySet<string>>;
149
164
  /** Makes the next load reread the project. The loaded boards keep serving sync reads until then. */
150
165
  invalidate(scope: StoredBoardScope): void;
151
166
  /** Loads every project, a few at a time, so sync reads find them warm and each has its boards stored. */
@@ -1 +1 @@
1
- {"version":3,"file":"project-boards.d.ts","sourceRoot":"","sources":["../../src/boards/project-boards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,OAAO,KAAK,EAEV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAEvF,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,eAAe,CAAC;AAanE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAarE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,aAAa,EAAE,EAAE,MAAa,EAAE;;CAAK,GAAG,gBAAgB,CAMpG;AAID;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,wBAAwB,C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