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.
76 lines
8.0 KiB
Markdown
76 lines
8.0 KiB
Markdown
# Integrate the document model and verify overlay and position behavior
|
|
|
|
Task ID: T-DOCS-003
|
|
Role: sol_implementer
|
|
Status: READY
|
|
|
|
## 1. Context and baseline
|
|
Repository /home/faumaray/Projects/VoidLanguageServer, branch feat/implement-roadmap, base ca04975. The Documents headers and implementations already exist untracked. User confirms no active writer and asks to continue them. Root preserved the original sixteen-file baseline in build/goal-baseline-20261127. This work implements roadmap 03 under R-006 and lays the document-side contract for 05/09.
|
|
|
|
## 2. Objective and deliverables
|
|
Make the existing Documents namespace usable by the LSP session for real opens, edits, closes and overlay reads. Provide tested immutable snapshot identities and consistent change/recovery semantics. Root integrates your library and tests with the server and native build.
|
|
|
|
## 3. Scope and non-goals
|
|
Own the document engine, URI/position boundaries and its focused tests. Keep source content immutable to callers. Protocol framing, LSP JSON decoding, dependency preparation, configuration, semantic workers, VBS build descriptions and shared build/revision model are separate.
|
|
|
|
## 4. Files to inspect
|
|
Inspect include/Void/LanguageServer/Documents/{Position,Uri,DocumentSnapshot,DocumentStore}.hpp, src/Documents/{Position,Uri,DocumentSnapshot,DocumentStore}.cpp and docs/roadmap/03-documents-positions.md. Consult roadmap 05 and 10 for snapshot stability; docs/roadmap/ARCHITECTURE.md is the context. VoidLibrary headers live in build/bootstrap/_deps/voidlibrary-src/include/Void/{System,Unicode,Crypto,Text}.
|
|
|
|
## 5. Write ownership and coordination
|
|
Write scope: include/Void/LanguageServer/Documents; src/Documents; tests/documents
|
|
The existing files are the baseline. New tests are confined to tests/documents/DocumentTests.cpp. Do not edit shared build files, CLI/server, TestSupport.hpp, sibling trees or docs. Root wires targets and resolves inter-component ownership. No Git mutations.
|
|
|
|
## 6. Implementation or investigation approach
|
|
Implement position clamping for character offsets beyond line end per LSP 3.17 (retain rejection inside UTF-8 scalars/UTF-16 surrogate pairs). Make invalid line, EOF and newline boundaries deliberate and safe. Ensure valid file/virtual URI identities and aliases, without conflating unrelated paths or losing the URI used to close an open overlay. Keep apply_changes transactional across a batch and monotonic across failed/recovered versions. A newer full replacement or close/reopen recovers desync. Bound overlay growth independently of single JSON frame limits. File reads outside the store lock recheck overlay, desync, and encoding before returning success OR error. Avoid quadratic full reindexes per edit when feasible and never allocate unbounded aggregate batches. Use the reviewed planner/preflight decisions for limits and identity policy.
|
|
|
|
## 7. Interfaces and data contracts
|
|
Retain existing Documents::DocumentStore::open, apply_changes, close, snapshot, resolve_content; const shared_ptr snapshots carry text, content identity, line map, version and revision. Any additional needed method to mark malformed known-document notifications desynchronized should accept an explicit error and version where available and notify root of the exact signature. Use C++26 expected with typed document errors. Make public line helpers safe on untrusted indices or move unchecked helpers private.
|
|
|
|
## 8. Dependencies and integration
|
|
Read-only T-PLAN-002 and fresh preflight freeze the API. Other workers own build/test wiring, protocol and workspace. Keep your suite self-registering (VOID_TEST) so both native and CMake harnesses can link the same bodies. Root owns server notification behavior and provider integration. Report the exact native source/module list and test names.
|
|
|
|
## 9. Edge cases security and performance
|
|
Exercise line-ending forms, astral scalars, combining marks, truncated UTF-8, nonexistent files, encoded separators/NUL, multi-edit ordering, old snapshot lifetime, stale versions, aliases and a newly-opened overlay while resolving disk. Passive content resolution never writes disk. Any deterministic race test should use an explicit bounded seam or observable synchronization, never flaky sleeps. Honor the roadmap limits for bounded text, errors and cancellation. Use a current upstream public SHA-256 API if the reviewed contract needs it.
|
|
|
|
## 10. Acceptance criteria
|
|
1. Both encodings round-trip valid positions, clamp oversized character values and detect invalid scalar/newline splits.
|
|
2. Sequential edits use preceding element state, failure publishes no partial text and preserves a clear desync barrier. Recovery and close/reopen create fresh identities while prior snapshots remain consistent.
|
|
3. Overlay precedence, including a raced failure/success disk read and URI alias behavior, is verified. Bounded disk/overlay limits have tested outcomes.
|
|
4. Focused tests exercise actual APIs, remain discoverable under native registration and pass. Report large-file/edit measurement and any residual issue.
|
|
|
|
## 11. Verification commands and evidence
|
|
From repository root, use dev cpp-gcc -c g++ -std=c++26 -freflection with -Iinclude and -Ibuild/bootstrap/_deps/voidlibrary-src/include for an isolated -fsyntax-only check. A compiled Void::Testing runner and real native archive already exist under build/vbs-framework-probe; discover the exact archives via its link action or the root-owned native/CMake build. Run the dedicated test binary in your own ignored build/docs-check if root wiring is not yet available. All repo build scripts are reserved. Use dev cpp -c clang-format on exact owned C++ paths. Include actual execution commands and counts.
|
|
|
|
## 12. Constraints and stop conditions
|
|
Stop if continued work requires changing the agreed shared revision schema, unowned files or dependency APIs. Return proposed changes to root. After two failed repairs for the same contract return reproduction, attempts and current diff. No broad sibling search, sensitive files, staging, commits or branch changes.
|
|
|
|
## 13. Authorization and decisions
|
|
D-022, D-024 through D-027 authorize the full roadmap, work on existing files and explicit GPT-6.2 Sol Max. Implement after fresh preflight and root dispatch. Follow project agent instructions and the reviewed contracts. Other agents share the checkout.
|
|
|
|
## 14. Return format
|
|
Return T-DOCS-003 DONE/PARTIAL/BLOCKED, changed files, public signatures, edge-case outcomes, test counts and commands, performance measurement, unverified risks and exact integration points. No children or independent user messages.
|
|
|
|
T-PLAN-002 clarification: distinguish lexical client URI/open incarnation and
|
|
physical lookup. Keep the original client URI available after symlink retarget,
|
|
and treat two live overlays for the same physical path as ambiguous for that
|
|
lookup. Disk snapshots have explicit origin and no client version. Track the
|
|
highest observed change version independently of last applied so a failed v12
|
|
cannot recover from v10. Newer full text may be followed by valid ranged edits
|
|
in the same notification. Recheck path generation including open/close ABA after
|
|
disk I/O, bounded retry or typed stale. Suggested session defaults are 16 MiB
|
|
per document, 128 MiB snapshot/index admission, 4096 open documents and 4096
|
|
changes per notification. Track snapshot lifetime while references remain.
|
|
Use LSP signed-32-bit versions and positions up to 2^31-1.
|
|
|
|
Preflight correction: reserve lightweight unavailable-open/desynchronization
|
|
state independently of document text allocation. When a valid didOpen exceeds
|
|
budget, the client still owns its content. resolve_content must report unready
|
|
and may never substitute disk. Define a bounded fail-closed state if even the
|
|
unavailable-open marker limit is reached. Reject stale events without allocating
|
|
or copying an entire text/index to set a desync barrier.
|
|
|
|
For disk inputs distinguish stable origin/content and a path/overlay epoch from
|
|
a newly allocated snapshot's in-process sequence. Re-reading an unchanged file
|
|
must not by itself invalidate an analysis revision. Report the read/identity API
|
|
to root for the shared context model.
|