Buyer-visible problem
The current Prisma exporter converts database names to [A-Za-z][A-Za-z0-9_]* by character replacement and a leading prefix. That bounded sanitization can still create invalid or ambiguous artifacts:
- Prisma's complete reserved-name set is not represented by a reviewed, versioned contract;
- case variants and future Prisma grammar changes can drift from a hand-maintained list;
- different database names can collapse to the same generated model or field name;
- a valid source name such as
M_model can collide with a prefixed fallback for another source name;
- source PostgreSQL identifiers are not preserved through
@map / @@map;
- generated output is not passed through the supported Prisma parser/formatter as release evidence.
PR #894 deliberately removes an incomplete four-word workaround and retains only its independent relation-index performance change.
Product contract
Implement a dedicated identifier allocator for Prisma export that:
- derives the accepted grammar and reserved names from a pinned, supported Prisma toolchain rather than an ad hoc partial list;
- allocates deterministic, collision-free model, scalar-field, relation-field, enum, and relation names in their applicable namespaces;
- preserves original database table and column names through
@@map and @map whenever a generated identifier differs;
- keeps quoted, multilingual, punctuation-bearing, case-sensitive, and long PostgreSQL identifiers traceable;
- records every source→generated mapping in an export manifest;
- fails closed if a deterministic unique name cannot be allocated within configured resource bounds;
- validates the complete generated schema with the pinned Prisma parser/formatter in CI;
- produces a fixed, non-reflecting UI failure while retaining a downloadable diagnostic manifest for authorized users.
Required regressions
model, Model, MODEL, and every reserved name from the pinned toolchain;
model versus M_model;
- punctuation and whitespace collisions such as
order-item, order item, and order_item;
- table/field names beginning with digits;
- Korean, Japanese, emoji, composed/decomposed Unicode, and quoted mixed-case PostgreSQL names;
- two relations that sanitize to the same display name;
- deterministic output under input reordering;
- parser/formatter acceptance and source-name round trip through
@map / @@map;
- large-schema allocation bound and collision diagnostics.
Evidence and doctoring
Use the current Prisma Schema API as the primary authority for identifier syntax, reserved names, @map, and @@map. Record the exact Prisma version, grammar/tool SHA or package integrity, algorithm, collision policy, monitoring, rollback, and known limitations in docs/doctoring/ and CHANGELOG.md.
Merge gate
Production statement and branch coverage 100%, exact-head frontend suite/typecheck/build, pinned parser validation, no unresolved security/review finding, and qualifying independent approval.
Buyer-visible problem
The current Prisma exporter converts database names to
[A-Za-z][A-Za-z0-9_]*by character replacement and a leading prefix. That bounded sanitization can still create invalid or ambiguous artifacts:M_modelcan collide with a prefixed fallback for another source name;@map/@@map;PR #894 deliberately removes an incomplete four-word workaround and retains only its independent relation-index performance change.
Product contract
Implement a dedicated identifier allocator for Prisma export that:
@@mapand@mapwhenever a generated identifier differs;Required regressions
model,Model,MODEL, and every reserved name from the pinned toolchain;modelversusM_model;order-item,order item, andorder_item;@map/@@map;Evidence and doctoring
Use the current Prisma Schema API as the primary authority for identifier syntax, reserved names,
@map, and@@map. Record the exact Prisma version, grammar/tool SHA or package integrity, algorithm, collision policy, monitoring, rollback, and known limitations indocs/doctoring/andCHANGELOG.md.Merge gate
Production statement and branch coverage 100%, exact-head frontend suite/typecheck/build, pinned parser validation, no unresolved security/review finding, and qualifying independent approval.