Files
Language-Server/docs/agent-workflow/tasks/T-SOURCE-CATALOG-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

9.5 KiB

Capture exact source and lookup observations under a compiler job's source roots

Task ID: T-SOURCE-CATALOG-009 Role: astra_implementer Status: READY

1. Context and baseline

Shared branch feat/implement-roadmap ca04975 with current integrated DocumentStore, Build model, and stock SARIF adapter. Actual controlled GCC job accepted the original Documents TU and diagnosed the edited missing name. Root also compiled that native row with stock cc1plus in a private Linux namespace at its original source names. T-PLAN-SEMANTICS-010 calls for FD-bound source capture. T-SOURCE-OVERLAYS-009 has a frozen API, implementation underway.

2. Objective and deliverables

Implement the Linux source acquisition library for an immutable compiler job. Given an explicit caller-authorized root set, exact requested file bindings and lookup observations, return retained logical names, origin, ready overlay or opened disk content and positive/negative namespace evidence. Revalidate the entire observed set and document authority at dispatch/publication. This library supplies input data for the upcoming unmodified stock runner, without launching it.

3. Scope and non-goals

Exact named inputs only in this slice. No directory crawls, automatic approval of paths from metadata, external process, sandbox implementation, compiler readiness or proof that a positive depfile describes every possible compiler lookup. A caller still supplies closed lookup scope or imposes/traces the actual worker's filesystem view. Do not copy a repository tree.

4. Files to inspect

Read include/Void/LanguageServer/{Support/RegularFile,Documents/{DocumentStore,DocumentSnapshot,Uri},Build/{Model,Providers}}.hpp; src/Build/ProviderFile.cpp; src/Documents/{DocumentStore,Uri}.cpp; tests/providers/ProviderFileTests.cpp; current T-SOURCE-OVERLAYS-009 contract plus frozen header; T-SEMANTIC-LEASE-009; src/semantic/Diagnostics.cpp and tests/corpus/frontend/verify-stock-diagnostics.py. Reuse existing fd streaming and logical-vs-physical document identities. Inspect actual available Linux/Void::System APIs.

5. Write ownership and coordination

Write scope: include/vls/semantic/SourceCatalog.hpp; src/semantic/SourceCatalog.cpp; tests/semantic/SourceCatalogTests.cpp Private build/source-catalog-009 for tests only. DocumentStore and WorkspaceSession have different active owners; communicate missing interface through root. No other file edits, registration, Git, external actions or child agents.

6. Implementation or investigation approach

Bind each caller-selected normalized absolute directory to an immutable handle and the actual directory route for the lifetime of a workspace incarnation and authority generation. Source roots can include the selected TU or an explicitly granted include root. A compilation database row alone grants neither external reads nor tool execution. Initial implementation may reject unsupported symlink/.. routes, but never silently normalize to a different source. Support normal in-root lexical paths and uncreated unsaved leaves. Check components and retain logical/file/namespace identities from the same opened objects. For disk, open bounded regular nonblocking descriptor, verify shape and stable metadata both sides of streaming using existing stream_regular_fd or equivalent; avoid reopening source bytes. Use DocumentStore's caller-bound overlay API before any disk content read. An unavailable/ambiguous editor binding vetoes disk. Positive overlays override bytes on disk including an empty overlay. Capture genuine missing candidates only on proven absence; retain named parent/authority evidence so later creation or redirection invalidates the observation. Distinguish requested required missing inputs from a recorded negative lookup. Revalidate path membership and object identity along with checked document census; consider races after opening and during multi-file capture. If evidence expires, old slice stays historical, with no accidental admission after observed invalidation. Prefer simple bounded conservative rules over a filesystem-wide watcher.

7. Interfaces and data contracts

NEW namespace vls::semantic; exact names freeze early. Suggested SourceGrant/SourceRoot carries Build::WorkspaceIdentity plus caller config/trust epoch, reusable pins; SourceRequest names absolute logical path and whether absence is allowed; capture_sources(authorized roots, DocumentStore, span, limits) -> expected<shared immutable SourceCapture,typed error>; validate_sources(capture, current scope, store) rechecks exact evidence. Expose immutable entries (logical physical names, presence and snapshot) plus census/authority/membership identity usable to populate AnalysisInputs. Preserve request order or return a documented deterministic alias mapping. Negative optional lookups can become ready with an unsaved new header. Multiple names must retain all logical receipts. For hard-linked files define safe handling of authoritative overlays (detect and reject ambiguous bindings, or return typed unsupported hardlinks). A request must never see unrelated file bytes from a root/epoch mismatch. No unsupported positive statement that this is a complete universe.

8. Dependencies and integration

Before reading payload bytes, match the job's expected workspace incarnation, configuration, trust generation and installed grant-set identity against its actual current grants. Retained grants for another root or a previous settings epoch cannot authorize acquisition even if the include directory is shared. A revocation overlapping acquisition must fence publication. If a caller built the request list from an overlay inventory, accept and validate that exact inventory throughout capture; obtaining a newer internal census cannot justify names computed from an older one. Exercise the empty-inventory → unsaved header race and verify wrong-grant requests read no source bytes. Exact path receipts alone cannot populate the all-roots AnalysisInputs.lookup_epoch. Frozen Documents API: file_overlay_inventory(max_entries), observe_bound_source(inventory,file_uri,physical_path), materialize_bound_disk(observation,string), validate_bound_sources(inventory,span) with per-store epoch/readiness checks. Wait for header before direct compilation; independent source acquisition code and tests may start after preflight. Root owns CLI/scheduling, private view/real worker, executable fixtures and build registration. New model/lease/workspace and source acquisition identities are passed by the caller; these separate APIs neither authorize execution nor choose a production compiler.

9. Edge cases security and performance

Apply bounded source count, aggregate source/retained name bytes, path/component depth, per-file bytes and fd count. Avoid holding document locks across IO; fail cleanly on read errors, stale/replaced parent or leaf, nonregular inputs, and unsupported route or incomplete evidence. Do not follow an unreviewed route from scope. Avoid a check-then-open path gap and avoid treating permission denied, symlinks or ENOTDIR as absence. Existing exact compiler or module output doesn't make input read-only on disk.

10. Acceptance criteria

Check cross-entry namespace consistency independent of request order. A requested negative file at generated/ and a positive unsaved generated/config.hpp cannot coexist if the former means genuine namespace absence. Two requested positive regular files at an ancestor and its descendant cannot both be materialized. Reject with a typed inconsistency or require a proven existing directory where appropriate. Include a disk leaf with two hard links where only one spelling is requested and its other spelling has an empty overlay. No ambient disk bytes may override the editor's authority. Cases: saved disk vs unsaved edit/empty overlay, missing file overlay and truly negative lookup then create, refused/desynced/ambiguous overlay, disk leaf identical-byte replacement, rename/replacement of a bound root or parent, nested and overlapping admitted roots, same physical multiple names including hardlinks, file/lookup route escaping scope (fail without reading external bytes), wrong scope/census/revocation, quota and FIFO. Include deterministic capture-vs-open/edit race and retained old readers. A caller observing only one named lookup cannot obtain a universal namespace-completeness claim. Test ordinary regular paths and non-ASCII file names under the original logical directory.

11. Verification commands and evidence

Run dev cpp-gcc -c g++ -std=c++26 -freflection -Iinclude -Ibuild/voidlibrary/current/include -fsyntax-only src/semantic/SourceCatalog.cpp tests/semantic/SourceCatalogTests.cpp after frozen dependency. Private Void::Testing runner allowed. Root wires VBS/CMake and repeats relevant real corpus when data API is stable. State actual case names/counts, exits and conservative limitations.

12. Constraints and stop conditions

Stop for necessary API changes outside owned files or unexpected permissions requirement. No network, install, executable derivation or filesystem updates outside private benign temp fixtures. Do not flatten missing/unsupported/incomplete into a usable snapshot.

13. Authorization and decisions

User authorized roadmap 03/05/09/13, VBS primary, separate branch, GPT-6.2 Max. Execution/ABI/license remain distinct D-028/030 gates. This is a C++ data/library slice for the real pipeline.

14. Return format

T-SOURCE-CATALOG-009 DONE/PARTIAL, exact types and handling of disk, editor overlay, negative lookup and revalidation, tests with actual exits, limits, true authorizations still needed and released write paths. Announce frozen interface early.