Skip to content

apps/api AGENTS.md says a :id route shadows a single-segment route, but Fastify matches static routes first #1834

Open

Description

@joshunrau

apps/api/AGENTS.md ("Adding a feature module") says a single-segment route such as
@Get('summary') can be shadowed by @Get(':id') on the same verb. perfectionist/sort-classes
orders handlers alphabetically, so a fixed route can end up declared below :id. The doc tells
readers to give such routes two segments.

The API runs on @nestjs/platform-fastify, whose router is find-my-way. Its README ("Match order")
matches a static node before a parametric one, whatever order the routes were registered in:

  1. static
  2. parametric node with static ending
  3. parametric(regex)/multi-parametric
  4. parametric
  5. wildcard

So GET /v1/instrument-records/linear-model should reach @Get('linear-model') even when it is
declared below @Get(':id'). An ad-hoc Fastify check during the lint cleanup on the linting branch
found the same, but it was not committed.

If a request-level test confirms it

  • Correct the paragraph in apps/api/AGENTS.md.
  • Remove the file-level perfectionist/sort-classes disable at the top of
    apps/api/src/instrument-records/instrument-records.controller.ts. It exists only to keep
    @Get('linear-model') above @Get(':id'), and without it the handlers can sort.

Activity

  1. added
    Priority: LowNice to have, cosmetic or speculative
    Difficulty: LowIsolated change, about 2 hours or less
    DocumentationType: user, admin or developer documentation only
    Area: APIapps/api (NestJS backend, Prisma models, CASL permissions)
    on Oct 29, 2026
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

    Area: APIapps/api (NestJS backend, Prisma models, CASL permissions)Difficulty: LowIsolated change, about 2 hours or lessDocumentationType: user, admin or developer documentation onlyPriority: LowNice to have, cosmetic or speculative

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions