Skip to content

refactor(routes): share the isStatusLabel guard#518

Merged
joryirving merged 2 commits into
mainfrom
refactor/shared-status-label-guard
Jul 1, 2026
Merged

refactor(routes): share the isStatusLabel guard#518
joryirving merged 2 commits into
mainfrom
refactor/shared-status-label-guard

Conversation

@joryirving

Copy link
Copy Markdown
Contributor

Summary

  • Hoist the duplicated isStatusLabel type guard (identical copies in issues/status/route.ts and issues/move/route.ts) to @/types, next to STATUS_LABELS/StatusLabel, and import it in both.

Verification

  • tsc → 0; eslint → clean; vitest status + move + types → 52 passing.

Closes #508 · part of #498

status/route.ts and move/route.ts each defined an identical local
isStatusLabel type guard. Hoist it to @/types next to STATUS_LABELS and
import it in both.

Closes #508

@its-saffron its-saffron Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Automated Review

Full PR review.

Analysis engine: MiniMax-M2.7@https://litellm.jory.dev/v1 (anthropic) — routed smart (risk match: public_route_changes)

Recommendation: Approve

This is a clean, low-risk refactor that extracts a duplicated isStatusLabel type guard into a shared location.

Change-by-Change Findings

src/types/index.ts (+5 lines)

  • Added the isStatusLabel type guard adjacent to STATUS_LABELS/StatusLabel — appropriate colocation per issue PR 508 guidance.
  • The function body is identical to the two local copies removed; only location changes.

src/app/api/issues/move/route.ts (−5 / +1 lines)

  • Replaced import { STATUS_LABELS, StatusLabel } with import { STATUS_LABELS, isStatusLabel }.
  • Removed the now-inlined local function.
  • Auth: authorizeRequest / auth.authorized check remains unchanged.

src/app/api/issues/status/route.ts (−5 / +1 lines)

  • Added isStatusLabel to the existing import.
  • Removed the now-inlined local function.
  • Auth: authorizeRequest / auth.authorized check remains unchanged.

Required Checks

Check Result
Verify route access controls are in place ✅ Verified — both move/route.ts and status/route.ts retain their authorizeRequest / auth.authorized gate. The refactor moved only the type guard; zero auth logic was altered.
Check for unintended public endpoints ✅ Verified — no new route handlers, no new HTTP method exposures, no middleware changes. Only a pure-code-movement refactor of an internal type guard.

Standards Compliance

  • No agent-specific names introduced.
  • No secrets committed.
  • No deviations from AGENTS.md conventions.
  • CI checks: Lint ✅, Typecheck ✅, Build ✅, Tests ✅, Docker Build ✅ (all passing).

Linked Issue Fit

PR 508 asked to extract isStatusLabel + optionally a mutateStatusLabels helper. This PR fully delivers the isStatusLabel extraction. The "optionally" clause means the second helper was not required; the issue is partially addressed and on-track for completion.

Evidence Provider / Tool Harness Findings

None applicable — no evidence providers configured, no tool calls issued.

Unknowns / Needs Verification

None.

@joryirving joryirving enabled auto-merge (squash) July 1, 2026 21:46
@joryirving joryirving merged commit 4df29a5 into main Jul 1, 2026
6 checks passed
@joryirving joryirving deleted the refactor/shared-status-label-guard branch July 1, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(routes): extract shared status-label mutation helper

1 participant