Repository navigation
feat(psl): multi-file schema support for contract emission - #30379
Merged
Merged
Conversation
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Require filename on ParseDiagnostic and remove the redundant SourceFile-bearing SymbolDiagnostic subtype. Derive filenames at diagnostic creation, filter language-server findings by filename, and preserve provider envelopes. This is the parser/symbol checkpoint; semantic interpreter diagnostics retain their existing external shape pending a separate migration. Signed-off-by: Steven McClankerton <[email protected]>
Introduce node-owned diagnostic creation and a neutral PslDiagnostic shape with optional data. Attribute combinators and refinements emit filename and range, without retaining SourceFile objects. Centralize external mapping and provide an ordered collector that keeps external contribution diagnostics unchanged. General SQL and Mongo semantic producer migration remains outstanding; attribute-helper adapters preserve the existing interpreter output during this intermediate step. Signed-off-by: Steven McClankerton <[email protected]>
Use the common filename/code/message/range shape throughout PSL-owned semantic producers and retain optional diagnostic data. Carry registry/node ownership through resolution helpers, enum lowering, and polymorphism. Serialize only at interpreter/provider output boundaries. Preserve ordered external contribution diagnostics without inventing locations, and retain legacy unlocated public envelopes separately from their owned internal ranges. Reject ambiguous filename-based serialization instead of picking a source. Cover internal default diagnostics, multi-document ownership, callback passthrough, and unchanged public envelopes. Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
…rs in glob static-prefix split Signed-off-by: Steven McClankerton <[email protected]>
…rective codemod Signed-off-by: Steven McClankerton <[email protected]>
…authored PSL fixtures Signed-off-by: Steven McClankerton <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Steven McClankerton <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Steven McClankerton <[email protected]>
The rebase onto origin/main replayed the multifiile-psl <- main merge with main's new resolveContractSource/loadContractSource extraction (from "a Prisma 7 project gets Prisma 8 set up beside it", #30291) combined with our expandContractInputs glob-expansion call (from the multi-file PSL work). The auto-merge kept our call wrapped in `unlessAborted`, a local const declared inside executeContractEmit, but placed it inside the newly extracted resolveContractSource function where that name is out of scope. Use `abortable(signal)` directly instead, matching how the same function already gates its `contractConfig.source.load(...)` call two lines below. Signed-off-by: Steven McClankerton <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Steven McClankerton <[email protected]>
SevInf
force-pushed
the
multifiile-psl
branch
from
September 24, 2026 11:42
9779d70 to
f0846b7
Compare
SevInf
enabled auto-merge
September 24, 2026 12:08
… config upgrade-instructions/pending/multifile-psl/ already exists on main from prior provenance work, so re-touching its extension/instructions.md counts as modified-inherited, not new, and check-upgrade-coverage's per-pr-declaration rule keeps firing for this PR's packages/3-extensions/ diff (the glob-shaped contract: config work). Add a new pending declaration dedicated to that diff, and revert the inherited file back to main's plain changes: [] now that the new declaration carries the explanation. Signed-off-by: Steven McClankerton <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Steven McClankerton <[email protected]>
wmadden-electric
added a commit
that referenced
this pull request
Sep 24, 2026
main's multi-file PSL work (#30379) lets contract.source.inputs hold glob patterns and adds expandContractInputs. The old validator it touched stays deleted; the orm schema resolves each pattern against the config file without expanding it, which is the absolute form expandContractInputs expects, and a schema test covers glob inputs. The export list keeps expandContractInputs and drops finalizeConfig. main's tsquery codec (#30386) declared paramsSchema = voidParamsSchema, which this branch removed; it now declares paramsSchema = undefined. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
SevInf
added a commit
that referenced
this pull request
Sep 24, 2026
Brings in main through fc35fca: multi-file PSL emission (#30379), the orm config section declared once as a schema (#30372), two migration-graph fixes, and a native enum column no longer counting as textual (#30390). Multi-file emission lands on our ground without touching it. Of the four psl-parser files it changes, none is binder.ts, entity-reference.ts, scope-chain.ts or symbol-table.ts: it adds a directive predicate, turns the interpreters plural (documents for document), and gives PslSources a merge that unions registries. A symbol table built from several documents was already the binder contract - the multiple-documents and namespace-reopened-across-documents pins covered it - so the two compose. Conflicts resolved: - psl-parser exports: both sides added an export beside the other, so both are kept, main schema-directive ahead of our scope-chain. - sql interpreter: main restructured the opening, replacing the missing target and scalar-descriptor diagnostics with assertions and deriving source from an anchor document out of the plural input. Took that opening whole and re-seated our binder construction after the collector it needs, which also lets the uncomposed-namespace filter read the target directly now that a missing one throws. Signed-off-by: Steven McClankerton <[email protected]>
wmadden-electric
added a commit
that referenced
this pull request
Sep 24, 2026
main changed interpretPslDocumentToMongoContract to take documents: [...] for multi-file PSL (#30379). This test was added on the branch with the old document field. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
wmadden-electric
added a commit
that referenced
this pull request
Sep 24, 2026
main now emits only PSL files that carry the "// use prisma-8" directive (#30379), so the branch-added fixture schema needs it. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
wmadden-electric
added a commit
that referenced
this pull request
Sep 24, 2026
main declares the orm config section once as a schema (#30372): the format rule for a contract source moves from the deleted config validator into that schema, which now accepts only psl or typescript. main's public loadContractSource (#30291) and the branch's shared loader are one module: emit, print, ControlClient.emit and orm init all load a source through it, and it expands glob inputs (#30379). contract print protects every file a glob input matches, and looks for prisma.config.ts in the loaded config's own directory. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
wmadden-electric
added a commit
that referenced
this pull request
Sep 24, 2026
Since #30379 a PSL source reads only files that carry `// use prisma-8`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
wmadden
pushed a commit
to veksa/prisma
that referenced
this pull request
Sep 24, 2026
## Release: 8.0.0-rc.11 → 8.0.0-rc.12 This is the release PR described in [docs/oss/versioning.md](https://github.com/prisma/orm/blob/main/docs/oss/versioning.md). It bumps every workspace package to 8.0.0-rc.12 and moves the Prisma dependencies to their latest versions. **Merging this PR ships the release.** The push to `main` carries the new root `version`. The `Publish to npm` workflow then publishes 8.0.0-rc.12 under `latest` and creates a pre-release GitHub Release from the notes file. ## Review these first - [docs/releases/v8.0.0-rc.12.md](https://github.com/prisma/orm/blob/release/8.0.0-rc.12/docs/releases/v8.0.0-rc.12.md): the release notes, which become the GitHub Release body. The same entry is at the top of `CHANGELOG.md`. - The upgrade guides for [apps](https://github.com/prisma/orm/blob/release/8.0.0-rc.12/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md) and [extensions](https://github.com/prisma/orm/blob/release/8.0.0-rc.12/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md). They merge the 24 pending fragments. The original fragments are moved unchanged to `upgrade-instructions/releases/8.0.0-rc.11-to-8.0.0-rc.12/sources/`. - Four guide entries have no fragment behind them. The `migration new` default and its removed error codes (prisma#30389) had no guide entry. Neither did the PSL parser API changes (prisma#30312, prisma#30344, prisma#30335, prisma#30379). I wrote those entries while preparing the release. - Where fragments contradicted later code, the guide follows the code. Examples: the Supabase storage hash, `voidParamsSchema`, and quoted defaults printed by `infer`. ## Dependency updates | Package | From | To | Where | | --- | --- | --- | --- | | `@prisma/cli-engine` | 0.4.0 | 0.6.1 | examples, test fixtures, apps (the toolchain packages were already on 0.6.1 from prisma#30372) | | `@prisma/dev` | 0.25.1 | 0.25.2 | the workspace catalog | | `@prisma/compute-sdk` | ^0.39.0 | ^0.43.0 | `apps/telemetry-backend` | | `@prisma/management-api-sdk` | ^1.56.0 | ^1.76.0 | `apps/telemetry-backend` | compute-sdk 0.43 renames "service" to "app" and "version" to "deployment". The telemetry deploy script now uses the new names. Both SDK versions call `/v1/apps/{appId}`, so the ID stored in the existing `TELEMETRY_DEPLOY_SERVICE_ID` secret is still correct. The app's typecheck now includes `scripts/`, so it catches the next SDK rename. The repo does not depend on `@prisma/composer`. ## Fixes needed to publish - **The publish workflow has failed on `main` since prisma#30372.** `check:conformance` called the `orm` config validator as `validate(value)`. Engine 0.6 always calls `validate(value, provenance)`, and the validator reads `provenance.files`, so it threw on every input. The check now passes the same provenance the engine would. The prisma-cli copy of this check already does this. - `set-version` rewrote `workspace:@internal/cli@<version>` to `workspace:<version>`, dropping the alias. The prisma7-adoption example uses that alias. This is the first bump since the alias was added. - `lint:legacy-name` and the `add-model-map` test pointed at the pending fragment paths. They now point at the archived sources. ## Verification Passed locally: - `pnpm build` - `pnpm typecheck` - `pnpm lint` - `pnpm test:scripts` (563 tests) - `pnpm check:conformance` - `pnpm check:publish-deps` - `pnpm check:upgrade-coverage`, in both publish and PR mode - `pnpm check:release-notes`, in both publish and PR mode - `pnpm lint:legacy-name` - `pnpm lint:skills` - `pnpm test:packages`: all 18,196 tests passed Not covered locally, left to CI: - Three `test:packages` suites install packed tarballs from the registry. This machine's pnpm refuses `@vercel/[email protected]` because it has no provenance. CI passed the same suites on prisma#30390. - `prisma-8-cloudflare-worker` needs a local Hyperdrive database. - The telemetry backend tests need Node 24.16 with `Temporal`. This machine has 24.13. - `fixtures:check` needs Postgres. 🤖 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 PostgreSQL full-text search, multi-file schemas, prepared ORM reads and aggregates, and conflict-skipping options for bulk creation. * Added support for using a Prisma 7 schema as the contract source, JavaScript `Date` timestamps on PostgreSQL, editor support for attribute arguments, and per-finding diagnostics. * **Breaking Changes** * Prisma 8 schema files now require `// use prisma-8` on the first line; unmapped models use their names verbatim for table names. * Replace `dbgenerated(...)` with SQL tagged literals. Defaults must be valid for their column types, creation timestamps use the application clock, and native PostgreSQL enums no longer support text operations. * Config naming and path resolution, migration starting points, and extension contracts have changed. * **Bug Fixes** * Improved migration checks and branching warnings, contract generation and inference, default verification, and type checking. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
|
Will this also enable multi-file TS schemas? |
|
This seems to be working with a couple of caveats: The exported defineConfig function from the SQLite package needs to be updated to support this (haven’t tested for other databases). Quick fix in the meantime is to do a deep merge with your own I also can’t get it working with glob paths (errors that source files can’t be found/loaded). An array of individual files works though. |
SevInf
added a commit
that referenced
this pull request
Sep 25, 2026
Brings in main through fc35fca: multi-file PSL emission (#30379), the orm config section declared once as a schema (#30372), two migration-graph fixes, and a native enum column no longer counting as textual (#30390). Multi-file emission lands on our ground without touching it. Of the four psl-parser files it changes, none is binder.ts, entity-reference.ts, scope-chain.ts or symbol-table.ts: it adds a directive predicate, turns the interpreters plural (documents for document), and gives PslSources a merge that unions registries. A symbol table built from several documents was already the binder contract - the multiple-documents and namespace-reopened-across-documents pins covered it - so the two compose. Conflicts resolved: - psl-parser exports: both sides added an export beside the other, so both are kept, main schema-directive ahead of our scope-chain. - sql interpreter: main restructured the opening, replacing the missing target and scalar-descriptor diagnostics with assertions and deriving source from an anchor document out of the plural input. Took that opening whole and re-seated our binder construction after the collector it needs, which also lets the uncomposed-namespace filter read the target directly now that a missing one throws. Signed-off-by: Steven McClankerton <[email protected]>
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
PSL schemas can now span multiple files.
contract.source.inputsaccepts an array of glob patterns; a file is part of the schema when it matches a glob and carries the// use prisma-8directive; all member files are parsed into one symbol table and interpreted into one contract. Membership is a standing rule — dropping a neworders.prismanext to the others adds it on the next emit, with no config change.Changes
@internal/config,@internal/config-loader):inputsentries are glob patterns. A new expansion helper partitions entries — wildcard-free literals pass through verbatim (no globbing, no existence check, socontract-prisma7's directory inputs and missing-file error surfacing are preserved bit-for-bit), glob entries expand viatinyglobby(expandDirectories: false, files only) — then dedupes by canonical absolute path and sorts. EveryContractSourceContextassembly site (contract-emit, control-api client, format, vite plugin) expands fresh per invocation.resolvedInputsis now the flat expanded list; its positional-matching contract is gone.@internal/psl-parser):PslInterpretInput.documentsreplaces the singulardocument. The two composition-context guard diagnostics (PSL_TARGET_CONTEXT_REQUIRED,PSL_SCALAR_TYPE_CONTEXT_REQUIRED) were unreachable through the typed config surface and are nowInternalErrorassertions; the codes are removed entirely.contract-psl):load()reads every resolved input, applies the directive gate per file (isPrismaNextSchemarelocated from the language server intopsl-parser), merges parse results via the newmergePslSources, builds one symbol table, interprets once. Zero matches and matched-but-none-opted-in produce dedicated error diagnostics; per-file read failures keepPSL_SCHEMA_READ_FAILEDand don't abort collection. Emission is byte-identical under permuted file-discovery order (test-pinned, mutation-verified).defineConfig({ contract: '<glob>' })works end-to-end on postgres/sqlite/mongo; the default output derives from the glob's static prefix (./prisma/**/*.prisma→./prisma/contract.json), single-path derivation unchanged.orm formatformats every member file.upgrade-instructions/pending/multifile-psl/including an executable codemod script.origin/main's independently landed source-provenance polish (refactor(psl): track source provenance by syntax root #30335, ADR-254 groundwork) is merged in, with its refinements (symbolsthreading,dataTypeSupport,TaggedLiteralLowering) folded into the multi-file shapes.Why
Schemas grow past one file; classic Prisma users already organize schemas across files. The design goal (see
projects/multifile-psl/spec.mdanddesign-decisions.md, 14 recorded decisions) is that the CLI and the editor agree on what the schema is — same membership predicate, same symbol table, same diagnostics. This PR delivers the emission half; the language-server half (reading unopened member files from disk, cross-file diagnostics pushed to closed files) is the project's third slice, with the playground test bench as the second.Scope
In scope: config/expansion, both PSL providers and interpreters, extension
defineConfigwrappers,orm format, the directive sweep with upgrade instructions, and compile-level language-server adaptation (documents: [document]in its existing per-open-document loop). Out of scope, deliberately: language-server behavior changes (slicelsp-whole-project), the playground (sliceplayground-scratchpad),workspace/diagnosticpull machinery, andcontract-prisma7, which keeps its directory-based loading untouched.Verification
All three slice acceptance criteria PASS with on-disk evidence (emission determinism under permuted order; directive-less file excluded from the contract; the singular
input.documentgone from both interpreters). Gates on the merged tree: workspace typecheck 168/169 (only the pre-existingprisma7-adoptionnetwork-404 baseline),pnpm fixtures:checkclean,pnpm lint:depsclean, package suites green across psl-parser (893), both contract-psl packages (560/209), language-server (630), targets, adapters, and extensions. Review ledger:projects/multifile-psl/reviews/code-review.md— five dispatches, three findings filed and resolved.🤖 Generated with Claude Code