Skip to content

MCP argument handling residuals: root take/skip typing, take:0 semantics, and a count-only fallback that keeps rows #1369

Description

@borisno2

Three small residuals from PR #1366 (issue #1164, part of #1127), judged non-blocking at review. Grouped because they are all in MCP's argument handling.

1. Root take / skip are range-checked but not type-checked

#1366 added guards refusing a negative root take/skip. The nested selector checks the type as well; the root guard does not, so a string-typed take slips past and reaches .limit().

  • Root take/skip are type-checked as well as range-checked, matching the nested selector
  • A string take is refused with the same wording a negative one gets

2. Root take: 0 silently means 10

A root take of 0 falls through to the default of 10 rather than being honoured or refused. The new test pins only that it is not refused, which leaves the actual behaviour unpinned.

An explicit 0 is a reasonable thing for a client to send (it usually means "count only, no rows"), and silently returning ten rows is the surprising answer.

  • take: 0 has a defined, documented behaviour — honoured as zero rows, or refused
  • A test pins that behaviour rather than only pinning that it is not an error

3. combinedCount returning undefined would leave rows on the wire

In the count-only path, toWire drops items so the response is the bare number it has always been. If combinedCount ever returns undefined on an unexpected shape, the fallback leaves { items, count }rows included — on the wire for a request that asked only for a count.

This is unreachable today — it is a latent shape, not a live leak. But the whole point of the count-only fix in #1366 was that the caller receives a number, and a defensive branch that fails towards more data is the wrong direction for a public surface.

  • An unexpected shape in the count-only path fails towards no rows, not towards rows
  • A test covers the fallback branch

Notes

None of these is a live defect. They are grouped as one cleanup so they are not lost, and so a fix can be reviewed as a single small diff.


Generated by Claude Code

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

    Prisma8Relates to the Prisma 8 migration (prisma-8 branch)bugSomething isn't workingpriority:lowNit, cleanup or deferred residualready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions