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.
51 lines
8.6 KiB
Markdown
51 lines
8.6 KiB
Markdown
# Bind editor overlays and directory-authorized disk inputs to one diagnostic view
|
|
|
|
Task ID: T-SOURCE-OVERLAYS-009
|
|
Role: astra_implementer
|
|
Status: READY
|
|
|
|
## 1. Context and baseline
|
|
Shared feat/implement-roadmap at ca04975 plus unstaged implementation. T-PLAN-SEMANTICS-010 approved a stock diagnostic path for real Void contexts. The native capture fixture verifies GCC SARIF output and overload edits. DocumentStore::resolve_content(path) checks overlays and detects mid-read replacement, but opens by path on its own. list_overlays only lists readable texts. A future source-catalog owner has directory-bound file handles and needs to use the actual editor authority without opening the ambient path again.
|
|
|
|
## 2. Objective and deliverables
|
|
Implement the document-side capture interface for a private compiler input view. A caller with a bound logical/physical source identity can query overlay/blocked/absent state, materialize already-authorized disk bytes into a budgeted immutable DocumentSnapshot, and enumerate file-overlay membership (including unsaved new headers and refused/desynchronized opens). Verify selected input authority is still current. Keep current public caller behavior.
|
|
|
|
## 3. Scope and non-goals
|
|
Document store support only. No compiler, IPC, file grant checker, filesystem staging, directory enumeration or process. The caller retains actual FD/path/lookup evidence and revalidates it separately. The snapshots must work with current AnalysisInputs, same_input_as and UTF encodings.
|
|
|
|
## 4. Files to inspect
|
|
Read include/Void/LanguageServer/Documents/{DocumentStore,DocumentSnapshot,Uri,Position}.hpp; src/Documents/{DocumentStore,DocumentSnapshot,Uri,Position}.cpp; include/Void/LanguageServer/Support/RegularFile.hpp; tests/documents/{DocumentTests,LongLineTests}.cpp; docs/agent-workflow/tasks/T-DOCS-003.md; tests/semantic/DiagnosticTests.cpp. Confirm file-vs-nonfile/unknown-open, byte budget, ABA and discarded-open semantics before implementation.
|
|
|
|
## 5. Write ownership and coordination
|
|
Write scope: include/Void/LanguageServer/Documents/DocumentStore.hpp; src/Documents/DocumentStore.cpp; tests/documents/BoundInputTests.cpp
|
|
No changes to existing tests or Uri, compiler/library/provider implementations, sibling repositories, shared build manifests or Git. Root owns actual disk/catalog implementation and build/test wiring; semantic lease owns only WorkspaceSession. Private build/bound-inputs-009 okay. No further delegation or user communication.
|
|
|
|
## 6. Implementation or investigation approach
|
|
Build on overlay_for_path, existing retained snapshot accounting, negotiated encoding, original client key and actual bound physical path. Freeze exact API early. Support an atomic bounded inventory of FILE overlay bindings with identity, ready snapshot or typed blocker; include refused/known without text. Expose an explicit failure for unbound/unrepresentable file opens/overflow rather than turning them into absence. For an already-bound disk candidate, offer an opaque capture/observation scoped to this store, the exact client/physical binding and its authority generation. An API accepting caller-owned bounded bytes may create a disk snapshot only after an eligible absent-overlay observation. Standalone source input should have zero ambient IO: do not canonicalize/reopen the already-bound file or recompute identity_from_path. Avoid duplicate copies of stored texts; reuse make_snapshot with existing budget and validate UTF8/size. A caller checks overlay state before reading disk; reject a race or return the newly authorized overlay by a documented typed outcome. Source owner separately checks FD/name and whole view before dispatch/publication.
|
|
|
|
## 7. Interfaces and data contracts
|
|
NEW public API with named types for the file overlay inventory and one bound source observation. Inventory retains lexical URI and physical path so callers can filter the exact approved source roots, detect alias ambiguity, include newly opened unpublished headers, and distinguish an absent binding from a blocked one. DocumentStore may use an opaque capture stamp carrying store identity, negotiated encoding/overlay epoch and selected overlay revision/absence. A validator must reject observations from another store even if allocator addresses are reused. Explicit overlay edit/close/reopen, new alias, desynchronization without a higher version and resource-refused opens invalidate as appropriate. Reads in truly independent documents should remain usable across unrelated text edits; conservative existing membership epoch on open/close/encoding is acceptable. Do not confuse this with proving a filesystem lookup closure or compiler run.
|
|
|
|
## 8. Dependencies and integration
|
|
The captured overlay inventory has its own opaque, store-bound membership/encoding generation captured under the same lock, including when it is empty. All selected observations must belong to that inventory generation and its membership must still be current at validation. Use an observation's current generation, distinct from a retained overlay snapshot's creation epoch. Edits/desync need checks on the selected entries even if membership is unchanged. Test empty census → open unsaved optional.hpp → observe unchanged TU, and obtaining a fresh valid observation of an older overlay after an unrelated file opens. Unrelated text-only edits may leave an existing observation current.
|
|
Preflight required and existing T-PLAN-SEMANTICS-010 names the need. Independent T-SEMANTIC-LEASE-009 has disjoint ownership. Root will consume the public API in a scoped stock source catalog. The existing program still uses resolve_content and public lifecycle methods. Their longstanding unit and process cases must continue passing. The stock JSON regressions are separate.
|
|
|
|
## 9. Edge cases security and performance
|
|
Avoid running user callbacks under mutex, unbounded retained paths, repeated text copies or bypass of retained-byte limits via caller-constructed snapshots. Charge disk acquisition promptly and never produce version for a disk snapshot. Bulk inventory must remain bounded with 4096 admitted/4096 blocked configured defaults; return typed saturation for caller-provided lower limit. Avoid using URI string normalization to erase alias/parent traversal. No leaking text through inventory for blocked documents. Fail conservatively for unsupported identity/cross-store stamps; tolerate empty text as a valid overlay/disk input.
|
|
|
|
## 10. Acceptance criteria
|
|
File-only coverage distinguishes a refused known virtual URI from a refused real-file URI when even the marker budget is exhausted. With one admitted file and zero spare marker slots, refusing an untitled document must leave the file census and capture usable. Refusing another file must block file authority until the store can establish complete coverage again. Fail conservatively when the URI cannot be classified. Preserve virtual document lifecycle behavior using the appropriate authority state.
|
|
Cases cover absent bound regular source, new unsaved overlay, refused and desynced overlay even at quota, visible recovery, two aliases of same physical file, retargeted lexical key, trusted caller disk bytes differing from ambient bytes (no ambient open), cache retention after store destruction, mismatched store, UTF8 and byte/line budgets. Deterministically interleave absent capture → open/change/close → supply old bytes, as well as edit/desync/reopen of a retained overlay. Check a changed unrelated overlay text doesn't invalidate an otherwise unchanged selection, with a distinct membership-change control. Validate library callers still see previous public behavior.
|
|
|
|
## 11. Verification commands and evidence
|
|
Run dev cpp-gcc -c g++ -std=c++26 -freflection -Iinclude -Ibuild/voidlibrary/current/include -fsyntax-only src/Documents/DocumentStore.cpp tests/documents/BoundInputTests.cpp, clang-format --dry-run on exact owned paths, private Void::Testing runner or parent-integrated target. Root adds test file to vls_document_tests (VBS and CMake). Report actual listed case names and counts.
|
|
|
|
## 12. Constraints and stop conditions
|
|
Stop for shared-file ownership conflicts or need to change source trust policy. Capture bytes only from the passed bounded buffer. No auto-discovery, private compiler changes, fake scope completeness or unguarded edits. A compiler or source.catalog grant is outside this document-only layer.
|
|
|
|
## 13. Authorization and decisions
|
|
Full roadmap D-022, Linux first, native VBS D-025, 6.2 family Max D-027, stock compiler evaluation D-028. Reversible local changes only, no Git staging or external sends.
|
|
|
|
## 14. Return format
|
|
T-SOURCE-OVERLAYS-009 DONE/PARTIAL with frozen types/methods, invariants, actual verification outcomes, limits, dependency on caller's external input/lookup evidence and released source paths.
|