Files
Language-Server/docs/agent-workflow/tasks/T-DIAGNOSTIC-SARIF-013.md
T
faumaray da8003f6d4 Implement the VLS roadmap on the native VBS build
Native VBS and CMake builds of the server and every registered suite:
protocol and document sync, VBS/compdb providers, stock GCC diagnostics
(including in-process default profile preparation), the stock occurrence
observer and hover/definition, the bounded Scheduler, C++ module graph,
scan and artifact cache with real CMI production, the context-aware
symbol index with schema-2 snapshot migration, navigation and guarded
rename, reflection provenance with splice-origin extraction, index-backed
completion and signature help, live GCC worker control with a registered
DAP suite, and the Neovim and VS Code clients.

VoidLibrary follows main. The private GCC 16.2.0 frontend is reproduced
from the versioned patches and verified stepping reflection/template code
with projected values 17/34 and 41/82.
2026-12-05 14:06:50 +03:00

51 lines
8.7 KiB
Markdown

# Map stock GCC diagnostics onto the exact analyzed editor snapshots
Task ID: T-DIAGNOSTIC-SARIF-013
Role: sol_implementer
Status: READY
## 1. Context and baseline
Shared VLS feat/implement-roadmap ca04975, D-028/D-030, Linux GCC16.2 with stock header/driver profile under evaluation. The planner compiled the genuine src/Documents/DocumentSnapshot.cpp with stock cc1plus, accepted both overload edits, and diagnosed a missing function at line 19, 1-based exclusive [34,41). Existing GCC SARIF 2.1 reports in build/gcc-gate/{constraint,queries}.sarif include one run, driver name/version, originalUriBaseIds.PWD, artifacts, regions, messages, relatedLocations, invocation.executionSuccessful and toolExecutionNotifications. GCC emits display columns even when columnKind is omitted; the Unicode witness display32/byte29/UTF16 unit26 appears in verify-gcc-ide.py.
## 2. Objective and deliverables
Implement a reusable C++ adapter for the stock GCC diagnostics worker and immutable DocumentSnapshot mappings, with normalized typed diagnostic/related-location records and explicit unlocated/failed states. Root will supply actual captured SARIF files + admitted input snapshots and exercise the C++ adapter through a real compiler run. It is part of the planned editor diagnostic publication path.
## 3. Scope and non-goals
Implement only decoding, source correlation, byte/position projection and typed outcome. No compiler launch, filesystem lookups, LSP transport/dispatch, worker scheduler or production backend choice. Reading a path supplied by SARIF is unnecessary and out of scope. Avoid a new JSON parser.
## 4. Files to inspect
Inspect include/Void/LanguageServer/{Protocol/Json,Documents/{DocumentSnapshot,Position,Uri},Build/Model}.hpp, src/Documents/Position.cpp, tests/corpus/frontend/{gcc-queries.cpp,verify-gcc-ide.py}, live SARIF files above (actual GCC 16.2), docs/roadmap/13-diagnostics-recovery.md. Use real stock GCC to capture missing/empty/related fixtures where useful under private build/diagnostics-sarif-013. Source definitions for GCC display columns are in gcc/diagnostics/sarif-sink.cc in the local approved release, part is under gcc-gate.
## 5. Write ownership and coordination
Write scope: include/vls/semantic/Diagnostics.hpp; src/semantic/Diagnostics.cpp; tests/semantic/DiagnosticTests.cpp
No shared build edits, protocol wire/JSON/source store edits, compiler or external source changes. Root owns integration, standalone real corpus and editorial docs. Other agents work in disjoint paths; no spawning or user messaging.
## 6. Implementation or investigation approach
Decode a bounded one-run GCC16 SARIF result via Protocol::parse_json (accept only known schema/dialect/capabilities). Explicit invocation outcome (exited, code, truncation/completeness) comes from the caller. Exit 0 clean vs exit 1 with real source error is distinct from tool failure/truncation. A missing, malformed, unsupported or unmappable location remains explicit; never collapse incomplete or unsupported results into a clean empty batch. Match artifacts to caller-provided logical spellings/verified bases or explicit admitted URI table, including index indirection. No server cwd assumptions and no disk. Preserve messages/severity/rule, useful related source locations and truthful unlocated diagnostics. Capture code-quality data only, no automatic edits.
## 7. Interfaces and data contracts
The caller binds an exact expected owning TU, its immutable lease and the same invocation/capture identity to the actual process status and diagnostic bytes. Only the unique matching analysisTarget in the attested run can admit an empty clear; some GCC absolute targets have no PWD, and empty successes may lack embedded contents. An individual source range needs a positively witnessed occurrence or a certified full analyzed input closure that excludes indistinguishable remaps. The active main source alone, matching bytes/snippets, and an identical text line in a header with a same-filename #line cannot prove origin. Default to unlocated until such proof exists. One unlocated related note does not invalidate an independently proven primary. Include both real-TU success confusion and same-line inert vs remapped text as distinguishing cases.
NEW namespace vls::semantic; report exact API early. Suggested inputs: completed process outcome + bounded bytes + a list of immutable retained DocumentSnapshots with verified SARIF artifact/base alias and provenance evidence from the snapshot worker; result either typed protocol/tool error or a complete batch with diagnostics and named mapping limitations. Each mapped location contains original URI and encoding-aware Docs::Range on that same snapshot. Validate end-exclusive bounds and 1-based coordinates. Ordinary ASCII yields exact positions. For tab, multibyte, combining, wide and BOM supports only known compiler tabstop/width policy and physically proven observations; if proof lacks a unique byte endpoint, name the gap. Do not assume OS wcwidth equals GCC. Use snapshot.offset_to_position for UTF8/16. A known #line/macro remapping/historical source must carry an explicit unmapped/witness contract; byte spelling alone does not prove physical source. Source text remains unchanged.
## 8. Dependencies and integration
The semantic planner established stock real-TU diagnostics under D-028/030. Root and subsequent owners handle immutable worker snapshots, versioned invocation authorization, publication via AnalysisRevision/guards and editor notifications. This part can be independently verified before a production engine decision. Reply with frozen header once available so the root can build the actual GCC integration witness.
## 9. Edge cases security and performance
Bound total bytes, depth, strings, locations, artifacts, results, related data and output memory. Bound normalization/lookup work across repeated huge locations without duplicate retained source-text copies. Detect conflicts between URI/base/index and duplicate artifact aliases, unknown origins, missing/extra compiler runs, oversized regions, partial side streams and multiple file/macro ambiguity. Do not open IO or trust embedded path/script properties. Empty clears only on a proven completed successful compilation.
## 10. Acceptance criteria
The independent reviewer cleared the amended contract. In GCC 16.2 the SARIF emitter switches to raw byte columns if it cannot read the cited line; for a tab/astral/combining fixture the results were display [32,39), tabstop 4 [28,35), or byte [29,36). Require actual column-policy evidence or an unambiguous range. GCC may emit literal unescaped artifact names: do not merge a literal percent-20 filename with a literal space filename. Use the JSON integer variant for coordinates/indices. Handle errors before full evaluation or a missing main/include separately from a complete source-error batch; exit 1 with empty stderr is not clean. GCC can emit a valid related include entry with only startLine and no message, and an EOF end past the source remains unlocated.
Cases: captured GCC valid→empty, actual source-error→current located error, warning with severity/rule, related diagnostics, malformed/incomplete or inconsistent stream, failed launch/exit/signal/notifications, unbound/mismatching artifact cannot attach, both document encodings, CRLF/BOM/tab/astral/combining, excluded ambiguous ranges, invalid numeric/overflow or reversed positions without clamping. Include observed narrow GCC 16.2 SARIF files as evidence without requiring machine-specific paths. Include components with identical bytes but conflicting physical mapping. Test multiple artifacts/relative references and partial coverage separately from compiler-success verdict.
## 11. Verification commands and evidence
Run dev cpp-gcc -c g++ -std=c++26 -freflection -Iinclude -Ibuild/voidlibrary/current/include -fsyntax-only src/semantic/Diagnostics.cpp tests/semantic/DiagnosticTests.cpp. Root owns native+CMake test target registration. Use focused Void::Testing runner and private temp outputs if desired; provide exact case list/actual outcomes. Root's acceptance adds the real saved/edited Void TU SARIF through your adapter.
## 12. Constraints and stop conditions
Stop for ambiguous dialect/source-map authority needing new API; retain unlocated reports if proof is unavailable. Track stock/GCC-specific behavior; never claim support for all vendors by accepting arbitrary JSON. No user decisions on licensing, production dependency or default compiler.
## 13. Authorization and decisions
Full 27-roadmap implementation D-022, native build D-025, GPT-6.2 family Max D-027, scoped GCC evaluation D-028/030. No staging, commits, deployment or sibling changes.
## 14. Return format
T-DIAGNOSTIC-SARIF-013 DONE/PARTIAL, public interface and files, source-mapping and clean-result invariants, real checks with counts/commands, remaining handoff. Return to root only.