Skip to content

v8.0.0-rc.18-dev.2

@StevenMcClankerton StevenMcClankerton tagged this 15 Oct 08:36
Closes the `lsp-rename` project: deletes `projects/lsp-rename/`. Stacked
on #30721; it will be rebased onto `main` when that merges.

## Project outcome

| Slice | PR | State |
|---|---|---|
| Rename symbol in the PSL language server, with `@map` / `@@map` where
a database name would change | #30633 | merged |
| The binder resolves entity names in type-constructor arguments
(`pg.enum(X)`), so rename edits them | #30659 | merged |
| A `pg.enum` column can name a `native_enum` of another namespace |
#30721 | in the merge queue |
| A named type over `pg.enum` (`types { Status = pg.enum(X) }`) | — |
not delivered; dropped from this project at close-out (see below) |

## Definition of Done

- Rename for models, composite types, named types, blocks, fields and
namespaces, from a declaration and from a reference, across files: met
(#30633, language-server tests).
- `prepareRename` ranges and refusals, refused non-identifier names: met
(#30633).
- Map attribute on rename for models, scalar fields and blocks whose
descriptor sets `nameIsStorageName`; none for relation fields, `@@base`
models and the other kinds: met (#30633).
- Rename in `apps/lsp-playground` across scratch files, including one
never selected: met (#30633, checked in a headless browser).
- READMEs state that rename is supported: met (#30633).
- `native_enum` rename edits its `pg.enum(...)` usages: met (#30659; QA
run over stdio with the Postgres target).
- References across namespaces produce a column: met by #30721 once it
merges.
- A named type over `pg.enum` gives the same column as the constructor
on the field: **not met**. Dropped at close-out on the operator's
request; no follow-up ticket exists.
- Manual check in VS Code (F2 on each symbol kind): **not recorded** in
the project. The script for it was in
`projects/lsp-rename/qa/manual-qa.md`, deleted here.

## Where the project's decisions live

| Decision | Home |
|---|---|
| Rename applies without a collision check, as TypeScript and Prisma 7
do | the rename provider and its tests |
| Rename adds `@map` / `@@map` with the old name where a database name
would change; the rule for models and fields is in the language server;
blocks opt in with `nameIsStorageName` |
`language-server/src/rename.ts`; the doc comment on
`AuthoringPslBlockDescriptor.nameIsStorageName` |
| An entity name in a type-constructor argument is bound by the binder
through `entityRefArg` | `psl-parser/src/binder.ts` and its tests |
| A `pg.enum` column's type is qualified by the namespace of its
value-set reference | `contract-ts/src/target-authoring-hooks.ts` and
the Postgres target tests (#30721) |

None is architecturally durable enough for an ADR.

## Deferred, with no ticket

- A named type over `pg.enum`.
- The TypeScript builder cannot express a `pg.enum` column naming an
enum of another namespace; the Prisma 7 interpreter still refuses an
enum of another schema.
- After a `native_enum` rename with `@@map`, the contract's value-set
entry is keyed by the block name, so the storage hash changes.
- No completion or signature help inside type-constructor arguments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* PostgreSQL enum columns can now reference enum types in other
namespaces. Generated column types include the appropriate namespace
qualification, while references to the public namespace remain
unqualified.
* Cross-namespace enum references are preserved when contracts are
printed and read again.

* **Bug Fixes**
* Invalid or unresolved enum references now produce more accurate
diagnostics, including when a reference points to an entity of the wrong
type.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Steven McClankerton <tatarintsev@prisma.io>
Co-authored-by: Steven McClankerton <tatarintsev@prisma.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Assets 2
Loading