38 lines
2.9 KiB
Markdown
38 lines
2.9 KiB
Markdown
# 13 — Diagnostics, freshness and incomplete-edit recovery
|
|
|
|
Status: PLANNED; no implementation claim
|
|
Requirements: R-004,R-006,R-014,R-021
|
|
Dependencies: 03,05,09,10;11/12 for module/reflection cases.
|
|
|
|
## Ownership and boundaries
|
|
Proposed Sol for LSP mapping and tests, Astra for compiler recovery fixes within approved backend scope. NEW src/features/diagnostics/, tests/diagnostics/.
|
|
Future assignments must verify the then-current baseline and exact disjoint paths;
|
|
these proposed scopes do not authorize work in another repository.
|
|
|
|
## Contracts and data flow
|
|
Diagnostic batches carry full AnalysisRevision, severity/code/message, source range, related locations and readiness context. Compiler diagnostics remain distinguishable from stale/missing-build-input status. Only current batches may replace current document diagnostics.
|
|
|
|
## Implementation sequence
|
|
1. Map compiler ranges and related locations through immutable source/encoding maps. Preserve include/import and reflection-origin chains where available.
|
|
2. Debounce edits without starving foreground diagnostics; cancel superseded work and publish complete current batches. Clear obsolete diagnostics on close/context removal according to client lifecycle.
|
|
3. Handle syntax errors around templates, splices, expansions and imports using actual backend recovery. Separate compiler crash from ordinary source errors.
|
|
4. Expose stale-build/generated-input status without pretending old diagnostics describe new text. Keep fix-its internal until the later code-action scope has its own safety contract.
|
|
|
|
## Failure behavior and constraints
|
|
Never publish a prior revision over a newer result or label a compiler crash as successful empty diagnostics. Invalid ranges are rejected or explicitly degraded; do not clamp them into unrelated source. Missing generated inputs remain a readiness issue with an explicit build action.
|
|
|
|
## Acceptance scenarios
|
|
1. Rapidly introduce and repair malformed reflection/templates/imports; verify useful current diagnostics and server survival.
|
|
2. Race old/new contexts, document closure and worker crashes; verify clearing/publication rules.
|
|
3. Test macro/Unicode/generated ranges, related locations across files, duplicate diagnostic suppression and absent generated prerequisites.
|
|
|
|
## Verification and integration
|
|
Proposed NEW CTest label: `diagnostics`. Once implemented, register a nonzero suite and run:
|
|
```sh
|
|
dev cpp-gcc -c ctest --test-dir build/bootstrap -L diagnostics --output-on-failure
|
|
```
|
|
This future command is not evidence that the label/tests exist now. Before dispatch,
|
|
bind the fixtures above to actual targets and record prerequisites/side effects.
|
|
Require fresh independent review of the implemented contract and affected integrations.
|
|
Switch diagnostic adapter/backend only with revision/capability invalidation. Preserve status/errors needed to explain a failed backend; do not hide failures by suppressing all diagnostics.
|