Skip to content

fix(scaffold): the @database/zod alias repoint broke the generated contract — example service crashes at startup #1290

Description

@rickylabs

Found by executing a real scaffold end to end during the #1274 Quickstart audit (db init + db generate + db seed on a clean --db postgres --service --yes workspace).

The @database/zod alias was repointed to the models barrel:

packages/cli/src/kernel/templates/workspace/deno-json.ts:43-46
  @database/zod → ./database/<engine>/schema/.generated/zod/schemas/models/index.ts

But that barrel exports only the model schema:

// .generated/zod/schemas/models/index.ts — the entire file
export { UserSchema } from './User.schema.ts';

while the previous target still carries the input variants the scaffold's own contract imports:

// .generated/zod/crud.ts
export { UserSchema } from './schemas/models/User.schema.ts';
export { UserInputSchema as UserCreateInput } from './schemas/variants/input/User.input.ts';
export { UserUpdateInputObjectZodSchema as UserUpdateInput } from './schemas/objects/UserUpdateInput.schema.ts';

The generated contract does:

import { UserCreateInput, UserSchema, UserUpdateInput } from '@database/zod';

Reproduced consequences on a clean scaffold

$ deno task check
TS2305 [ERROR]: Module '.../zod/schemas/models/index.ts' has no exported member 'UserCreateInput'
TS2305 [ERROR]: … has no exported member 'UserUpdateInput'
TS2345 [ERROR]: QueryClientPort is not assignable to QueryClient      # separate defect, #1287

and at runtime the example service fails to boot:

SyntaxError: … does not provide an export named 'UserCreateInput'

So a fresh --service scaffold ships a service that does not start and a workspace that does not type-check. The regression test at generators_test.ts:203-214 asserts the alias string, which is why the repoint passed CI — nothing asserts that the target resolves the symbols the generated contract imports.

Why this is urgent beyond the usual

Wave 6 hands demo agents one instruction: follow the Quickstart, satisfy its verify gate, then build. Three of that gate's seven boxes are red on a clean scaffold today, and this defect owns two of them. An agent either halts forever or learns the checklist is decorative — the exact failure the gate exists to prevent.

Acceptance

Note: #1254 is closed, and this is not #1287 (that is the separate QueryClientPort defect) — together they are why the scaffold's check is red.

Lane: CLI/template source → WSL Codex slice.

Refs #1274, #1287, #1276

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions