Skip to content

[P3] transitionIssueStatus multi-status-label dedupe edge case has no direct test #764

Description

@itsmiso-ai

Ask: Add a direct unit test for transitionIssueStatus covering the two-status-labels edge case it exists to fix.
Expected files: src/lib/issue-status.test.ts

Problem: src/lib/issue-status.ts documents that the helper exists because five API routes used to remove only the first status/* label, leaving stale labels on GitHub while the Prisma cache moved on. The helper's core guarantee — remove every existing status/* label, add exactly the target — is only exercised indirectly through route tests whose fixtures always start from a single status label. No test feeds it two status labels, so the exact regression the helper was written to prevent could return unnoticed. The file has no dedicated test suite at all.

Evidence:

  • src/lib/issue-status.ts: transitionIssueStatus removes all status/* labels before adding the target
  • src/app/api/issues/status/route.test.ts: fixtures are single-status only (["status/backlog"], ["status/in-progress"], ["priority/p0","status/backlog","type/bug"]); the multi-status case never appears
  • No src/lib/issue-status.test.ts exists

Acceptance:

  • A test calls transitionIssueStatus with labels containing two status/* entries (e.g. ["status/backlog","status/in-progress","type/bug"]) and asserts both are removed via removeIssueLabel and only the target is added
  • Assert the returned label set is non-status labels + target
  • Full suite still passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions