Files
Language-Server/docs/roadmap/09-semantic-workers.md
T
faumaray ca04975d54 bootstrap
Signed-off-by: faumaray <faumaray@gmail.com>
2026-11-25 02:11:19 +03:00

3.0 KiB

09 — Semantic worker protocol and compiler integration

Status: PLANNED; no implementation claim 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.