type Rec = Record const CLOSE = new Set(['closed', 'deleted']) /** * One comparable decision string for an issues delivery, from either path. * Ledger-dependent details (dropped vs noted) are left out on purpose: the * webhook runs first and changes the ledger, so the event path would see a * different "before". */ export function issueDecision(action: string, result: Rec): string { if (result.ok === false) return `error:${String(result.error ?? 'unknown')}` if (result.skipped) return `skip:${String(result.reason ?? '')}` const where = `${String(result.projectId ?? '')}:${String(result.repoRef ?? '')}` if (CLOSE.has(action)) return `close:${where}` if (action === 'reopened') return `reopen:${where}` return `ingest:${where}` }