(events: DecisionEvent[])
| 183 | * order (oldest first). |
| 184 | */ |
| 185 | export function computeActive(events: DecisionEvent[]): ActiveDecision[] { |
| 186 | const retired = new Set<string>(); |
| 187 | for (const e of events) { |
| 188 | if ((e.kind === "supersede" || e.kind === "redact") && e.supersedes) { |
| 189 | retired.add(e.supersedes); // dangling target id is harmless — just a no-op |
| 190 | } |
| 191 | } |
| 192 | return events |
| 193 | .filter((e): e is ActiveDecision => e.kind === "decide" && !retired.has(e.id)) |
| 194 | .sort((a, b) => (a.date < b.date ? -1 : a.date > b.date ? 1 : 0)); |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Scope filter for resurfacing: repo-scoped decisions always apply; branch-scoped |
no outgoing calls
no test coverage detected