implements PLN-0035 pbs inline type hint payload production

This commit is contained in:
2026-04-03 11:35:29 +01:00
parent 3e8f53dc16
commit 09d9bb4c96
14 changed files with 559 additions and 25 deletions
+1 -1
View File
@@ -15,4 +15,4 @@
{"type":"discussion","id":"DSC-0014","status":"done","ticket":"studio-frontend-owned-semantic-editor-presentation","title":"Definir ownership do schema visual semantico do editor por frontend","created_at":"2026-04-02","updated_at":"2026-04-02","tags":["studio","editor","frontend","presentation","semantic-highlighting","compiler","pbs"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0029","file":"discussion/lessons/DSC-0014-studio-frontend-owned-semantic-editor-presentation/LSN-0029-frontend-owned-semantic-presentation-descriptor-and-host-consumption.md","status":"done","created_at":"2026-04-02","updated_at":"2026-04-02"}]}
{"type":"discussion","id":"DSC-0015","status":"done","ticket":"pbs-service-facade-reserved-metadata","title":"SDK Service Bodies Calling Builtin/Intrinsic Proxies as Ordinary PBS Code","created_at":"2026-04-03","updated_at":"2026-04-03","tags":["compiler","pbs","sdk","stdlib","lowering","service","intrinsic","sdk-interface"],"agendas":[],"decisions":[],"plans":[],"lessons":[{"id":"LSN-0030","file":"discussion/lessons/DSC-0015-pbs-service-facade-reserved-metadata/LSN-0030-sdk-service-bodies-over-private-reserved-proxies.md","status":"done","created_at":"2026-04-03","updated_at":"2026-04-03"}]}
{"type":"discussion","id":"DSC-0016","status":"open","ticket":"studio-editor-scope-guides-and-brace-anchoring","title":"Scope Guides do Code Editor com ancoragem exata em braces e destaque do escopo ativo","created_at":"2026-04-03","updated_at":"2026-04-03","tags":["studio","editor","scope-guides","braces","semantic-read","frontend-contract"],"agendas":[{"id":"AGD-0017","file":"AGD-0017-studio-editor-scope-guides-and-brace-anchoring.md","status":"accepted","created_at":"2026-04-03","updated_at":"2026-04-03"}],"decisions":[{"id":"DEC-0014","file":"DEC-0014-studio-editor-active-scope-and-structural-anchors.md","status":"accepted","created_at":"2026-04-03","updated_at":"2026-04-03"}],"plans":[{"id":"PLN-0030","file":"PLN-0030-studio-active-container-and-active-scope-gutter-wave-1.md","status":"done","created_at":"2026-04-03","updated_at":"2026-04-03"},{"id":"PLN-0031","file":"PLN-0031-studio-structural-anchor-semantic-surface-specification.md","status":"done","created_at":"2026-04-03","updated_at":"2026-04-03"},{"id":"PLN-0032","file":"PLN-0032-frontend-structural-anchor-payloads-and-anchor-aware-tests.md","status":"done","created_at":"2026-04-03","updated_at":"2026-04-03"}],"lessons":[]}
{"type":"discussion","id":"DSC-0017","status":"open","ticket":"studio-editor-inline-type-hints-for-let-bindings","title":"Inline Type Hints for Let Bindings in the Studio Editor","created_at":"2026-04-03","updated_at":"2026-04-03","tags":["studio","editor","inline-hints","inlay-hints","lsp","pbs","type-inference"],"agendas":[{"id":"AGD-0018","file":"AGD-0018-studio-editor-inline-type-hints-for-let-bindings.md","status":"accepted","created_at":"2026-04-03","updated_at":"2026-04-03"}],"decisions":[{"id":"DEC-0015","file":"DEC-0015-studio-editor-inline-type-hints-contract-and-rendering-model.md","status":"accepted","created_at":"2026-04-03","updated_at":"2026-04-03","ref_agenda":"AGD-0018"}],"plans":[{"id":"PLN-0033","file":"PLN-0033-inline-hint-spec-and-contract-propagation.md","status":"done","created_at":"2026-04-03","updated_at":"2026-04-03","ref_decisions":["DEC-0015"]},{"id":"PLN-0034","file":"PLN-0034-lsp-inline-hint-transport-contract.md","status":"done","created_at":"2026-04-03","updated_at":"2026-04-03","ref_decisions":["DEC-0015"]},{"id":"PLN-0035","file":"PLN-0035-pbs-inline-type-hint-payload-production.md","status":"open","created_at":"2026-04-03","updated_at":"2026-04-03","ref_decisions":["DEC-0015"]},{"id":"PLN-0036","file":"PLN-0036-studio-inline-hint-rendering-and-rollout.md","status":"open","created_at":"2026-04-03","updated_at":"2026-04-03","ref_decisions":["DEC-0015"]}],"lessons":[]}
{"type":"discussion","id":"DSC-0017","status":"open","ticket":"studio-editor-inline-type-hints-for-let-bindings","title":"Inline Type Hints for Let Bindings in the Studio Editor","created_at":"2026-04-03","updated_at":"2026-04-03","tags":["studio","editor","inline-hints","inlay-hints","lsp","pbs","type-inference"],"agendas":[{"id":"AGD-0018","file":"AGD-0018-studio-editor-inline-type-hints-for-let-bindings.md","status":"accepted","created_at":"2026-04-03","updated_at":"2026-04-03"}],"decisions":[{"id":"DEC-0015","file":"DEC-0015-studio-editor-inline-type-hints-contract-and-rendering-model.md","status":"accepted","created_at":"2026-04-03","updated_at":"2026-04-03","ref_agenda":"AGD-0018"}],"plans":[{"id":"PLN-0033","file":"PLN-0033-inline-hint-spec-and-contract-propagation.md","status":"done","created_at":"2026-04-03","updated_at":"2026-04-03","ref_decisions":["DEC-0015"]},{"id":"PLN-0034","file":"PLN-0034-lsp-inline-hint-transport-contract.md","status":"done","created_at":"2026-04-03","updated_at":"2026-04-03","ref_decisions":["DEC-0015"]},{"id":"PLN-0035","file":"PLN-0035-pbs-inline-type-hint-payload-production.md","status":"done","created_at":"2026-04-03","updated_at":"2026-04-03","ref_decisions":["DEC-0015"]},{"id":"PLN-0036","file":"PLN-0036-studio-inline-hint-rendering-and-rollout.md","status":"open","created_at":"2026-04-03","updated_at":"2026-04-03","ref_decisions":["DEC-0015"]}],"lessons":[]}
@@ -0,0 +1,110 @@
---
id: PLN-0035
ticket: studio-editor-inline-type-hints-for-let-bindings
title: PBS inline type hint payload production
status: done
created: 2026-04-03
completed: 2026-04-03
tags: [compiler, pbs, inline-hints, type-inference, lsp]
---
## Objective
Produce frontend-owned inline hint payloads for PBS inferred local bindings, starting with `let` bindings whose types are omitted in source.
## Background
DEC-0015 explicitly leaves hint eligibility frontend-owned. The initial user need comes from PBS inferred `let` bindings, and PBS already computes the inferred type during flow analysis. That semantic fact now needs to be surfaced as frontend-produced hint payload rather than remaining internal-only analysis state.
## Scope
### Included
- Surface PBS-produced inline type hints for inferred `let` bindings.
- Reuse existing flow-analysis type information rather than adding parallel inference.
- Preserve valid hints under partial degradation wherever the frontend can still produce them.
- Add PBS/LSP-facing tests for hint eligibility and payload correctness.
### Excluded
- Host rendering policy.
- Non-PBS frontend hint production.
- Hint categories not chosen by PBS.
## Execution Steps
### Step 1 - Identify stable anchor and payload sources in PBS analysis
**What:** Determine the exact PBS semantic source for inferred binding type and anchor location.
**How:** Trace `let` analysis through the PBS flow-analysis pipeline and identify:
- where inferred local binding type becomes stable;
- how to render that type as display text;
- which source position should anchor the hint;
- what happens when the binding has explicit type text and therefore should not receive an inferred-type hint.
This step must avoid recomputing types outside the existing semantic pipeline.
**File(s):**
- `prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/semantics/`
- `prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/services/`
### Step 2 - Emit frontend-owned hint payloads for eligible bindings
**What:** Make PBS produce inline hint payloads for eligible inferred bindings.
**How:** Extend the PBS semantic-read production path so it emits frontend-owned hint entries for `let` bindings with omitted type syntax and stable inferred type results.
The production path must:
- suppress hints when PBS does not want one;
- avoid emitting hints for explicitly typed bindings;
- preserve valid hints even if unrelated parts of the document degrade.
**File(s):**
- `prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/services/`
- `prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/java/p/studio/compiler/pbs/semantics/`
- any accepted frontend semantic contract surface used by `prometeu-lsp`
### Step 3 - Add PBS-focused hint production tests
**What:** Lock PBS hint policy and payload behavior with tests.
**How:** Add tests for:
- inferred `let` bindings receiving hints;
- explicit `let name: Type = ...` bindings receiving no inferred-type hint;
- payload text stability for scalar, struct, optional, result, tuple, or other supported type forms chosen by PBS;
- partial-degradation cases where unaffected bindings still produce hints.
**File(s):**
- `prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/`
- `prometeu-lsp/prometeu-lsp-v1/src/test/java/p/studio/lsp/` where end-to-end analyze assertions are required
## Test Requirements
### Unit Tests
- PBS semantic tests for inferred binding hint eligibility.
- Type-surface formatting tests if payload display text is factored into a helper.
### Integration Tests
- LSP analyze tests verifying PBS-produced hints appear in transported results.
- Partial-degradation tests preserving unaffected hints.
### Manual Verification
- Open a PBS document with inferred `let` bindings and inspect the LSP analyze payload.
- Confirm no hints appear for explicit type annotations.
## Acceptance Criteria
- [ ] PBS produces frontend-owned inline hint payloads for eligible inferred `let` bindings.
- [ ] Explicitly typed bindings do not receive inferred-type hints.
- [ ] Valid hints survive unrelated local degradation when PBS can still analyze those bindings.
- [ ] Tests lock the frontend-owned eligibility policy.
## Dependencies
- Accepted decision `DEC-0015-studio-editor-inline-type-hints-contract-and-rendering-model.md`
- `PLN-0033-inline-hint-spec-and-contract-propagation.md`
- `PLN-0034-lsp-inline-hint-transport-contract.md`
## Risks
- If inferred-type display text is not normalized, hint output may become unstable across equivalent semantic forms.
- If hint production is attached too late in the pipeline, degraded documents may lose more valid hints than necessary.