Files
Language-Server/docs/agent-workflow/tasks/T-001.md
T
faumaray ca04975d54 bootstrap
Signed-off-by: faumaray <faumaray@gmail.com>
2026-11-25 02:11:19 +03:00

12 KiB

Bootstrap and stdio LSP lifecycle shell

Task ID: T-001 Role: sol_implementer Status: APPROVED

Execution amendment D-021: after worker handoff, the user selected following VoidLibrary main without a commit pin. Root changed the default dependency ref. Historical pin instructions below are superseded; exact tested-commit evidence and the upstream JSON acceptance gate remain required.

1. Context and baseline

Cwd/repository /home/faumaray/Projects/VoidLanguageServer. Root initialized main with unborn HEAD. Existing .serena runtime metadata is preserved/ignored. Root has added AGENTS.md, .gitignore and docs/agent-workflow records; no source, CMake, tests or formatting files existed. User approved the complete plan with "Implement the plan." Current execution scope is the initial compiling shell plus detailed plans, NOT the full language server/debugger. Relevant requirements R-001 C++26/VoidLibrary, R-002 lifecycle shell, R-003 reliable JSON, R-004 honest capability reporting, R-005 reproducible dependency/testing. Independent planner mapped VBS; fresh preflight reviewer accepted revised contracts. See docs/agent-workflow/APPROVED_PLAN.md and PREFLIGHT.md.

2. Objective and deliverables

Implement a maintainable C++26 vls executable and reusable protocol library, using actual VoidLibrary APIs. Deliver CLI, bounded LSP framing, safe JSON adapter, lifecycle state machine, and meaningful unit plus real-subprocess tests. Establish CMake/Ninja build with exact VoidLibrary pin/default remote fetch and explicit VLS_VOID_SOURCE_DIR development override. Keep final JSON conformance visibly pending if the user's upstream decimal revision has not landed; complete all independent code/testing. Do not substitute an integer-only protocol success claim.

3. Scope and non-goals

In: local bootstrap, help/version/stdio, JSON-RPC envelope validation and LSP3.17 lifecycle, error handling, input bounds, tests, install of executable if straightforward. Out: semantic parsing/diagnostics/completion, document synchronization, VBS or compdb providers, compiler-fork downloads, DAP/debugging/editor extensions, unrelated dependency fixes, Git mutations and docs writes. The shell advertises no unimplemented capabilities and never returns fake semantic results.

4. Files to inspect

Read project AGENTS.md and workflow records first. Dependency read-only at /home/faumaray/Projects/VoidLibrary: CMakeLists.txt, include/Void/Configuration/Argparse.hpp, include/Void/Data/StrictJson.hpp, include/Void/Data/Json.hpp, include/Void/Unicode/Utf.hpp, include/Void/System/Process.hpp, cmake/VoidTesting.cmake, tests/standalone/Data/StrictJson.cpp and relevant Testing examples. VBS read-only reference: /home/faumaray/Projects/VoidBuildSystem/cmake/VoidDependency.cmake, tests/CMakeLists.txt, tests/SdkRegistration.cmake, src/main.cpp. Do not assume VBS provides a native executor. Inspect actual APIs before code; do not change sibling repositories.

5. Write ownership and coordination

Write scope: CMakeLists.txt; cmake; include; src; tests; .clang-format All these are NEW VLS paths. Root exclusively owns .gitignore, AGENTS.md, README.md and docs/; do not edit them. You share the checkout, not an isolated worktree. Do not revert others' changes. No branch changes, staging, commits, clean/reset/stash, remote setup or push. Use build/worker for your builds; root will use build/bootstrap and build/local. Do not edit generated .serena config, global tools or Nix sources. Report changed paths; parent integrates after explicit handoff.

6. Implementation or investigation approach

Mandatory sequence:

  1. Inspect actual Void APIs and establish narrowly selected dependency modules (Configuration, Data, Unicode; Testing and System as needed for tests). Configure C++26/-freflection with GCC16+ checks and CMake>=4; scope Void options, disable dependency tests/benchmarks and use static linkage for this bootstrap.
  2. Implement stream-independent framing and lifecycle components plus thin main. Prefer simple synchronous shell with clean interfaces over premature worker/index abstractions.
  3. Use Void::Argparse for CLI. No-argument and --stdio launch LSP; --help/-h and --version/-V are standalone, mixed/incompatible modes or unknown options exit2. Help/version can use stdout outside stdio. In stdio stdout only framed protocol; stderr logs.
  4. JSON UPSTREAM GATE: inspected VoidLibrary baseline 9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5 has StrictJson integer-only parsing. The user says another worker is adding decimal support. DO NOT create a competing decimal parser or edit VoidLibrary. Design a thin adapter to use improved upstream StrictJson with raw UTF-8 validation and any needed bounded escape/depth validation. Use variant visitors tolerant of the future numeric alternative rather than assuming an unobserved exact new API. Until a verified committed revision exists, pin the observed baseline provisionally, complete independent components, and keep decimal capability tests as real FAILURES (no skip/xfail/false success). Parent owns final pin decision after verification. Notify parent when ready to adopt any observed upstream change.
  5. Add unit and executable protocol tests using Void::Testing and a bounded subprocess harness. Preserve real test failure exit codes; registration must be nonzero.
  6. Format exact owned C++ paths, inspect your diff, build and test what is available. Return code complete vs blocked accurately.

7. Interfaces and data contracts

NEW C++ public interfaces should separate framing, JSON-envelope processing and lifecycle so tests exercise the real main path; choose clear minimal names under namespace vls and include/vls. No public ABI commitment yet. Framing: Content-Length ASCII decimal, CRLF headers, body length in BYTES, optional UTF-8 Content-Type, multiple messages/partial reads. Header max8192 bytes; body max16777216 bytes; JSON depth64. Reject missing/duplicate/invalid/overflow length, unsupported charset, oversized/truncated framing without trying to resynchronize: stderr and nonzero exit. Validate before unbounded allocation. Exact-limit cases testable through smaller injectable limits in units. JSON: valid objects with jsonrpc="2.0"; preserve integer/string request IDs (LSP signed32-bit integer range), reject invalid ID types/ranges. Arrays/batches and malformed envelopes return InvalidRequest with appropriate id/null. Full decimal/exponent grammar in initializationOptions/ignored fields is REQUIRED, pending upstream. Reject raw controls, invalid UTF-8 and escaped lone surrogates. Void's general parser alone lacks these guards; raw UTF-8 validation alone does not reject escaped surrogates. No unchecked recursive parse before a depth bound. Known-size malformed JSON -> ParseError (-32700), id:null and continue. Lifecycle: before initialize, requests except initialize receive ServerNotInitialized (-32002); ignore notifications except exit as prescribed by LSP. Initialize returns serverInfo{name:"VoidLanguageServer",version:"0.1.0"} and capabilities:{}; initialized notification accepted. Repeated initialize -> InvalidRequest (-32600). Unknown requests after initialize -> MethodNotFound (-32601); unknown notifications no response. Shutdown request -> result:null and enter shutdown state. Post-shutdown requests -> InvalidRequest before generic method handling. Exit notification returns process0 after shutdown,1 otherwise. Unexpected/truncated EOF before proper shutdown/exit must not report a successful lifecycle. Initialization params are an object; test complete client payloads and tolerant handling of unknown fields. No responses to notifications, including invalid/unknown methods when no response id exists; malformed JSON itself uses id:null. No compiler, build description, shell, plugin, package manager, network listener, or metadata command executes during normal server operation.

8. Dependencies and integration

Default dependency URL https://git.faumaray.com/Void/VoidLibrary.git with exact revision, no floating branches. Current observed HEAD baseline above. VLS_VOID_SOURCE_DIR bypass must be explicit and print clear provenance; build output goes into VLS build dir, never dependency source. Root will validate new upstream pin and repeat default+override paths after handoff. The source API may change while the other worker works. Inspect and report rather than silently adopting dirty source or pretending pin validation. Root documentation proceeds independently. No Nix module change is needed; use existing dev cpp-gcc. Flake/store source copying, --impure and installer work are prohibited.

9. Edge cases security and performance

Bound read buffers, depth and frame sizes. Check stream errors and avoid stderr/stdout mixing. Ignore unknown extension fields without rejecting valid decimal values once gate passes. Test surrogate pairs and malformed escapes; preserve quoted/non-ASCII string IDs. Enforce argument mode errors deterministically. Subprocess tests need timeouts and cleanup; do not let a blocked child hang CTest. Do not read/index .env, keys, WG.conf, .aws, credentials or ignored caches from dependencies. Graph identities known: home-faumaray-Projects-VoidLibrary and home-faumaray-Projects-VoidBuildSystem; old indexes are stale. Use exact-path coverage and source verification; no reindex. Keep Serena active project VoidLanguageServer; do not switch shared activation.

10. Acceptance criteria

  1. Default pinned and explicit local builds have truthful provenance and leave dependency source unchanged (R-001/R-005).
  2. CLI --help/--version and invalid combinations have correct output/exit codes; stdio default writes only protocol (R-002).
  3. Unit tests cover frame boundaries, length overflow, encoding/JSON/ID checks and lifecycle precedence (R-002/R-003).
  4. End-to-end tests run the built vls executable through initialize/initialized/shutdown/exit; fragment headers/bodies, send multiple messages, unknown methods/notifications, malformed JSON, premature exit, post-shutdown requests (R-002).
  5. Decimal/exponent initialization options and Unicode/depth tests pass on the VERIFIED upstream pin before final shell acceptance (R-003). If not available, return PARTIAL with exact failing prerequisite.
  6. Capability response is empty; no semantic/debugger/VBS behavior claimed (R-004).
  7. Tests are nonzero, fail visibly, time-bounded; no ignored failures/xfails fabricated to pass (R-005).

11. Verification commands and evidence

Cwd /home/faumaray/Projects/VoidLanguageServer. Existing environment commands observed: dev cpp-gcc -c g++ --version =>16.2.0; dev cpp -c clang++ --version =>23.1.3. GCC passes reflection syntax probe, installed Clang fails, so GCC required. NEW project acceptance commands once you create build files: dev cpp-gcc -c cmake -S . -B build/worker -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DVLS_VOID_SOURCE_DIR=/home/faumaray/Projects/VoidLibrary dev cpp-gcc -c cmake --build build/worker dev cpp-gcc -c ctest --test-dir build/worker --output-on-failure dev cpp-gcc -c ctest --test-dir build/worker -N Default pin verification belongs to root after pin settles; you may use build/worker-pinned if needed and report. These commands write only ignored build artifacts and may fetch dependency packages. Use plain commands and capture exits. Scope clang-format to exact owned C++ paths. Do not run NixOS checks or edit environment tooling.

12. Constraints and stop conditions

Stop and report if upstream JSON API/pin is unavailable for final integration, a change needs unowned/sibling files, a consequential API decision contradicts this contract, or toolchain access fails. Continue independent code before returning partial. After two unsuccessful repairs of same issue, return original failure, attempts and diff for Astra re-diagnosis; no third same-hypothesis loop. Do not disable tests or patch dependency as a workaround. No children.

13. Authorization and decisions

User "Implement the plan" authorizes initial shell+repo/plans after completed discovery and READY preflight; root is executing repository/docs in parallel. Configured sol_implementer gpt-6.1-sol/XHigh; do not assert runtime routing verified. Full future product/debugger work and publishing remain gated. This full task is persisted and structurally linted before dispatch; root semantically reviewed it.

14. Return format

Return T-001; DONE/PARTIAL/BLOCKED; summary; exact changed paths; decisions/deviations; commands with cwd, exits and test counts; every acceptance criterion evidence; unrun checks; JSON gate/pin status; residual risks and handoff. Do not contact user directly or spawn agents.