prometeu-studio/discussion/workflow/plans/PLN-0111-define-generic-frontend-editorial-dtos-and-capability-surface.md
2026-07-15 11:22:38 +01:00

72 lines
3.5 KiB
Markdown

---
id: PLN-0111
ticket: multi-frontend-remove-pbs-branches
title: Define generic frontend editorial DTOs and capability surface
status: done
created: 2026-07-15
completed: 2026-07-15
ref_decisions: [DEC-0042]
tags: [compiler, compiler-general, compiler-pbs, studio, frontend, coupling, multi-frontend]
---
## Briefing
`DEC-0042` requires the common LSP/editorial path to consume frontend-provided editorial capabilities through generic contracts exposed from `prometeu-frontend-api`. This plan creates the shared model surface before any LSP capability is migrated.
## Objective
Define the minimal generic frontend editorial API needed by LSP v1 without changing the provider contract: `FrontendProvider.compiler()` remains mandatory, `FrontendProvider.languageService()` remains optional, and compile-only frontends remain valid.
## Dependencies
- Requires accepted decision `DEC-0042`.
- Must complete before migrating completion, hover, signature help, or final PBS import removal.
## Scope
- Add generic editorial DTOs and capability methods under `prometeu-compiler/prometeu-frontend-api`.
- Keep the surface aggregated behind optional `FrontendProvider.languageService()`.
- Model empty/fallback behavior for unsupported capabilities.
- Keep frontend API independent from `prometeu-lsp`.
## Non-Goals
- Migrating `CompilerLanguageServiceBridge` behavior in this plan.
- Removing PBS imports from LSP in this plan.
- Adding plugin discovery, dynamic loading, RPC, sandboxing, or service locator infrastructure.
- Making `languageService()` mandatory.
## Execution Method
1. Inspect `prometeu-compiler/prometeu-frontend-api/src/main/java/p/studio/compiler/services/FrontendProvider.java` and current `PBSFrontendLanguageService` to identify existing method shapes.
2. Add generic models under `prometeu-compiler/prometeu-frontend-api/src/main/java/p/studio/compiler/services` or a nearby frontend editorial package:
- `FrontendCompletionCandidate`
- `FrontendHover`
- `FrontendSignatureHelp`
- `FrontendSignature`
- `FrontendSymbolKind`
- `FrontendDocumentation`, only if documentation format must be explicit.
3. Add or update the frontend language service interface so the optional language-service surface can expose semantic tokens, completion, hover, and signature help using generic types.
4. Define deterministic defaults for missing capabilities, such as empty completion lists, empty semantic tokens, no hover, and empty signature help.
5. Keep DTOs free of LSP4J, PBS AST, PBS semantic, and Studio UI dependencies.
6. Add API-level tests or compile fixtures proving a provider can omit `languageService()`.
## Acceptance Criteria
- `prometeu-frontend-api` exposes generic editorial DTOs for current LSP v1 needs.
- The API does not import `prometeu-lsp`, LSP4J, or `p.studio.compiler.pbs.*`.
- `FrontendProvider.languageService()` remains optional.
- A compile-only provider still compiles without implementing editorial methods.
- The generic model can represent labels, details, kinds, Markdown/documentation, signatures, active signature, active parameter, and semantic token keys needed by PBS.
## Tests
- Frontend API compile/test task.
- Existing provider boundary tests.
- Compile-only provider fixture tests proving no language service remains valid.
## Affected Artifacts
- `prometeu-compiler/prometeu-frontend-api/src/main/java/p/studio/compiler/services/...`
- `prometeu-compiler/prometeu-build-pipeline/src/test/java/p/studio/compiler/specs/FrontendProviderBoundaryTest.java`