Files
Language-Server/docs/agent-workflow/tasks/T-DOCS-PERF-006.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

5.6 KiB

Remove repeated prefix decoding for long-line incremental edits

Task ID: T-DOCS-PERF-006 Role: sol_implementer Status: READY

1. Context and baseline

Shared checkout /home/faumaray/Projects/VoidLanguageServer on feat/implement-roadmap at ca04975. The Documents store passed 17 focused cases after the text_size_ repair. The fresh integrated reviewer T-REVIEW-005 observed a P2: eight single-character edits near the end of one 64 KiB ASCII line took 42.36 ms versus 3.09 ms near the beginning in the native debug build. Root separately owns its torn-read and envelope corrections.

2. Objective and deliverables

Fix the long-line position conversion on actual document edit paths while preserving Unicode/CRLF and memory admission. Add a repeatable long-line option to the existing benchmark and new narrow correctness coverage for edits that introduce/remove Unicode.

3. Scope and non-goals

Only the position index and performance evidence. Leave store, disk, session, preparation, existing document tests and all build configurations to root. The current scope is a small evidence-driven regression fix, validated by the existing planner and fresh reviewer.

4. Files to inspect

Inspect include/Void/LanguageServer/Documents/Position.hpp, src/Documents/Position.cpp, src/Documents/DocumentStore.cpp especially apply_changes/apply_replacement/line admission, tests/documents/DocumentTests.cpp and tests/performance/document_sync.py. The native debug and release tools are under build/native-validation/profiles/{debug,release}/out/bin.

5. Write ownership and coordination

Write scope: include/Void/LanguageServer/Documents/Position.hpp; src/Documents/Position.cpp; tests/documents/LongLineTests.cpp; tests/performance/document_sync.py These four paths are exclusive to you. New tests go into LongLineTests.cpp. Root and other workers share all other paths. No branch changes, sibling edits, staging, or common native build/metadata writes.

6. Implementation or investigation approach

Choose a measured ASCII fast path or bounded sparse checkpoints that avoid decoding from line start for routine ASCII edits. Share decoded traversal between two endpoints on the same line. Preserve direct public checks, per-session encoding, line clamping, size/offset validation and atomic edits. Keep every new allocation charged under the existing storage contract; prefer a constant-space approach where possible. Include a mixed-ASCII/Unicode long-line case. Optimize the release code used by DocumentStore. Do not change quotas or skip validation to improve the benchmark.

7. Interfaces and data contracts

Keep existing public LineIndex APIs usable. The checked same-size index contract applies to original snapshot text; changed-size mismatches return an error. apply_replacement gets old text and already validated start/end bytes, plus the replacement and max-lines allowance. An edit creating/deleting CRLF or non-BMP sequences must update any new metadata correctly. New tests use native VOID_TEST(LongLines,...). Retain tests/performance/document_sync.py's original size/samples behavior.

8. Dependencies and integration

Root integrates new tests into both builds after handoff. Return the --list names and your independent run using an isolated compiler invocation and the real native or comparison Void::Testing libraries. For benchmark use a freshly linked binary with the changed position code under your own build/doc-perf path or coordinate with root for the shared binary once source changes are ready.

9. Edge cases security and performance

Keep algorithmic bounds explicit and avoid mutable data races in shared immutable snapshots. Verify UTF-16 split-surrogate, UTF-8 split-scalar, invalid/truncated UTF-8 and integer upper boundaries. Do not introduce full-document work per small edit solely to maintain an optimization. Bounds still cover exceptionally long single lines, repeated edits and retained snapshots.

10. Acceptance criteria

  1. Real nonempty tests for long ASCII endpoints, mixed Unicode positions, and transitions from ASCII to Unicode and back through ranges/full replacements. Existing 17 cases remain meaningful. 2. Repeat the 64 KiB single-line near-start and near-end workloads, report before/after counts, timings/build profile. 3. Preserve actual behavior under original multiline 1/8 MiB benchmark and original public API. 4. No unaccounted memory or per-request mutable shared caches.

11. Verification commands and evidence

Run git status --short --branch, read actual source and scoped graph coverage. Use dev cpp-gcc -c g++ -std=c++26 -freflection -Iinclude -Ibuild/voidlibrary/current/include -fsyntax-only src/Documents/Position.cpp tests/documents/LongLineTests.cpp. Link and execute real tests in build/doc-perf using present libraries; root will register both builds. Run dev cpp -c clang-format --dry-run --Werror on your three C++ paths and python3 tests/performance/document_sync.py --help.

12. Constraints and stop conditions

Stop and notify root before incompatible store/storage changes or after two unsuccessful repair attempts with the same hypothesis. Keep original failing/performance witness visible. Do not rewrite generic test framework or performance targets.

13. Authorization and decisions

The user explicitly reiterated all plans and Max on all agents, and already selected GPT-6.2 fallback at Max after escalation. This bounded correction uses the approved Sol role on that family. No external side effects, no children or user messages.

14. Return format

T-DOCS-PERF-006 DONE/PARTIAL/BLOCKED, exact paths, algorithm/public invariants, benchmark commands/outputs, test registration/count/results, remaining gaps and root wiring required.