refactor(routes): share the isStatusLabel guard#518
Merged
Conversation
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
Contributor
There was a problem hiding this comment.
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
isStatusLabeltype guard adjacent toSTATUS_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 }withimport { STATUS_LABELS, isStatusLabel }. - Removed the now-inlined local function.
- Auth:
authorizeRequest/auth.authorizedcheck remains unchanged.
src/app/api/issues/status/route.ts (−5 / +1 lines)
- Added
isStatusLabelto the existing import. - Removed the now-inlined local function.
- Auth:
authorizeRequest/auth.authorizedcheck 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isStatusLabeltype guard (identical copies inissues/status/route.tsandissues/move/route.ts) to@/types, next toSTATUS_LABELS/StatusLabel, and import it in both.Verification
tsc→ 0;eslint→ clean;viteststatus + move + types → 52 passing.Closes #508 · part of #498