(active: ActiveDecision[], ctx: { branch?: string; issue?: string })
| 200 | * issue matches. (Recency != relevance — callers filter by scope, not just date.) |
| 201 | */ |
| 202 | export function filterByScope(active: ActiveDecision[], ctx: { branch?: string; issue?: string }): ActiveDecision[] { |
| 203 | return active.filter((d) => { |
| 204 | if (d.scope === "repo") return true; |
| 205 | if (d.scope === "branch") return !!ctx.branch && d.branch === ctx.branch; |
| 206 | if (d.scope === "issue") return !!ctx.issue && d.issue === ctx.issue; |
| 207 | return false; // unknown/garbage scope: fail conservative, don't leak into every context |
| 208 | }); |
| 209 | } |
| 210 | |
| 211 | /** Append a validated event atomically (single-line, concurrency-safe). */ |
| 212 | export function appendEvent(paths: DecisionPaths, event: DecisionEvent): void { |
no outgoing calls
no test coverage detected