Skip to content

[P3] POST /api/pr-fix-queue/requeue has no route.test.ts coverage, breaking the #416 co-located-test convention #914

Description

@itsmiso-ai

Ask: Add a co-located route.test.ts for POST /api/pr-fix-queue/requeue covering auth, parse validation, the not-found path, and the happy requeue.

Expected files: src/app/api/pr-fix-queue/requeue/route.test.ts, src/app/api/pr-fix-queue/requeue/route.ts

Problem: POST /api/pr-fix-queue/requeue is the only mutating API route under src/app/api/ without a co-located route.test.ts (excluding src/app/api/auth/[...nextauth], which is NextAuth's own handler). It is mutating (calls requeuePrFixItem over prisma, performs a status transition, and writes audit history). It is also a recently-introduced feature (commit 8790ae7 "Route BLOCKED PR-fix items into NEEDS_HUMAN lane and add a requeue action"), so its surface is not yet battle-tested and there is no regression net. Issue #416 set the co-located-test convention that every other route follows; this one slipped. The route's input parser (parseRequeuePrFixInput) is reached in many places (requeue from operator UI, automated tombstones), and a parse-error regression here would block the entire pr-fix-surfacing pipeline.

Evidence:

Acceptance: Add src/app/api/pr-fix-queue/requeue/route.test.ts covering: 401 unauthenticated, 400 invalid JSON, 400 parse error (missing fields), 404 item not found, 200 happy path (requeuePrFixItem returns the item, JSON response includes the item). Test must run green under npm test and follow the same vi.mock pattern used by neighbouring pr-fix-queue tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditAudit, review, or investigation work.priority/p3Low priority.status/readyReady for Dispatch worker pickup.type/choreRoutine tasks and maintenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions