Skip to content

v8.0.0-rc.13-dev.2

@StevenMcClankerton StevenMcClankerton tagged this 28 Sep 17:06
## What this PR does

Generic-block values now bind the same typed expression grammar
attributes use, and the legacy `PslBlockParam` DSL is retired in the
same change that migrates every consumer. Block authors declare values
with `fixedBlock({ parameters })` or `entriesBlock({ value, allowBare
})`, get inferred outputs through `InferBlock`, and lowering receives a
typed envelope (`ParsedPslExtensionBlock<Values>`) — never raw parameter
text.

## The design in five decisions

- **Source and semantics are separate products.** The print block keeps
ordered source entries `{ expression?, span }` strictly for rendering;
validated values live only in the typed envelope. The printer renders
provenance verbatim and never executes spec or reference factories;
lowering never reads print text.
- **Collect everything, then interpret.** `buildSymbolTable` collects
all declarations first, then binds each registered block's spec factory
against the complete table and publishes only successful envelopes in a
symbol-keyed `parsedBlocks` map. Forward references work, invalid blocks
keep their syntax for recovery/tooling but never lower, and every
value/attribute failure is reported exactly once at its original span.
- **Core stays parser-blind.** `AuthoringPslBlockDescriptor` carries one
erased callable `spec` field; a single parser-owned boundary
(`blockSpecFactoryOf`) restores the type, mirroring the existing
attribute-factory erasure.
- **Policies file at their selected target.** SQL core gains an optional
`pslPlacement` hook (`SqlPslEntityPlacementOutput`); PostgreSQL
registers it on policies so a policy whose target resolves through
top-level fallback lands in the target's physical namespace, with
destination-keyed collision checks. Other entities keep lexical
placement.
- **Family and native enums keep their distinct contracts.** Family
enums accept bare members and native JSON through the new shared
`jsonValue()` rule with codecs deciding meaning (decode, post-decode
uniqueness, empty/unknown-codec checks unchanged); native enums remain
explicit strings. Prisma 7 constructs trusted envelopes directly and
owns duplicate-key reporting for its dialect.

Supported policy predicates are `optional(str())` — previously accepted
omissions and inferred documents stay valid; unsupported predicate keys
are rejected as unknown fixed keys at parse time.

## What was removed

`PslBlockParam*`, the five-way `PslExtensionBlockParam*` union,
`variadicParameters`, both legacy validators
(`psl-extension-block-validator.ts`,
`validateExtensionBlockFromSymbol`), the printer's descriptor-kind
rendering and codec reparse, and Postgres's raw-reading helpers
(`readValueParam`, `readListRefParams`, `unwrapQuotedString`,
native-enum `JSON.parse`). A tests-inclusive inventory (grep evidence in
the branch history) shows zero survivals and no compatibility exports.

## Editor behavior

Block-key completion and attribute signatures read the same bound specs
validation uses, via metadata only (spies pin that inspection never
parses or resolves). Registered block value/reference errors now surface
in the parse-plus-symbol pipeline; family semantics (codecs, `@@rls`,
placement, collection uniqueness) keep their owners. One deliberate
regression: declaration snippets no longer pre-fill key lines (no symbol
exists to bind a spec before the block is authored); keys complete
inside the block immediately after insertion.

## Docs

ADR 255 records the shipped design; ADR 126's block-parameter sections
carry supersession notes; ADRs 231/249/246 got minimal factual
corrections; extension upgrade instructions live under
`upgrade-instructions/pending/typed-block-value-specs/`.

## Verification

Full workspace build, root typecheck 169/169, `lint:deps`,
`test:packages` (1334 files / 18001 tests), `test:integration` (4254
tests), `test:e2e` (123 tests), and `pnpm fixtures:check` with zero
churn — emitted contracts and generated types are byte-equivalent.
Inference round-trips parse their own output through the real pipeline
to equal IR. Manual QA covered extension-author ergonomics,
schema-author diagnostics, and the new-block editor flow.

Two pre-existing issues surfaced during the aggregate gates and are
reported separately, not addressed here: a missing turbo edge between
`integration-tests#typecheck` and `@prisma/orm-postgres:build`
(nested-manifest dependency invisible to the graph), and a parallel-run
flake in the CLI migration-snapshot suite.

🤖 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**
- Added typed specifications for top-level PSL blocks, supporting fixed
keys and arbitrary entries.
- Added support for native JSON literals, including nested arrays and
objects.
  - Added namespace-aware placement for generated extension entities.
- Improved block-key completion based on each block’s specification;
arbitrary-entry blocks do not offer fixed-key suggestions.
  - Enum members can now use bare names or JSON values.

- **Bug Fixes**
- Improved diagnostics for invalid, duplicate, missing, and unknown
block entries and attributes.
- Preserved authored entry order and expressions when printing PSL
blocks.

- **Documentation**
- Added architecture and upgrade guidance for typed block
specifications.
<!-- 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 Fable 5 <noreply@anthropic.com>
Assets 2
Loading