## Linked issue
Follow-up to #30456. Linear tracking waived for this work.
## At a glance
```text
server.ts Protocol wiring and feature delegation
project-registry.ts Config/document indexes, discovery, event ordering
project.ts One stable project per config, reloads, watchers, diagnostics
project-artifacts.ts Sources, symbols, interpretation
```
Previously, `server.ts` coordinated project lifecycle state across
separate config-keyed maps.
## Summary
Consolidate resolved project configuration and managed lifecycle into
one concrete `Project`, with `ProjectRegistry` responsible for discovery
and routing. This is an internal ownership refactor with no intended
user-visible behavior changes.
## Decision
A project's identity survives reloads, membership refreshes, and the
last document closing. Configuration and analysis can be replaced inside
that object, while watcher registrations, asynchronous ordering checks,
and diagnostic history remain owned by the same project.
## Notes for the reviewer
The registry's config-to-project and document-to-project maps are
distinct lookup indexes, not parallel lifecycle state. Event sequence
numbers are still assigned before asynchronous discovery. Watcher
registration has a separate generation because its completion is
independent of membership refresh.
Existing push/pull behavior, removed-member clearing, last-good
fallback, and captured results for in-flight requests are preserved.
Shared-file diagnostic ownership and internal watching remain
follow-ups. Local project-planning artifacts are not included in this
PR.
## How it fits together
1.
[`Project`](packages/1-framework/3-tooling/language-server/src/project.ts)
combines the previous resolved-data record and managed loading state,
together with membership, watcher, and diagnostic operations. Resolved
state is private; there is no interface/implementation/factory split.
2.
[`ProjectRegistry`](packages/1-framework/3-tooling/language-server/src/project-registry.ts)
performs nearest-config discovery, caches document associations, and
dispatches watched-file changes while preserving arrival ordering.
3.
[`server.ts`](packages/1-framework/3-tooling/language-server/src/server.ts)
negotiates capabilities, handles editor-buffer updates, and delegates
features. `ProjectArtifacts` and immutable document snapshots retain
their existing analysis and parsing responsibilities.
4. New project and registry tests characterize stable identity,
failed-load recovery, routing, and superseded reads. Existing
membership-race, watcher-cache, and diagnostic protocol tests remain in
place.
## Testing performed
- `pnpm --filter @internal/language-server test` — 730 passed.
- Language-server `typecheck`, `lint`, and `build` — passed.
- `pnpm --filter integration-tests typecheck` — passed.
- Focused `lsp-emit-parity.integration.test.ts` — 14 passed.
- `pnpm lint:deps` — passed.
- Independent review of both dispatches and the complete slice — no
findings.
## Skill update
n/a — internal only.
## Checklist
- [x] All commits are signed off (`git commit -s`).
- [x] CONTRIBUTING.md read; change scoped to one logical concern.
- [x] Tests updated.
- [ ] Linear-prefixed title — tracking waived for this work.
- [x] Skill update section filled in.
## Alternatives considered
- Putting lifecycle generations in `ProjectArtifacts`: rejected because
analysis is replaced on reload while lifecycle and diagnostic history
must persist.
- Retaining separate public resolved-state and managed-project
abstractions: rejected in favor of one concrete owner with private
state.
- Merely moving the parallel maps into another class: rejected because
operations and state should be encapsulated together.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* The language server now detects newly created schema files and updates
project membership without requiring a configuration change.
* Configuration file changes are monitored when supported by the client;
otherwise, a restart may be required for changes to take effect.
* Failed configuration reloads preserve the last successful project
analysis when available.
* **Bug Fixes**
* Improved refresh handling when file changes and project loading occur
at the same time.
* Diagnostics now update when schema membership changes, including
clearing results for files that are no longer members.
<!-- 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>