Skip to content

dogfood: DX papercuts — redirect() defaults to 307; bare webjs dev skips predev #452

@vivek7405

Description

@vivek7405

Problem

Two small DX papercuts, each of which cost a moment of confusion while building crisp and which an AI is prone to trip over:

(a) redirect() defaults to HTTP 307. A gating/post-action redirect like redirect('/login') returns 307 (Temporary Redirect, method-preserving), whereas the convention people/agents reach for is 302 (Found). Not wrong, but surprising — and method-preserving 307 on what's usually a GET-to-GET navigation is an odd default. An AI emits redirect('/login') assuming 302-ish behavior.

(b) A bare webjs dev silently skips the npm predev hook. The scaffold's dev script is webjs dev, and npm run dev runs predev (prisma generate) first. But invoking webjs dev directly (easy to do, and tempting for an AI/CLI) skips predev, so the dev server crashes on an ungenerated Prisma client with no hint that the canonical command is npm run dev. (This also bit the crisp work on the sandbox side earlier — a bare webjs dev vs npm run dev was a real source of "why won't it start".)

Design / approach

(a) Reconsider 302 as redirect()'s default (or, if 307 is intentional, document it prominently in the recipe with how to pass an explicit status).

(b) Have webjs dev detect a missing/stale generated Prisma client (or, more generally, a missing predev artifact) and either generate it or print a clear, actionable hint ("Prisma client not generated — run via npm run dev (which runs prisma generate first), or run webjs db generate"). Even just the hint turns a confusing crash into a one-line fix. Docs should name npm run dev as the canonical command and say why.

Acceptance criteria

  • redirect()'s default status is documented; 302-vs-307 default reconsidered.
  • webjs dev gives a clear, actionable message (or self-heals) when the Prisma client isn't generated, instead of a raw crash.
  • Docs note npm run dev as the canonical dev command and the predev (prisma generate) reason.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions