prometeu-studio/discussion/workflow/plans/PLN-0113-migrate-completion-to-generic-frontend-models.md
2026-07-15 11:26:53 +01:00

66 lines
2.8 KiB
Markdown

---
id: PLN-0113
ticket: multi-frontend-remove-pbs-branches
title: Migrate completion to generic frontend models
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 completion to move from PBS-specific editorial models to generic frontend models while preserving PBS completion behavior and deterministic fallback for frontends without completion support.
## Objective
Migrate LSP completion handling to generic frontend completion models exposed through the selected provider's optional language service.
## Dependencies
- Depends on `PLN-0111`.
- Should run after `PLN-0112` so the bridge already has the provider/capability lookup pattern.
## Scope
- Map PBS completion candidates to generic `FrontendCompletionCandidate` values.
- Update LSP completion mapping to consume generic models.
- Preserve labels, details, kinds, origin/documentation fallback, and existing PBS behavior.
## Non-Goals
- Changing completion ranking or filtering.
- Expanding PBS completion depth.
- Migrating hover or signature help in this plan.
- Removing all PBS imports from LSP if hover/signature still depend on them.
## Execution Method
1. Inspect `PbsEditorialCompletionCandidate`, `PbsEditorialSymbolKind`, and LSP `mapCompletionItem(...)`.
2. Ensure `FrontendCompletionCandidate` can represent label, kind, detail, documentation, and origin or equivalent text.
3. Add PBS adapter code inside `PBSFrontendLanguageService` or the PBS frontend boundary to return generic completion candidates.
4. Update `CompilerLanguageServiceBridge.completion(...)` to call the generic completion capability through `FrontendProvider.languageService()`.
5. Replace PBS-specific completion-kind mapping with mapping from `FrontendSymbolKind` to `BaselineCompletionItemKind`.
6. Preserve empty completion fallback when language service or completion capability is absent.
## Acceptance Criteria
- LSP completion no longer consumes `PbsEditorialCompletionCandidate`.
- Completion kind mapping uses generic frontend kinds.
- Existing PBS completion tests pass without user-visible behavior changes.
- Missing capability returns a valid empty `BaselineCompletion`.
## Tests
- Existing PBS completion/editorial tests.
- `CompilerLanguageServiceBridgeTest` completion cases.
- Compile-only provider completion fallback test.
## Affected Artifacts
- `prometeu-compiler/prometeu-frontend-api/src/main/java/p/studio/compiler/services/...`
- `prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/PBSFrontendLanguageService.java`
- `prometeu-lsp/prometeu-lsp-v1/src/main/java/p/studio/lsp/services/compiler/CompilerLanguageServiceBridge.java`
- Completion-related tests.