Files
Language-Server/docs/agent-workflow/tasks/T-SEMANTIC-LEASE-009.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.2 KiB
Markdown

# Acquire and revalidate a real compiler context for one editor document
Task ID: T-SEMANTIC-LEASE-009
Role: astra_implementer
Status: READY
## 1. Context and baseline
Shared feat/implement-roadmap ca04975, native VBS primary and real compile_commands support. T-PLAN-SEMANTICS-010 observed the installed native row and stable context model. WorkspaceSession::provider_status currently retains lastGood JSON and creates short-lived SelectionState. Recent root repairs fenced URI selection and optional grants. Stock GCC on the real DocumentSnapshot.cpp row gives valid diagnostics. No stdio semantic operations run yet.
## 2. Objective and deliverables
Implement a reusable C++ editor-context lease for the future stock diagnostics worker. A caller with an explicitly opted-in launcher driver gets the actual selected TU generation, its checked normalized invocation and ordered command, immutable provider evidence, and a validity check against the workspace/configuration/authority/document route. Repeated unchanged requests preserve Selection identity. Failures carry actionable typed readiness.
## 3. Scope and non-goals
Only semantic context acquisition, reuse and revocation, not frontend execution or current on-disk file contents. Preserve passive provider status behavior and do not add CLI options/LSP capabilities. The semantic provider may check a driver specifically selected by the launcher, never auto-pick a row executable.
## 4. Files to inspect
Inspect include/vls/WorkspaceSession.hpp, src/WorkspaceSession.cpp, include/Void/LanguageServer/Build/{Model,Providers}.hpp, src/Build/{Model,CompdbProvider,VbsProvider,CommandImport,ProviderFile}.cpp, include/Void/LanguageServer/Workspace/{Trust,Configuration}.hpp, src/Workspace/Trust.cpp, tests/workspace/ProviderSessionTests.cpp and tests/providers/CommandImportTests.cpp. Use actual revocation, directory and URI semantics. Root has repaired nonexistent '..' traversal and separately verifies earlier provider review findings.
## 5. Write ownership and coordination
Write scope: include/vls/WorkspaceSession.hpp; src/WorkspaceSession.cpp; tests/workspace/SemanticLeaseTests.cpp
Shared checkout, no other writes. Root serializes the public interface and owns build registration, actual subprocess/corpus, docs and CLI. Preserve all current edits; no staging, branches, dependencies, further agents or user contact. Private build/semantic-lease-009 for verification.
## 6. Implementation or investigation approach
Reuse WorkspaceSession observation, exact FilePurpose bindings, checked alias/absent-selector revalidation and the existing Build::SelectionState and Workspace::TrustPolicy. Scope opt-in driver to a single explicit launcher workspace. Initial caller grants must be backed by root/purpose/executable configuration and current file identity; project paths/preferences cannot approve. Classifier must receive a real DriverInput for the exact selected driver and core wrappers from licensed settings. A lease supplies execution data, not authority to run arbitrary programs; separately approved frontend/toolchain and bound input view are later dispatch prerequisites. Pin a driver once per new trusted generation. Re-check a recorded pin thereafter; never auto-repin a changed executable.
## 7. Interfaces and data contracts
NEW WorkspaceSession::acquire_semantic_context(document_uri, optional_workspace_uri, selected_driver) and method to validate a returned lease. Freeze exact names/header early. Selected_driver comprises launcher-selected absolute executable and declared driver family; check identity + operation+root+generation. Lease retains Build::Generation, Build::Selection, shared lifetime for per-file SelectionState, provider stamps/negative fallback, exact checked driver, config/trust/incarnation and document logical→physical binding. Encapsulate mutable owner/validation state. Distinguish unavailable/disabled/no-command/wrong-command/superseded via typed outcomes. Cached selected pointer must remain identical on genuinely equivalent observations. Concurrent independent documents may both succeed; one operation or passive status refresh for B must not gratuitously supersede a still valid read for A. Bound retained cache entries; eviction invalidates or degrades safely.
## 8. Dependencies and integration
Choose the passive ContextKey over all rows before checking the selected driver's normalized command. A compatible later row cannot substitute for an unusable active row. The root owns the separate checked source-language proof in CommandImport; a lease alone does not make diagnostics available. Expose the monotonic settings generation used by AnalysisInputs independently of normal status issuance.
WorkspaceSession remains sole owner of logical folder configuration and trust. Root handles CLI and integration. Subsequent source/diagnostic workers consume only validated immutable lease; don't synthesize missing standard-library/prerequisite/target metadata. CMake and VBS already include WorkspaceSession.cpp. Agent uses dedicated tests file, root adds to the workspace target.
## 9. Edge cases security and performance
Keep filesystem reads/driver hash work outside global mutex. At installation compare root object/config/trust and latest applicable observation; current successes and failures obey ordering. Physical aliases/negative responses, invalid native precedence and explicit driver identity replacements invalidate old lease. No ABA after root removal/re-add; no previous last-good admission. Avoid unbounded map growth for arbitrary document paths; return typed saturation or evict. Returned object lifetime must remain safe across shutdown and concurrent use.
## 10. Acceptance criteria
Reconcile an internal driver revocation from TrustPolicy::check_tool with the owning folder's generation under the incarnation guard. A replaced driver A invalidates old leases while an independently approved unchanged driver B and passive status recover without settings reload. Retain whether the request supplied an explicit workspace; re-evaluate implicit routing when nested folders change at acquisition and validation, with an explicitly selected outer folder as a control. Identical-byte DB replacement or a changed selector ticket must invalidate old evidence despite a matching content revision. An invalidated lease cannot revive on A→B→A; a fresh lease may use the new evidence. Test competing driver rows with different defines and stability of the returned configuration generation across ordinary status.
Prove a root-approved native row and compile database row return correctly normalized command via non-executed benign fixture, unapproved/mismatched/replaced driver returns unready, status cannot promote a pin, one selected pointer survives unchanged lease re-acquisition/status, plan refresh/settings change/driver revocation/root removal/stale selector/alias retarget lose eligibility, commands for two documents independent, missing @file-then-creation changes result. Include deterministic concurrency, cache limits, real populated context counts; no requirement that global project metadata be complete for the diagnostic-only lease.
## 11. Verification commands and evidence
From repo root run dev cpp-gcc -c g++ -std=c++26 -freflection -Iinclude -Ibuild/voidlibrary/current/include -fsyntax-only src/WorkspaceSession.cpp tests/workspace/SemanticLeaseTests.cpp. Root registers case suite with native VBS and comparison CMake. Private linked Void::Testing executable permitted. Return actual test bodies and outcomes. Directly reference the existing API implementation, not hypothetical flags.
## 12. Constraints and stop conditions
Do not execute the driver, invoke VBS or advertise LSP features. Isolate authority generation changes and never pass status-only data as a semantic ticket. Stop and contact root for necessary changes outside exclusive files. C++ model/backend/license decision remains with user.
## 13. Authorization and decisions
Approved roadmap 05/06/07/09, D-025 VBS primary and D-027 GPT-6.2 Max. Fits D-028/030 isolated derived compiler evidence without selecting a production engine. No Git or sibling actions.
## 14. Return format
T-SEMANTIC-LEASE-009 DONE/PARTIAL with exact API, files, race/stability/expiry proof, registration counts and limitations. Notify root when interface is stable.