Skip to content

Use the binder for Mongo PSL interpretation - #30538

Merged
SevInf merged 30 commits into
mainfrom
mongo-conversion
Oct 1, 2026
Merged

SevInf merged 30 commits into
mainfrom
mongo-conversion

Conversation

@StevenMcClankerton

@StevenMcClankerton StevenMcClankerton commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Linked issue

This project intentionally omits Linear tickets by operator decision. Prerequisite: #30478 (merged). Scope and completion: Mongo conversion spec.

At a glance

From the provider interpretation test:

model User {
  id ObjectId @id @map("_id")
  bad Mystery
}

This now reports PSL_UNRESOLVED_REFERENCE: Cannot find type "Mystery", rather than the interpreter's PSL_UNSUPPORTED_FIELD_TYPE fallback.

Summary

Use the existing binder as the authority for Mongo PSL declaration resolution. Reuse its resolved symbols and typed attribute nodes so classification, relation targets, and diagnostics agree instead of independently resolving names.

Decision

The interpreter consumes same-snapshot binder results for models, composites, enum blocks, and contributed types. Physical-name lowering uses exactly one Map<ModelSymbol | FieldSymbol, string>; actual attribute interpretation populates each name once.

Notes for the reviewer

Mongo still rejects every explicit namespace block. There are no public API or contract-shape changes, but the unresolved-type error code and wording change intentionally. Preset misuse diagnostics and separate relation/polymorphism semantic errors remain.

Main was merged without rewriting history after #30478 was squash-merged. The file diff has no SQL, Prisma7, parser, or lockfile changes, despite the retained prerequisite commit history.

How it fits together

  1. Binder results replace classification sets and relation target-name lookups. Bare and qualified unresolved references retain binder diagnostics.
  2. Declarations shadow contributed presets. Preset interpretation cannot bypass a wrongly bound qualifier, and diagnostic suppression follows actual preset handling—not guessed diagnostic text. Exact diagnostic and preset tests cover these cases; single-diagnostic tests cover unknown types and scalar shadowing.
  3. Attribute consumers use ResolvedAttribute.node directly, removing AST re-walks and positional joins. The single physical-name index supplies forward FK mappings, indexes, and discriminator/base lowering. Interpreter tests and polymorphism tests verify mapped output and single malformed-map diagnostics.

Testing performed

Validated after the main merge; the final commit only records completion in the spec:

  • pnpm turbo run build --filter=@internal/mongo-contract-psl...
  • Mongo package tests: 277 passed; package typecheck passed.
  • pnpm --filter integration-tests test --project integration --project packaging with six focused files: CLI emit, Mongo enums, migration PSL authoring, temporal presets, scalar-list Mongo parity, and value objects. 120 passed, including test/cli.emit-command.test.ts in both modes.
  • Integration typecheck, changed-file Biome, pnpm fixtures:check, pnpm lint:deps, and pnpm lint:casts passed; cast delta 0.

This is focused coverage, not a full-workspace test run. No test failures or reported skips.

Skill update

No authoring-workflow translation is required: supported PSL syntax, configuration, and emitted contracts are unchanged. The observable diagnostic-code/wording change is documented above and pinned in tests; it does not require changing an authoring skill's instructions.

Checklist

  • All commits are signed off (git commit -s) per the DCO.
  • I read CONTRIBUTING.md; this is one logical concern.
  • Tests are updated.
  • Linear-prefixed title — explicitly waived: the operator omitted tickets for this project and supplied this title.
  • The Skill update section explains why no update is required.

Summary by CodeRabbit

  • Bug Fixes
    • Model, field, relation, and index definitions now consistently reflect mapped physical names.
    • Preset-provided field types are handled without masking unrelated diagnostics.
    • Unresolved type references now provide clearer guidance, including for enums and composite fields.
    • Polymorphic collection indexes and relation mappings are interpreted more accurately.
  • Improvements
    • Enum blocks can be interpreted when an enum factory is available.
    • Deprecated scalar names and presets with no effect can produce warnings.

…named model

Two namespaces declaring `model User` plus a relation field in each: the
bare-name relation-target lookup collapses to the last-registered mapping,
so the public-namespace FK is stamped against auth.User. Red against the
current fallback.

Signed-off-by: Steven McClankerton <[email protected]>
…e bare type name

The relation-lowering loop resolved a field's model target through a
bare-name view of the model mappings, so two namespaces declaring the same
model name collapsed to whichever was registered last and the FK was stamped
against the wrong namespace. It now reads the resolution the binder recorded
for the field's type reference and keys the mapping on the resolved
ModelSymbol, which distinguishes the two by construction.

The mappings carry the namespace they were built with, so the FK target
namespace and the declaring namespace come from the mapping instead of two
more bare-name lookups; `modelNamespaceIds` loses its last caller. The
written-qualifier normalisation, the flattened-name-set guard, and the
unreachable post-parse target check go with them.

`resolvePolymorphism`'s parameter is renamed to say what its callers pass:
coordinate-keyed mappings, not bare-name ones.

Signed-off-by: Steven McClankerton <[email protected]>
… already refused

An unqualified model name the binder could not resolve was reported twice:
once by the binder as an unresolved type reference, once again by the
relation loop as an invalid relation target. The loop now steps past an
unresolved resolution and leaves that name to the binder.

It steps past only the unqualified form. For a qualified name the
interpreter drops the binder's type-position diagnostic at the collector
(checkUncomposedNamespace treats any dotted prefix outside db, the family,
the target, a field-preset namespace, or a composed extension as an
uncomposed extension namespace) and emits no replacement for a plain type
reference, so the relation loop is the only voice the author hears there.
Removing the narrowing turns the pinned wrong.User refusal silent.

The two cases the diagnostic still answers are kept and pinned: a resolution
that is absent (a malformed type, which the binder leaves unexamined) and a
resolution that is not a model (an enum or composite type, which the binder
has no reason to complain about).

The unsupported-named-type pin tightens to an exact code set: it passed
under arrayContaining either way.

Signed-off-by: Steven McClankerton <[email protected]>
… type reference

SQL dropped every binder type-class diagnostic whose name carried a dotted
prefix outside its five exemptions, on the theory that its own richer
unrecognized-namespace message replaced it. That replacement exists only for
a type-constructor call, so a bare `ns.Type` lost its only voice: an author
writing `wrong.User` heard nothing about `wrong.User`.

The binder now records whether the reference it failed to resolve was written
as a constructor call, and the filter suppresses only that shape. The bare
reference keeps the binder voice, the constructor call keeps its single
richer one.

With the voice restored, the relation loop no longer needs the unqualified-only
narrowing that stood in for it: a relation target the binder could not resolve
is skipped whatever its form.

PSL_INVALID_RELATION_TARGET stops claiming a resolved target is an unknown
model. It knows the kind from the resolution and now says so, so a composite
type is reported as a composite type.

Signed-off-by: Steven McClankerton <[email protected]>
A back-relation candidate took its target from the written type name and the
pairing graph keyed every side on bare model names. Two namespaces declaring
the same two model names therefore matched each list field against both
namespaces FK sides, and a legal schema was refused with
PSL_AMBIGUOUS_BACKRELATION.

A candidate now carries the model symbol the binder resolved its type
reference to, FK metadata carries the symbols on both of its ends, and the
pairing graph keys on the namespace-qualified identity those symbols already
have — the same identity the polymorphism pass uses, hoisted above the model
loop so both can read it. Junction matching compares the symbols directly.

A field whose type does not resolve to a model no longer becomes a candidate
at all, so the pairing graph never sees a name it could not place.

Signed-off-by: Steven McClankerton <[email protected]>
…ned name sets

The `modelNames` and `compositeTypeNames` sets answered "is this field a
relation" and "is this field a value object" by bare name, across every
namespace at once. Both questions are now the resolution kind the binder
recorded for the field type reference, so a name declared in a sibling
namespace no longer classifies a field that cannot see it.

One consequence is visible in the pins and is not an improvement: a field
whose type resolves to nothing but whose bare name matched some model
anywhere used to be skipped as a relation field, and now falls through to the
field-type cascade, which adds its unsupported-type message after the binders
unresolved-reference one. The sibling-namespace and wrong-qualifier pins
record that second message rather than hide it.

Signed-off-by: Steven McClankerton <[email protected]>
…model name"

This reverts commit fcf7e22.

Signed-off-by: Steven McClankerton <[email protected]>
…he revert

Reverting the back-relation pairing conversion also removed the helper that
decides whether a field is a relation candidate from the binder resolution.
The flattened name set it replaced is gone, so the helper returns and the
candidate loop keeps asking the binder; only the pairing keys go back to bare
names.

Signed-off-by: Steven McClankerton <[email protected]>
The constructor-call half of the type-voice split was pinned on codes only.
Pin it beside the restored half, on the message the author actually reads and
on the absence of the binder second voice.

Signed-off-by: Steven McClankerton <[email protected]>
…ead from

readResolvedAttributes maps one-to-one over a declarations attributes, so the
node each resolved attribute came from was recoverable only by re-walking the
syntax and matching the name. It is now recorded on the resolved attribute and
the type is generic over which attribute form it holds, so a field symbol
offers field attributes and an entity offers model attributes.

The pin records what identity means here: the recorded nodes underlying syntax
node is the same object a fresh walk reaches, while the AST wrapper around it
is allocated per walk.

Signed-off-by: Steven McClankerton <[email protected]>
…lking the syntax

findModelAttributeNode and findFieldAttributeNode walked a declarations
attributes and matched a name to recover a node the symbol had already read.
Every one of their call sites now asks the symbol for the attribute it wants
and takes the node from it, and both helpers are gone.

getAttribute carries the attribute form through, so a field yields a field
attribute node and an entity yields a model attribute node — the same types the
attribute interpreters require, with no narrowing at the call sites.

Signed-off-by: Steven McClankerton <[email protected]>
…ed unresolved

A field whose type reference the binder could not resolve was reported twice:
Cannot find type "X" from the binder, then "type X is not supported in SQL PSL
provider v1" from the field-type cascade. The second message is wrong as well
as redundant — the type is not unsupported, it does not exist.

The three last-resort pushes now stand down for an unresolved reference. They
are reached only when the cascade had nothing specific to say, so SQL keeps
every voice that is a different complaint: the unrecognized-namespace guidance
and the unknown-preset message both arrive through the already-reported paths
and are untouched.

Eleven pins carried the old pairing under containment matchers. They are exact
sets now, each naming the single voice that remains.

Signed-off-by: Steven McClankerton <[email protected]>
…duplicated

The suppression asked only whether a name pointed at an unrecognized extension
namespace. A registered field-preset namespace is exempt from that question, so
a typoed preset earned both the binders "cannot find type" and SQLs
unknown-preset message, which says the same thing with the namespace and the
spelling hint attached.

The rule is unchanged — drop the binder type voice only where SQL emits its own
message for the same reference — and now names both messages that qualify. The
predicate moves next to the two voices it describes.

The shape gate stays where it was: both replacements are reached only from a
type-constructor call, so a bare name in a preset namespace, for which SQL says
nothing, keeps the binder as its only voice. That case is pinned alongside.

Signed-off-by: Steven McClankerton <[email protected]>
The name and the two branches say what it answers, and its precondition is
enforced by the callers shape gate and pinned by a test.

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]>
@StevenMcClankerton
StevenMcClankerton requested a review from a team as a code owner September 30, 2026 14:48
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: prisma/orm/.coderabbit.yml

Review profile: CHILL

Plan: Advanced

Run ID: ca8c1bad-fa20-4424-b076-66af0c819819

📥 Commits

Reviewing files that changed from the base of the PR and between b7307b4 and cc6c80b.

📒 Files selected for processing (1)
  • packages/3-extensions/mongo/test/config/define-config.psl.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The MongoDB PSL interpreter now classifies field types through binder resolutions and uses symbol-keyed physical names for models and fields. It updates relation, index, and polymorphism lowering, and adjusts diagnostics for unresolved types and presets.

Changes

MongoDB PSL interpretation

Layer / File(s) Summary
Physical names, indexes, and polymorphism
packages/2-mongo-family/2-authoring/contract-psl/src/interpreter.ts, packages/2-mongo-family/2-authoring/contract-psl/src/mongo-attribute-specs.ts, packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts, packages/2-mongo-family/2-authoring/contract-psl/test/mongo-attribute-specs.test.ts, packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.test.ts
A shared symbol-keyed map supplies mapped model and field names to index and polymorphism lowering. Attribute nodes are read directly from declarations. Tests check model shapes, index details, and mapped names.
Binder-based field type resolution
packages/2-mongo-family/2-authoring/contract-psl/src/interpreter.ts, packages/2-mongo-family/2-authoring/contract-psl/src/mongo-attribute-specs.ts, packages/2-mongo-family/2-authoring/contract-psl/test/interpreter*.test.ts, packages/2-mongo-family/2-authoring/contract-psl/test/provider.interpret.test.ts, packages/3-extensions/mongo/test/config/define-config.psl.test.ts
Field types are classified from binder resolutions. Eligible unresolved field references can use presets, and matching unresolved-reference diagnostics are filtered or rewritten. Tests cover enums, presets, and diagnostic results.
Relation lowering from resolved symbols
packages/2-mongo-family/2-authoring/contract-psl/src/interpreter.ts, packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.test.ts
Relation targets and mapped local and target fields come from resolved symbols and physical-name entries. Tests check mapped relation fields, collection names, malformed mappings, and namespace diagnostics.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant PSLField
  participant Binder
  participant MongoInterpreter
  participant Diagnostics
  PSLField->>Binder: Resolve field type reference
  Binder-->>MongoInterpreter: Return type resolution
  MongoInterpreter->>Diagnostics: Filter preset diagnostic or map unresolved diagnostic
Loading

Suggested reviewers: wmadden-electric

Merge Risk: ⚪ Minimal · up to cc6c8

The Mongo configuration test now expects an unresolved-reference diagnostic for the old field names, consistent with the interpreter’s reported behavior. No material merge risk is established.

Architecture Summary

Architecture risk: 🔵 Low · up to cc6c8

The change affects 2 systems.

Changed systems: packages/2-mongo-family, packages/3-extensions

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/2-mongo-family (library) was modified; 9 changed files map to changed impact.
  • observed — packages/3-extensions (library) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts: Added the MongoIndex import for the polymorphism assertions.
  • observed — Modified behavior in packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts: The forward-declaration test replaces partial shape checks with exact expectations for the variant and base models, including mapped fields, relations, storage, discriminator, and variants; it also checks the collection index’s keys and discriminator filter using a MongoIndex instance.
  • observed — Modified behavior in packages/2-mongo-family/2-authoring/contract-psl/test/interpreter.polymorphism.test.ts: The malformed @@map test now retains the syntax diagnostic, explicitly asserts interpretation failed, and expects the diagnostic list to also include PSL_MONGO_VARIANT_SEPARATE_COLLECTION.
  • observed — Modified behavior in packages/2-mongo-family/2-authoring/contract-psl/test/mongo-attribute-specs.test.ts: Removed the findModelAttributeNode import, which is no longer used by the test.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: using binder results for Mongo PSL interpretation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma/orm-extension-arktype-json

npm i https://pkg.pr.new/@prisma/orm-extension-arktype-json@30538

@prisma/orm-extension-middleware-cache

npm i https://pkg.pr.new/@prisma/orm-extension-middleware-cache@30538

@prisma/orm-extension-paradedb

npm i https://pkg.pr.new/@prisma/orm-extension-paradedb@30538

@prisma/orm-extension-pgvector

npm i https://pkg.pr.new/@prisma/orm-extension-pgvector@30538

@prisma/orm-extension-postgis

npm i https://pkg.pr.new/@prisma/orm-extension-postgis@30538

@prisma/orm-extension-supabase

npm i https://pkg.pr.new/@prisma/orm-extension-supabase@30538

@prisma/orm-family-mongo

npm i https://pkg.pr.new/@prisma/orm-family-mongo@30538

@prisma/orm-family-sql

npm i https://pkg.pr.new/@prisma/orm-family-sql@30538

@prisma/orm-framework

npm i https://pkg.pr.new/@prisma/orm-framework@30538

@prisma/orm-mongo

npm i https://pkg.pr.new/@prisma/orm-mongo@30538

@prisma/orm-postgres

npm i https://pkg.pr.new/@prisma/orm-postgres@30538

@prisma/orm-sqlite

npm i https://pkg.pr.new/@prisma/orm-sqlite@30538

@prisma/orm-target-mongo

npm i https://pkg.pr.new/@prisma/orm-target-mongo@30538

@prisma/orm-target-postgres

npm i https://pkg.pr.new/@prisma/orm-target-postgres@30538

@prisma/orm-target-sqlite

npm i https://pkg.pr.new/@prisma/orm-target-sqlite@30538

@prisma/orm-toolchain

npm i https://pkg.pr.new/@prisma/orm-toolchain@30538

commit: cc6c80b

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
postgres / no-emit 213.96 KB (0%)
postgres / emit 192.07 KB (0%)
mongo / no-emit 195.73 KB (+0.01% 🔺)
mongo / emit 174.98 KB (0%)
cf-worker / no-emit 269.89 KB (0%)
cf-worker / emit 245.23 KB (0%)

@SevInf
SevInf enabled auto-merge September 30, 2026 14:54
@SevInf
SevInf added this pull request to the merge queue Sep 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 30, 2026
Preserve binder-based type and relation resolution, symbol-keyed physical names, and preset shadowing while retaining upstream Mongo scalar guidance and nested-index diagnostics.

Signed-off-by: Steven McClankerton <[email protected]>
@SevInf
SevInf enabled auto-merge October 1, 2026 10:32
@SevInf
SevInf added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit 6ccdd44 Oct 1, 2026
27 checks passed
@SevInf
SevInf deleted the mongo-conversion branch October 1, 2026 12:38
@StevenMcClankerton StevenMcClankerton mentioned this pull request Oct 1, 2026
4 of 5 tasks
AbhilashG12 pushed a commit to AbhilashG12/orm that referenced this pull request Oct 1, 2026
…30545)

## Linked issue

This project explicitly omits Linear tickets. Prerequisite:
[prisma#30538](prisma#30538), still open/queued;
this PR targets `mongo-conversion` and should be retargeted after it
merges. [Approved slice
spec](projects/symbol-table-resolve/slices/lsp-conversion/spec.md).

## At a glance

From the [completion
regression](packages/1-framework/3-tooling/language-server/test/completion-provider.test.ts),
with `|` marking the cursor:

```prisma
model Shared { id Int }
namespace app {
  enum Shared { VALUE }
  model Int { id String }
  model Local { value | }
}
namespace other { model Hidden { id Int } }
```

Completion includes local `Local` and classifies `Int` as a model; the
local enum hides the outer `Shared` model before candidate filtering.
The previous independent enumeration missed these lexical rules.

## Summary

Existing language-server features now share the parser binder's
declaration and reference resolution. This removes duplicate resolution
logic without introducing new LSP features or expanding namespace
support.

## Decision

Retain and enumerate authoritative binder scopes, then use the
snapshot's binder for completion, signature-help owners, semantic
tokens, and interpreter-absent semantic diagnostics.

## Notes for the reviewer

Internal source APIs change and their consumers are updated; no
authoring-schema migration is required. SQL, Mongo, and Prisma7
interpreter implementations are unchanged. Independent D1/D2 reviews are
satisfied. Packaging remains blocked by the dependency-install trust
check described below; remote CI has not been claimed green.

## How it fits together

1. `scopeAt(node)` uses snapshot-owned syntax identity. `entries()`
follows lookup's nearest-name, kind-blind shadowing; qualified member
enumeration excludes lexical parents. See [scope implementation and
API](packages/1-framework/2-authoring/psl-parser/src/scope.ts) and
[scope
tests](packages/1-framework/2-authoring/psl-parser/test/scope.test.ts).
2. LSP owner span scans, duplicated candidate enumeration, and
name-based classification cascades are deleted. [Project
artifacts](packages/1-framework/3-tooling/language-server/src/project-artifacts.ts)
cache one binder beside the symbol table and invalidate it with
snapshots/configuration; [lifecycle
tests](packages/1-framework/3-tooling/language-server/test/project-artifacts.test.ts)
verify identity and replacement.
3. Named-type base annotations record references at their definition
site, without new diagnostics or recursive alias interpretation.
Interpreters remain the sole semantic diagnostic source when present;
binder diagnostics are the fallback only when interpretation is
unavailable, not when it crashes.

## Behavior changes & evidence

- Completion respects local shadowing, qualified-member isolation, and
actual owners across equal spans in different files
([implementation](packages/1-framework/3-tooling/language-server/src/completion-provider.ts),
[tests](packages/1-framework/3-tooling/language-server/test/completion-provider.test.ts)).
- Unbound expressions receive plain `type` tokens rather than guessed
symbols. Unresolved field references retain property highlighting, and
malformed decorators preserve every parsed segment
([implementation](packages/1-framework/3-tooling/language-server/src/semantic-tokens.ts),
[exact-token
regressions](packages/1-framework/3-tooling/language-server/test/semantic-tokens.test.ts)).

## Testing performed

At code commit `46e966273d`; the final commit only records the approved
spec:

- Parser 1,166; LSP 751; SQL 572; Mongo 277; Prisma7 132 tests passed,
plus all five package typechecks.
- 20 focused LSP parity, attribute-consumability, and
CLI-without-Temporal integration tests passed; integration typecheck
passed.
- Dependency builds, standalone `pnpm fixtures:check`, parser/LSP lint,
`pnpm lint:packages`, and repository
dependency/cast/throw/code/docs/rules/manifests and other lint gates
passed.
- Packaging suites were **blocked**, not green: installs fail with
`ERR_PNPM_TRUST_DOWNGRADE` for `@vercel/[email protected]`. No bypass
or dependency change was attempted.
- Full-workspace tests were not run. Active editor diagnostics were
inconclusive; compiler typechecks passed.

## Skill update

No update required: no new user-facing workflow or authoring syntax; the
existing typed-AST guidance covers the added getter.

## Checklist

- [x] All commits are DCO signed off.
- [x] CONTRIBUTING.md read; one logical concern.
- [x] Tests updated.
- [ ] Linear-prefixed title: explicitly waived for this ticket-free
project; approved title used.
- [x] Skill update section completed.

## Alternatives considered

- Keeping LSP-specific resolvers would preserve competing shadowing and
ownership rules.
- Appending binder diagnostics to interpreter output would duplicate
semantic reports; diagnostic ownership remains exclusive.


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

* **Language Server**
* Improved completions for model types, namespace members, field
references, block keys, and entity-reference arguments, including
scope-aware name visibility and shadowing.
* Updated semantic highlighting for qualified names, types, and field
references, with fallback highlighting for unresolved references.
* Binder diagnostics are available when no project interpreter is
configured.
* Name resolution is consistent across completions, signature help, and
semantic highlighting.

* **Bug Fixes**
* Mongo interpretation applies mapped names consistently to fields,
relations, indexes, and collections, and supports enum fields.
* Unresolved field types now report missing-type diagnostics; handled
presets avoid duplicate unresolved-reference errors.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Steven McClankerton <[email protected]>
Co-authored-by: Steven McClankerton <[email protected]>
SevInf added a commit that referenced this pull request Oct 1, 2026
…stic

createProjectBinder builds the binder from the symbol table, sources and
ContractSourceContext; both family providers, the language server and tests
use it, and interpret receives it through PslInterpretInput.
interpretPslSqlSources / interpretPslMongoSources run symbol table, binder
and interpret in one call. The family descriptor's pslDiagnostics supplies
describeUnsupportedAttribute and describeUnresolvedType. The extension-pack
guess, both binder-diagnostic filters and PSL_UNKNOWN_FIELD_PRESET are
removed. ProjectArtifacts caches one binder per snapshot.

Rebased onto #30538 (6ccdd44), which moved Mongo's interpreter onto the
binder's own Resolution-kind classification. Kept #30538's resolution code
in full (composite/enum/model|namedType|block|crossSpace/contributedType/
unresolved branches, the single physicalNames map, direct ResolvedAttribute
.node reads) while keeping this branch's binder-from-caller rules: the
interpreter reads `input.binder` instead of building its own, never filters
or rewrites binder diagnostics, and leaves the unknown-type wording to
describeUnresolvedType. describeUnresolvedMongoType now defers to the
binder's plain "Cannot find type" message for a qualified or constructor-
call reference, matching #30538's new tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
SevInf added a commit that referenced this pull request Oct 1, 2026
…stic

createProjectBinder builds the binder from the symbol table, sources and
ContractSourceContext; both family providers, the language server and tests
use it, and interpret receives it through PslInterpretInput.
interpretPslSqlSources / interpretPslMongoSources run symbol table, binder
and interpret in one call. The family descriptor's pslDiagnostics supplies
describeUnsupportedAttribute and describeUnresolvedType. The extension-pack
guess, both binder-diagnostic filters and PSL_UNKNOWN_FIELD_PRESET are
removed. ProjectArtifacts caches one binder per snapshot.

Rebased onto #30538 (6ccdd44), which moved Mongo's interpreter onto the
binder's own Resolution-kind classification. Kept #30538's resolution code
in full (composite/enum/model|namedType|block|crossSpace/contributedType/
unresolved branches, the single physicalNames map, direct ResolvedAttribute
.node reads) while keeping this branch's binder-from-caller rules: the
interpreter reads `input.binder` instead of building its own, never filters
or rewrites binder diagnostics, and leaves the unknown-type wording to
describeUnresolvedType. describeUnresolvedMongoType now defers to the
binder's plain "Cannot find type" message for a qualified or constructor-
call reference, matching #30538's new tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
SevInf added a commit that referenced this pull request Oct 1, 2026
…stic

createProjectBinder builds the binder from the symbol table, sources and
ContractSourceContext; both family providers, the language server and tests
use it, and interpret receives it through PslInterpretInput.
interpretPslSqlSources / interpretPslMongoSources run symbol table, binder
and interpret in one call. The family descriptor's pslDiagnostics supplies
describeUnsupportedAttribute and describeUnresolvedType. The extension-pack
guess, both binder-diagnostic filters and PSL_UNKNOWN_FIELD_PRESET are
removed. ProjectArtifacts caches one binder per snapshot.

Rebased onto #30538 (6ccdd44), which moved Mongo's interpreter onto the
binder's own Resolution-kind classification. Kept #30538's resolution code
in full (composite/enum/model|namedType|block|crossSpace/contributedType/
unresolved branches, the single physicalNames map, direct ResolvedAttribute
.node reads) while keeping this branch's binder-from-caller rules: the
interpreter reads `input.binder` instead of building its own, never filters
or rewrites binder diagnostics, and leaves the unknown-type wording to
describeUnresolvedType. describeUnresolvedMongoType now defers to the
binder's plain "Cannot find type" message for a qualified or constructor-
call reference, matching #30538's new tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
SevInf added a commit that referenced this pull request Oct 1, 2026
…stic

createProjectBinder builds the binder from the symbol table, sources and
ContractSourceContext; both family providers, the language server and tests
use it, and interpret receives it through PslInterpretInput.
interpretPslSqlSources / interpretPslMongoSources run symbol table, binder
and interpret in one call. The family descriptor's pslDiagnostics supplies
describeUnsupportedAttribute and describeUnresolvedType. The extension-pack
guess, both binder-diagnostic filters and PSL_UNKNOWN_FIELD_PRESET are
removed. ProjectArtifacts caches one binder per snapshot.

Rebased onto #30538 (6ccdd44), which moved Mongo's interpreter onto the
binder's own Resolution-kind classification. Kept #30538's resolution code
in full (composite/enum/model|namedType|block|crossSpace/contributedType/
unresolved branches, the single physicalNames map, direct ResolvedAttribute
.node reads) while keeping this branch's binder-from-caller rules: the
interpreter reads `input.binder` instead of building its own, never filters
or rewrites binder diagnostics, and leaves the unknown-type wording to
describeUnresolvedType. describeUnresolvedMongoType now defers to the
binder's plain "Cannot find type" message for a qualified or constructor-
call reference, matching #30538's new tests.

The interpreters no longer look up names written in field type positions:
SQL and Mongo take field types from the binder's resolution, and the
binder binds a field preset name to the preset descriptor. A preset or a
type constructor that needs arguments, written without a call, reports
PSL_PRESET_NOT_CALLED / PSL_TYPE_CONSTRUCTOR_NOT_CALLED.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
SevInf added a commit that referenced this pull request Oct 1, 2026
…stic

createProjectBinder builds the binder from the symbol table, sources and
ContractSourceContext; both family providers, the language server and tests
use it, and interpret receives it through PslInterpretInput.
interpretPslSqlSources / interpretPslMongoSources run symbol table, binder
and interpret in one call. The family descriptor's pslDiagnostics supplies
describeUnsupportedAttribute and describeUnresolvedType. The extension-pack
guess, both binder-diagnostic filters and PSL_UNKNOWN_FIELD_PRESET are
removed. ProjectArtifacts caches one binder per snapshot.

Rebased onto #30538 (6ccdd44), which moved Mongo's interpreter onto the
binder's own Resolution-kind classification. Kept #30538's resolution code
in full (composite/enum/model|namedType|block|crossSpace/contributedType/
unresolved branches, the single physicalNames map, direct ResolvedAttribute
.node reads) while keeping this branch's binder-from-caller rules: the
interpreter reads `input.binder` instead of building its own, never filters
or rewrites binder diagnostics, and leaves the unknown-type wording to
describeUnresolvedType. describeUnresolvedMongoType now defers to the
binder's plain "Cannot find type" message for a qualified or constructor-
call reference, matching #30538's new tests.

The interpreters no longer look up names written in field type positions:
SQL and Mongo take field types from the binder's resolution, and the
binder binds a field preset name to the preset descriptor. A preset or a
type constructor that needs arguments, written without a call, reports
PSL_PRESET_NOT_CALLED / PSL_TYPE_CONSTRUCTOR_NOT_CALLED.

Attribute-spec factories now receive the field's type resolution as
FieldAttributeSpecContext.typeResolution, and SQL's @default enum arms take
the enum from it instead of looking the written type name up. The
@@Discriminator check in SQL and Mongo accepts a field that resolves to a
contributed type, or a named type whose base resolves to one, with the
codec id of the stack's String scalar, so a named type based on String is
accepted and a user model or composite named String is rejected. A named
type's base is resolved in a scope without the named types, which replaces
the binder's self-reference retry.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
SevInf added a commit that referenced this pull request Oct 2, 2026
…stic

Rebased onto main (#30538, #30545, #30051, #30566) as one change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Steven McClankerton <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants