You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(unassign): base the unassign label set on live GitHub labels instead of the cached row #1366
Base the label set that POST /api/issues/unassign writes on the live GitHub labels instead of the cached Prisma row, so an unassign can no longer silently strip a label that was added on GitHub since the last sync.
Expected files: src/app/api/issues/unassign/route.ts and its test file (src/app/api/issues/unassign/route.test.ts).
Context:
updateIssueLabels is a FULL-label-set PUT — it replaces all labels. The unassign route computes that set from issue.labels (the Prisma cache) minus the labels of the requested type.
The codebase already states the rule this breaks, in src/lib/issue-claim.ts: "Only targeted label writes reach GitHub here … Never replace the whole label set — the cached row be behind GitHub, and a full-set write would silently revert every label change made on GitHub since the last sync."
The sibling assign route (src/app/api/issues/actions/route.ts) already complies: it reads the live label set through getLiveIssueLabels and fails closed with a 503 when GitHub is unreachable.
The unassign route cannot succeed without GitHub anyway (it PUTs the label set), so a live read costs no availability: a GitHub outage already fails the write.
The label set the unassign writes is derived from the live GitHub labels (minus the agent/owner labels of the requested type), not from the cached row.
GitHub unreachable → fail closed: no remote write, no cache write, a failure audit row, and a 503 — the same shape the assign route uses.
The live read happens inside the per-issue mutation anchor, and the remote write stays inside the fenced write.
Follow-up to #1361 (the anchor/fence for this route), found while reviewing that change.
Activity
fix(unassign): fence the remote label write in POST /api/issues/unass…
fix(unassign): base the unassign label set on live GitHub labels inst…