Skip to content

The row-lock path is named all().forUpdate() everywhere, but that order does not type-check #1415

Description

@borisno2

The name the engine reports is not the order you write

The multi-row lock path is named all().forUpdate() throughout the repository — in the engine's own error
messages (packages/core/src/secured/read.ts, where that string is passed to the lock lane as the member name), in
specs/prisma-8/architecture-spec.md, in docs/adr/0062-…, and in the published reference page
docs/content/reference/context-api.md.

But that is not the order a caller writes, and it is not an order that type-checks. forUpdate() returns a query and
all() returns a promise, so the only valid spelling is .forUpdate().all(). A reader who copies the name as code
gets a type error; a reader who sees it in an error message and searches the documentation finds the same inverted
form.

Found while verifying PR #1410, which corrected the one instance that appeared as a code sample. The rest are
names and prose, which is why they were out of that pull request's scope — but the published reference page is
reader-facing, and it is the one that matters most.

What to do

  • Decide what the path is called, once. Either the name becomes the spelling (forUpdate().all()), or the
    documentation states explicitly that the name is a label for the lane rather than a call sequence
  • Apply it to the engine's error-message constants, the architecture spec, the decision record and the published
    reference page together — a half-renamed concept is worse than either version
  • If the engine's strings change, they are user-visible in errors: a minor changeset for @opensaas/stack-core

Why it is worth doing rather than tolerating

An error message exists to be searched. When a developer hits the row-lock bound and reads
all().forUpdate(), the natural next step is to write exactly that, and it will not compile. The cost is small per
person and paid by every person who hits it.

Context


🤖 Generated with 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