Files
Language-Server/docs/roadmap/09-semantic-workers.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

3.4 KiB

09 — Semantic worker protocol and compiler integration

The opt-in Linux/Nix worker runs stock GCC 16.2 on the workspace-selected TU and publishes diagnostics over stdio. It reconstructs the compiler's observed lookup paths in an isolated filesystem, retains positive and negative source receipts, and checks the context and editor revision before publication. Persistent AST workers, other toolchain profiles and semantic queries remain open. Requirements: R-007,R-010,R-013,R-014,R-021 Dependencies: 03,04,05 and successful08; shared worker protocol frozen before10-16.

Ownership and boundaries

Proposed Astra: NEW include/vls/semantic/, src/semantic/, tests/semantic/. Root owns versioned IPC/common DTOs; bounded subprocess infrastructure may be a separate Sol task. 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

SemanticRequest/Result carry operation/capability, full AnalysisRevision, immutable overlays, context and cancellation identity. Typed outcomes distinguish unsupported, unready, cancelled, stale, compiler failure and valid empty results. AST/Sema objects and pointers never cross worker boundaries.

Implementation sequence

  1. Implement supervisor/worker handshake with protocol/backend/capability identities and bounded messages. Use Void System/IPC only after checking their actual lifecycle/framing guarantees.
  2. Construct compiler invocations from approved normalized contexts; adapt exact overlays and generated views without mutating source. Apply tool execution policy before frontend dispatch.
  3. Implement semantic operations through the compiler's real APIs; retain source provenance and instantiate required context lazily. Avoid treating batch LibTooling alone as a complete editor engine.
  4. Recover crashed/timed-out workers, cancel obsolete requests and cap retained compiler states. Publish only matching revisions through10; use small deterministic fixtures before project-scale workloads.

Failure behavior and constraints

Compiler crash cannot kill the session process. A worker protocol mismatch or malformed result is rejected. Cancellation kills/reaps owned processes when cooperative cancellation fails. Do not count stale/partial results as authoritative or cache failures as successful analysis.

Acceptance scenarios

  1. Inject worker crash, malformed reply, version mismatch, cancellation and delayed reply; verify server survives and no stale result is published.
  2. Verify overlay-vs-disk behavior, changed dependency identity, tool policy enforcement and genuine source locations.
  3. Stress repeated open/edit/close and worker recycling; measure memory reclamation and foreground scheduling behavior.

Verification and integration

Proposed NEW CTest label: semantic. Once implemented, register a nonzero suite and run:

dev cpp-gcc -c ctest --test-dir build/bootstrap -L semantic --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. Revert backend/protocol versions as a unit and invalidate incompatible caches. Preserve last-good read-only status where meaningful; never deserialize compiler state across incompatible versions.