From 3cac890ce9b8a0681130a58601e0516231471ad8 Mon Sep 17 00:00:00 2001 From: faumaray Date: Wed, 25 Nov 2026 01:32:43 +0300 Subject: [PATCH] bootstrap Signed-off-by: faumaray --- .clang-format | 4 + .gitignore | 24 + AGENTS.md | 51 ++ CMakeLists.txt | 50 ++ LICENSE | 21 + README.md | 169 +++++++ build-support/defaults.cpp | 12 + build-support/defaults.hpp | 7 + build.cpp | 20 + build.profiles.cpp | 3 + cmake/VoidDependency.cmake | 30 ++ cmake/bootstrap_config.hpp.in | 9 + docs/SDK.md | 118 +++++ docs/agent-workflow/APPROVED_PLAN.md | 43 ++ docs/agent-workflow/DECISIONS.md | 48 ++ docs/agent-workflow/PREFLIGHT.md | 36 ++ docs/agent-workflow/REVIEW.md | 68 +++ docs/agent-workflow/STATE.md | 40 ++ docs/agent-workflow/TASKS.md | 35 ++ docs/agent-workflow/VERIFICATION.md | 155 ++++++ docs/agent-workflow/tasks/T-001.md | 57 +++ docs/agent-workflow/tasks/V-002-R1.md | 66 +++ docs/agent-workflow/tasks/V-002.md | 67 +++ docs/roadmap/01-bootstrap-sdk.md | 67 +++ docs/roadmap/02-configuration-frontend.md | 66 +++ docs/roadmap/03-targets-action-graph.md | 66 +++ docs/roadmap/04-profiles-toolchains.md | 66 +++ docs/roadmap/05-snapshots-invalidation.md | 66 +++ docs/roadmap/06-execution-scheduling.md | 66 +++ docs/roadmap/07-state-local-cache.md | 66 +++ docs/roadmap/08-modern-cpp.md | 66 +++ docs/roadmap/09-compilation-database.md | 66 +++ docs/roadmap/10-watchers-cli.md | 66 +++ docs/roadmap/11-dependencies-solver-lock.md | 66 +++ docs/roadmap/12-fetching-packages.md | 66 +++ docs/roadmap/13-foreign-providers.md | 67 +++ docs/roadmap/14-cmake-bridge.md | 66 +++ docs/roadmap/15-install-export.md | 66 +++ docs/roadmap/16-registry-service.md | 67 +++ docs/roadmap/17-registry-ui.md | 66 +++ docs/roadmap/18-self-host-voidlibrary.md | 66 +++ docs/roadmap/19-quality-performance-ci.md | 66 +++ .../20-future-translation-platforms.md | 66 +++ docs/roadmap/ARCHITECTURE.md | 180 +++++++ docs/roadmap/README.md | 96 ++++ docs/roadmap/REQUIREMENTS.md | 58 +++ include/vbs/build.hpp | 201 ++++++++ src/build.cpp | 448 ++++++++++++++++++ src/describe.cpp | 44 ++ src/main.cpp | 43 ++ tests/CMakeLists.txt | 17 + tests/CliContracts.cmake | 28 ++ tests/DescribeContracts.cmake | 75 +++ tests/ExampleContexts.cpp | 57 +++ tests/RunSdkTests.cmake | 8 + tests/SdkDeclarations.cpp | 288 +++++++++++ tests/SdkRegistration.cmake | 44 ++ 57 files changed, 4043 insertions(+) create mode 100644 .clang-format create mode 100644 .gitignore create mode 100644 AGENTS.md create mode 100644 CMakeLists.txt create mode 100644 LICENSE create mode 100644 README.md create mode 100644 build-support/defaults.cpp create mode 100644 build-support/defaults.hpp create mode 100644 build.cpp create mode 100644 build.profiles.cpp create mode 100644 cmake/VoidDependency.cmake create mode 100644 cmake/bootstrap_config.hpp.in create mode 100644 docs/SDK.md create mode 100644 docs/agent-workflow/APPROVED_PLAN.md create mode 100644 docs/agent-workflow/DECISIONS.md create mode 100644 docs/agent-workflow/PREFLIGHT.md create mode 100644 docs/agent-workflow/REVIEW.md create mode 100644 docs/agent-workflow/STATE.md create mode 100644 docs/agent-workflow/TASKS.md create mode 100644 docs/agent-workflow/VERIFICATION.md create mode 100644 docs/agent-workflow/tasks/T-001.md create mode 100644 docs/agent-workflow/tasks/V-002-R1.md create mode 100644 docs/agent-workflow/tasks/V-002.md create mode 100644 docs/roadmap/01-bootstrap-sdk.md create mode 100644 docs/roadmap/02-configuration-frontend.md create mode 100644 docs/roadmap/03-targets-action-graph.md create mode 100644 docs/roadmap/04-profiles-toolchains.md create mode 100644 docs/roadmap/05-snapshots-invalidation.md create mode 100644 docs/roadmap/06-execution-scheduling.md create mode 100644 docs/roadmap/07-state-local-cache.md create mode 100644 docs/roadmap/08-modern-cpp.md create mode 100644 docs/roadmap/09-compilation-database.md create mode 100644 docs/roadmap/10-watchers-cli.md create mode 100644 docs/roadmap/11-dependencies-solver-lock.md create mode 100644 docs/roadmap/12-fetching-packages.md create mode 100644 docs/roadmap/13-foreign-providers.md create mode 100644 docs/roadmap/14-cmake-bridge.md create mode 100644 docs/roadmap/15-install-export.md create mode 100644 docs/roadmap/16-registry-service.md create mode 100644 docs/roadmap/17-registry-ui.md create mode 100644 docs/roadmap/18-self-host-voidlibrary.md create mode 100644 docs/roadmap/19-quality-performance-ci.md create mode 100644 docs/roadmap/20-future-translation-platforms.md create mode 100644 docs/roadmap/ARCHITECTURE.md create mode 100644 docs/roadmap/README.md create mode 100644 docs/roadmap/REQUIREMENTS.md create mode 100644 include/vbs/build.hpp create mode 100644 src/build.cpp create mode 100644 src/describe.cpp create mode 100644 src/main.cpp create mode 100644 tests/CMakeLists.txt create mode 100644 tests/CliContracts.cmake create mode 100644 tests/DescribeContracts.cmake create mode 100644 tests/ExampleContexts.cpp create mode 100644 tests/RunSdkTests.cmake create mode 100644 tests/SdkDeclarations.cpp create mode 100644 tests/SdkRegistration.cmake diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..bf1cf6a --- /dev/null +++ b/.clang-format @@ -0,0 +1,4 @@ +BasedOnStyle: LLVM +IndentWidth: 4 +ColumnLimit: 100 +SortIncludes: CaseSensitive diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1113db9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Local build and editor state +/build/ +/build-*/ +!/build-support/ +/.vbs/ +/.serena/ +/.cache/ +/compile_commands.json +CMakeUserPresets.json + +# Local credentials and environment +.env +.env.* +!.env.example +/keys/ +/keys +/WG.conf +*.pem +*.key + +# Editor/OS scratch +*.swp +*~ +.DS_Store diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..40f8b5f --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,51 @@ +# VoidBuildSystem development + +## Scope and truth + +Read docs/agent-workflow/STATE.md and TASKS.md, then the relevant roadmap plan. +This repository starts with a bootstrap and declaration SDK. Native builds, +TOML loading, package resolution, snapshots, watching and registry operation +must not be described as implemented until verified. +The accepted initial scope is in docs/agent-workflow/APPROVED_PLAN.md. + +## Environment and checks + +The user's environment provides `dev cpp-gcc -c COMMAND...` (GCC 16.2, +CMake 4.4.4, Ninja 1.13.2, Meson 1.12.1) and `dev cpp -c COMMAND...` +(Clang 23.1.3). Use the GCC environment for this C++26 bootstrap. +The bootstrap's source dependency is VoidLibrary at +9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5. +An explicit VBS_VOID_SOURCE_DIR override is development-only; never change +that external checkout. It may contain untracked secrets. + +After the bootstrap exists: +```sh +dev cpp-gcc -c cmake -S . -B build/bootstrap -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON +dev cpp-gcc -c cmake --build build/bootstrap +dev cpp-gcc -c ctest --test-dir build/bootstrap --output-on-failure +``` +Consult README.md for the local-source override and actual executable paths. +Format only owned C++ files, never the entire dependency or dirty checkout. + +## Architecture boundaries + +- Build descriptions and profiles are ordinary C++; TOML is dependency data. +- Keep host description compilation distinct from per-profile target evaluation. +- A description declares symbolic dependencies without resolving/building them. +- Preserve target/profile isolation, immutable input identities and explicit errors. +- Compilation database projections are separate from exact execution records. +- Metadata watchers never run foreign configure/build/install operations. +- Maintain detailed plans and mark future commands and interfaces as planned. +- Prefer VoidLibrary. Record reusable gaps for later upstream work rather than + editing another repository as an incidental fix. + +## Coordination and safety + +Use the supplied Astra/Sol workflow, precise task contracts and fresh reviews. +Workers share this checkout: respect exclusive task ownership. +Root owns documentation, dependency-pin changes and shared integration after +the initial bootstrap assignment completes. +Do not read or index .env files, keys, WG.conf, .git internals or ignored caches. +Do not stage, commit, push, deploy, or create remote repositories without a +separate user instruction. This task authorizes local initialization and edits. +Never copy an entire external checkout into a Nix store source. diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5a45bf5 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 4.0) +project(VoidBuildSystem VERSION 0.1.0 LANGUAGES CXX) + +if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) + message(FATAL_ERROR + "The VBS bootstrap requires GCC 16+ with C++26 reflection. Use dev cpp-gcc; " + "--compiler clang in vbs_describe selects a declaration context, not the host compiler.") +endif() +set(CMAKE_CXX_STANDARD 26) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag(-freflection VBS_HAS_REFLECTION) +if(NOT VBS_HAS_REFLECTION) + message(FATAL_ERROR "The GCC host compiler must support -freflection for VoidLibrary.") +endif() + +option(VBS_BUILD_TESTS "Build declaration SDK and bootstrap contract tests" ON) +set(VBS_VOID_SOURCE_DIR "" CACHE PATH "Development-only VoidLibrary source override (bypasses pin)") +set(VBS_VOID_REVISION "9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5") +include(cmake/VoidDependency.cmake) +vbs_add_void_dependency() + +add_library(vbs_bootstrap_options INTERFACE) +target_compile_features(vbs_bootstrap_options INTERFACE cxx_std_26) +target_compile_options(vbs_bootstrap_options INTERFACE -freflection -Wall -Wextra -Wpedantic) + +add_library(vbs_sdk STATIC src/build.cpp) +target_include_directories(vbs_sdk PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") +target_link_libraries(vbs_sdk PUBLIC vbs_bootstrap_options) + +configure_file(cmake/bootstrap_config.hpp.in generated/vbs/bootstrap_config.hpp @ONLY) +add_executable(vbs src/main.cpp) +target_include_directories(vbs PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/generated") +target_link_libraries(vbs PRIVATE vbs_sdk Void::Configuration) + +add_library(vbs_example_description STATIC build.cpp build.profiles.cpp build-support/defaults.cpp) +target_include_directories(vbs_example_description PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") +target_link_libraries(vbs_example_description PUBLIC vbs_sdk) +add_executable(vbs_describe src/describe.cpp) +target_include_directories(vbs_describe PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/generated") +target_link_libraries(vbs_describe PRIVATE vbs_example_description Void::Configuration) + +set_target_properties(vbs vbs_describe PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") +if(VBS_BUILD_TESTS) + enable_testing() + include("${VBS_VOID_TESTING_SCRIPT}") + add_subdirectory(tests) +endif() diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..51347f7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 faumaray + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..93e5075 --- /dev/null +++ b/README.md @@ -0,0 +1,169 @@ +# VoidBuildSystem + +A C++ build system for Void projects, using +[VoidLibrary](https://git.faumaray.com/Void/VoidLibrary). Build logic lives in +ordinary `build.cpp` and reusable `.cpp`/`.hpp` files. Dependency declarations +will also support TOML. + +**Current milestone: compiling bootstrap and declaration SDK.** The `vbs` CLI +implements help/version and useful errors. `vbs_describe` evaluates the compiled +example and emits a versioned JSON description. Native builds, self-hosting, +dependency resolution, watchers and profile-aware compilation databases are +planned; those commands currently fail explicitly. + +Start with the [twenty implementation plans](docs/roadmap/README.md), +[architecture](docs/roadmap/ARCHITECTURE.md) and +[requirements](docs/roadmap/REQUIREMENTS.md). Each part specifies interfaces, +dependencies, ownership, implementation steps, failure behavior and acceptance +checks. [Verification](docs/agent-workflow/VERIFICATION.md) records observed results. + +## Build the bootstrap + +Requirements: GCC 16+ with C++26 reflection, CMake 4.0+, Git and Ninja. The verified +host environment is GCC 16.2.0, CMake 4.4.4 and Ninja 1.13.2 on Linux. The supplied +`dev cpp-gcc` environment provides these tools: + +```sh +dev cpp-gcc -c cmake -S . -B build/bootstrap -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON +dev cpp-gcc -c cmake --build build/bootstrap --parallel 2 +dev cpp-gcc -c ctest --test-dir build/bootstrap --output-on-failure + +build/bootstrap/bin/vbs --help +build/bootstrap/bin/vbs --version +build/bootstrap/bin/vbs_describe --profile debug --compiler gcc +build/bootstrap/bin/vbs_describe --profile release --compiler clang +``` + +Without this local `dev` wrapper, run the same CMake/CTest commands in an +equivalent toolchain environment. The host bootstrap requires GCC; the descriptor's +`--compiler clang` selects runtime declaration facts and does not invoke Clang. + +CMake fetches VoidLibrary at the exact commit +`9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5`. It builds the Configuration and Testing +module closure statically, with VoidLibrary's own tests and benchmarks disabled. +To use a development checkout explicitly: + +```sh +dev cpp-gcc -c cmake -S . -B build/bootstrap-local -G Ninja \ + -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DVBS_VOID_SOURCE_DIR=../VoidLibrary +dev cpp-gcc -c cmake --build build/bootstrap-local --parallel 2 +dev cpp-gcc -c ctest --test-dir build/bootstrap-local --output-on-failure +``` + +The override bypasses the pin and prints a diagnostic. Its source checkout is not +modified. `-DVBS_BUILD_TESTS=OFF` omits the bootstrap tests and Testing module. +Build products and generated test registrations stay in the chosen build directory. +The `compile_commands.json` produced here belongs to the CMake bootstrap; VBS's +automatic per-profile export and selection are separate planned features. + +## Ordinary C++ declarations + +The [root example](build.cpp) and its [helper](build-support/defaults.cpp) compile +as part of the bootstrap. This smaller example uses the implemented SDK: + +```cpp +#include + +void build(vbs::Project& project) { + auto core = project.static_library("core"); + core.sources(project.glob("src/core/*.cpp")) + .include_directory("include", vbs::Visibility::public_); + + auto app = project.executable("app"); + app.sources({"src/main.cpp"}).link(core); + + if (project.context().compiler == vbs::CompilerFamily::clang) { + app.compile_option("-Wextra-semi"); + } +} +``` + +These calls record data. They do not enumerate files, resolve dependencies or run +a compiler. See the [SDK contract](docs/SDK.md) and [public header](include/vbs/build.hpp). +`build.profiles.cpp` supplies ordinary C++ profile definitions; the current example +uses debug/release defaults. The same host-compiled descriptor is evaluated with +each requested target context, so host preprocessor macros are not target selectors. + +The root description currently models `vbs_sdk`, `vbs` and their dependency links. +It is not yet a complete self-build: generated bootstrap headers, test registration +and native VoidLibrary construction belong to the +[self-hosting milestone](docs/roadmap/18-self-host-voidlibrary.md). + +## Dependencies + +The current SDK can record an exact Git source, CMake options and imported targets: + +```cpp +auto library = project.dependency("VoidLibrary"); +library.git("https://git.faumaray.com/Void/VoidLibrary.git", + vbs::Commit{"9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5"}) + .cmake({{"VOID_ENABLED_MODULES", "Configuration"}, + {"VOID_ENABLE_TESTING", false}, + {"BUILD_SHARED_LIBS", false}}); +app.link(library.target("Void::Configuration")); +``` + +It also records `project.dependency("fmt").package("fmt", "^11.0")`. +Resolution, fetching and foreign builds are future operations; declaring a dependency +does not perform them. + +**Planned TOML form**, normalized to the same dependency model: + +```toml +[dependencies.VoidLibrary] +git = "https://git.faumaray.com/Void/VoidLibrary.git" +rev = "9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5" +builder = "cmake" + +[dependencies.VoidLibrary.options] +VOID_ENABLED_MODULES = "Configuration" +VOID_ENABLE_TESTING = false +BUILD_SHARED_LIBS = false + +[dependencies.fmt] +package = "fmt" +version = "^11.0" +``` + +The proposed `project.dependencies("vbs.deps.toml")` loader will permit custom +filenames. It is not in the bootstrap SDK. Conflicting C++/TOML declarations will +fail with origin diagnostics. A context-aware `vbs.lock` will hold exact resolutions; +existing incompatible declarations will require explicit resolve/update. See the +[dependency plan](docs/roadmap/11-dependencies-solver-lock.md). + +## Planned build and editor workflow + +The native engine will build selected target/profile combinations, with several +profiles sharing one build root and separate mutable outputs. Per-profile +`compile_commands.json` files will cover all configured targets, even when the build +selects only a subset. + +Editor selection will follow the latest single-profile build or an explicit manual +switch. Multi-profile builds will require `--editor-profile`. Configuration and source +membership changes will refresh metadata automatically; an independent metadata +watcher will update it without scheduling target/package builds or foreign configure +operations. Invalid configuration retains a clearly stale last valid database. + +Content verification and immutable snapshots will cover additions, deletions, renames, +headers, generated inputs and changed build logic. File events are hints; periodic +reconciliation recovers missed changes. See the [profile](docs/roadmap/04-profiles-toolchains.md), +[snapshot](docs/roadmap/05-snapshots-invalidation.md), +[compilation database](docs/roadmap/09-compilation-database.md) and +[watcher](docs/roadmap/10-watchers-cli.md) plans. + +Full v1 also includes modern C++ modules/header units/PCH/unity/LTO/sanitizers, +CMake/Meson/Conan consumption, native source/binary package management, a CMake-facing +dependency bridge, installation/exports, a C++ registry service and web administration. +Native self-hosting progresses from the CMake seed through clean native stages. +Later work covers native translation of foreign graphs and additional operating systems. + +## Development + +Use [STATE](docs/agent-workflow/STATE.md), [TASKS](docs/agent-workflow/TASKS.md) and +[decisions](docs/agent-workflow/DECISIONS.md) to continue work. The initial test suite +has four CTest checks covering SDK behavior and registration, CLI contracts and +the four debug/release × GCC/Clang declaration contexts. Tests use Void::Testing. + +Licensed under [MIT](LICENSE). diff --git a/build-support/defaults.cpp b/build-support/defaults.cpp new file mode 100644 index 0000000..b271885 --- /dev/null +++ b/build-support/defaults.cpp @@ -0,0 +1,12 @@ +#include "defaults.hpp" + +namespace build_support { +void compiler_warnings(vbs::Target target, const vbs::ProfileContext &context) { + target.compile_option("-Wall").compile_option("-Wextra"); + if (context.compiler == vbs::CompilerFamily::gcc) { + target.compile_option("-Wduplicated-cond"); + } else { + target.compile_option("-Wextra-semi"); + } +} +} // namespace build_support diff --git a/build-support/defaults.hpp b/build-support/defaults.hpp new file mode 100644 index 0000000..6fe73cb --- /dev/null +++ b/build-support/defaults.hpp @@ -0,0 +1,7 @@ +#pragma once + +#include + +namespace build_support { +void compiler_warnings(vbs::Target target, const vbs::ProfileContext &context); +} // namespace build_support diff --git a/build.cpp b/build.cpp new file mode 100644 index 0000000..db28ab8 --- /dev/null +++ b/build.cpp @@ -0,0 +1,20 @@ +#include "build-support/defaults.hpp" + +void build(vbs::Project &project) { + auto library = project.dependency("VoidLibrary"); + library + .git("https://git.faumaray.com/Void/VoidLibrary.git", + vbs::Commit{"9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5"}) + .cmake({{"VOID_ENABLED_MODULES", "Configuration;Testing"}, + {"VOID_ENABLE_TESTING", false}, + {"VOID_ENABLE_BENCHMARKS", false}, + {"BUILD_SHARED_LIBS", false}}); + + auto sdk = project.static_library("vbs_sdk"); + sdk.sources({"src/build.cpp"}).include_directory("include", vbs::Visibility::public_); + build_support::compiler_warnings(sdk, project.context()); + + auto cli = project.executable("vbs"); + cli.sources({"src/main.cpp"}).link(sdk).link(library.target("Void::Configuration")); + build_support::compiler_warnings(cli, project.context()); +} diff --git a/build.profiles.cpp b/build.profiles.cpp new file mode 100644 index 0000000..418ad8d --- /dev/null +++ b/build.profiles.cpp @@ -0,0 +1,3 @@ +#include + +void profiles(vbs::Profiles &descriptions) { descriptions = vbs::default_profiles(); } diff --git a/cmake/VoidDependency.cmake b/cmake/VoidDependency.cmake new file mode 100644 index 0000000..22988bd --- /dev/null +++ b/cmake/VoidDependency.cmake @@ -0,0 +1,30 @@ +include(FetchContent) + +function(vbs_add_void_dependency) + # Function scope keeps dependency policy out of the embedding project's variables/cache. + set(VOID_ENABLE_TESTING OFF) + set(VOID_ENABLE_BENCHMARKS OFF) + set(BUILD_SHARED_LIBS OFF) + set(VOID_ENABLED_MODULES Configuration) + if(VBS_BUILD_TESTS) + list(APPEND VOID_ENABLED_MODULES Testing) + endif() + if(VBS_VOID_SOURCE_DIR) + get_filename_component(_vbs_void_source "${VBS_VOID_SOURCE_DIR}" ABSOLUTE + BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + if(NOT IS_DIRECTORY "${_vbs_void_source}" OR + NOT EXISTS "${_vbs_void_source}/CMakeLists.txt") + message(FATAL_ERROR "VBS_VOID_SOURCE_DIR must contain a VoidLibrary CMakeLists.txt") + endif() + message(STATUS "VBS development source override: ${_vbs_void_source}; " + "the pinned VoidLibrary revision ${VBS_VOID_REVISION} is bypassed") + FetchContent_Declare(voidlibrary SOURCE_DIR "${_vbs_void_source}") + else() + FetchContent_Declare(voidlibrary + GIT_REPOSITORY https://git.faumaray.com/Void/VoidLibrary.git + GIT_TAG "${VBS_VOID_REVISION}" + GIT_SHALLOW FALSE) + endif() + FetchContent_MakeAvailable(voidlibrary) + set(VBS_VOID_TESTING_SCRIPT "${voidlibrary_SOURCE_DIR}/cmake/VoidTesting.cmake" PARENT_SCOPE) +endfunction() diff --git a/cmake/bootstrap_config.hpp.in b/cmake/bootstrap_config.hpp.in new file mode 100644 index 0000000..f2b8fa0 --- /dev/null +++ b/cmake/bootstrap_config.hpp.in @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace vbs::bootstrap { +inline constexpr std::string_view version = "@PROJECT_VERSION@"; +inline constexpr std::string_view os = "@CMAKE_SYSTEM_NAME@"; +inline constexpr std::string_view architecture = "@CMAKE_SYSTEM_PROCESSOR@"; +} // namespace vbs::bootstrap diff --git a/docs/SDK.md b/docs/SDK.md new file mode 100644 index 0000000..adb8798 --- /dev/null +++ b/docs/SDK.md @@ -0,0 +1,118 @@ +# Bootstrap declaration SDK + +Status: implemented declaration subset, schema version 1. This documents the +[public header](../include/vbs/build.hpp) and the compiled +[example](../build.cpp), not a completed native build engine. The SDK is experimental; +future incompatible protocol changes must change its schema version. + +## Entry points and context + +`void build(vbs::Project&)` declares one concrete graph for one effective profile. +`void profiles(vbs::Profiles&)` declares available profiles. The current example +defines both and links them into `vbs_describe`; automatic loading of arbitrary +projects and optional-profile fallback belong to the future frontend. + +`vbs::default_profiles()` contains debug (`-O0`, `-g`) and release (`-O3`, `-DNDEBUG`). +`Profiles::add(name, options)` adds a distinct profile. `Profiles::resolve(name, +compiler, os, architecture)` returns a `ProfileContext` with those target facts and +the profile's options. Unknown names and invalid contexts throw +`std::invalid_argument`. + +`Project::context()` exposes name, compiler family, OS, architecture and effective +compile options. The bootstrap harness accepts `--profile debug|release` and +`--compiler gcc|clang`. OS and architecture come from its CMake configuration. +Selecting Clang here does not prove a Clang build or probe a target toolchain. + +## Targets and source membership + +`Project::executable(name)` and `static_library(name)` return handles to new target +records. Names must be nonempty and unique in the target namespace. Other target +kinds, cycle detection, usage propagation and command lowering are planned. + +| Operation | Recorded data | +| --- | --- | +| `target.sources({"src/main.cpp"})` | Explicit source files | +| `target.sources(project.glob("src/*.cpp"))` | A symbolic glob | +| `target.include_directory("include", visibility)` | Include path and visibility | +| `target.compile_option("-Wall")` | An ordered compile option | +| `target.link(other, visibility)` | A local target reference | +| `target.link(dependency.target("Name::Target"), visibility)` | An imported target reference | + +`Visibility` values are `private_`, `public_`, `interface_`; the default is private. +Source paths/patterns are retained without filesystem access. `SourceSet::file` +and `SourceSet::glob` are also available. Repeated operations append records; +semantic graph validation beyond the declaration invariants is future work. + +## Dependencies and options + +`Project::dependency(alias)` creates a unique dependency handle. It records one of: + +- `.git(url, vbs::Commit{sha})`: a nonempty URL and an exact 40-hex-digit revision. +- `.package(id, range)`: a nonempty package identity and version constraint string. + +`.cmake(options)` selects the CMake builder for a source dependency. Options retain +string, boolean or signed 64-bit integer types through `vbs::OptionValue`. Out-of-range +integers, empty option names and contradictory source/builder declarations fail. +Package range syntax is recorded but is not parsed or solved in this milestone. + +Imported target names are symbolic; the future provider validates that they exist. +An unset dependency source is permitted during declaration construction but fails +when serializing a complete project. Source downloads, CMake execution, TOML and +other providers are outside the implemented SDK. + +## Ownership and failures + +`Project` cannot be copied or moved. Target/dependency handles store a weak owner +identity and index, so adding more records does not invalidate handles. Cross-project +links and operations after owner destruction throw. An imported target also carries +its dependency's owner identity. + +`record()`, `targets()`, `dependencies()` and `Profiles::records()` expose borrowed +const views. Do not retain element references across container growth or after owner +destruction. Stable handles do not imply stable references into vectors. + +Declaration errors are exceptions; the example harness catches them, prints a +diagnostic and exits 2. Successful output is only JSON on stdout. The SDK is intended +for one configuration evaluation at a time; it does not promise concurrent mutation. +Ordinary user C++ executes as trusted code without a sandbox. + +## JSON protocol + +`Project::to_json()` emits a deterministic object with these fields: + +| Field | Shape | +| --- | --- | +| `schema_version` | Integer `1` | +| `profile` | `name`, `compiler`, `os`, `architecture`, ordered `compile_options` | +| `targets` | Ordered target records | +| `dependencies` | Ordered dependency records | + +Each target has `name`, `kind` (`executable` or `static_library`), `sources` +(`kind`: `file`/`glob`, `path`), `include_directories` (`path`, `visibility`), +`compile_options` and `links`. A link has `kind` (`local`/`imported`), `target`, +`dependency` (empty for local links) and `visibility` (`private`/`public`/`interface`). + +Each dependency has `name`, `source`, `builder` and `options`. A Git source has +`kind: "git"`, `location` and `revision`; a package source has `kind: "package"`, +`package` and `version`. Options are a key-sorted JSON object with their native +string/bool/integer types. An unspecified builder is the empty string. + +Declaration order is preserved; string escaping covers quotes, backslashes and +control characters. All strings, including keys, must be valid UTF-8 at serialization. +`to_json()` preserves valid Unicode and throws `std::invalid_argument` on malformed +UTF-8, including overlong sequences, surrogate encodings and values above U+10FFFF. +Declaration methods may record raw bytes, but they cannot cross the JSON boundary +without this validation. Non-UTF-8 filesystem names therefore require an explicit +future path-encoding policy; they are not silently replaced or reinterpreted. +This protocol currently describes inputs; it contains no resolved +packages, expanded files, actions, build results or capability claims. + +## Tests + +`vbs_sdk_tests` uses Void::Testing. CTest checks the complete suite, named registration, +CLI exit/output behavior and the four runtime contexts. The JSON test roundtrips +through Void::Json::Strict; CMake independently parses example output. Registration +checks ensure the aggregate test cannot pass merely because no SDK cases were found. + +See [verification](agent-workflow/VERIFICATION.md) for actual commands and results, +and [plan 01](roadmap/01-bootstrap-sdk.md) for milestone acceptance. diff --git a/docs/agent-workflow/APPROVED_PLAN.md b/docs/agent-workflow/APPROVED_PLAN.md new file mode 100644 index 0000000..20a4432 --- /dev/null +++ b/docs/agent-workflow/APPROVED_PLAN.md @@ -0,0 +1,43 @@ +# Approved implementation contract + +Date: 2026-11-25 +Approval: user said "Implement the plan" after the complete proposal. +Current delivery: repository initialization, detailed plans and compiling +bootstrap skeleton. The full product is a staged roadmap, not the claimed +capability of the first skeleton. +Baseline: empty project directory except .serena metadata; no prior Git HEAD. +Preflight: V-001-R1 READY after five contract corrections (see PREFLIGHT.md). +Technical default choices remain subject to evidence during implementation; +material scope changes require a recorded decision. + +VoidBuildSystem proposed delivery and contracts (NEW; no files implemented). + +Current delivery: initialize local Git main/MIT, preserve .serena metadata, add ignore rules; create README and project AGENTS, durable docs/agent-workflow state/decisions/tasks/verification plus docs/roadmap requirements/architecture/index and a detailed plan per subsystem. Add a C++26/GCC16 CMake>=4.0 bootstrap, vbs --help/--version using Void::Argparse::Parser, selected VoidLibrary Configuration+Testing module closure pinned at 9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5, static linkage for bootstrap, own-library tests disabled. Allow an explicit local-source override for the inspected checkout without modifying it. Add minimal declaration-only SDK, root build.cpp plus helper compiled by CMake into an example harness; test target/profile/dependency records and graph protocol version. The example includes the optional profile-definition callback and tests separate GCC/Clang evaluation contexts. No application execution, solver, watchers or registry claim in this skeleton; unsupported commands fail. Root CMake file is solely bootstrap, root build.cpp will become native self-build. Conventional and explicit helper membership and all included headers enter the configuration identity and package source manifest, so the same descriptor builds from a Git checkout or exported source archive with no .git. All functionality below gets separate detailed implementation plans, not implemented in current delivery. No remote creation, commit, push or deployment. + +Confirmed product: native Linux-first executor; host and build description C++26/GCC16, target GCC/Clang separate; no bespoke build language. Out-of-process void build(vbs::Project&) compiled against SDK and local helpers; seed compilation uses filesystem-discovered build-support/**/*.cpp, never Git tracking, plus explicit --build-source inputs; optional build.profiles.cpp defines void profiles(vbs::Profiles&) and otherwise SDK debug/release defaults apply; symbolic dependency handles avoid needing project packages to compile its declarations. The generated SDK driver first supports a profiles-discovery mode invoking the optional profiles callback, or SDK defaults. Root resolves profile inheritance and installed target toolchains/probes, then invokes the same host-compiled description executable once per selected effective ProfileContext. void build(vbs::Project&) observes project.profile()/project.toolchain()/project.target() runtime facts from that context; ordinary C++ preprocessor macros describe the host compiler and are not target selectors. Each evaluation emits its concrete graph, then providers resolve and actions lower for that context. Host-compilation identity and per-profile evaluation identities are separate. The profile callback cannot consume unresolved project packages. Recompile description on its source/header/toolchain changes; reevaluate configuration each graph reconciliation initially. Arbitrary C++ is trusted; no sandbox/complete hidden-I/O guarantee. + +Explicit target kinds: executable/static/shared/header-only/object libraries/custom actions/tests/install/export. Conventional include and src/source roots with explicit/glob/custom overrides and opt-in module-directory discovery; target kinds are declared, never guessed from a main function. Source membership is input, including additions/deletions/renames. Custom actions declare input/output files, command argv, environment and toolchain. Generated prerequisites must precede consumers, usage requirements distinguish visibility and preserve static private-link requirements/link order. No output collisions or action cycles. + +Profiles: effective options/toolchain/dependency context identify a profile; debug/release defaults and C++ custom profiles. Several requested targets and profiles build as the selected combination. Mutable products/state/editor generations are isolated below build/profiles/; immutable CAS may be shared under build/.vbs. Serialize execution per profile initially; allow profiles in parallel, with one overall concurrency budget. Compiler PCH/BMI/object/output directories never overlap. + +Snapshots: SHA-256 content identities, declared source/include/search roots and namespace membership, relevant symlinks and negative lookups. Compiler-visible deterministic metadata is part of the contract: an explicit reproducibility epoch (default Unix epoch zero) is included in action identity; set SOURCE_DATE_EPOCH, TZ=UTC and LC_ALL=C, canonicalize snapshot file timestamps to that epoch, and use capability-tested structured path-prefix maps for __FILE__/__BASE_FILE__/source_location/debug paths. Generated inputs get the same deterministic metadata policy. Time/path macro fixtures must show cached/uncached equivalence. Unsupported deterministic drivers fail the requested capability rather than silently weakening it. An explicit wall-clock/custom nondeterministic action mode disables both cached and incremental result reuse for affected actions. Private copies/reflinks, no hardlinks to editable sources; capture plus full revalidation with bounded retries before sealing immutable manifest. It freezes captured bytes, not a promise of atomic cross-file filesystem time. No implicit secret, repository metadata or build-output capture; external symlinks require declared roots. Generated outputs become immutable inputs after successful producer validation. Compiler/helper/sysroot environment identity must be covered; opaque non-declared actions are noncacheable and outside closed-input guarantee. Opaque paths cannot silently escape snapshot mapping. + +State/execution: transactional state via Void::Sqlite after its adapter is validated; content-addressed local cache, verified outputs, generation-based publication and crash recovery. SHA-256 via focused crypto adapter, candidate future VoidLibrary reuse. Direct argv process APIs, stdout/stderr drains and bounded logs, cancellation must kill ordinary descendants even if leader exits early. Known VoidLibrary cleanup gap handled by local Linux lifecycle wrapper and upstream-candidate record; no incidental upstream edit. Never mark partial/failed/cancelled outputs successful. Opaque binaries such as BMI/PCH include physical path/toolchain identity unless proven relocatable. + +Compdb: standard per-profile JSON with arguments/file/directory/output for all configured enabled targets even when only subset builds. Physical snapshot executions stay in exact execution records; editor projection maps structured path operands to editable sources and graph-compatible generated views, never string-replaces arbitrary flags. Root build/compile_commands.json and a managed project-root alias select a complete immutable generation. Preserve any unrelated existing user-owned file. Publish atomically with request tickets/revision checks and a project-level selector lock so stale operations cannot overwrite newer selections. Single-profile build reserves selection on acceptance and publishes after valid configuration; compile failure does not undo it. Multiple profiles require --editor-profile (one of selected profiles) before work. Explicit compdb use is a newer selection request. Watchers refresh their profile but do not steal selection. + +Automatic refresh: vbs build reconfigures/refreshes as necessary; vbs watch rebuilds; vbs compdb watch refreshes without engine-scheduled project-target/package builds, network fetches, lockfile writes or foreign configuration. It may compile/evaluate the trusted local build description and run known native compiler scanners/probes. It only reads validated cached provider exports/introspection and lock/package metadata; it never invokes CMake configure, Meson setup, Conan install, arbitrary generators or package builds. Changed provider inputs requiring such work yield an explicit needs-build/stale diagnostic. Arbitrary user C++ in the local description is trusted and may have its own side effects; no sandbox promise is made. File events are hints with periodic content/namespace reconciliation and overflow recovery. Deletion/addition/rename/profile/flag/manifest changes refresh metadata before target compilation. Missing generated artifacts get readiness diagnostics. Invalid config or unavailable/unresolved deps retain last valid DB with explicit stale/error status; never fabricate current commands or silently use incompatible generated outputs. + +Modern C++ v1: named-module P1689 scanning/dynamic ordering, partitions/cycle diagnostics, explicitly declared header units (Clang scanner currently only supports named modules), profile-specific BMI/PCH ownership, PCH/unity/LTO/sanitizers and compiler/stdlib capability probes. Module TUs excluded from unity; unsupported combinations fail explicitly. Test GCC16.2 and Clang23.1.3 target drivers using actual commands, and supported lower compiler baselines can be broadened later. Target language standard is independent of host. + +Dependencies: C++ inline declarations and vbs.deps.toml (TOML1.0 via toml++ initially) share source/provider/package/option records. Fields examples already shown to user: git/rev/builder/options or package/version; local path/archive checksummed sources and Conan provider also supported. Explicit load calls permit custom manifest filenames. Reject conflicting duplicate identities/values with origin diagnostics; compatible transitive version constraints solve jointly. Native deterministic PubGrub-style SemVer solver, one version per identity per profile and build/target context; configured registry authority is part of identity. vbs.lock stores exact sources, hashes, features/options/contexts, no credentials. A normal first build may create an absent lock; --locked disallows that. Existing incompatible declarations/options/contexts fail before actions and require explicit deps resolve/update; compatible pinned dependencies never silently upgrade. Project-wide lockfile publication uses a short project mutex plus compare-and-swap of the source lock revision, atomic replacement and revalidation of declaration/context fingerprints. Solving may happen outside the lock, but a changed revision triggers re-resolution/revalidation rather than overwriting another profile update. Each build pins one immutable lock payload/hash with its captured inputs; running builds never mix revisions. Offline mode reuses only verified data. Fetch transport/auth uses existing supported mechanisms; archive extraction and symlink/path traversal guarded. Native binaries keyed by toolchain/target/stdlib/ABI/options/linkage/CPU/sanitizers/LTO/dependency closure; incompatible binary uses source build or clear failure. Binary distribution is not remote build-cache scope. + +Foreign providers: initially invoke CMake/Meson/Conan2 in isolated per-source/profile/build directories and import typed usage/artifact/prerequisite metadata. Use CMake>=4.2 File API plus evaluated consumer-interface probes/exports, Meson configured introspection plus exported pkg-config/interface data, Conan2 component-aware generator with distinct build/host contexts. Require explicit interface description for gaps, never guess from a library filename or assume introspection is universally lossless. During full build operations their mutable source inputs/build definitions trigger reconfigure/rebuild as needed; metadata-only operations use the restricted read-only provider mode above. No direct re-execution of their source code in native engine yet. Provide new VbsDeps.cmake helper for FetchContent/CPM-style dependency declarations; resolve with native package manager, generate imported targets/package configs. No exact drop-in compatibility claim. Dependency CMake/TOML/Python adapters do not become native build languages. + +Registry v1 included: separate C++ HTTP service with immutable releases/source+binary blobs, filesystem CAS, SQLite metadata, versioned API, scoped publishing tokens, package ownership and reader/publisher/admin roles. Existing configured registry HTTPS+authenticated publication+content digests are v1 trust boundary; standalone publisher signing is future, not silently promised. Loopback development binding, reverse-proxy TLS deployment model; no actual exposure/deployment in current task. Web admin required: package/version search/detail, publish/yank operations, users/roles/tokens/audit/storage administration. Plain web assets served by C++ service use same auth API; HttpOnly session handling/CSRF/escaping and upload validation/quotas covered. Do not introduce a required third-party hosted service. Plan backup/restore and atomic blob/metadata publication. + +Detailed roadmap documents: Bootstrap and SDK; configuration frontend; target/usage graph; profiles/toolchains; snapshots/invalidation; execution/scheduling; state/local cache; modules and compiler features; compilation database/editor selection; build+metadata watchers/CLI; TOML/model/solver/lock; fetching and binary packages; install/export; CMake/Meson/Conan providers; CMake-facing bridge; registry server; registry web UI; testing/benchmarks/CI; self-hosting and VoidLibrary migration; later native foreign graph translation/platform ports. Each gets goals/non-goals, architecture/interfaces, dataflow/invariants/failures, Void reuse/upstream candidates, dependency DAG, exclusive write ownership/configured role, implementation sequence and testable acceptance/commands with truthful status. + +Phases: initial docs+bootstrap; core native/snapshots/profiles/compdb; native self-host through stage0->stage1->stage2 and VoidLibrary native migration; full modern C++ and package/adapters/bridge; registry API/UI and full-v1 hardening. Some are parallel after frozen contracts. All selected v1 features remain release gates; later native graph translation, Windows/macOS and remote caching/distributed execution are separately planned future work. Translator must prove complete graph support for a documented subset or explicitly use foreign fallback; compile_commands is not a build graph. + +Initial checks (NEW planned after files exist): dev cpp-gcc -c cmake -S . -B build/bootstrap -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DVBS_VOID_SOURCE_DIR=/home/faumaray/Projects/VoidLibrary ; dev cpp-gcc -c cmake --build build/bootstrap ; dev cpp-gcc -c ctest --test-dir build/bootstrap --output-on-failure ; CLI help/version/error and SDK example tests. Local override/path is test convenience, committed defaults pin upstream. Validate both default pinned upstream fetching in a separate clean bootstrap directory and the local override, without widening permissions on a fetch failure. Review actual nonzero generated test registration and count because Void tests use CMake scanner; unique test stems avoid known collision. A future native C++ registration generator replaces CMake during strict self-host testing. No full project build/test yet; root observed syntax-only GCC check success for Void Argparse/Testing headers + reflection, and tool versions. Strict native self-host stages rebuild VBS plus its required VoidLibrary closure in clean stage directories, run tests, and demonstrate no CMake use or reuse of bootstrap-produced project artifacts after the shim stage. No bit-identical binary claim is required. Future adversarial tests include time/path macro equivalence, concurrent lock updates and changed declarations, no-Git helper discovery, forbidden foreign configure during metadata watch, per-profile target facts, snapshot mutation/symlink/header shadowing, removed archive members, modules, selector races/crash recovery, TOML conflicts/solver oracle/lock/offline/ABI, foreign public/private linkage, registry auth/uploads/XSS/CSRF, stage self-hosting. diff --git a/docs/agent-workflow/DECISIONS.md b/docs/agent-workflow/DECISIONS.md new file mode 100644 index 0000000..ebbb14c --- /dev/null +++ b/docs/agent-workflow/DECISIONS.md @@ -0,0 +1,48 @@ +# Decision ledger + +All dates: 2026-11-25. CONFIRMED means user-selected; APPROVED DEFAULT means root +technical choice included in the approved plan; REVISED records preflight corrections. + +| ID | Status | Decision and consequence | +| --- | --- | --- | +| D-001 | CONFIRMED | Linux first, native executor, GCC/Clang target drivers; other desktop OSes later. | +| D-002 | CONFIRMED | C++26/GCC16 host baseline matching VoidLibrary. | +| D-003 | CONFIRMED | Ordinary build.cpp with cpp/hpp helpers; root may choose internal API. | +| D-004 | CONFIRMED | Conventional include/src/source plus explicit/glob/custom layouts. | +| D-005 | CONFIRMED | Core targets plus modules/header units/PCH/unity/LTO/sanitizers in full v1. | +| D-006 | CONFIRMED | Reliable one-shot builds and explicit rebuilding watch. | +| D-007 | CONFIRMED | Content verification and immutable execution input snapshots. | +| D-008 | CONFIRMED | Multiple selected targets/profiles coexist inside one build directory. | +| D-009 | CONFIRMED | Per-profile compile databases, manual swapping, automatic refresh and independent metadata watcher. | +| D-010 | CONFIRMED | Editor selection follows latest single-profile build; multiple profiles need explicit editor-profile. | +| D-011 | CONFIRMED | Native package manager owns version solving and source/binary packages. | +| D-012 | CONFIRMED | Dependency declarations in C++ and parsed files such as TOML. | +| D-013 | CONFIRMED | CMake/Meson/Conan run-and-import first; native foreign graph translation later. | +| D-014 | CONFIRMED | Both C++ convenience dependency API and CMake-facing FetchContent/CPM-style integration. | +| D-015 | CONFIRMED | Hosted registry service plus web administration required. | +| D-016 | CONFIRMED | Void-first with focused extra dependencies/wrappers; mark upstream candidates. | +| D-017 | CONFIRMED | Local cache first; remote build cache/distributed workers deferred. | +| D-018 | CONFIRMED | Self-hosting required; CMake shim allowed for seed; self + VoidLibrary first adoption targets. | +| D-019 | CONFIRMED | Initial delivery includes detailed plans and compiling bootstrap skeleton. | +| D-020 | CONFIRMED | MIT license; use existing dev / dev cpp-gcc environment. | +| D-021 | APPROVED DEFAULT | CLI vbs; separate configuration process with versioned declarative protocol. | +| D-022 | REVISED | Profile discovery then per-context evaluation; host preprocessor is not a target selector. | +| D-023 | REVISED | Helpers selected by filesystem membership, including archive/no-Git operation. | +| D-024 | REVISED | Canonical timestamps/epoch/path mapping; nonreuse for nondeterministic actions. | +| D-025 | REVISED | Atomic revision-checked project lock updates and one immutable lock revision per build. | +| D-026 | REVISED | Metadata watcher never runs foreign configure/build/install/fetch or lock updates. | +| D-027 | APPROVED DEFAULT | SHA-256 identities, SQLite adapter, TOML1.0/toml++ and native PubGrub-style solving planned. | +| D-028 | APPROVED DEFAULT | C++ registry with filesystem CAS and SQLite; ordinary browser assets use same authenticated API. | +| D-029 | APPROVED DEFAULT | Loopback development, reverse-proxy TLS for eventual hosting; deployment separately authorized. | +| D-030 | APPROVED DEFAULT | Compdb editor projection is distinct from exact snapshot execution records. | +| D-031 | APPROVED DEFAULT | Source bootstrap pin 9931c5f; static selected Void modules; no incidental VoidLibrary changes. | + +## Approval and deferred actions + +The user approved the complete proposal with "Implement the plan". This authorizes +the initial local delivery described in APPROVED_PLAN.md, not a claim that the entire +v1 roadmap is finished. No remote repository, commit, push, deployment or changes to +the global Nix-managed agent installation have been requested. + +No deadline, paid infrastructure or performance SLA was supplied. Prefer measured +correctness first; document measurements before promising numerical performance. diff --git a/docs/agent-workflow/PREFLIGHT.md b/docs/agent-workflow/PREFLIGHT.md new file mode 100644 index 0000000..c64295b --- /dev/null +++ b/docs/agent-workflow/PREFLIGHT.md @@ -0,0 +1,36 @@ +# Architecture preflight + +Date: 2026-11-25. Mode during review: read-only planning. +Configured roles: astra_planner and astra_researcher at XHigh; fresh +astra_reviewer at XHigh. Runtime model identity was not independently exposed. +No application diff existed during preflight. + +P-001 mapped the native engine, action/input invariants and self-host stages. +R-001 inspected VoidLibrary 9931c5f and identified process-cleanup, basic-watcher, +test-registration and hashing/persistence boundaries. +P-002 reconciled immutable snapshots, package/registry scope, profiles and +editor projection with the bounded bootstrap. + +## V-001: CHANGES_REQUIRED + +| Finding | Required correction | Disposition in V-001-R1 | +| --- | --- | --- | +| P1 compiler-visible time/path inputs | Explicit epoch, canonical timestamps, path mappings, nonreuse for nondeterministic actions | Resolved at contract level | +| P1 shared lock updates and stale declarations | Project coordination, compare revisions, atomic publication, validate context, pin one lock payload per build | Resolved at contract level | +| P2 helpers outside Git checkout | Filesystem membership plus source manifests and explicit helper inputs | Resolved at contract level | +| P2 metadata-only provider side effects | Only cached foreign metadata; no foreign configure/build/install/fetch; explicit stale status | Resolved at contract level | +| P2 host/target evaluation semantics | Profile discovery followed by separate evaluations with runtime target/toolchain facts | Resolved at contract level | + +## V-001-R1: READY — preflight only + +The reviewer found all five previous issues resolved and no new material +blockers. This is approval of planning contracts, not runtime correctness, +implementation acceptance, release, push or deployment. +It requires later integrated-diff review and observed build/test evidence. + +Source evidence: assigned VoidLibrary source/headers/CMake files at the pinned +HEAD, with stale/partial graph results checked against source. No full build +or runtime tests were run during preflight. The root's syntax-only GCC probe +passed; it did not establish linkage or runtime behavior. + +Final implementation review will be recorded separately. diff --git a/docs/agent-workflow/REVIEW.md b/docs/agent-workflow/REVIEW.md new file mode 100644 index 0000000..323e6a8 --- /dev/null +++ b/docs/agent-workflow/REVIEW.md @@ -0,0 +1,68 @@ +# Integrated review and finding dispositions + +Scope: initial bootstrap, declaration SDK, tests and complete planning documents. +Baseline: unborn main; actual added files were reviewed, not an empty git diff. +Reviewer: configured astra_reviewer at XHigh, independent of implementation. +Runtime model identity was not independently reported. No source changes were made +by the reviewer. Task contracts: [V-002](tasks/V-002.md), [V-002-R1](tasks/V-002-R1.md). + +## V-002 — CHANGES_REQUIRED + +The reviewer inspected actual code, tests, README/SDK contracts and all twenty +plans. It found no P0/P1 defects and one P2 encoding defect. Existing bootstrap +behavior, selected dependency pin/modules, meaningful test registration and honest +current/future boundaries were accepted subject to that correction. + +The reviewer directly ran all four CMake contract scripts against the pinned +bootstrap executables: exit 0, initially 15 SDK cases, 16 CLI cases, four runtime +contexts and six descriptor error cases. It checked dependency HEAD/cleanliness, +generated linkage/registration and prior build evidence. It did not repeat a fresh +configure/build; root and worker supplied that observed evidence. + +### P2: invalid UTF-8 could escape through JSON serialization + +The original quote() escaped ASCII controls but copied other bytes unchanged. +A nonempty target name containing 0xff therefore produced a result that strict +UTF-8 consumers could not decode. Void's JSON parser did not independently validate +those raw bytes, so the original roundtrip test could miss the problem. + +Root reproduced this before editing: a compiled SDK harness exited 0 and emitted +bytes rejected by Python's strict UTF-8 decoder. Root then added centralized UTF-8 +validation before quoting, preserved valid Unicode, rejected malformed sequences +with std::invalid_argument and documented the encoding boundary. No new dependency +was added. The SDK remains a declaration subset with no path transcoding policy. + +Two new SDK cases cover valid multibyte boundaries and 21 malformed sequences +across names, source paths, option keys/values and profile flags. Registration/count +checks now require 17 cases. Both build modes and all four CTest checks passed after +the change. An independent one-off Python oracle agreed on 71,803 inputs, including +every one/two-byte string, explicit boundaries and deterministic random samples. + +Disposition: correction implemented and verified by root; accepted by V-002-R1. + +## V-002-R1 — READY + +The independent reviewer inspected the changed validator, tests, registration and +encoding contract. It confirmed bounds/unsigned-byte handling, rejection of malformed +Unicode, preservation of valid scalars and central validation for every JSON string. +No new material findings; the original P2 is resolved. + +It independently ran RunSdkTests.cmake and SdkRegistration.cmake against the pinned +binary, both exit 0: 17/17 cases and expected registrations. A separate read-only +Python subprocess check of the existing oracle passed 26 inputs (11 valid roundtrips, +15 exact rejections, including 0xff). An initial reviewer wrapper assertion omitted +the harness's prefix marker; inspecting output and correcting that assumption fixed +the check without a product change. + +The reviewer checked both final build and CTest logs: local and pinned modes passed +4/4. It did not repeat rebuilds/formatting/full CTest or root's larger oracle; those +remain root-observed evidence. Conclusions use actual source because graph coverage +is stale. The reviewer changed no files and is now closed. No further correction +review was required. Initial delivery is accepted; no unresolved P0/P1/P2 findings. + +## Acceptance boundary + +A READY result applies to this initial milestone only. Native builds, automatic +metadata/profile selection, dependencies/TOML resolution, watchers, registry and +self-hosting remain future implementation. Review never authorizes staging, commit, +push, deployment or unrelated changes. diff --git a/docs/agent-workflow/STATE.md b/docs/agent-workflow/STATE.md new file mode 100644 index 0000000..5c0aabf --- /dev/null +++ b/docs/agent-workflow/STATE.md @@ -0,0 +1,40 @@ +# Development state + +Updated: 2026-11-25 +Branch: main +HEAD: unborn; no commits +Stage: VERIFIED — initial bootstrap and documentation complete +Baseline: only .serena metadata existed; it is preserved and ignored. +Git initialized locally. No remote configured, no staging/commit/push authorized. + +## Completed delivery + +- Root: integrated source inspection, verification evidence and final acceptance. +- T-001: compiling bootstrap and declaration SDK complete; source ownership + returned to root. The configured sol_implementer worker is closed. +- README, SDK contract, requirements, architecture and twenty plans are written. +- V-002 found one P2 UTF-8 serialization defect; root reproduced and corrected it. + V-002-R1 returned READY with no remaining material findings. See REVIEW.md. +- Both implementation and review workers are closed. No active file ownership + remains outside root; no required initial-delivery work remains. + +## Next milestone + +Implement the native configuration frontend and prerequisite graph/profile models +from plans 02–04, with the snapshot/state contracts from 05/07. Prepare new scoped +tasks against the actual repository and obtain the next milestone's scope approval. +The existing initial approval does not mark future features complete. No unanswered +decision blocks the delivered bootstrap and plans. + +## Confirmed boundaries + +See APPROVED_PLAN.md and PREFLIGHT.md. The initial skeleton must report its +limited capabilities honestly. Native execution, TOML resolution, snapshots, +watching, packages, registry and self-hosting remain roadmap work. + +## Evidence + +Local-source and independent pinned-upstream bootstrap builds passed. Each ran +four CTest checks; the final SDK suite executes 17 cases. Exact-source formatting and +documentation/requirement checks passed. See VERIFICATION.md for commands, +provenance and limits. No native build or native self-host has run. diff --git a/docs/agent-workflow/TASKS.md b/docs/agent-workflow/TASKS.md new file mode 100644 index 0000000..d5828f9 --- /dev/null +++ b/docs/agent-workflow/TASKS.md @@ -0,0 +1,35 @@ +# Task graph and ownership + +Baseline: main, unborn HEAD. Shared checkout; workers do not have isolated worktrees. + +| Task | Status | Owner | Exclusive writes / dependencies | +| --- | --- | --- | --- | +| T-ROOT-INIT | COMPLETE | Root Astra | Git initialization, LICENSE, AGENTS.md, ignores; preserves .serena | +| T-DOC | COMPLETE / VERIFIED | Root Astra | README.md; docs/SDK.md; twenty plans; workflow records; integrated review accepted | +| T-001 | COMPLETE / VERIFIED | sol_implementer (configured XHigh), now closed | 19 source/config/test files; full spec in tasks/T-001.md; ownership returned to root | +| T-INTEGRATE | COMPLETE / VERIFIED | Root Astra | Actual additions inspected, local + pinned builds, test evidence, source override integrity; review correction verified | +| V-002 | CHANGES_REQUIRED, resolved by R1 | Fresh astra_reviewer (configured XHigh) | One P2 UTF-8 defect; root correction in source/tests/docs; see REVIEW.md | +| V-002-R1 | READY / CLOSED | Same independent astra_reviewer | Correction and 17-case registration accepted; full linted spec in tasks/V-002-R1.md | + +T-001 owns root CMake/shared SDK during bootstrap only. After handoff, root serializes +changes to those interfaces, dependency pins and generated registrations. Worker +used build/worker-bootstrap; root used build/bootstrap-pinned. No active worker +owns source writes. All workers are closed; root accepted the initial milestone. +Role routing is configured, not independently model-verified. Later roadmap work +requires new assignments; these completed tasks grant no continuing write ownership. + +## Subsequent implementation waves + +The numbered roadmap documents specify interfaces, prerequisites and proposed +bounded ownership. They are not live worker assignments. Write and lint a complete +task contract against the then-current HEAD before dispatching any future wave. + +A: bootstrap -> native frontend + graph + profiles + snapshots/state. +B: those contracts -> scheduler + compiler drivers; compdb can use graph fixtures. +C: native core + basic dependency import -> staged self-host and VoidLibrary. +D: complete modern C++ + solver/fetch/packages + all foreign adapters/CMake bridge. +E: package/API contracts -> registry service -> administration UI; v1 hardening. +F: explicitly scoped foreign graph translation and additional OS ports. + +Use Astra for tightly coupled snapshot/execution/module risks; Sol for bounded +features; fresh reviewers for preflight and final integrated acceptance. diff --git a/docs/agent-workflow/VERIFICATION.md b/docs/agent-workflow/VERIFICATION.md new file mode 100644 index 0000000..ea48904 --- /dev/null +++ b/docs/agent-workflow/VERIFICATION.md @@ -0,0 +1,155 @@ +# Verification record + +Record cwd, exact command, exit status, results and limits. Planned checks are not +evidence. Never treat a zero-test run as test success. + +## Planning evidence (observed) + +- VoidLibrary local main and remote main matched + 9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5; tracked tree clean. +- dev cpp-gcc exposed GCC16.2.0, CMake4.4.4, Ninja1.13.2, Meson1.12.1. +- dev cpp exposed Clang23.1.3. Conan was absent from cpp-gcc. +- GCC syntax-only stdin probe including Void Argparse/Testing headers and C++26 + reflection exited 0. It did not link or execute a program. +- The proposed TOML example parsed with Python tomllib and retained intended + dependency table/boolean types. +- Architecture review V-001-R1 READY, preflight only. + +## Initial implementation + +- cwd /home/faumaray/Projects/VoidBuildSystem: + git init -b main -> exit 0, unborn main. +- T-001 tasklint -> exit 0. Semantic contract checked by root. +- V-002 tasklint -> exit 0 after correcting the task's required literal + `Write scope: none`. Semantic contract checked by root. +- V-002-R1 tasklint -> exit 0; root checked semantics and scope. +- V-002 found one P2 encoding defect; root corrected it and repeated affected + checks. V-002-R1 returned READY; no material findings remain. See REVIEW.md. + +## Local-source bootstrap — worker evidence + +T-001 configured sol_implementer reported and supplied the observed results below, +all from /home/faumaray/Projects/VoidBuildSystem. Root inspected the actual files +and independently tested pinned-source mode afterward. + +```sh +dev cpp-gcc -c cmake -S . -B build/worker-bootstrap -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DVBS_VOID_SOURCE_DIR=/home/faumaray/Projects/VoidLibrary +dev cpp-gcc -c cmake --build build/worker-bootstrap --parallel 2 +dev cpp-gcc -c ctest --test-dir build/worker-bootstrap --output-on-failure +``` + +All three exited 0; CTest passed 4/4. The override's tracked source remained clean. +Void Testing headers produced missing-field-initializer warnings, without test or +build failures. No dependency code was changed to suppress them. + +## Pinned upstream bootstrap — independent root evidence + +Same cwd. Default HTTPS FetchContent populated a separate clean build directory: + +```sh +dev cpp-gcc -c cmake -S . -B build/bootstrap-pinned -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON +dev cpp-gcc -c cmake --build build/bootstrap-pinned --parallel 2 +dev cpp-gcc -c ctest --test-dir build/bootstrap-pinned --output-on-failure +git -C build/bootstrap-pinned/_deps/voidlibrary-src rev-parse HEAD +git -C /home/faumaray/Projects/VoidLibrary diff --stat HEAD +``` + +All exited 0. The initial asynchronous build's final status was unavailable after +context handoff, so root repeated the build command: Ninja reported no work to do +and exited 0. CTest then passed 4/4. The fetched HEAD was exactly +9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5; the local source's tracked diff was empty. +Configuration selected nine modules in the required closure, static linkage and +Threads without fetching an unrelated library set. + +## Behavior verified + +| Check | Observed coverage | +| --- | --- | +| vbs_sdk_tests | Final 17 cases executed and passed: records, typed options, validation, source spelling, vector growth, owner lifetime, cross-owner rejection, JSON/control/UTF-8 handling and example contexts | +| vbs_sdk_registration | Expected named cases listed; a named JSON case executed; zero registration cannot pass | +| vbs_cli_contract | 16 exact exit/stdout/stderr contracts, including no args/help/version and unsupported/invalid requests | +| vbs_description_contract | Four debug/release × GCC/Clang runtime contexts, expected JSON contents/types, six error contracts | + +Before review, root also ran `build/bootstrap-pinned/bin/vbs_sdk_tests --no-color`: exit 0, +15 discovered and 15 passed. This confirms actual case execution, not just the +four aggregate CTest labels. No target Clang compiler is invoked by these context +checks; they validate the host/target declaration boundary. + +## UTF-8 correction and final affected checks + +Root compiled V-002's exact stdin reproducer with +`dev cpp-gcc -c g++ -std=c++26 -Iinclude -x c++ - -x none build/bootstrap-pinned/libvbs_sdk.a -o build/bootstrap-pinned/utf8-repro`. +Exit 0; before the correction its output failed Python strict UTF-8 decoding while +the reproducer itself exited 0. This established the review finding at runtime. + +After correction, root repeated the following, each exit 0: + +```sh +dev cpp-gcc -c cmake --build build/bootstrap-pinned --parallel 2 +dev cpp-gcc -c cmake --build build/worker-bootstrap --parallel 2 +dev cpp-gcc -c ctest --test-dir build/bootstrap-pinned --output-on-failure +dev cpp-gcc -c ctest --test-dir build/worker-bootstrap --output-on-failure +``` + +Build output was captured in each directory's review-build.log. Both CTest runs +passed 4/4, with the expanded 17-case suite. The exact-file clang-format check below +also passed again. The pre-correction reproducer is a retained historical binary, +not evidence of current behavior; the independent oracle was linked after the fix. + +Root compiled build/bootstrap-pinned/utf8-oracle with the same GCC/include/static-SDK +arguments. Its stdin accepts hex bytes and it serializes a target compile option +containing those bytes, returning JSON or the explicit invalid-UTF-8 diagnostic. +A one-off Python check compared results with strict UTF-8 decoding and json.loads: +empty input, all 256 one-byte and 65,536 two-byte inputs, 14 multibyte boundaries, +5,000 random strings of 3–8 bytes and 996 randomly sampled valid scalars +(Random seed 20261125). Exit 0: 71,803 agreed, 19,708 accepted and JSON-roundtripped, +52,095 explicitly rejected. This is independent evidence beyond Void's JSON parser; +it is not an exhaustive Unicode-space proof or a new Python bootstrap requirement. + +## Formatting and documentation + +Root ran this exact-file check, exit 0: + +```sh +dev cpp-gcc -c clang-format --dry-run --Werror include/vbs/build.hpp src/build.cpp src/main.cpp src/describe.cpp build.cpp build.profiles.cpp build-support/defaults.cpp build-support/defaults.hpp tests/SdkDeclarations.cpp tests/ExampleContexts.cpp +``` + +A read-only Python check enumerated README.md, AGENTS.md and docs/**/*.md; checked +relative Markdown link destinations; asserted twenty numbered plans and their +seven required sections; compared plan R-IDs with REQUIREMENTS.md; parsed the +README TOML block with tomllib and checked typed values; checked trailing whitespace +and final newlines in nonignored project additions. Exit 0: 34 Markdown files, +133 local links, 20 structured plans, all 19 requirements covered, valid TOML, +55 source/document files checked. Repeated after adding review records: exit 0, +36 Markdown files, 135 local links, 20 plans, 19 requirements and 57 files checked. +All three persisted task contracts passed tasklint together. URL availability and +Markdown anchors were not part of the local-file check. + +`git check-ignore build-support/defaults.cpp build/worker-bootstrap/bin/vbs` +listed only the build executable. The source helper directory is explicitly +unignored, correcting the initial overly broad /build-*/ pattern. + +## Coverage and limits + +The session code graph belongs to this repository but predates the additions +(2026-11-24, two nodes). search_graph found no SDK symbols. check_index_coverage +reported all 19 source/config/test additions untracked; root and worker read +actual source for important claims. No stale graph was treated as code evidence. + +Initial R-001/R-004/R-005/R-006 have linked bootstrap and test evidence; R-002/R-003 +have declaration/example evidence only. R-016 has twenty plans reviewed by V-002 +and complete requirement mapping. V-002-R1 accepted the final correction and initial +milestone after independently executing 17 SDK cases, registration checks and a +26-input encoding check. Full details and evidence limits are in REVIEW.md. +R-017 has LICENSE. Other product requirements remain planned, not verified features. + +Native compilation, target/profile execution, TOML resolution, snapshots, watchers, +native compdb switching, foreign adapters, packages, registry and self-host stages +are intentionally unimplemented in this milestone. Their planned tests have not run. +Conan is absent from the inspected dev environment. No remote repository, staging, +commit, push or deployment occurred. Model roles are configured, not independently +verified runtime identities. + +Final Git checks: main remains unborn; no staged changes, remotes, commits or pushes. +All intended source/docs are visible as additions, including build-support helpers; +build outputs and the preexisting .serena directory remain ignored/preserved. diff --git a/docs/agent-workflow/tasks/T-001.md b/docs/agent-workflow/tasks/T-001.md new file mode 100644 index 0000000..fe42b2e --- /dev/null +++ b/docs/agent-workflow/tasks/T-001.md @@ -0,0 +1,57 @@ +# Implement the compiling bootstrap and declaration SDK +Task ID: T-001 +Role: sol_implementer +Status: APPROVED + +## 1. Context and baseline +Root/cwd /home/faumaray/Projects/VoidBuildSystem, main, unborn HEAD. Root just initialized Git. Preexisting .serena metadata is preserved and ignored; no application files existed. Root created AGENTS.md, LICENSE, .gitignore and docs/agent-workflow records. Read those applicable instructions. User approved "Implement the plan": initial delivery is detailed plans plus a compiling bootstrap skeleton, NOT the entire future build engine. P-001/P-002 planning and V-001-R1 fresh preflight READY completed; records persisted. Requirements: R-001 C++/VoidLibrary, R-002 cpp/hpp descriptions, R-003 profiles/host-target split, R-004 honest bootstrap, R-005 tests, R-006 pinned source. All interfaces below are NEW. +## 2. Objective and deliverables +Create a real CMake-built vbs CLI, minimal declaration SDK, compile-tested root build.cpp/build.profiles.cpp with reusable helper cpp/hpp, a description harness emitting versioned JSON, and meaningful Void::Testing/CTest tests. Complete local-source bootstrap verification. Root separately writes all documentation and runs pinned-source integration. +## 3. Scope and non-goals +Implement only declaration/data recording and bootstrap infrastructure. Do not implement native compilation, snapshots, source glob expansion, automatic config compilation, solver, TOML loading, watchers, native compdb selection or registry. Do not fake those features. CLI native build/test/compdb/deps/watch requests must fail clearly with nonzero status. Do not modify VoidLibrary or global installation. +## 4. Files to inspect +AGENTS.md and docs/agent-workflow/APPROVED_PLAN.md/PREFLIGHT.md in new repo. Dependency /home/faumaray/Projects/VoidLibrary main HEAD 9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5, tracked clean, matches remote. Relevant verified paths: CMakeLists.txt (CMake>=4, C++26, selectable VOID_ENABLED_MODULES), cmake/Module.cmake, cmake/VoidTesting.cmake and VoidTestScanner.cmake, include/Void/Configuration/Argparse.hpp and src/Configuration/Argparse.cpp, src/Configuration/module.cmake, src/Testing/module.cmake, include/Void/Testing/Test.hpp and Assert.hpp, tests/standalone/Configuration/Argparse.cpp. Optional JSON test validator include/Void/Data/StrictJson.hpp already exists. Never inspect dependency .env/WG.conf/keys/.serena or other untracked data. +## 5. Write ownership and coordination +Write scope: CMakeLists.txt; cmake; include; src; tests; build.cpp; build.profiles.cpp; build-support; .clang-format +You share this checkout; root is writing README/AGENTS/LICENSE/ignores and all docs concurrently. Do not edit those or revert anyone's work. No commit/stage/push, branch switches, worktrees, activation/index changes or children. Your build artifacts belong only under build/worker-bootstrap; root uses separate build directories. Root owns shared files/pins after handoff. +## 6. Implementation or investigation approach +1. Inspect existing dependency APIs before coding. Use CMake>=4.0, project version 0.1.0, C++26, no extensions, GCC16+ host as supported bootstrap. Propagate required -freflection to own targets when using GNU>=16; useful early compiler diagnostics. +2. FetchContent default public HTTPS Git https://git.faumaray.com/Void/VoidLibrary.git at exact SHA 9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5 (not floating/shallow incompatible pin). VBS_VOID_SOURCE_DIR optional local source override, validate directory/CMakeLists and document bypass in diagnostic. Use explicit local MODULE selection Configuration;Testing (Testing only when VBS_BUILD_TESTS ON is reasonable), VOID_ENABLE_TESTING OFF, VOID_ENABLE_BENCHMARKS OFF, BUILD_SHARED_LIBS OFF for dependency without changing unrelated parent state. No root-wide dependency download/install outside build artifacts. +3. CLI uses actual Void::Argparse::Parser, help/version exit0, no args help0, invalid/unsupported requests exit2 and useful message. Parser returns help text as unexpected; treat standalone -h/--help as success deliberately. Avoid claiming help-listed roadmap commands are implemented. +4. Add a lightweight ordinary C++ SDK per interfaces below. Handles must survive vector growth, cannot accidentally refer to another Project, and cannot outlive or be silently rebound to moved owner storage. Prefer index+owner handles with owner nonmovable if simplest. No deferred graph callbacks crossing the process boundary. +5. Root build.cpp describes at least vbs_sdk static library and vbs executable, selected VoidLibrary dependency, source sets/public include dirs and link relationships. build.profiles.cpp defines debug/release defaults; build-support cpp/hpp supplies reusable helper. Context-dependent flag difference must be driven by runtime context.compiler, never host preprocessor. +6. Add vbs_describe example executable built by CMake from root descriptor, profiles and helpers. It accepts --profile debug|release and --compiler gcc|clang, constructs runtime context and emits graph JSON; it DOES NOT invoke those target compilers. Unknown profile/compiler exit2. It proves SDK/example boundary, not a general native configure command. +7. Use Void::Testing for SDK tests, explicit void_add_tests(target) loaded from dependency script when needed, with unique source stems. Add CTest CLI process contract checks checking exact exit/output, not WILL_FAIL alone. Inspect real runner options before testing registration count; assert at least the expected named cases execute. +8. Format exact owned C++ files with dev cpp-gcc -c clang-format -i , run local-source configure/build/ctest in assigned directory, fix issues within scope. No additional libraries needed for this skeleton. +## 7. Interfaces and data contracts +Public umbrella include/vbs/build.hpp, namespace vbs; free entry void build(vbs::Project&) and void profiles(vbs::Profiles&) for optional profile source; SDK supplies debug/release defaults when custom profiles absent in later native frontend. +Define explicit ProfileContext with name, compiler family (gcc/clang), target OS and architecture, effective compile options. Project::context() returns runtime facts. Profiles records distinct named profile descriptions. A helper resolves name + compiler override to an effective context, rejecting unknown names. +Project::executable(name), static_library(name), dependency(name), glob(pattern) are declaration operations. Target handles support sources(source set), include_directory(path, visibility), compile_option(string), link(local target or imported target, visibility). Default private linkage; visibility enum. Dependency handles support git(url, Commit{sha}), cmake(option map), package(id, range), target(exported_name). A SourceSet distinguishes explicit file and glob, retaining spelling without filesystem reads. Typed option values support string, bool and integer. +Use concrete records inspectable by tests. Reject duplicate/empty identifiers, invalid cross-project links and contradictory source-provider declarations. Full graph cycle/usage propagation belongs to later plan. +Graph serialization schema version 1: top-level schema_version, profile, targets, dependencies. Profile includes name/compiler/os/architecture and effective options. Targets include name/kind/source records/include directories/options/link records with visibility. Dependencies include name/source kind+location+revision OR package+version; builder and typed options. Escape JSON correctly; deterministic declaration order; integer schema_version (not string). Implement to_json(Project) or Project::to_json consistently and expose schema_version constant. Roundtrip tests with StrictJson can validate structure. +No TOML parser now: documentation will label project.dependencies("vbs.deps.toml") as planned. No filesystem enumeration or dependency download while constructing descriptors. +## 8. Dependencies and integration +Configuration closure observed: Core, Functional, System, Data, Time, LogState; Data also pulls Math; external Threads only. Testing optionally sees selected Configuration but no intentional Boost dependency. Verify actual CMake configuration. Root integrates final files and creates docs using your actual public names; return exact APIs/commands. root preflight has approved these bootstrap boundaries. +## 9. Edge cases security and performance +No shell command interpolation from user values. Avoid source-root writes for generated registrations, version information or compile_commands. Never hardcode /home/faumaray paths in defaults. Local override does not alter source dependency. File/test names must avoid scanner stem collisions. Reject malformed CLI input and cross-owner handles. Correctly escape quotes, backslashes, newline/control characters in JSON. Keep handles valid after additions. Installed/public configuration context is separate from target facts. Don't add silent fallbacks to downloaded/compiler versions. +## 10. Acceptance criteria +1. CLI builds/links with actual pinned/local VoidLibrary and implements help/version/error contracts. +2. Root example/helper/profile sources compile through CMake. +3. Same host-built descriptor emits different correct GCC/Clang and debug/release graph contents. +4. Serialization parses as schema v1, preserves typed option values and escaped strings; handles remain correct after container growth. +5. Real SDK tests register and execute nonzero cases; CLI process checks catch wrong exit status. +6. Unsupported native build/compdb/dependency/watch commands fail honestly. +7. No unowned files or external repository changes. +## 11. Verification commands and evidence +cwd /home/faumaray/Projects/VoidBuildSystem. Existing dev commands verified: dev cpp-gcc supplies GCC16.2/CMake4.4.4/Ninja1.13.2 and clang-format; dev cpp supplies Clang23.1.3. No old project runner existed. NEW commands once your scaffold creates targets: +dev cpp-gcc -c cmake -S . -B build/worker-bootstrap -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DVBS_VOID_SOURCE_DIR=/home/faumaray/Projects/VoidLibrary +dev cpp-gcc -c cmake --build build/worker-bootstrap --parallel 2 +dev cpp-gcc -c ctest --test-dir build/worker-bootstrap --output-on-failure +Run actual executable paths discovered from generated targets (prefer build/worker-bootstrap/bin/vbs, vbs_describe, vbs_sdk_tests as runtime output locations). Record outputs and test count. These write only build artifacts plus your owned files. Root will independently verify pinned upstream mode. No Nix flake evaluation beyond user-authorized dev wrapper. +## 12. Constraints and stop conditions +Stop and report unexpected source mutation, scope conflicts, missing dependency APIs or unsupported compiler prerequisites. Do not weaken tests or fix VoidLibrary. After two failed repair cycles on the same issue, stop that approach and return errors/current owned diff so root can assign Astra re-diagnosis. No models/roles substitutions, no extra agents. +Graph source discovery for dependency: exact-file search only; index home-faumaray-Projects-VoidLibrary is stale/partial, use check_index_coverage for each relied source, verify reported missed lines directly and do not reindex. Keep active Serena project VoidBuildSystem. +## 13. Authorization and decisions +User approved full proposal with "Implement the plan"; current deliverable is docs + bootstrap. MIT confirmed. Root owns docs and integration. Jev sol_implementer candidate is compatible; role configured XHigh, runtime identity not independently verified. No deployment/stage/commit authorization. +## 14. Return format +Return T-001 DONE/BLOCKED/PARTIAL, files changed, public APIs and executable paths, actual commands/cwd/exit and test counts, deviations, unrun checks, residual risks, integration notes. Do not spawn children. diff --git a/docs/agent-workflow/tasks/V-002-R1.md b/docs/agent-workflow/tasks/V-002-R1.md new file mode 100644 index 0000000..cea65af --- /dev/null +++ b/docs/agent-workflow/tasks/V-002-R1.md @@ -0,0 +1,66 @@ +# Re-review the UTF-8 graph serialization correction +Task ID: V-002-R1 +Role: astra_reviewer +Status: APPROVED + +## 1. Context and baseline +Repository/cwd /home/faumaray/Projects/VoidBuildSystem, main, unborn HEAD; all additions remain untracked. You completed independent V-002 with one P2 finding: quote() could emit malformed UTF-8 JSON. No other material defects were found in the bootstrap and twenty plans. Root reproduced the defect and made the bounded correction below. This is a follow-up review by the same nonimplementing reviewer, not a new implementation assignment. + +## 2. Objective and deliverables +Determine whether V-002's encoding defect is resolved without regression and whether the initial bootstrap/documentation milestone can now be accepted. Return READY, CHANGES_REQUIRED or INSUFFICIENT_EVIDENCE with actual source/test evidence. No file edits. + +## 3. Scope and non-goals +Review changed serializer validation, encoding contract, tests and registration counts, plus their integration with previous CLI/description checks. Do not repeat the entire architectural review or require native engine features. V-002 remains the baseline review of unaffected files. + +## 4. Files to inspect +src/build.cpp: new require_utf8() called by quote() for every serialized string/key. +include/vbs/build.hpp: to_json encoding contract comment. +tests/SdkDeclarations.cpp: json_preserves_valid_utf8 and json_rejects_malformed_utf8. +tests/RunSdkTests.cmake and tests/SdkRegistration.cmake: count 17 and two named cases. +docs/SDK.md: JSON encoding policy and non-UTF-8 path limitation. +Read docs/agent-workflow/tasks/T-001.md and V-002.md for original scope; actual pre-correction source was already reviewed by you. Root may update STATE/TASKS/VERIFICATION and persist the review disposition while you review. + +## 5. Write ownership and coordination +Write scope: none +Shared checkout. Source, tests and SDK documentation are frozen during this review. Root owns all integrated files and is updating workflow records only. No stage/commit/push/reset/clean, branches, extra agents, Serena activation or reindex. Any extra repro requiring new files must be returned as text for root. + +## 6. Implementation or investigation approach +Inspect validator bounds and Unicode scalar rules, preservation of valid bytes, no partial-return behavior and central quote coverage. Confirm rejection of stray/invalid leads, truncated sequences, invalid continuation, overlong forms, surrogates and values above U+10FFFF. Inspect tests as code, including valid boundary sequences, malformed strings in names/source paths/option keys/option values/profile flags and unchanged ASCII/control tests. Verify tests register/execute 17 bodies. Use bounded existing tests if helpful; do not repeat completed broad checks without a new concern. + +## 7. Interfaces and data contracts +Schema_version remains 1. All serialized strings and keys must be valid UTF-8; Project::to_json() throws std::invalid_argument with "JSON string contains invalid UTF-8" on malformed encoding. Declaration methods may record raw bytes; failure occurs at serialization before returned JSON. Valid Unicode bytes are preserved and ASCII controls still escaped. This is a bug correction to valid JSON output, not a new source-encoding conversion. Non-UTF-8 filesystem paths require future explicit policy. + +## 8. Dependencies and integration +SDK remains standard-library-only; no new runtime/test dependency was introduced. Existing Void::Json::Strict is used for structural roundtrip tests but is not treated as an independent UTF-8 validator. Root ran Python strict UTF-8/JSON as a one-off independent oracle against a compiled SDK harness in ignored build/bootstrap-pinned; Python is not a bootstrap dependency. Existing pinned/local VoidLibrary source remains unchanged. + +## 9. Edge cases security and performance +Bounds checks must prevent truncated-input access. Unsigned byte handling must avoid signed-char errors. Reject surrogate/overlong/out-of-range scalars and preserve legitimate U+10FFFF and noncharacters. Empty UTF-8 strings are valid where the field otherwise permits them; declaration name validation remains separate. Validation is linear in string bytes; no normalization, replacement or silent transcoding. Ordinary user C++ remains trusted. + +## 10. Acceptance criteria +1. V-002 P2 is demonstrably fixed: raw 0xff no longer crosses the JSON boundary. +2. Valid 1/2/3/4-byte boundary encodings and existing ASCII/control behavior are preserved. +3. Meaningful malformed-input tests and 17-case registration pass. +4. Both dependency modes still pass all four CTest checks; current header/docs match behavior. +5. No new material defects in changed code; findings have severity, trigger, expected/actual behavior and evidence. + +## 11. Verification commands and evidence +All commands ran in /home/faumaray/Projects/VoidBuildSystem. +Before fix, root compiled your exact stdin reproducer against build/bootstrap-pinned/libvbs_sdk.a with dev cpp-gcc -c g++ -std=c++26 -Iinclude; program exit0 and Python strict decode failed as predicted. +After fix: +dev cpp-gcc -c cmake --build build/bootstrap-pinned --parallel 2 -> exit0 (log build/bootstrap-pinned/review-build.log). +dev cpp-gcc -c cmake --build build/worker-bootstrap --parallel 2 -> exit0 (log build/worker-bootstrap/review-build.log). +dev cpp-gcc -c ctest --test-dir build/bootstrap-pinned --output-on-failure -> exit0, 4/4. +dev cpp-gcc -c ctest --test-dir build/worker-bootstrap --output-on-failure -> exit0, 4/4. +Exact ten C++ source/header clang-format --dry-run --Werror command from V-002 -> exit0. +Independent harness build/bootstrap-pinned/utf8-oracle accepts newline-delimited hex bytes and emits one JSON line or "! JSON string contains invalid UTF-8". Root tested empty + every one/two-byte string + 14 boundary sequences + 5000 seeded random byte strings + up to 1000 random valid scalars (seed 20261125). 71803 cases agreed with Python strict decoding; 19708 accepted/JSON-roundtripped, 52095 rejected. Not a persisted application test or full Unicode-space proof. +Existing bin/vbs_sdk_tests and bin/vbs_describe/CLI paths remain valid in both build dirs. CTest LastTest.log contains actual counts and bodies. + +## 12. Constraints and stop conditions +Read-only source/documents. No dependency or global installation changes. Correct graph project home-faumaray-Projects-VoidBuildSystem remains stale for new files; check coverage and use direct source for missed lines, without reindexing. Shared Serena project stays VoidBuildSystem. Report any verification needing extra authority; do not silently change models or claim runtime identity. Stop if a meaningful issue requires source changes; root owns correction. + +## 13. Authorization and decisions +User's "Implement the plan" authorizes this local correction and review within the initial milestone. Root handled the small integration fix under workflow policy. You remain the independent configured astra_reviewer at XHigh and did not implement the correction. No external action, release or deployment is authorized. + +## 14. Return format +Return V-002-R1 verdict; resolution of original P2; new findings if any; exact commands/results; evidence limitations and residual risks. State no files changed. Do not spawn children. + diff --git a/docs/agent-workflow/tasks/V-002.md b/docs/agent-workflow/tasks/V-002.md new file mode 100644 index 0000000..34769ce --- /dev/null +++ b/docs/agent-workflow/tasks/V-002.md @@ -0,0 +1,67 @@ +# Review the integrated bootstrap, declaration SDK and initial plans +Task ID: V-002 +Role: astra_reviewer +Status: APPROVED + +## 1. Context and baseline +Repository/cwd /home/faumaray/Projects/VoidBuildSystem, branch main, unborn HEAD. User approved initial delivery: local Git initialization, detailed subsystem plans and compiling bootstrap; full native engine is later. Baseline contained only preexisting .serena metadata, now preserved/ignored. All project files are newly added and untracked; git diff alone is empty and is not a valid view of the change. Read actual added files. T-001 sol_implementer has completed source work; root owns integrated tree. Previous V-001-R1 was architectural preflight only and does not substitute for this review. Relevant requirements: initial R-001..R-006, R-016, R-017; all other requirements need complete plans and honest future status. + +## 2. Objective and deliverables +Perform an independent defect-oriented review of actual integrated code, tests and cross-file documentation contracts. Return READY, CHANGES_REQUIRED or INSUFFICIENT_EVIDENCE, with reproduced defects clearly separated from suspicions. Determine whether initial delivery is usable, truthfully documented and satisfies T-001 and approved scope. + +## 3. Scope and non-goals +Review the bootstrap, SDK, example/harness, meaningful tests, documentation/roadmap coverage and dependency isolation. Do not implement features or require the full future native engine now. Do not redesign previously approved v1 choices unless a concrete contradiction prevents the plans from being implemented. Do not recommend merge/release/deployment; no external action is authorized. + +## 4. Files to inspect +Read AGENTS.md; docs/agent-workflow/APPROVED_PLAN.md, PREFLIGHT.md, tasks/T-001.md, VERIFICATION.md and DECISIONS.md. Read actual CMakeLists.txt, cmake/VoidDependency.cmake, cmake/bootstrap_config.hpp.in, include/vbs/build.hpp, src/build.cpp, src/main.cpp, src/describe.cpp, build.cpp, build.profiles.cpp, build-support/defaults.cpp, build-support/defaults.hpp, .clang-format, .gitignore, LICENSE. Read tests/CMakeLists.txt, tests/SdkDeclarations.cpp, tests/ExampleContexts.cpp, tests/CliContracts.cmake, tests/DescribeContracts.cmake, tests/RunSdkTests.cmake, tests/SdkRegistration.cmake. Check README.md, docs/SDK.md, docs/roadmap/README.md, REQUIREMENTS.md, ARCHITECTURE.md and numbered 01-20 plans for scope coverage, implementable sequencing and truthful status. STATE/TASKS/VERIFICATION bookkeeping is being finalized by root and is not a source feature diff. + +## 5. Write ownership and coordination +Write scope: none +Source/documentation edits are forbidden. Existing build artifacts may be read/executed. If a reproduction needs temporary source, return its exact text for root to execute rather than writing it. +Shared checkout; root concurrently performs documentation-link/requirement checks and updates workflow evidence. Source and product documents are frozen during your review. No Git stage/commit/push/reset/clean/branch changes, external repository edits, children, Serena reactivation or graph reindex. You are not alone in the checkout; do not revert or overwrite anything. + +## 6. Implementation or investigation approach +1. Establish baseline from actual Git/status and task contract, then inspect added source files because no commit diff exists. +2. Check SDK owner/index lifetime, error mutation semantics, source/provider contradictions, typed options and deterministic valid JSON. Inspect CLI process errors and declaration context separation. Potential question from root: raw bytes above 0x7f are copied by the serializer; establish whether accepted strings can produce invalid UTF-8 JSON, with severity/contract impact based on evidence rather than an assumed defect. +3. Check pinned FetchContent and explicit override, static selected Void modules, dependency settings scope, generated file locations and host diagnostics. +4. Review tests as code: assertions/registration/counts and output/exit-status checks must test behavior, not only exit zero. +5. Check examples and roadmap preserve all confirmed requirements, with bootstrap limitations explicit. The root build.cpp is intentionally illustrative, not a complete executable self-build. +6. Use existing executables/tests to distinguish any suspected issue, keeping verification bounded. Return actionable corrections and exact paths/lines. + +## 7. Interfaces and data contracts +Current NEW SDK contract is T-001 and docs/SDK.md: build(Project&), profiles(Profiles&), runtime ProfileContext, executable/static-library declarations, sources/includes/visibility/local/imported links, Git or package source with typed CMake options, schema_version=1 JSON. Project noncopyable/nonmovable; handles survive vector growth, reject cross-owner/expired use. Borrowed record references have normal vector lifetime. No glob expansion/fetch/compiler execution. CLI help/version/noargs succeed and unsupported native requests exit2. Description compiler selection is target context, not actual host compiler selection. + +## 8. Dependencies and integration +VoidLibrary pin 9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5. Local override /home/faumaray/Projects/VoidLibrary matches this HEAD and tracked tree remains clean. Prefer fetched build/bootstrap-pinned/_deps/voidlibrary-src if surrounding dependency code is needed; inspect only specific relevant tracked source/CMake files. Exclude .env, keys, WG.conf, .serena and all external untracked data. Root integrates findings and owns shared schemas/pins. Do not rely on implementer summary without actual source inspection. + +## 9. Edge cases security and performance +Relevant boundaries: invalid/unknown CLI input, unknown profile/compiler, type/range errors, quote/control/unicode strings, owner destruction, vector growth, cross-project references, duplicate declarations, unsupported native operations, zero-test false positives, generation outside source tree. No shell interpolation of user values. Ordinary C++ is trusted; no sandbox or complete hidden-I/O guarantee. No full performance SLA for this bootstrap. Future snapshots, lock concurrency, metadata-only foreign restrictions and editor selection races must remain documented contracts. + +## 10. Acceptance criteria +1. Initial R-001..R-006: actual Void-linked bootstrap and compiled examples; correct CLI/SDK/protocol behavior; nonzero meaningful tests; both dependency modes supported and verified. +2. R-016: all selected v1 capabilities have distinct detailed plans with interfaces, dependencies, failures and acceptance, and current vs future status is unambiguous. +3. R-017: MIT file present; local Git initialized without staging/commit/push. +4. No material source/test/document contradiction or unintended dependency/source mutation. +5. Every finding has severity, location, trigger, expected/actual result, evidence and a bounded correction/check. A suspicion alone is not a reproduced bug. + +## 11. Verification commands and evidence +cwd /home/faumaray/Projects/VoidBuildSystem. dev cpp-gcc provides GCC16.2.0, CMake4.4.4, Ninja1.13.2. +Observed worker local-source configure/build/ctest exit0 in build/worker-bootstrap. Four CTest checks cover 15 named SDK cases, 16 CLI cases, four profile/compiler combinations and six descriptor errors. +Root independently configured default HTTPS pin: +dev cpp-gcc -c cmake -S . -B build/bootstrap-pinned -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -> exit0. +dev cpp-gcc -c cmake --build build/bootstrap-pinned --parallel 2 -> exit0; a final confirmation reported no work. +dev cpp-gcc -c ctest --test-dir build/bootstrap-pinned --output-on-failure -> exit0, 4/4. +git -C build/bootstrap-pinned/_deps/voidlibrary-src rev-parse HEAD -> exact pin, exit0. +git -C /home/faumaray/Projects/VoidLibrary diff --stat HEAD -> empty, exit0. +dev cpp-gcc -c clang-format --dry-run --Werror include/vbs/build.hpp src/build.cpp src/main.cpp src/describe.cpp build.cpp build.profiles.cpp build-support/defaults.cpp build-support/defaults.hpp tests/SdkDeclarations.cpp tests/ExampleContexts.cpp -> exit0. +Existing executables: build/bootstrap-pinned/bin/vbs, vbs_describe, vbs_sdk_tests; same names under build/worker-bootstrap. Run only needed reproductions, not an unrelated matrix. + +## 12. Constraints and stop conditions +No source or scratch-file edits; no secrets, global/Nix modifications, network publication, extra agents, hidden model substitutions. If exact configured role cannot run, report limitation. For graph use, project home-faumaray-Projects-VoidBuildSystem is correct but its 2026-11-24 index has only two nodes and none of the new C++ files. Prior search_graph for SDK found zero. Before relying on a file, check_index_coverage; read untracked/missed source directly, do not reindex. Serena session 0bd90d65 active project VoidBuildSystem is already confirmed; read its manual if you have not, but do not change shared active project. Stop a check if it would mutate unowned data; report missing evidence. + +## 13. Authorization and decisions +User said "Implement the plan"; local bootstrap/documentation and tests/review are authorized. Exact configured astra_reviewer role at XHigh; runtime model identity should be described as configured unless independently reported. This review is fresh and independent of T-001. No merge/release approval is requested or implied. + +## 14. Return format +Return V-002 verdict; concise summary; findings ordered by severity with exact file/line, trigger/impact/evidence/correction; acceptance evidence; commands/cwd/results; unrun checks and remaining risks. State no source files were changed. Do not spawn children. + diff --git a/docs/roadmap/01-bootstrap-sdk.md b/docs/roadmap/01-bootstrap-sdk.md new file mode 100644 index 0000000..0a4dcb9 --- /dev/null +++ b/docs/roadmap/01-bootstrap-sdk.md @@ -0,0 +1,67 @@ +# 01 — Bootstrap and declaration SDK + +Implementation status: initial bootstrap and declaration subset VERIFIED, 2026-11-25. +See [STATE](../agent-workflow/STATE.md), [SDK contract](../SDK.md) and +[accepted review](../agent-workflow/REVIEW.md). Native loading, execution and +self-hosting belong to subsequent plans. + +## Requirements and ownership + +- Requirements: R-001, R-002, R-003, R-004, R-005, R-006, R-017. +- Delivery phase: Initial delivery. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: Approved requirements and architecture preflight; no native engine prerequisite. +- Implemented scope: CMakeLists.txt, cmake/, include/vbs/build.hpp, src/build.cpp, src/main.cpp, src/describe.cpp, tests/, root description/profile files and build-support/. T-001 completed and returned ownership to root. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Build a small CLI and description SDK with CMake>=4 and GCC16/C++26. Pin VoidLibrary to 9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5 using the public HTTPS repository. An explicit local-source override is a development convenience, not the committed default. +- Select Configuration and, when tests are enabled, Testing plus their actual transitive closure. Disable the dependency's own suite/benchmarks and build the selected modules statically. Do not overwrite unrelated parent CMake settings. +- CLI help/version succeed; invalid and future native operations fail clearly. Use the real Void::Argparse parser and account for its help-as-error return convention. +- The SDK records data without fetching, expanding globs or invoking compilers. Index/owner handles remain valid when record containers grow and reject cross-project references. +- Compile root build.cpp, optional profile definitions and a real cpp/hpp helper into vbs_describe. A host-compiled program receives target compiler/profile facts and emits a versioned JSON description. It is an example harness, not a runtime project loader. +- Expose a public umbrella header. Record source kind/spelling, target kind/visibility, typed dependency options, source identities, profile context and local/imported links. Serialization must escape correctly and preserve bool/integer/string distinctions. + +## Implementation sequence + +1. Create CMake targets and dependency selection, with useful unsupported-host diagnostics. +2. Implement minimal SDK records/handles and CLI contracts, then the real descriptor and profile/helper example. +3. Add JSON/handle/context tests and CTest process-contract tests using Void::Testing for SDK cases. +4. Run local and pinned-source clean builds, inspect actual registration, format exact sources, and obtain integrated review. + +## Failure behavior and boundaries + +- No source dependency edits or files generated into its checkout. +- No native-build or TOML support implied by data declaration methods. +- Reject duplicate/empty identifiers and contradictory dependency sources; avoid silent selection defaults for unknown profiles. +- No unregistered test success: verify expected test names/count, not just the aggregate executable exit. + +## Acceptance scenarios + +1. CLI no-args/help/version exit 0; unknown and unsupported requests exit 2 with useful text. +2. Same host executable emits different correct debug/release and GCC/Clang graphs. +3. Handle operations after container growth; invalid cross-project link and duplicate IDs fail. +4. JSON roundtrip with quotes, backslashes, control characters and typed options. +5. Local override and clean pinned upstream configuration/build/CTest succeed. + +## Verification and integration gate + +Current scaffold commands are in README.md and tasks/T-001.md. Run CMake build + CTest; inspect the actual SDK runner and generated registrations. Native build commands are not acceptance commands for this milestone. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void::Configuration/Argparse, Void::Testing, and existing Data support. Keep the CMake test scanner only for the seed; native replacement belongs to plan 18. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/02-configuration-frontend.md b/docs/roadmap/02-configuration-frontend.md new file mode 100644 index 0000000..507d472 --- /dev/null +++ b/docs/roadmap/02-configuration-frontend.md @@ -0,0 +1,66 @@ +# 02 — Native C++ configuration frontend + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-002, R-003, R-004, R-014. +- Delivery phase: Core native engine. +- Intended configured role: astra_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 01; toolchain identity from 04; configuration capture/state primitives from 05/07; seed action execution from 06. +- Proposed exclusive implementation scope: src/config/, include/vbs/config/, tests/config/; root owns public SDK/protocol changes and shared build registration. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Construct the seed compilation graph without running project code: root build.cpp, optional build.profiles.cpp, default SDK profile implementation when absent, filesystem-discovered build-support/**/*.cpp and explicit repeated --build-source paths. Header depfiles and helper membership are inputs. +- Compile against a fixed SDK with the host toolchain. Newly declared project packages cannot supply headers for this executable. Package-based configuration extensions require a separately approved future bootstrap mechanism. +- Generate an SDK driver with separate profile-discovery and graph-evaluation requests. Resolve profile inheritance and installed target toolchains in the parent before evaluating build(Project&) once for each effective context. +- Provide target OS, architecture, compiler and effective options as runtime SDK facts. Host preprocessor macros never stand in for target selection. Separate seed-compilation identity from target-context evaluation identity. +- Use a dedicated bounded result channel/file with protocol version, request identity, context and complete graph. Logs cannot corrupt results. Validate before installing a generation. +- Reuse a valid compiled description but reevaluate each reconciliation initially. Track SDK-mediated reads and namespace queries; arbitrary C++ remains trusted and complete hidden-I/O tracking is not promised. + +## Implementation sequence + +1. Version the seed request/result envelopes and freeze SDK runtime context types. +2. Implement filesystem helper selection and a CMake-independent seed recipe using the action engine. +3. Implement profile discovery, target capability resolution and per-context evaluation. +4. Validate protocol/graph responses, report source locations/origins, and integrate with build and metadata-only modes. + +## Failure behavior and boundaries + +- Compilation failure, crash, malformed response, wrong protocol/request/context, timeout or invalid graph fails current configuration. +- A prior graph may remain for diagnostics/editor stale status, never masquerade as current success. +- Snapshot captures work from archives without .git; include helper manifest in exported source packages. +- Metadata mode may execute trusted local C++ but schedules no project/package actions. + +## Acceptance scenarios + +1. Add/delete a helper cpp or included hpp; description recompiles; non-Git exported archive yields equivalent graph. +2. One host executable emits distinct GCC/Clang and cross-target configurations. +3. Build.cpp attempting to depend on unresolved package headers gets a clear bootstrap diagnostic. +4. Crashing/noisy/truncated/mismatched configuration result cannot replace a valid generation. +5. Target-context or SDK/toolchain change never reuses the wrong evaluated graph. + +## Verification and integration gate + +NEW future fixtures under tests/config/ run through the project's test target. Exercise native configuration via vbs build and vbs compdb watch only after those commands exist. Record seed recompilation and graph-generation counts. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void process/serialization/Result facilities through verified adapters. Potential upstream candidate: stable bounded protocol and configuration-observation helpers. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/03-targets-action-graph.md b/docs/roadmap/03-targets-action-graph.md new file mode 100644 index 0000000..78cc765 --- /dev/null +++ b/docs/roadmap/03-targets-action-graph.md @@ -0,0 +1,66 @@ +# 03 — Targets, usage requirements and action graph + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-002, R-003, R-018, R-019. +- Delivery phase: Core native engine. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 01/02 description model; interface contract with 04 toolchains and 13 imported targets. +- Proposed exclusive implementation scope: src/graph/, include/vbs/graph/, tests/graph/; shared SDK and action schema changes belong to root. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Explicit target kinds cover executable, static/shared/interface/object libraries, custom producers and test registrations. Conventional source sets are selectors over src/source and include, with overrides; do not infer target type from a main function. +- Expand source selectors deterministically and retain membership as an input. Explicit missing files fail; a new matching file joins the target. Exclude configuration sources and owned output roots from automatic product discovery. +- Model compile usage visibility separately from link requirements. Static private implementation libraries can still be required at the final link; preserve ordered archives, flags and groups rather than sorting or globally deduplicating them. +- Lower target descriptions to typed compile/archive/link/generator actions and artifacts with one producer. Explicit generated prerequisites establish first-build ordering; an old depfile is not a substitute. +- Reject action cycles and output collisions, including relevant canonical path aliases and source/output overlap. Model valid static link groups separately from execution dependency cycles. +- Freeze an immutable graph generation per resolved profile. Selected target closure controls execution, while configured enabled targets remain available for editor projection. + +## Implementation sequence + +1. Implement typed records and origin-rich validation for names, references and source selection. +2. Resolve public/private/interface compile and link requirements with deterministic traversal. +3. Lower generators and normal C/C++ products to actions, then validate producer ownership and action DAG. +4. Add selected-target closure, stable graph identities and explain/diagnostic records. + +## Failure behavior and boundaries + +- Conflicting requirements identify both origins; do not silently overwrite incompatible toolchain/profile facts. +- Missing generated producer or a discovered unordered generated input triggers replan or an error, not retrospective success. +- Removing an object must regenerate the archive without stale members. +- Unsupported arbitrary shell behavior is an explicit custom action, not hidden parsing of command strings. + +## Acceptance scenarios + +1. Public/private/interface exposure, transitive static link requirements and archive ordering. +2. New/removed/renamed selected sources, missing explicit sources, custom layouts and duplicate aliases. +3. First-build generated headers; cycles, producer collisions and source/output overlap. +4. Selected app target builds only required closure; database still covers other configured targets. +5. Delete a source defining a symbol and verify it disappears from the static archive. + +## Verification and integration gate + +NEW future graph unit fixtures compare semantic action records and diagnostics, not incidental IDs. Integration fixtures compile/link executable outputs through both supported target drivers once 06 is available. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Evaluate Void graph/container primitives against required invariants; graph algorithms can reuse verified generic components without coupling the public SDK to their storage. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/04-profiles-toolchains.md b/docs/roadmap/04-profiles-toolchains.md new file mode 100644 index 0000000..cc8c4f6 --- /dev/null +++ b/docs/roadmap/04-profiles-toolchains.md @@ -0,0 +1,66 @@ +# 04 — Profiles, target selection and toolchains + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-003, R-011, R-015, R-019. +- Delivery phase: Core native engine. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 01/02 profile protocol; 03 action/usage types; platform operations in 06. +- Proposed exclusive implementation scope: src/toolchain/, include/vbs/toolchain/, tests/toolchain/; profile public schema root-owned. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Resolve named C++ profiles with explicit inheritance and overrides, rejecting unknown parents and cycles. Built-in debug/release defaults are reproducible; target language standard is independent of the C++26 host. +- ProfileContext contains target/build machine facts, resolved compiler family/path/identity, sysroot/stdlib and effective flags/features. Evaluate build.cpp separately for each selected context. +- Model target selection as the requested target/profile combinations, validating all names before scheduling. Keep mutable outputs, response files, generated files, PCH/BMI and foreign trees isolated below each profile identity. +- Identify drivers, helpers, sysroots, configured search roots, options and relevant environment. Version text alone is insufficient. Support installed cross-toolchain descriptions without accidentally executing target binaries during probes. +- Generate structured argv and response files via GCC/Clang adapters. Detect language standard, depfile/scanner and requested optimization/sanitizer capabilities using bounded probes. +- Begin with observed GCC16.2 and Clang23.1.3 target environments. Older versions and other systems enter the matrix only after tests establish support; never silently downgrade an explicitly requested feature. + +## Implementation sequence + +1. Implement profile resolution and canonical effective-context identities. +2. Implement host/target driver discovery and capability cache keyed by complete toolchain context. +3. Add command generation for normal compile/archive/link and response-file handling. +4. Expose cross-toolchain settings and coordinate overall jobs across selected profiles; connect modern feature drivers in 08. + +## Failure behavior and boundaries + +- Missing compiler/helper/sysroot or incompatible library ABI is a diagnostic, not an unannounced compiler fallback. +- Do not use host preprocessor conditionals to select target-specific flags. +- Do not hold a global build lock that prevents independent profiles, but serialize competing writers to one profile. +- Explicit unsupported flags/features fail before expensive builds where possible. + +## Acceptance scenarios + +1. Same source built in debug/release and GCC/Clang profiles has isolated outputs and correct argv. +2. Changing compiler binary, sysroot, flags, response contents or relevant environment invalidates identity. +3. Cross profile probe never runs a target-only executable on the host. +4. Unknown profile, inheritance cycle and incompatible sanitizer/LTO settings fail clearly. +5. Paths with spaces and long argv preserve exact compiler arguments. + +## Verification and integration gate + +NEW future driver fixtures plus actual GCC/Clang compile/link probes run under dev cpp-gcc and dev cpp. Log target-driver versions and feature outcomes separately from host bootstrap success. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void process/path helpers with explicit error results. Capability caching belongs in VBS; reusable process and environment wrappers are upstream candidates. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/05-snapshots-invalidation.md b/docs/roadmap/05-snapshots-invalidation.md new file mode 100644 index 0000000..6f475c9 --- /dev/null +++ b/docs/roadmap/05-snapshots-invalidation.md @@ -0,0 +1,66 @@ +# 05 — Immutable snapshots and mutation tracking + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-002, R-007, R-014. +- Delivery phase: Core correctness foundation. +- Intended configured role: astra_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 03 SourceSet/Artifact contracts; 04 toolchain/search-root identity; platform and state primitives in 06/07. +- Proposed exclusive implementation scope: src/snapshot/, include/vbs/snapshot/, tests/snapshot/; filesystem identity schema coordinated by root. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Represent content, logical paths, relevant file metadata, namespace membership, symlinks and negative lookup guards in InputSnapshot. Include the configuration source set as well as selected product and toolchain inputs. +- Capture through private copies or isolated reflinks. Hash captured bytes with SHA-256, then revalidate source contents and namespace before sealing. Use bounded retry and report an unstable tree. Never hardlink mutable originals. +- Define the consistency boundary precisely: immutable captured bytes are guaranteed, not a globally atomic filesystem instant. Concurrent capture tests must not assume a single transaction across arbitrary filesystems. +- Canonicalize compiler-visible metadata using the selected reproducibility epoch; incorporate path maps and other supported observable facts into action identity. Explicit nondeterministic modes cannot reuse action results. +- Track include/search directory membership so a new earlier candidate or __has_include result invalidates consumers even when prior depfiles omit it. System/toolchain roots need explicit identity and lookup coverage. +- Resolve internal symlinks safely and require declared external roots; detect loops/escape attempts. Exclude repository metadata, build outputs and credentials by default. Generated outputs enter as separately sealed producer artifacts. + +## Implementation sequence + +1. Freeze path/namespace/metadata policies and the snapshot manifest format. +2. Implement robust capture, content verification, symlink handling and publication of sealed manifests. +3. Add content/lookup invalidation and integration of compiler-discovered dependencies. +4. Add immutable generated-input promotion and conservative fallback for unmodeled/opaque actions. + +## Failure behavior and boundaries + +- Permission/stat/read errors are errors, not silently missing files. +- Partial capture or changed membership never becomes a successful snapshot. +- No source/output overlap; no capture of the tool's own changing output namespace. +- Full hidden-I/O tracking is not claimed; cache eligibility requires a complete declared input model. + +## Acceptance scenarios + +1. Same-size restored-mtime edits, add/delete/rename, atomic replacement and symlink retargeting. +2. Header shadowing and newly true __has_include invalidate affected actions. +3. Edit inputs during capture/execution; sealed inputs stay unchanged and new epochs see edits. +4. Macro values __DATE__/__TIME__/__TIMESTAMP__/__FILE__/source_location agree between cached and uncached execution under the selected policy. +5. Escape/loop/permission failures, generated headers, archive-without-Git capture and no hardlinks to editable inputs. + +## Verification and integration gate + +NEW deterministic filesystem fixtures inject capture interleavings and compare actual compiler results. Measure scan/reflink/copy cost separately; do not replace content checks with unqualified metadata shortcuts to meet a benchmark. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void filesystem/Result utilities where verified. Candidates: streaming cryptographic digest, transactional file operations and reliable recursive observation; direct focused wrappers allowed meanwhile. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/06-execution-scheduling.md b/docs/roadmap/06-execution-scheduling.md new file mode 100644 index 0000000..3b16ad4 --- /dev/null +++ b/docs/roadmap/06-execution-scheduling.md @@ -0,0 +1,66 @@ +# 06 — Native execution, scheduling and process lifecycle + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-007, R-014, R-019. +- Delivery phase: Core native engine. +- Intended configured role: astra_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 03 validated actions; 04 driver commands; 05 immutable inputs; 07 success/publication protocol. +- Proposed exclusive implementation scope: src/execution/, src/platform/, include/vbs/execution/, tests/execution/; root coordinates shared platform APIs. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Schedule ready action nodes under a configurable global job budget and per-profile ownership. Dependents run only after all required producer artifacts are validated and published. +- Invoke executables through typed argv/cwd/environment, never implicit shell concatenation. Resolve absolute executables before launch and include the resolution in identity. +- Use explicit Void process APIs for spawn/communicate so exec failure, signal exit, timeout, cancellation and output overflow remain distinguishable. Drain both streams without deadlock and keep logs bounded without losing diagnostic state. +- Add a Linux lifecycle boundary that retains ownership of ordinary descendants through TERM, grace, KILL and reap. The pinned Child::terminate can return after leader exit; a supervisor/ownership implementation must prove the early-leader case before acceptance. +- Stage complete output sets. Validate files and dependency outputs before promoting artifacts or success records. Newly discovered unordered producer dependencies require replan/error; failed output is not usable merely because it exists. +- Do not hold global SQLite/cache transactions over child execution. Coordinate per-key claims and detect reentrant dependency/build cycles instead of deadlocking on nested tools. + +## Implementation sequence + +1. Implement process result/error mapping, streaming, argument fidelity and isolated temporary/output paths. +2. Implement profile/action ownership and ready-queue scheduling with bounded concurrency. +3. Implement cancellation/supervision and verify descendants cannot write after cancelled work returns. +4. Integrate output/dependency validation, publication ordering, failures and diagnostic event streams. + +## Failure behavior and boundaries + +- On fail-fast stop new work, cancel only owned processes according to policy and preserve useful logs. +- No destructive cleanup outside managed directories; interrupted work stays uncommitted. +- Crash, timeout, capture overflow, invalid dependency metadata and missing outputs have different diagnostics. +- Deliberately detached or undeclared external writers are outside the ordinary-child guarantee and cannot be represented as hermetic actions. + +## Acceptance scenarios + +1. argv/environment/cwd quoting; large concurrent stdout/stderr; exec failure versus program exit127. +2. Leader exits while grandchild ignores TERM; cancellation waits through escalation and prevents later output writes. +3. Parallel DAG ordering, missing outputs, signal failure, timeouts and two invocations competing for one profile. +4. Crash between output staging/publication/state commit and successful conservative recovery. +5. Generated dependencies first build and late-discovered unordered producer rejection. + +## Verification and integration gate + +NEW subprocess helper fixtures run with isolated temp roots and bounded deadlines. Execute real compiler DAG fixtures after lifecycle tests; collect child termination evidence, not merely the parent exit code. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void::Process explicit spawn/communicate, optional async services only after source/runtime validation. Robust descendant lifecycle and bounded independent stream handling are potential upstream work. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/07-state-local-cache.md b/docs/roadmap/07-state-local-cache.md new file mode 100644 index 0000000..1539409 --- /dev/null +++ b/docs/roadmap/07-state-local-cache.md @@ -0,0 +1,66 @@ +# 07 — Transactional state and local artifact cache + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-007, R-014, R-015. +- Delivery phase: Core correctness foundation. +- Intended configured role: astra_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 03 action schema; 04 identities; 05 manifests; coordinated protocol with 06 publication. +- Proposed exclusive implementation scope: src/state/, src/cache/, include/vbs/state/, tests/state/; root owns schema migrations and shared version constants. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Store successful action identities, discovered inputs, artifact digests, graph generations and ownership claims in transactional state. Use a verified Void::Sqlite adapter with prepared statements, explicit transaction boundaries and schema versioning. +- Use SHA-256-addressed immutable blobs/manifests. An action key includes command order, environment policy, toolchain, inputs, lookup guards, output expectations and metadata/path policy. +- Keep reusable artifact cache separate from dependency binary packages and user install destinations. Verify expected outputs and relevant blob integrity; missing or externally changed outputs invalidate reuse. +- Publish objects before committing references. Recovery can discard/rebuild uncommitted outputs, collect orphaned objects and repair projection pointers; it must not invent a successful record. +- Coordinate short write transactions and per-action/profile leases. GC considers active runs and reachable generations/locks, and cannot remove in-use artifacts or another project's uncontrolled files. +- Treat opaque BMI/PCH and other path-sensitive artifacts conservatively: include physical path/toolchain context unless relocation has a tested format-aware proof. + +## Implementation sequence + +1. Verify Sqlite implementation semantics needed for rollback, errors, concurrency and migrations; add local adapter tests. +2. Implement versioned schema, CAS I/O and action identity canonicalization. +3. Integrate success publication/recovery and explicit corruption/schema-mismatch behavior. +4. Add retention, quota, GC and explainable reuse/miss diagnostics. + +## Failure behavior and boundaries + +- Database busy/corrupt/newer-schema cases have explicit recovery/error paths; do not silently delete user data. +- No success record for failed, cancelled, truncated or partially published action. +- Never put credentials or unrestricted process environments into lock/log/state records. +- Clock-dependent/custom opaque actions are nonreusable unless their declared model provides the required determinism. + +## Acceptance scenarios + +1. Crash injection before/after every publication boundary; resume yields correct outputs. +2. Corrupt/missing blobs, modified outputs, schema migration rollback and concurrent writers. +3. Identity changes for command ordering, flags, response files, toolchain, env, headers and namespace guards. +4. GC under active builds; quota failure; no deletion outside owned cache. +5. No-op build performs no target actions while retaining required input verification. + +## Verification and integration gate + +NEW SQLite/CAS unit tests and crash subprocess fixtures. Compare cold/clean/warm/unchanged builds for output behavior and actual action counts; cache-hit percentage alone is not correctness evidence. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void::Sqlite, Binary/Data helpers as suitable, focused SHA-256 adapter. Upstream candidates include transactional publication and bounded serialization; validate rather than assume header promises. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/08-modern-cpp.md b/docs/roadmap/08-modern-cpp.md new file mode 100644 index 0000000..803153b --- /dev/null +++ b/docs/roadmap/08-modern-cpp.md @@ -0,0 +1,66 @@ +# 08 — Modules, header units and compiler features + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-003, R-011, R-015. +- Delivery phase: Full v1 compiler capability. +- Intended configured role: astra_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 03 graph; 04 capability drivers; 05 snapshots; 06 dynamic scheduling; 07 cache identity. +- Proposed exclusive implementation scope: src/toolchain/modules/, src/features/, tests/features/; common toolchain contracts root-owned. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Use compiler-supported dependency scans (P1689 for named modules) to establish providers/imports before compilation. Scan generated sources only after their producer completes. Detect duplicate providers, missing imports and module cycles with context. +- Map named modules, partitions and explicit header-unit declarations to typed artifacts/actions. Clang's named-module scanner must not be assumed to discover header units; provide explicit header-unit sources and import mappings. +- Keep BMI/CMI/PCH products isolated by compiler/stdlib, profile, macros/options, input identity and required physical path context. Do not assume such binaries can be moved or shared across compilers. +- Implement PCH, unity batching, LTO and sanitizer options through capability-checked drivers. Exclude module translation units from unity. Validate incompatible combinations and preserve per-file overrides. +- Cover standard-library module use through actual compiler/stdlib probes. A requested capability is either tested/supported or explicitly rejected; do not silently turn it off. +- Make scan, BMI, PCH and generated unity actions visible to state/scheduler/diagnostics. Editor projection must distinguish real supported commands from missing prerequisite readiness. + +## Implementation sequence + +1. Implement named-module scanning/collation and dynamic graph integration. +2. Add module partition/standard-library cases and per-context artifact naming. +3. Add explicitly declared header units with driver-specific mappings. +4. Implement PCH/unity/LTO/sanitizers incrementally with separate capability and invalidation fixtures. + +## Failure behavior and boundaries + +- Invalid scans or unsupported format/version fail clearly. +- No importer runs before a required BMI; stale module artifacts cannot survive changed provider/options. +- ASan/TSan and other unsupported combinations fail configuration. +- A successful compilation database export does not prove clangd supports the compiler's extensions. + +## Acceptance scenarios + +1. Provider edits/additions/deletions, partitions, transitive imports and missing/duplicate/cyclic modules. +2. Header units, macros, profile changes and generated module sources. +3. Cross-profile/compiler BMI/PCH isolation; no reuse of incompatible artifacts. +4. Unity exclusion, per-file flags, LTO linker matching and sanitizer runtime tests. +5. Cold parallel versus sequential builds produce equivalent observable programs. + +## Verification and integration gate + +NEW real compile/link/run fixtures in GCC16.2 and Clang23.1.3 environments, recording compiler+stdlib versions and capability matrix. Test supported combinations; distinguish explicit unsupported cases from regressions. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Reuse graph/scheduler/state primitives, not an independent module executor. Compiler-specific scanning belongs in VBS; generic graph facilities may use VoidLibrary. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/09-compilation-database.md b/docs/roadmap/09-compilation-database.md new file mode 100644 index 0000000..db58866 --- /dev/null +++ b/docs/roadmap/09-compilation-database.md @@ -0,0 +1,66 @@ +# 09 — Compilation databases and editor selection + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-003, R-008, R-014. +- Delivery phase: Core developer experience. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 02/03 configured graph; 04 typed compiler commands; 05 path mapping; 07 generation publication; 08 feature metadata when selected. +- Proposed exclusive implementation scope: src/editor/, include/vbs/editor/, tests/editor/; project selection state schema root-owned. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Emit standard JSON command objects using argv arrays, logical source file, working directory and output. Cover all enabled configured targets in a profile even when execution selects a subset; preserve multiple meaningful commands for a source. +- Build a typed projection from physical snapshot execution paths to editable sources and compatible immutable generated views. Project response files structurally. Never replace arbitrary macro/string contents. Preserve exact execution records separately. +- Maintain immutable editor generations and per-profile compile_commands.json. A managed build-root pointer and optional project-root alias select the current generation without overwriting unrelated user files. +- Assign project-level monotonically ordered selection tickets. Single-profile builds reserve intent and publish after valid configuration. Multiple profiles require --editor-profile from their selection. Manual use creates a newer request; watchers refresh without selecting. +- Coordinate short publication locks with revision checks. Older compilation/configuration completion cannot replace newer metadata. Recover stale filesystem pointers from authoritative state after crashes. +- Publish valid metadata independently of target success. Missing generated inputs have readiness diagnostics; invalid/unresolved graphs retain a clearly stale previous generation rather than fabricated commands. + +## Implementation sequence + +1. Implement deterministic standard JSON export from typed compile records. +2. Implement logical/physical mappings and immutable generated editor views. +3. Implement selection tickets, managed alias ownership and atomic publication/recovery. +4. Connect build/manual use/metadata watch and add diagnostics for stale or unrepresentable commands. + +## Failure behavior and boundaries + +- Reject ambiguous opaque path rewriting rather than corrupt arguments. +- A failing compile does not undo a valid editor selection; failed configuration does not silently select stale data. +- Do not remove a generation while clangd or an active selection/run can still reference it. +- Do not mix debug headers/BMIs with release or another graph generation. + +## Acceptance scenarios + +1. Spaces/Unicode/quotes, response files, duplicate source commands, generated headers and module flags. +2. Single/multiple-profile selection, explicit manual switch and reverse-order completion races. +3. Atomic replacement readers never observe truncated JSON; crash recovery repairs pointers. +4. Adding/deleting/renaming sources refreshes metadata even when an unrelated compile fails. +5. Selected target subset leaves other configured editor entries available; user-owned root file preserved. + +## Verification and integration gate + +NEW JSON and race fixtures plus actual clangd parse checks for supported toolchains/features. Record database validity separately from editor support. Exercise planned vbs compdb use/watch only after implementation. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void data/path utilities behind correctly escaped serialization. Follow Clang JSONCompilationDatabase specification; no shell-command parser as the primary representation. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/10-watchers-cli.md b/docs/roadmap/10-watchers-cli.md new file mode 100644 index 0000000..497e3a0 --- /dev/null +++ b/docs/roadmap/10-watchers-cli.md @@ -0,0 +1,66 @@ +# 10 — Reconciliation, build watching and metadata watching + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-007, R-008, R-014. +- Delivery phase: Core developer experience. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 02 configuration; 05 observations; 06 execution; 07/09 generations; 13 read-only provider metadata mode. +- Proposed exclusive implementation scope: src/watch/, include/vbs/watch/, tests/watch/; src/cli integration transferred explicitly after bootstrap. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Implement one-shot build, rebuilding watch and compdb watch over the same graph/snapshot reconciliation pipeline. Do not install an always-on daemon as an implicit side effect. +- Filesystem notifications trigger work but never prove cleanliness. Reconcile content and namespace periodically, after overflow, watcher failure, directory replacement and subscription changes. Coalesce bursts without losing final state. +- Full watch may execute required build/dependency actions. Metadata-only watch may compile/evaluate trusted local descriptions and use known native scans/probes, but never fetch, update locks, run foreign configure/install or schedule project/package builds. +- Read cached provider metadata only when its freshness guards remain valid. Otherwise publish needs-build/stale status and await an explicit full operation. Direct user C++ remains trusted, not sandboxed. +- Observe active selection changes so the default metadata watcher follows the editor profile without stealing selection. Explicit profile watchers can refresh unselected generations safely. +- Exclude owned generated/cache outputs from source-change feedback loops while separately observing published metadata needed by the editor. If command bytes are unchanged, avoid needless database rewrites while updating observation status. + +## Implementation sequence + +1. Implement event sources, debouncing and periodic reconciliation with injectable clocks/events. +2. Add graceful stop, watch reattachment and overflow/failure recovery. +3. Integrate full-build and strict metadata-only operation capabilities. +4. Add clear CLI progress/exit/status diagnostics and selection-change handling. + +## Failure behavior and boundaries + +- Stat/permission errors are not absence; continuous edits produce bounded retry/status instead of false success. +- Watch mode survives a target compile failure and reacts to the next edit. +- Metadata mode never silently broadens to a full provider build to make its database look current. +- No uncontrolled child remains after watch cancellation. + +## Acceptance scenarios + +1. Atomic saves, new/deleted directories, rename storms, event loss and deliberate queue overflow. +2. Same-size preserved-time edits detected by reconciliation. +3. Metadata-only fixture has foreign configure side-effect marker; marker must remain absent. +4. Invalid build.cpp/dependency changes yield stale status; repaired inputs recover. +5. No source-output feedback loop, unnecessary compiler launch or selection theft; Ctrl-C reaps children. + +## Verification and integration gate + +NEW deterministic fake-event tests plus real temporary-directory integration tests with bounded deadlines. Measure convergence/action counts; avoid flaky exact-sleep assertions. Later CLI integration uses vbs watch and vbs compdb watch. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void SystemAsync richer rescan APIs may help after implementation validation. Basic polling FileWatcher alone cannot satisfy the content/recursive guarantees; upstream watcher improvements are candidates. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/11-dependencies-solver-lock.md b/docs/roadmap/11-dependencies-solver-lock.md new file mode 100644 index 0000000..a239481 --- /dev/null +++ b/docs/roadmap/11-dependencies-solver-lock.md @@ -0,0 +1,66 @@ +# 11 — Dependency declarations, native solver and lockfile + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-003, R-006, R-009, R-014. +- Delivery phase: Native package management. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 02 context-specific declarations; 04 host/target contexts; shared package metadata contract with 12/16. +- Proposed exclusive implementation scope: src/package/model/, src/package/solver/, src/package/lock/, tests/package/; root owns vbs.lock schema and public dependency types. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Normalize inline C++ and explicitly loaded TOML1.0 files to one model: alias, registry/package or source identity, version constraints, builder, typed options/features and build/target role. Use toml++ behind a loader adapter so future Void TOML support can replace it. +- Preserve origin file/line or C++ declaration labels for diagnostics. Compatible transitive version requirements combine; duplicate contradictory source identities/options fail instead of silently overriding. Manifest paths and contents are configuration inputs. +- Implement deterministic PubGrub-style SemVer solving in C++. Keep one version per package identity per resolution context, with build-machine and target-machine graphs distinct. Registry authority belongs to identity; no implicit cross-registry fallback. +- Choose deterministic version ordering and explain incompatibility causes. Features/options participate in constraints and package identity; do not combine incompatible build choices merely because their version matches. +- Use a versioned generated lock payload containing exact revisions/releases/content digests, nodes/edges, features/options and context/declaration fingerprints. Never store credentials. Multiple profiles can have separate contexts inside one project lock. +- A first ordinary build may create an absent lock; --locked prevents modification. Existing incompatible declarations require explicit deps resolve/update. Publish with project-wide coordination, revision comparison, revalidation and atomic replacement. Every build pins one immutable payload. + +## Implementation sequence + +1. Freeze normalized dependency/context records and loader diagnostics; implement TOML/C++ equivalence fixtures. +2. Implement SemVer/range semantics and deterministic solver with conflict explanations. +3. Implement context-aware lock serialization, validation and explicit resolution/update operations. +4. Add atomic concurrent publication and immutable build lock capture; integrate provider/fetch requests only after solving. + +## Failure behavior and boundaries + +- Malformed/unknown manifest fields and unsupported combinations fail with locations. +- Offline mode cannot silently query registries; missing verified data is an actionable prerequisite. +- Two concurrent profile updates cannot overwrite each other; retry/re-resolve on a revision conflict. +- Changed declarations/options/platform facts cannot run actions under an incompatible lock. + +## Acceptance scenarios + +1. Equivalent C++/TOML declarations yield equivalent normalized graphs; boolean/integer/string options remain typed. +2. Range/prerelease/diamond/conflict cases; compare solver against exhaustive enumeration for small generated graphs. +3. Multiple profiles and build/target contexts do not leak settings; registry identity prevents substitution. +4. Concurrent updates preserve contexts or report a conflict; edited manifest invalidates before actions. +5. A running build uses one lock revision even if another operation updates the project lock. + +## Verification and integration gate + +NEW solver/property tests, lock race subprocess fixtures and offline fake-registry tests. Future CLI commands deps resolve/update and --locked are acceptance interfaces only after implementation. Keep deterministic resolution fixtures independent of live network state. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void Result/Data/Text primitives where semantics match; toml++ initially. Native SemVer solver and package policy remain VBS-owned. TOML/validated semantic-version utilities are candidates for VoidLibrary. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/12-fetching-packages.md b/docs/roadmap/12-fetching-packages.md new file mode 100644 index 0000000..743fd24 --- /dev/null +++ b/docs/roadmap/12-fetching-packages.md @@ -0,0 +1,66 @@ +# 12 — Acquisition, source packages and binary packages + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-006, R-009, R-014, R-015. +- Delivery phase: Native package management. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 11 resolved immutable identities; 05 snapshots; 07 artifact primitives; 13 builders; 16 registry protocol for hosted distribution. +- Proposed exclusive implementation scope: src/package/fetch/, src/package/archive/, src/package/binary/, tests/package-fetch/; root owns package manifest versions. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Support explicit local paths, exact Git revisions, checksummed archives and registry releases. Materialize into managed dependency storage, never modify external source checkouts. Network operations are full dependency/build operations, not metadata-watch work. +- Verify immutable source identity before use. Source package manifests retain build.cpp, optional profiles, selected helper cpp/hpp and declared source/include inputs, so exported sources work without .git. +- Use bounded streaming downloads and extraction. Validate paths, link targets, entry sizes/counts, duplicate/colliding paths and archive traversal before publishing extracted content. Interrupted downloads remain uncommitted. +- Separate source identities from built binary variants. Binary identity includes target, compiler/helpers, stdlib ABI, linkage, CPU/features, profile options, sanitizers/LTO and relevant dependency closure. +- Treat BMI/PCH and other opaque path-sensitive products as toolchain/path-specific. Reject incompatible binaries; build from allowed sources or fail clearly. Binary package distribution is not remote action-cache support. +- Use runtime credential providers/configuration outside committed manifests/locks. Verify HTTPS and configured registry authority; redact authentication from progress/error records. + +## Implementation sequence + +1. Implement source-provider adapters with deterministic identities and managed staging. +2. Implement verified archive materialization and complete source-package manifests. +3. Implement binary variant compatibility and source-build fallback through provider/native actions. +4. Add offline cache reuse, interrupted transfer recovery, concurrency ownership and bounded cleanup. + +## Failure behavior and boundaries + +- No extraction outside the destination, overwriting source files, credential leakage or permissive TLS fallback. +- A digest verifies bytes, not publisher identity; transport/registry trust is separate. +- Mutable local source changes invalidate provider builds even with unchanged mtimes. +- A failed source build cannot publish a usable binary package. + +## Acceptance scenarios + +1. Pinned Git/local/archive variants, wrong hashes, truncated downloads and offline reuse. +2. Traversal, absolute paths, symlink escapes, collisions and extraction quota failures. +3. Same bytes exported from checkout/archive retain configuration helpers without Git. +4. ABI/compiler/CPU/sanitizer/dependency mismatch never selects a binary optimistically. +5. Concurrent fetches and cancelled builds leave no published partial package. + +## Verification and integration gate + +NEW local HTTP/Git fixture repositories and malicious-archive fixtures; no production endpoints required. End-to-end native/provider package tests use isolated directories and verified identities. Record actual source fallback versus binary selection. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void Net/Archive/Crypto facilities only after bounded-stream/extraction/TLS capabilities are verified. Focused adapters are allowed; reusable safe extraction and digest streaming can later move upstream. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/13-foreign-providers.md b/docs/roadmap/13-foreign-providers.md new file mode 100644 index 0000000..d780099 --- /dev/null +++ b/docs/roadmap/13-foreign-providers.md @@ -0,0 +1,67 @@ +# 13 — CMake, Meson and Conan providers + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-008, R-009, R-010, R-014. +- Delivery phase: Foreign dependency interoperability. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 04 toolchains; 05/07 source identities/state; 06 processes; 11/12 resolved dependencies; 03 ImportedTarget contract. +- Proposed exclusive implementation scope: src/providers/cmake/, src/providers/meson/, src/providers/conan/, tests/providers/; common provider interface root-owned. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Initially run foreign tools in isolated source/profile/toolchain contexts and import artifacts plus complete consumer requirements. Do not translate their build graph into native actions in this milestone. +- ImportedTarget includes public/system include paths, definitions/options, ordered link requirements, static implementation dependencies, runtime artifacts, generated prerequisites, configuration mapping and module capabilities. +- Use CMake>=4.2 File API for configured target/artifact facts plus evaluated consumer-interface probes/exports. File API target/build dependencies are not automatically complete transitive public link metadata. +- Use configured Meson introspection for targets/build options and exported pkg-config or explicit interface data for consumers. Use Conan2 component-aware generated metadata and separate build/host contexts; do not flatten components indiscriminately. +- Where complete interface data is unavailable, require an explicit typed interface description and diagnose the missing fields. Never guess usage requirements from filenames or scrape compile_commands as a complete graph. +- Provider input identity includes source contents, build definitions, tool versions, options, toolchain and dependencies. Changed immutable source identities use invalidated/fresh managed build state so foreign timestamp shortcuts cannot retain wrong binaries. +- Define metadata-only operations as reads of validated cached exports/introspection. Never invoke CMake configure, Meson setup, Conan install, nested generators or builds from compdb watch. + +## Implementation sequence + +1. Freeze provider requests, imported interfaces, freshness guards and metadata-only capability contract. +2. Implement CMake build/import with representative target/interface fixtures. +3. Implement Meson and Conan2 adapters with their own availability/version probes and fixtures. +4. Add imported target graph integration, explicit overrides, compdb merging/projection where valid and cancellation/recovery. + +## Failure behavior and boundaries + +- Missing executable/provider version is a prerequisite diagnostic; Conan absence is not a successful empty import. +- Unknown metadata semantics require explicit support or a clear unsupported result. +- Do not expose mutable provider build paths as immutable shared artifacts until publication validates them. +- Nested bridge/provider operations must not deadlock on project/package locks. + +## Acceptance scenarios + +1. Public/private/interface requirements, static transitive links, generated headers and ordered link flags. +2. Debug/release and GCC/Clang imports remain isolated; ABI mismatch fails. +3. Edit foreign source with preserved timestamp/size and verify changed output. +4. Provider errors/cancellation/reconfiguration failures never publish partial imports. +5. Metadata-only fixture cannot execute configure side effects; stale status is explicit. + +## Verification and integration gate + +NEW tiny CMake/Meson/Conan fixture projects build and link a native consumer. Test real supported versions and record their identities. Add the first VoidLibrary provider fixture, but do not edit its checkout. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void process/path/data facilities. Official references: CMake File API, Meson IDE-integration/introspection docs and Conan2 CppInfo/custom-generator docs; keep adapter version contracts explicit. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/14-cmake-bridge.md b/docs/roadmap/14-cmake-bridge.md new file mode 100644 index 0000000..577b519 --- /dev/null +++ b/docs/roadmap/14-cmake-bridge.md @@ -0,0 +1,66 @@ +# 14 — CMake-facing dependency integration + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-009, R-010, R-018. +- Delivery phase: Package-manager adoption. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 11/12 native package resolution; 13 imported interfaces; 15 package exports. +- Proposed exclusive implementation scope: cmake/bridge/, src/package/export-cmake/, tests/cmake-bridge/; root owns bridge/CLI protocol compatibility. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Ship VbsDeps.cmake as a dependency integration module. Provide new vbs_declare_dependency and vbs_make_available helpers with FetchContent/CPM-style declaration/use separation; do not claim exact macro-level drop-in compatibility. +- Allow CMake consumers to use native registry packages and pinned sources without authoring build.cpp. Normalize requests to the same model/lock protocol as native projects. +- Resolve/fetch/build only during explicit full dependency operations initiated by the CMake bridge. Generate package-config/imported-target files from typed interfaces, preserving transitive requirements, configuration mappings and runtime artifacts. +- Use structured request/result files or argv with correct escaping; avoid shell interpolation. Include requester toolchain/profile/build-target contexts so a host-native package is not substituted into a cross build. +- Share verified package blobs while keeping mutable CMake and provider build directories isolated. Define reentry/cycle diagnostics and no global transaction held over a nested child process. +- Support locked/offline operation and clear vbs executable/version discovery. Missing vbs is a prerequisite, not permission to download an arbitrary unpinned binary. + +## Implementation sequence + +1. Freeze helper signatures and versioned native CLI request protocol. +2. Implement model normalization and generation of imported targets/config files. +3. Integrate multi-config/cross-context mapping and package lock ownership. +4. Write consumer examples and test nested dependency/error/cancellation behavior. + +## Failure behavior and boundaries + +- Conflicting declarations identify both CMake origins; no silent first-writer version selection. +- Avoid unescaped CMake lists/semicolons, quotes and paths. +- No native-build-language requirement added to the consuming CMake project's own targets. +- Unsupported interface features fail rather than drop needed transitive flags. + +## Acceptance scenarios + +1. CMake executable consumes a native package, a CMake source package and a Meson source package. +2. Multiple declarations deduplicate compatible requests and diagnose incompatible ones. +3. Multi-config/debug-release/cross-toolchain mapping and offline/locked repeatability. +4. Paths with spaces, quotes and semicolons; version mismatch and missing vbs diagnostics. +5. Nested package use does not deadlock or overwrite another build's artifacts. + +## Verification and integration gate + +NEW ordinary CMake consumer fixtures configure/build/run against the installed bridge and CLI, separate from building VBS itself. Trace which resolver/provider executes; no production registry needed. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Reuse the native package model and exporter; do not implement a second solver in CMake. CMake code remains dependency glue permitted by the user. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/15-install-export.md b/docs/roadmap/15-install-export.md new file mode 100644 index 0000000..9e30276 --- /dev/null +++ b/docs/roadmap/15-install-export.md @@ -0,0 +1,66 @@ +# 15 — Installation, exports and package consumption + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-009, R-010, R-018. +- Delivery phase: Product distribution. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 03 usage model; 04 ABI/toolchain contexts; 06 artifacts; 11/12 package model. +- Proposed exclusive implementation scope: src/install/, src/export/, tests/install/; export schema and generated files root-owned. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Declare installation rules in C++ with explicit artifact/header/data destinations and component selection. Build into managed staging first; install only declared files. +- Export native package metadata and generated CMake configs from the same typed usage requirements. Preserve public/system includes, definitions, ordered static/shared dependencies, configuration mapping and compatible module metadata. +- Keep installed metadata relocatable where the artifact format permits. Do not leak build-only dependency directories, temporary snapshots or local absolute source paths as required consumer inputs. +- Handle runtime shared libraries and platform loader paths explicitly. Static bootstrap linkage is not a promise that all user products are static. +- Treat install prefixes as user-managed destinations with ownership manifests. Support staged packaging and predictable uninstall of owned files without deleting unrelated content. +- Keep source/binary package manifests separate from the build lock; installation/export records identify the exact artifacts and compatibility context. + +## Implementation sequence + +1. Implement typed install/export records and validated relative destinations. +2. Implement staging, ownership manifests and conflict handling. +3. Generate native and CMake consumer metadata, then add runtime-library closure handling. +4. Add relocation/component/uninstall fixtures and integrate registry package publication preparation. + +## Failure behavior and boundaries + +- Reject path traversal, source overwrite, duplicate destination conflicts and unsupported relocations. +- Never remove unrelated prefix files during uninstall/recovery. +- An incomplete or incompatible module export cannot be advertised as usable. +- Failed staging/publication does not leave metadata pointing to missing artifacts. + +## Acceptance scenarios + +1. Install under a temporary prefix, relocate it and build a fresh native/CMake consumer. +2. Static/private dependency propagation and shared runtime loading. +3. Component selection, path conflicts, staged interruption and uninstall preservation. +4. No references to temporary snapshot/build paths in supported relocated exports. +5. Source and binary package variants retain correct profile/ABI metadata. + +## Verification and integration gate + +NEW integration consumers run in isolated prefixes with original build directories unavailable. Inspect exported references and actual program runtime behavior rather than just file presence. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void filesystem/archive/data helpers after validation; reusable safe installation/manifest primitives are upstream candidates, package policy stays in VBS. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/16-registry-service.md b/docs/roadmap/16-registry-service.md new file mode 100644 index 0000000..a460ba5 --- /dev/null +++ b/docs/roadmap/16-registry-service.md @@ -0,0 +1,67 @@ +# 16 — Hosted package registry service + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-009, R-012, R-014. +- Delivery phase: Full v1 registry. +- Intended configured role: astra_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 11 package identity/solver metadata; 12 source/binary formats; 15 exports; API frozen before 17 UI. +- Proposed exclusive implementation scope: registry/service/, registry/include/, tests/registry-service/; root owns API/schema versions and migrations. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Implement a separate C++ service, initially one node with filesystem content-addressed artifacts and SQLite metadata. Use Void facilities where verified; no compulsory third-party hosted service. +- Version the API around package search, release metadata, source/binary download, publish, yank, users, roles, tokens and audit records. UI and CLI use this same API. +- Published release bytes are immutable. Repeating identical publication can be idempotent; different bytes for an existing identity conflict. Yanking changes availability policy without rewriting locked history. +- Publishing requires authenticated scoped authority and package ownership. Provide reader/publisher/admin roles, private/public visibility policy, bounded tokens and revocation. Store token hashes, not bearer secrets; use established password/session primitives where accounts require them. +- Stream uploads to private staging, enforce configurable size/entry/quota limits, validate hashes and archive/manifest paths, then publish blobs before transactionally recording references. The server never executes uploaded build recipes. +- Development binds to loopback; eventual deployment uses an explicitly configured reverse-proxy TLS/public origin and trusted proxy policy. HTTPS + configured registry authority + authenticated publication and hashes define initial trust; standalone publisher signing is not silently promised. +- Implement audit records with secret redaction, integrity checks, orphan collection and consistent metadata/blob backup/restore. Runtime credentials stay outside committed and Nix-store payloads. + +## Implementation sequence + +1. Verify required HTTP/storage/security Void APIs and freeze API/errors/authentication schemas. +2. Implement read/index/download operations and native client interoperability against local fixtures. +3. Implement authenticated publication/yank, transactional blobs, ownership/roles/tokens and audits. +4. Add quotas/recovery/backup, harden request parsing and run independent security-oriented review before any exposure. + +## Failure behavior and boundaries + +- Never trust a supplied filename, archive path, digest, role or forwarded header without validation. +- Failed/revoked authorization cannot expose private metadata or content; publish cannot overwrite release bytes. +- No cache/registry credential in locks, diagnostics, browser URLs or audit payloads. +- No actual server deployment or public exposure follows merely from code/review completion. + +## Acceptance scenarios + +1. Role/package authorization matrix, private read isolation, token expiry/revocation and privilege escalation attempts. +2. Immutable/idempotent/conflicting publication, invalid digest, interrupted upload and concurrent same-version publish. +3. Oversized/malformed archives, traversal/symlink cases and quotas. +4. Crash between blob publication/metadata commit; backup/restore preserves releases and ownership. +5. Malicious recipe upload never executes server-side; logs/audits contain no secrets. + +## Verification and integration gate + +NEW local HTTP service fixtures with ephemeral ports, private test credentials and isolated storage. Run migration/restore and concurrent-client tests. Deployment needs a separate environment/authorization record. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void Net/Sqlite/Crypto/Security/Log where contracts suffice; established focused libraries are allowed for gaps. Authentication and robust HTTP/streaming primitives are candidates for upstream reuse. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/17-registry-ui.md b/docs/roadmap/17-registry-ui.md new file mode 100644 index 0000000..60c2f8e --- /dev/null +++ b/docs/roadmap/17-registry-ui.md @@ -0,0 +1,66 @@ +# 17 — Registry web administration + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-009, R-012. +- Delivery phase: Full v1 registry. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 16 stable authenticated API/error model; 12/15 package metadata shapes. +- Proposed exclusive implementation scope: registry/web/, tests/registry-web/; API changes requested from service owner, never made silently. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Provide a browser interface for package search, release detail, source/binary variants, publish/yank, user/role/token management, audit history and storage administration. +- Use ordinary HTML/CSS/JavaScript assets served with the C++ service. Keep runtime business logic and authorization in the service; no independent browser-side solver or privileged policy. +- Use authenticated sessions with HttpOnly cookie handling, origin/CSRF protection for mutations and server-side role checks. Never persist privileged bearer tokens in public URLs or rendered logs. +- Render package descriptions, names, filenames and diagnostics as untrusted text. Apply escaping/content policies; show integrity and compatibility metadata without executing package content. +- Design loading, empty, unauthorized, expired-session, validation/conflict, upload-progress and server-error states. Keyboard navigation, labels, focus management and accessible confirmation/status messages are required. +- Publishing/yanking and role/token changes show the affected package/version/user and server result. Do not present an optimistic success before durable publication; double submissions must be safe. + +## Implementation sequence + +1. Create package browsing/search/detail flows against API fixtures. +2. Add authenticated session/navigation and role-aware administration views. +3. Implement upload/publish/yank and user/role/token/audit/storage workflows. +4. Run browser/accessibility/security-state fixtures and integrate real service end-to-end tests. + +## Failure behavior and boundaries + +- Hidden buttons do not establish authorization; every mutation is checked server-side. +- Expired/revoked sessions cannot leave stale privileged controls functioning. +- Malformed server responses produce recoverable errors without rendering raw unsafe HTML. +- No required paid UI service or public hosting is introduced. + +## Acceptance scenarios + +1. Browse/search/empty/error states and keyboard-only workflows. +2. Login/logout/session expiry; reader/publisher/admin access and direct unauthorized request attempts. +3. XSS payloads in all displayed package metadata; CSRF rejection on mutations. +4. Successful/failed/interrupted uploads, duplicate clicks, conflicting publish and yank recovery. +5. User/role/token changes, token shown only at creation, redacted audits and storage quota errors. + +## Verification and integration gate + +NEW browser automation plus real local service integration, with test runner versions pinned in the future harness. Do not call a mock UI proof of backend authorization. Public deployment remains separate. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +The same C++ registry API owns data and security. Void HTML/text helpers may assist server rendering; avoid duplicating escaping/auth mechanisms across layers. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/18-self-host-voidlibrary.md b/docs/roadmap/18-self-host-voidlibrary.md new file mode 100644 index 0000000..f36c77b --- /dev/null +++ b/docs/roadmap/18-self-host-voidlibrary.md @@ -0,0 +1,66 @@ +# 18 — Native self-hosting and VoidLibrary migration + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-001, R-004, R-005, R-006, R-013. +- Delivery phase: First native adoption. +- Intended configured role: astra_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: 02-07 native core; basic 11-13 dependency support; 08 when required by selected sources; 15 exported closure. +- Proposed exclusive implementation scope: root build.cpp/build.profiles.cpp, build-support/, recipes/VoidLibrary/, tests/selfhost/ after explicit ownership transfer; no automatic external repository writes. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- CMake produces stage0 only. Stage0 uses the native description to build stage1; stage1 builds stage2 in a fresh directory and builds the required VoidLibrary closure natively. +- Keep the initial description aligned with real target/source/dependency requirements, then replace its CMake Void provider with an approved native recipe. Source remains pinned; a recipe in this repository can exercise an external immutable checkout without editing it. +- Translate VoidLibrary module selection and transitive/optional dependencies into native targets. Preserve aliases, compile definitions/features, platform requirements, installation/export behavior and static/shared distinctions. +- Replace CMake-only test registration for strict native stages. Preserve current discovery semantics and test names/counts while avoiding equal-basename collisions with stable path-based generated identities; use a supported upstream registration API when available. +- Later stages may use the already supplied external compiler/SDK prerequisites but must not invoke CMake or reuse bootstrap-produced project/Void artifacts. Instrument this boundary in tests. +- Compare normalized graph behavior, executed acceptance fixtures and outputs. Bit-identical binaries are not required without a separately established reproducible-build contract. + +## Implementation sequence + +1. Make the native frontend build the tool's own graph and tests with imported dependencies. +2. Add a pinned native VoidLibrary module recipe and required test registration generator. +3. Build stage0->stage1->stage2 with isolated directories and artifact provenance checks. +4. Run mutation, clean rebuild, packaging and installed-consumer comparisons; document migration gaps before wider Void adoption. + +## Failure behavior and boundaries + +- A wrapper that calls CMake for the tool's own compilation is not self-hosting. +- Using old stage outputs or CMake-generated test shims cannot satisfy strict clean native stages. +- Do not claim all VoidLibrary modules work because a minimal closure does; track expanded library coverage explicitly. +- Changes to the actual VoidLibrary repo need a separate owned assignment, not incidental edits. + +## Acceptance scenarios + +1. Clean staged rebuilds and same test suite run by stages1/2. +2. Trap CMake invocation in strict stages; isolate old build artifacts so accidental reuse fails. +3. Edit tool source/helper/profile, add/remove selected source, delete output, cancel and recover. +4. Native module selection/export/test registration matches the baseline for the adopted VoidLibrary closure. +5. Same test names/counts and relevant consumer behavior before/after migration. + +## Verification and integration gate + +NEW self-host harness records tool/stage identities, commands, provenance and actual tests. Initial CMake bootstrap results do not satisfy this gate. Expand VoidLibrary acceptance from required closure to wider module matrix explicitly. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Native recipe consumes verified VoidLibrary APIs. Native test-registration and build-export conveniences may later be contributed upstream under separate scope. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/19-quality-performance-ci.md b/docs/roadmap/19-quality-performance-ci.md new file mode 100644 index 0000000..240ff36 --- /dev/null +++ b/docs/roadmap/19-quality-performance-ci.md @@ -0,0 +1,66 @@ +# 19 — Quality, performance and CI + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-005, R-007, R-008, R-011, R-014, R-015, R-016. +- Delivery phase: Every milestone and full v1 hardening. +- Intended configured role: sol_implementer at XHigh; fresh astra_reviewer acceptance. +- Dependencies: Each feature's concrete contracts; 01 supplies initial test harness. Future CI environment must be inspected before workflow activation. +- Proposed exclusive implementation scope: tests/integration/, tests/adversarial/, benchmarks/, CI workflow files under a separately approved owner; root owns acceptance evidence. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Use deterministic unit/property tests for models and algorithms, subprocess integration for lifecycle/recovery, real compiler fixtures for semantic correctness and browser tests for registry UI. +- Test initial GCC16.2 and Clang23.1.3 target drivers separately from the GCC16 host build. Record stdlib/toolchain identities and capability exceptions; a skipped unsupported matrix entry is not a pass. +- Maintain mutation, snapshot, negative-lookup, generated-input, module, compdb-race, lock-race, provider and registry failure suites. Inject failures at publication boundaries and compare with clean execution. +- Use Void::Testing where appropriate and verify nonzero registered test cases. Test code itself is reviewed; assertions must check observable outcomes rather than merely repeat implementation steps. +- Benchmark clean/no-op/single-source/transitive-header/source-set/module/profile/cache/watch scenarios on documented fixture sizes. Track hashing/capture work and compiler launches separately; no unmeasured numerical SLA. +- Add CI only for verified runner/toolchain provisioning. Avoid copying secrets into source artifacts, cache logs or Nix store inputs. Preserve exact failed commands and unrun prerequisites. + +## Implementation sequence + +1. Establish test conventions, isolated resources and required feature acceptance mappings. +2. Add deterministic adverse fixtures alongside each implementation, not as a final cleanup phase. +3. Define measured benchmark baselines and nonflaky regression thresholds from observed variance. +4. Configure CI with pinned prerequisites, sanitizer jobs, artifact/log retention and clean self-host checks after local evidence. + +## Failure behavior and boundaries + +- No success from zero tests, ignored child status, skipped compiler matrix or absent tools. +- Do not weaken assertions to hide architecture bugs or retry infrastructure errors as if code were invalid. +- After two failed repair cycles on one issue, preserve evidence and route changed-hypothesis diagnosis to Astra. +- Fresh adversarial review remains required even when automated tests pass. + +## Acceptance scenarios + +1. Harness deliberately failing/zero-registration cases are detected. +2. Failure-injection fixtures fail when publication/cancellation protections are removed. +3. Benchmarks report reproducible fixture/toolchain/context and distinguish cache warmup. +4. CI cannot pass after skipping required compiler or stage-self-host checks. +5. Documentation/requirement mapping and task ownership stay consistent with observed source. + +## Verification and integration gate + +Use actual project commands from README once present; each future fixture/runner gets concrete discovered commands in its task spec. Initial acceptance is CMake + CTest local/pinned source, not an invented native vbs command. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void Testing/TestingMock/Time/observability where validated. Generic deterministic failure-injection and reporting utilities may become upstream candidates. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/20-future-translation-platforms.md b/docs/roadmap/20-future-translation-platforms.md new file mode 100644 index 0000000..a468c34 --- /dev/null +++ b/docs/roadmap/20-future-translation-platforms.md @@ -0,0 +1,66 @@ +# 20 — Later native foreign execution and platform ports + +Implementation status: planned, except the initial bootstrap when marked verified in +[STATE](../agent-workflow/STATE.md). This document is an implementation contract, +not a report that the capability exists. + +## Requirements and ownership + +- Requirements: R-010, R-015. +- Delivery phase: After full-v1 foundations. +- Intended configured role: astra_planner at XHigh; fresh astra_reviewer acceptance. +- Dependencies: Stable 03-08 action/toolchain contracts and proven 13 adapters; separate implementation approval/task contracts for each supported slice. +- Proposed exclusive implementation scope: Future src/providers/translation/, platform-specific driver/backend directories and compatibility fixtures; planning read-only until precise implementation ownership is assigned. + +Before dispatch, reconcile these paths with the real HEAD, write a full task spec, +lint it, and transfer shared-file ownership explicitly. Paths that do not yet exist +are NEW. Source-disjoint work still coordinates shared state, ports and build directories. + +## Design and interfaces + +- Native graph translation is a later goal, distinct from v1 run-and-import. Initially retain foreign tools for configuration/evaluation while translating only a documented complete subset of resulting actions for native execution. +- Do not treat CMake codemodel, Meson introspection or compile_commands as a complete action graph. Custom commands, depfiles, generated files, pools, response files, dynamic module edges, environments and ordering need explicit evidence. +- Prototype a bounded configured-generator export/import route and prove semantic equivalence against the original tool. Unsupported graph constructs cause a diagnostic or explicit foreign-provider fallback, never silent omission. +- Conan is a package/recipe system; native execution concerns supported underlying builder actions or reusable binary packages. Do not promise arbitrary Python recipe translation. +- Add Windows/MSVC and macOS/Apple Clang through platform/toolchain interfaces after Linux correctness is stable. Cover process lifecycle, path/case semantics, watcher loss, loader/install behavior and module/debug formats. +- Remote action caching and distributed workers remain deferred options, not registry binary distribution. They require separate trust, transport, platform execution and complete-input contracts before adoption. + +## Implementation sequence + +1. Inventory foreign metadata coverage with small official-tool fixtures and record unsupported constructs. +2. Choose one bounded translation subset and freeze its completeness/compatibility contract before implementation dispatch. +3. Compare native and original execution under source/generator/environment/module mutations. +4. Port platform primitives and compiler drivers with native CI evidence, preserving shared invariants rather than conditional approximations. + +## Failure behavior and boundaries + +- No marketing claim of replacing arbitrary CMake/Meson logic without a tested compatibility boundary. +- Unknown actions or incomplete dependencies cannot be dropped to make a build appear successful. +- No cross-platform support inferred from compilation alone; lifecycle/filesystem behavior needs real hosts. +- No remote service deployment, credentials or expanded source exposure assumed. + +## Acceptance scenarios + +1. Supported subset yields equivalent outputs and rebuild decisions under adversarial mutations. +2. Unsupported custom/dynamic rule produces an explicit result or selected fallback. +3. Foreign generated headers, response files and module actions preserve order. +4. Windows/macOS native process cancellation, paths, watcher recovery, installation and compiler feature matrix. +5. No regression in Linux/context isolation when platform backends are introduced. + +## Verification and integration gate + +This is a planned research/implementation sequence. No translator or platform test command exists yet. Each slice needs discovered original-tool commands, native equivalence fixtures, planner preflight and independent final review before claims. + +Acceptance requires observed results for these scenarios, the affected regression +suite, reviewed cross-component contracts, and a fresh independent review. Record +unrun checks and environment limitations; tests passing alone do not waive an invariant. +No merge, push or deployment is authorized by a review verdict. + +## VoidLibrary reuse and upstream candidates + +Void platform capabilities may expand before these ports; re-inspect the pinned version then. Generic process/watch/path improvements should be considered for upstream use rather than duplicated blindly. + +Shared invariants and input/publication policies are defined in +[ARCHITECTURE](ARCHITECTURE.md); requirement authority is +[REQUIREMENTS](REQUIREMENTS.md). Return implementation evidence to +[VERIFICATION](../agent-workflow/VERIFICATION.md). diff --git a/docs/roadmap/ARCHITECTURE.md b/docs/roadmap/ARCHITECTURE.md new file mode 100644 index 0000000..059c116 --- /dev/null +++ b/docs/roadmap/ARCHITECTURE.md @@ -0,0 +1,180 @@ +# Architecture and cross-subsystem contracts + +Status: approved design; the initial implementation is the bootstrap only. +See [requirements](REQUIREMENTS.md), [delivery graph](README.md), and the +[preflight record](../agent-workflow/PREFLIGHT.md). Proposed types and commands below +are future contracts unless README explicitly lists them as implemented. + +## Layers and control flow + +1. The CLI selects a project/build root, requested profiles and targets. +2. A seed recipe captures configuration sources and builds a host executable from + build.cpp, optional build.profiles.cpp and build-support helpers. +3. Profile discovery returns declared profiles; the engine resolves inheritance, + installed toolchains and capabilities. +4. The same host executable evaluates build.cpp separately for each effective + ProfileContext. It emits a versioned declarative graph, not engine callbacks. +5. The resolver validates or creates the lock and imports dependency interfaces. +6. The engine captures the relevant source/include namespace, then lowers targets + into actions, scans module dependencies and orders generated prerequisites. +7. The scheduler executes only required actions against immutable inputs. Outputs + become immutable artifacts after validation; successful state references them. +8. Editor projection derives a per-profile compilation database from the configured + graph. Selection/publication does not wait for every target to compile. +9. Watch drivers request new reconciliations. They do not introduce another + invalidation algorithm or silently bypass dependency restrictions. + +The configuration executable is compiled using the fixed installed SDK and local +helpers. A project dependency cannot be required just to compile its declaration. +The host compiler, target compiler and build-machine tools are separate identities. + +## Core records + +| Record | Meaning and owner | +| --- | --- | +| ProfileDefinition / ProfileContext | User declarations versus resolved compiler/platform/options facts; frontend/toolchain | +| ProjectDescription | Targets, source selections, symbolic dependencies and context; configuration frontend | +| Target / UsageRequirements | Product kind, compile/link visibility, ordered requirements; graph layer | +| SourceSet / NamespaceObservation | Explicit paths or selector membership, symlinks and absence/lookup guards; input layer | +| InputSnapshot | Immutable manifest and materialized captured bytes with deterministic metadata; snapshot layer | +| ToolchainIdentity | Driver/helper/sysroot identities, capabilities and relevant environment; toolchain layer | +| Action / Artifact | Typed argv/env/cwd, inputs, outputs, prerequisites and success identity; execution layer | +| ImportedTarget | Consumer requirements, artifacts, configuration mapping and freshness obligations; provider | +| ResolvedGraph / LockRevision | Exact package graph per profile/build-target context and immutable lock payload; packages | +| GraphGeneration / EditorGeneration | Validated immutable descriptions and editor projections; metadata layer | +| SelectionTicket | Project-wide ordering of explicit/implicit editor selection; editor coordinator | + +Shared schemas and public headers have one owner per wave. Freeze their versions +before parallel dependent implementation; changes invalidate affected task contracts. + +## Profiles and paths + +One build root contains profiles// with independent mutable outputs and +generation directories. Internal state and immutable CAS live below .vbs/ in that +build root. Project-local .vbs/ coordinates the selected editor build root/profile. +Source, build and package paths have distinct logical namespaces. + +Serialize execution within a profile initially. Different profiles may execute +concurrently under one job budget. Never share mutable object files, BMIs, PCHs, +response files, provider build trees or generated headers between incompatible contexts. + +Configuration helpers are discovered by filesystem selection, not git ls-files. +Their content and membership enter the seed compilation identity; package source +manifests retain them. Optional profile sources are discovered before the seed build, +so no package-resolution cycle is needed to find profile definitions. + +## Snapshots and freshness + +Capture declared source/include/search roots, source membership, relevant metadata +and symlink resolution. Track absent candidates that could change include/library +lookup. Depfiles alone are insufficient for a newly created shadowing header. +Compiler helpers, sysroots and immutable external roots require an explicit identity. + +Private copies or isolated reflinks materialize inputs. Never hardlink mutable source +files. Revalidate the captured namespace/contents before sealing; bounded retries +report an unstable tree. This freezes admitted bytes; without a filesystem primitive +or cooperating writers it does not prove a single atomic instant across every file. + +Generated output sets are staged, validated and sealed before dependents execute. +Opaque actions and undeclared I/O are outside the complete-input guarantee and cannot +reuse results as if their inputs were fully modeled. C++ descriptions are trusted +native code; process isolation and snapshots are not a sandbox. + +A reproducibility epoch (default zero) is part of action identity. Canonicalize +snapshot timestamps, use SOURCE_DATE_EPOCH/TZ/locale policies and capability-tested +path maps. Include other supported observable metadata in identity. Explicit +wall-clock/nondeterministic modes disable both cache and incremental reuse for +affected actions. Test __DATE__, __TIME__, __TIMESTAMP__, __FILE__, __BASE_FILE__ +and source-location behavior against uncached execution. + +## Publication, persistence and cancellation + +Successful process exit is necessary but not sufficient: validate required outputs, +dependency metadata and discovered ordering before recording reusable success. +No output may have multiple producers or overlap editable source paths. +Removed source objects must disappear from archive membership. + +Use transactional state behind a Void::Sqlite adapter after its guarantees have +been verified. Publish complete artifact/generation objects before committing +references. Recover orphaned objects or stale filesystem pointers conservatively. +SQLite authority and filesystem projections must have a replayable recovery rule. + +Never hold a global database transaction across a compiler or foreign tool. +Coordinate per-key build claims without recursive deadlocks; diagnose dependency +cycles and re-entry into the same active context. Cancellation stops scheduling, +terminates owned process groups, reaps children and withholds success publication. +The pinned Void process API needs additional handling when its group leader exits +before descendants; test that exact case instead of assuming group cleanup. + +## Editor view + +Retain exact physical execution records. EditorCommand is an explicit projection +onto editable source paths and compatible immutable generated views. Rewrite typed +path operands, including response-file projections; do not blindly replace strings +inside definitions or unknown flags. Path-sensitive binary artifacts cannot be +relocated on faith: include physical/toolchain identity unless proven safe. + +Per-profile compile_commands.json covers configured enabled targets, even when a +build selects only one. Include host-description commands where tooling can represent +them. Standard JSON arguments are preferred to shell command strings. +Compilation-database validity is separate from clangd support for compiler extensions. + +A single-profile build reserves a ticket and publishes selection after successful +configuration. Compilation failure does not undo it. Multi-profile requests require +--editor-profile from the selected profiles. Manual use creates a newer ticket. +Watchers update generations but never steal selection. Revision checks stop late +work from publishing over a newer request. Atomic pointers expose complete generations; +unrelated user-owned project-root files are never overwritten. + +## Watch modes + +Full build/watch may configure and build dependencies. compdb watch may rebuild and +evaluate trusted local descriptions and run known native probes/scanners, but reads +only validated cached foreign metadata and existing locked package data. It does not +fetch, update a lock, run CMake configure/Meson setup/Conan install or run generators. +User C++ can have its own side effects; no sandbox claim is made. + +Invalid descriptions, stale provider metadata or missing generated inputs produce +explicit stale/readiness diagnostics. Keep a previous valid database identifiable as +previous, never fabricate current commands. Valid source-set changes can publish +before target compilation succeeds. Events are hints; periodic content/namespace +reconciliation and overflow recovery provide correctness. + +## Package and foreign boundaries + +C++ and TOML declarations normalize to one model. Compatible transitive constraints +solve together; conflicting identities/options have origin diagnostics. Resolution +contexts distinguish profile and build/target machine. Registry authority is part +of identity to prevent silent substitution across registries. + +A first ordinary build may create a missing lock; --locked forbids changes. Existing +incompatible declarations require explicit resolution. Solve outside a short +publication lock, then compare revisions, revalidate declarations/contexts and atomically +replace. Retry/re-resolve competing updates rather than lose other profile contexts. +Every build pins one immutable lock payload/hash. + +Foreign providers return complete typed usage requirements or require explicit +descriptions of gaps. CMake File API, Meson introspection and Conan CppInfo are +inputs, not automatic proof of complete public interfaces. Changed immutable source +identities must invalidate opaque provider results even when timestamps match. +No inference from a library filename alone; preserve order, static implementation +link dependencies, generated prerequisites and configuration mappings. + +Registry binary packages are not the local action cache. Binary compatibility +includes toolchain/stdlib ABI, target/CPU, linkage, profile features, sanitizer/LTO +settings and dependency closure. Published release bytes are immutable; yanking +changes selection policy. Authentication + configured HTTPS + hashes define initial +trust; hashes alone do not authenticate publishers. + +## VoidLibrary reuse and gaps + +The pinned source provides Configuration, System, Testing, Data and other relevant +modules. Reuse verified APIs, not roadmap promises. The simple FileWatcher is a +polling hint, not sufficient recursive/content correctness. Explicit process APIs +preserve failures that legacy helpers can discard. Current test discovery is a CMake +generator and must be replaced for strict native self-host tests. + +Candidates for later upstream work: robust descendant lifecycle, recursive rescan +signals, streaming cryptographic hashing, transactional file publication, TOML, +and a supported native test-registration interface. Local focused wrappers are +allowed; no cross-repository edits are implicit. diff --git a/docs/roadmap/README.md b/docs/roadmap/README.md new file mode 100644 index 0000000..4376918 --- /dev/null +++ b/docs/roadmap/README.md @@ -0,0 +1,96 @@ +# Roadmap and delivery graph + +The current deliverable is a compiling bootstrap and declaration SDK plus these +detailed plans. Full native execution and the rest of v1 are subsequent milestones. +For implemented behavior and commands, start with the [project README](../../README.md). + +Authority: [requirements](REQUIREMENTS.md), [architecture](ARCHITECTURE.md), +[decisions](../agent-workflow/DECISIONS.md), [approved scope](../agent-workflow/APPROVED_PLAN.md). +Do not infer implementation status from a plan's existence. + +## Per-part implementation plans + +| Part | Delivery phase | Intended role | +| --- | --- | --- | +| [01 — Bootstrap and declaration SDK](01-bootstrap-sdk.md) | Initial delivery | sol_implementer | +| [02 — Native C++ configuration frontend](02-configuration-frontend.md) | Core native engine | astra_implementer | +| [03 — Targets, usage requirements and action graph](03-targets-action-graph.md) | Core native engine | sol_implementer | +| [04 — Profiles, target selection and toolchains](04-profiles-toolchains.md) | Core native engine | sol_implementer | +| [05 — Immutable snapshots and mutation tracking](05-snapshots-invalidation.md) | Core correctness foundation | astra_implementer | +| [06 — Native execution, scheduling and process lifecycle](06-execution-scheduling.md) | Core native engine | astra_implementer | +| [07 — Transactional state and local artifact cache](07-state-local-cache.md) | Core correctness foundation | astra_implementer | +| [08 — Modules, header units and compiler features](08-modern-cpp.md) | Full v1 compiler capability | astra_implementer | +| [09 — Compilation databases and editor selection](09-compilation-database.md) | Core developer experience | sol_implementer | +| [10 — Reconciliation, build watching and metadata watching](10-watchers-cli.md) | Core developer experience | sol_implementer | +| [11 — Dependency declarations, native solver and lockfile](11-dependencies-solver-lock.md) | Native package management | sol_implementer | +| [12 — Acquisition, source packages and binary packages](12-fetching-packages.md) | Native package management | sol_implementer | +| [13 — CMake, Meson and Conan providers](13-foreign-providers.md) | Foreign dependency interoperability | sol_implementer | +| [14 — CMake-facing dependency integration](14-cmake-bridge.md) | Package-manager adoption | sol_implementer | +| [15 — Installation, exports and package consumption](15-install-export.md) | Product distribution | sol_implementer | +| [16 — Hosted package registry service](16-registry-service.md) | Full v1 registry | astra_implementer | +| [17 — Registry web administration](17-registry-ui.md) | Full v1 registry | sol_implementer | +| [18 — Native self-hosting and VoidLibrary migration](18-self-host-voidlibrary.md) | First native adoption | astra_implementer | +| [19 — Quality, performance and CI](19-quality-performance-ci.md) | Every milestone and full v1 hardening | sol_implementer | +| [20 — Later native foreign execution and platform ports](20-future-translation-platforms.md) | After full-v1 foundations | astra_planner | + +Each plan contains concrete interfaces/behavior, ordered work, dependencies, +exclusive ownership proposals, failure boundaries, acceptance cases and verification +gates. Future paths and commands are marked as such. A full linted task contract +against the actual HEAD is still required before dispatch. + +## Milestones and dependencies + +```mermaid +flowchart TD + A["01 Bootstrap / SDK"] --> B["02 Configuration + 03 Graph + 04 Profiles"] + A --> C["05 Snapshots + 07 State"] + B --> D["06 Native execution"] + C --> D + B --> E["09 Editor metadata"] + C --> E + D --> F["10 Build / metadata watching"] + E --> F + A --> G["11 Solver / lock + 12 Packages"] + D --> H["13 Foreign providers"] + G --> H + H --> I["18 Native self-host / VoidLibrary"] + F --> I + D --> J["08 Modern C++"] + G --> K["15 Install / exports"] + H --> K + K --> L["14 CMake bridge"] + G --> M["16 Registry API"] + M --> N["17 Registry UI"] + I --> O["19 Integrated v1 hardening"] + J --> O + L --> O + N --> O + O --> P["20 Later translation / OS ports"] +``` + +The arrows describe integration prerequisites, not permission to let one worker +change another's files. Interfaces can be developed with fixtures before all runtime +dependencies exist; acceptance waits for real integration. Self-hosting can begin +with a required dependency closure, then broaden through explicit library coverage. + +## Release gates + +1. Initial delivery: repository/docs, linked CLI, compile-tested SDK descriptor, + real tests, local and pinned dependency builds, fresh integrated review. +2. Native core: immutable snapshots, correct action execution, profile isolation, + selection/refresh and input mutation tests. +3. First adoption: clean stage0->stage1->stage2 and native VoidLibrary closure. +4. Full v1: all selected modern compiler features, package/foreign/CMake bridge, + install/export, registry service/UI and adverse-case coverage. +5. Later: separately bounded native foreign translation and platform ports. + +Remote build caches/distributed workers are outside v1. The hosted registry and +binary-package distribution remain inside v1; they are not the same feature. + +## Evidence and coordination + +See [STATE](../agent-workflow/STATE.md), [TASKS](../agent-workflow/TASKS.md) and +[VERIFICATION](../agent-workflow/VERIFICATION.md). Root owns shared schemas/pins and +integration. Use configured XHigh roles, conservative concurrency and fresh +read-only reviews. Preserve source exclusions and do not publish or deploy as a +side effect of finishing a milestone. diff --git a/docs/roadmap/REQUIREMENTS.md b/docs/roadmap/REQUIREMENTS.md new file mode 100644 index 0000000..fe28932 --- /dev/null +++ b/docs/roadmap/REQUIREMENTS.md @@ -0,0 +1,58 @@ +# Requirements and acceptance ledger + +Status: approved requirements, 2026-11-25. Approval covers the initial repository, +detailed plans and bootstrap skeleton. Full v1 is a sequence of later implementation +milestones; planning a capability does not mark it implemented. + +| ID | Requirement | Acceptance boundary | Plans | +| --- | --- | --- | --- | +| R-001 | Native C++ implementation using VoidLibrary; C++26/GCC16 host | Real linked Void APIs; explicit module/dependency closure | 01, 06, 07 | +| R-002 | Ordinary cpp/hpp build logic, conventional and custom layouts | Compiled build.cpp/helpers; explicit sets and live glob membership; no bespoke interpreter | 01, 02, 03 | +| R-003 | Selected targets and multiple profiles in one build root | Separate GCC/Clang target contexts and artifacts; selected target/profile combinations; no host-preprocessor confusion | 02, 04, 09 | +| R-004 | Compiling, honest bootstrap with CMake permitted | CLI help/version/errors, SDK example and tests; no false native-build success | 01 | +| R-005 | Meaningful tests and independent verification | Registered nonzero tests, adverse fixtures, compiler matrix, fresh review of integrated code | 01, 19 | +| R-006 | Reproducible bootstrap dependency source | Exact VoidLibrary commit, default upstream mode and explicit local override both verified | 01, 12 | +| R-007 | Content-verified mutations and immutable execution inputs | Add/delete/rename, restored timestamps, symlinks, include shadowing, capture races and generated inputs handled | 05, 06, 10 | +| R-008 | Automatically current, selectable compilation databases | Per-profile databases, latest-build/manual selection, independent metadata watcher, atomic updates and honest stale status | 09, 10 | +| R-009 | Native packages, version resolution and TOML declarations | Common C++/TOML model, solver, context-aware locks, local/Git/archive/registry sources, source/binary packages and offline use | 11, 12 | +| R-010 | Foreign build consumption and CMake-facing dependency API | Initial native-tool execution + complete imports for CMake/Meson/Conan; new FetchContent/CPM-style bridge; later native translation | 13, 14, 20 | +| R-011 | Full modern C++ in v1 | Named modules/partitions/header units, PCH, unity, LTO, sanitizers with actual capability checks | 08 | +| R-012 | Hosted registry with browser administration | C++ API, accounts/roles/tokens, immutable releases, source/binary storage, audits, backup and UI workflows | 16, 17 | +| R-013 | Native self-hosting and VoidLibrary first adoption | Clean stage 0 -> 1 -> 2; native tool and required VoidLibrary closure/tests; no CMake/project-artifact reuse after seed | 18 | +| R-014 | Correct persistent state and failure recovery | Strong identities, checked publication, crash recovery, corruption detection, no failed/cancelled success records | 05, 06, 07, 11 | +| R-015 | Linux-first and local cache first | GCC16.2/Clang23.1.3 initial target matrix; Windows/macOS later; no remote build cache or distributed workers in v1 | 04, 07, 20 | +| R-016 | Durable and executable engineering plans | Each part has interfaces, dependencies, ownership, failure behavior, implementation steps and observable tests | All | +| R-017 | MIT project license | Repository license and copyright notice present | 01 | +| R-018 | Installable/exportable products and dependencies | Relocatable package metadata, transitive requirements and runtime library handling | 15 | +| R-019 | Native executor and normal C/C++ targets | Executable/static/shared/header-only/object libraries, generators, tests, usage propagation and ordered actions | 03, 06 | + +## Product decisions + +- Build logic and profile definitions stay in C++. TOML is dependency data. +- Sources may use include/ plus src/ or source/, explicit files, globs or custom layouts. + Discovery reacts to untracked files too; Git membership is not the selection rule. +- Native executor, one-shot builds and opt-in rebuilding watch; a separate metadata + watcher keeps editors current without engine-scheduled target/package builds. +- Multiple profiles share a build root but never mutable object, BMI/PCH or generated + products. A single-profile build changes editor selection after valid configuration; + multiple profiles require an explicit editor profile. +- Immutable snapshots were selected over merely checking editable files after a build. + A sealed captured tree is not a claim of a globally atomic filesystem instant. +- Native package manager, hosted registry and web administration are required for full v1. + The CMake bridge is also required, not just a C++ equivalent of FetchContent. +- Local artifact caching is included; remote build caching and distributed execution + are deferred. Registry binary distribution is a different capability. +- Foreign graphs are initially built by their existing tools; native translation is later. +- Reuse VoidLibrary broadly; focused dependencies/wrappers are allowed. Record reusable + gaps for possible upstream implementation; do not make incidental upstream edits. +- First migration targets are VBS itself and VoidLibrary, not all Void repositories at once. + +## Acceptance language + +A plan is complete when its contracts and dependencies are usable for implementation. +Code is complete only when its behavior exists. Verified requires observed checks +against the integrated files. Released/deployed requires a separate action and authority. + +The bootstrap does not satisfy the future executor, package, snapshot, editor watcher +or registry requirements merely because it can describe their data. Keep that distinction +in help output, README, task status and test reports. diff --git a/include/vbs/build.hpp b/include/vbs/build.hpp new file mode 100644 index 0000000..1066239 --- /dev/null +++ b/include/vbs/build.hpp @@ -0,0 +1,201 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace vbs { + +inline constexpr int schema_version = 1; + +enum class CompilerFamily { gcc, clang }; +enum class Visibility { private_, public_, interface_ }; +enum class TargetKind { executable, static_library }; +enum class SourceKind { file, glob }; +enum class LinkKind { local, imported }; +enum class DependencySourceKind { unspecified, git, package }; + +[[nodiscard]] std::string_view compiler_name(CompilerFamily compiler); +[[nodiscard]] CompilerFamily parse_compiler(std::string_view name); + +struct ProfileContext { + std::string name; + CompilerFamily compiler{CompilerFamily::gcc}; + std::string os; + std::string architecture; + std::vector compile_options; +}; + +struct ProfileDescription { + std::string name; + std::vector compile_options; +}; + +class Profiles { + public: + void add(std::string name, std::vector compile_options = {}); + [[nodiscard]] const std::vector &records() const noexcept; + [[nodiscard]] ProfileContext resolve(std::string_view name, CompilerFamily compiler, + std::string os, std::string architecture) const; + + private: + std::vector records_; +}; + +[[nodiscard]] Profiles default_profiles(); + +struct SourceRecord { + SourceKind kind; + std::string path; +}; + +// Source spelling is recorded verbatim; construction never reads the filesystem. +class SourceSet { + public: + SourceSet() = default; + SourceSet(std::initializer_list files); + [[nodiscard]] static SourceSet file(std::string path); + [[nodiscard]] static SourceSet glob(std::string pattern); + [[nodiscard]] const std::vector &records() const noexcept; + + private: + std::vector records_; +}; + +struct OptionValue { + using Value = std::variant; + Value value; + + OptionValue(std::string text) : value{std::move(text)} {} + OptionValue(const char *text) : OptionValue{std::string{text}} {} + OptionValue(bool boolean) : value{boolean} {} + template + requires(!std::same_as) + OptionValue(Integer integer) : value{std::int64_t{0}} { + if (!std::in_range(integer)) { + throw std::invalid_argument{"option integer is out of range"}; + } + value = static_cast(integer); + } +}; +using OptionMap = std::map>; + +struct Commit { + std::string sha; +}; +struct IncludeDirectory { + std::string path; + Visibility visibility{Visibility::private_}; +}; +struct LinkRecord { + LinkKind kind; + std::string target; + std::string dependency; // Empty for a local target. + Visibility visibility{Visibility::private_}; +}; +struct TargetRecord { + std::string name; + TargetKind kind; + std::vector sources; + std::vector include_directories; + std::vector compile_options; + std::vector links; +}; +struct DependencyRecord { + std::string name; + DependencySourceKind source_kind{DependencySourceKind::unspecified}; + std::string location; + std::string revision; + std::string package; + std::string version; + std::string builder; + OptionMap options; +}; + +namespace detail { +struct ProjectState; +} +class Project; +class Dependency; + +// Handles retain an index and weak owner identity, never a pointer into a growing vector. +class ImportedTarget { + private: + friend class Dependency; + friend class Target; + ImportedTarget(std::weak_ptr owner, std::size_t dependency, + std::string name); + std::weak_ptr owner_; + std::size_t dependency_; + std::string name_; +}; + +class Target { + public: + Target &sources(const SourceSet &sources); + Target &include_directory(std::string path, Visibility visibility = Visibility::private_); + Target &compile_option(std::string option); + Target &link(const Target &target, Visibility visibility = Visibility::private_); + Target &link(const ImportedTarget &target, Visibility visibility = Visibility::private_); + [[nodiscard]] const TargetRecord &record() const; + + private: + friend class Project; + Target(std::weak_ptr owner, std::size_t index); + std::weak_ptr owner_; + std::size_t index_; +}; + +class Dependency { + public: + Dependency &git(std::string url, Commit commit); + Dependency &cmake(OptionMap options = {}); + Dependency &package(std::string id, std::string range); + [[nodiscard]] ImportedTarget target(std::string exported_name) const; + [[nodiscard]] const DependencyRecord &record() const; + + private: + friend class Project; + Dependency(std::weak_ptr owner, std::size_t index); + std::weak_ptr owner_; + std::size_t index_; +}; + +class Project { + public: + explicit Project(ProfileContext context); + ~Project(); + Project(const Project &) = delete; + Project &operator=(const Project &) = delete; + Project(Project &&) = delete; + Project &operator=(Project &&) = delete; + + [[nodiscard]] const ProfileContext &context() const noexcept; + [[nodiscard]] Target executable(std::string name); + [[nodiscard]] Target static_library(std::string name); + [[nodiscard]] Dependency dependency(std::string name); + [[nodiscard]] SourceSet glob(std::string pattern) const; + [[nodiscard]] const std::vector &targets() const noexcept; + [[nodiscard]] const std::vector &dependencies() const noexcept; + // Emits UTF-8 JSON; malformed UTF-8 in any recorded string throws invalid_argument. + [[nodiscard]] std::string to_json() const; + + private: + Target add_target(std::string name, TargetKind kind); + std::shared_ptr state_; +}; + +} // namespace vbs + +// Description entry points supplied by ordinary user C++ translation units. +void build(vbs::Project &project); +void profiles(vbs::Profiles &profiles); diff --git a/src/build.cpp b/src/build.cpp new file mode 100644 index 0000000..c84aaab --- /dev/null +++ b/src/build.cpp @@ -0,0 +1,448 @@ +#include + +#include +#include + +namespace vbs { +namespace detail { +struct ProjectState { + ProfileContext context; + std::vector targets; + std::vector dependencies; +}; +} // namespace detail +namespace { +void require_text(std::string_view text, std::string_view field) { + if (text.empty()) { + throw std::invalid_argument{std::string{field} + " must not be empty"}; + } +} + +auto owner(const std::weak_ptr &weak) { + auto state = weak.lock(); + if (!state) { + throw std::logic_error{"declaration handle's Project has expired"}; + } + return state; +} + +std::string_view visibility_name(Visibility visibility) { + switch (visibility) { + case Visibility::private_: + return "private"; + case Visibility::public_: + return "public"; + case Visibility::interface_: + return "interface"; + } + throw std::invalid_argument{"unknown visibility"}; +} + +void validate_context(const ProfileContext &context) { + require_text(context.name, "profile name"); + (void)compiler_name(context.compiler); + require_text(context.os, "target OS"); + require_text(context.architecture, "target architecture"); + for (const auto &option : context.compile_options) { + require_text(option, "compile option"); + } +} + +void require_utf8(std::string_view text) { + std::size_t position = 0; + const auto invalid = [] { throw std::invalid_argument{"JSON string contains invalid UTF-8"}; }; + while (position < text.size()) { + const auto lead = static_cast(text[position++]); + if (lead < 0x80) { + continue; + } + std::size_t remaining = 0; + std::uint32_t scalar = 0; + std::uint32_t minimum = 0; + if (lead >= 0xc2 && lead <= 0xdf) { + remaining = 1; + scalar = lead & 0x1f; + minimum = 0x80; + } else if (lead >= 0xe0 && lead <= 0xef) { + remaining = 2; + scalar = lead & 0x0f; + minimum = 0x800; + } else if (lead >= 0xf0 && lead <= 0xf4) { + remaining = 3; + scalar = lead & 0x07; + minimum = 0x10000; + } else { + invalid(); + } + if (remaining > text.size() - position) { + invalid(); + } + for (std::size_t i = 0; i < remaining; ++i) { + const auto continuation = static_cast(text[position++]); + if ((continuation & 0xc0) != 0x80) { + invalid(); + } + scalar = (scalar << 6) | (continuation & 0x3f); + } + // JSON strings contain Unicode scalar values: no overlong forms or surrogates. + if (scalar < minimum || scalar > 0x10ffff || (scalar >= 0xd800 && scalar <= 0xdfff)) { + invalid(); + } + } +} + +std::string quote(std::string_view text) { + require_utf8(text); + constexpr char hex[] = "0123456789abcdef"; + std::string output{"\""}; + for (const unsigned char c : text) { + switch (c) { + case '"': + output += "\\\""; + break; + case '\\': + output += "\\\\"; + break; + case '\n': + output += "\\n"; + break; + case '\r': + output += "\\r"; + break; + case '\t': + output += "\\t"; + break; + default: + if (c < 0x20) { + output += "\\u00"; + output += hex[c >> 4]; + output += hex[c & 0x0f]; + } else { + output += static_cast(c); + } + } + } + output += '"'; + return output; +} + +template +std::string array(const Range &range, Serialize serialize) { + std::string output{"["}; + bool first = true; + for (const auto &item : range) { + if (!first) + output += ','; + first = false; + output += serialize(item); + } + return output + ']'; +} + +std::string options_json(const OptionMap &options) { + std::string output{"{"}; + bool first = true; + for (const auto &[name, option] : options) { + if (!first) + output += ','; + first = false; + output += quote(name) + ':'; + output += std::visit( + [](const auto &value) -> std::string { + using Type = std::remove_cvref_t; + if constexpr (std::same_as) + return quote(value); + else if constexpr (std::same_as) + return value ? "true" : "false"; + else + return std::to_string(value); + }, + option.value); + } + return output + '}'; +} +} // namespace + +std::string_view compiler_name(CompilerFamily compiler) { + switch (compiler) { + case CompilerFamily::gcc: + return "gcc"; + case CompilerFamily::clang: + return "clang"; + } + throw std::invalid_argument{"unknown compiler family"}; +} + +CompilerFamily parse_compiler(std::string_view name) { + if (name == "gcc") + return CompilerFamily::gcc; + if (name == "clang") + return CompilerFamily::clang; + throw std::invalid_argument{"unknown compiler '" + std::string{name} + + "' (expected gcc or clang)"}; +} + +void Profiles::add(std::string name, std::vector compile_options) { + require_text(name, "profile name"); + if (std::ranges::any_of(records_, [&](const auto &record) { return record.name == name; })) { + throw std::invalid_argument{"duplicate profile '" + name + "'"}; + } + for (const auto &option : compile_options) + require_text(option, "compile option"); + records_.push_back({std::move(name), std::move(compile_options)}); +} + +const std::vector &Profiles::records() const noexcept { return records_; } + +ProfileContext Profiles::resolve(std::string_view name, CompilerFamily compiler, std::string os, + std::string architecture) const { + const auto found = std::ranges::find(records_, name, &ProfileDescription::name); + if (found == records_.end()) { + throw std::invalid_argument{"unknown profile '" + std::string{name} + "'"}; + } + ProfileContext context{found->name, compiler, std::move(os), std::move(architecture), + found->compile_options}; + validate_context(context); + return context; +} + +Profiles default_profiles() { + Profiles result; + result.add("debug", {"-O0", "-g"}); + result.add("release", {"-O3", "-DNDEBUG"}); + return result; +} + +SourceSet::SourceSet(std::initializer_list files) { + for (const auto path : files) { + require_text(path, "source path"); + records_.push_back({SourceKind::file, std::string{path}}); + } +} + +SourceSet SourceSet::file(std::string path) { + require_text(path, "source path"); + SourceSet result; + result.records_.push_back({SourceKind::file, std::move(path)}); + return result; +} + +SourceSet SourceSet::glob(std::string pattern) { + require_text(pattern, "glob pattern"); + SourceSet result; + result.records_.push_back({SourceKind::glob, std::move(pattern)}); + return result; +} + +const std::vector &SourceSet::records() const noexcept { return records_; } + +Target::Target(std::weak_ptr state, std::size_t index) + : owner_{std::move(state)}, index_{index} {} + +Target &Target::sources(const SourceSet &sources) { + auto state = owner(owner_); + auto &records = state->targets.at(index_).sources; + records.insert(records.end(), sources.records().begin(), sources.records().end()); + return *this; +} + +Target &Target::include_directory(std::string path, Visibility visibility) { + require_text(path, "include directory"); + (void)visibility_name(visibility); + owner(owner_)->targets.at(index_).include_directories.push_back({std::move(path), visibility}); + return *this; +} + +Target &Target::compile_option(std::string option) { + require_text(option, "compile option"); + owner(owner_)->targets.at(index_).compile_options.push_back(std::move(option)); + return *this; +} + +Target &Target::link(const Target &target, Visibility visibility) { + auto state = owner(owner_); + if (owner(target.owner_) != state) { + throw std::invalid_argument{"cannot link a target from another Project"}; + } + (void)visibility_name(visibility); + state->targets.at(index_).links.push_back( + {LinkKind::local, state->targets.at(target.index_).name, {}, visibility}); + return *this; +} + +Target &Target::link(const ImportedTarget &target, Visibility visibility) { + auto state = owner(owner_); + if (owner(target.owner_) != state) { + throw std::invalid_argument{"cannot link an imported target from another Project"}; + } + (void)visibility_name(visibility); + state->targets.at(index_).links.push_back({LinkKind::imported, target.name_, + state->dependencies.at(target.dependency_).name, + visibility}); + return *this; +} + +const TargetRecord &Target::record() const { return owner(owner_)->targets.at(index_); } + +ImportedTarget::ImportedTarget(std::weak_ptr state, std::size_t dependency, + std::string name) + : owner_{std::move(state)}, dependency_{dependency}, name_{std::move(name)} {} + +Dependency::Dependency(std::weak_ptr state, std::size_t index) + : owner_{std::move(state)}, index_{index} {} + +Dependency &Dependency::git(std::string url, Commit commit) { + require_text(url, "Git URL"); + if (commit.sha.size() != 40 || !std::ranges::all_of(commit.sha, [](char c) { + return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + })) { + throw std::invalid_argument{"Commit must contain an exact 40-digit hexadecimal Git SHA"}; + } + auto state = owner(owner_); + auto &record = state->dependencies.at(index_); + if (record.source_kind != DependencySourceKind::unspecified) { + throw std::invalid_argument{"dependency '" + record.name + + "' already has a source provider"}; + } + record.source_kind = DependencySourceKind::git; + record.location = std::move(url); + record.revision = std::move(commit.sha); + return *this; +} + +Dependency &Dependency::cmake(OptionMap options) { + for (const auto &[key, value] : options) { + (void)value; + require_text(key, "CMake option name"); + } + auto state = owner(owner_); + auto &record = state->dependencies.at(index_); + if (record.source_kind == DependencySourceKind::package || !record.builder.empty()) { + throw std::invalid_argument{"contradictory builder for dependency '" + record.name + "'"}; + } + record.builder = "cmake"; + record.options = std::move(options); + return *this; +} + +Dependency &Dependency::package(std::string id, std::string range) { + require_text(id, "package identifier"); + require_text(range, "package version range"); + auto state = owner(owner_); + auto &record = state->dependencies.at(index_); + if (record.source_kind != DependencySourceKind::unspecified || !record.builder.empty()) { + throw std::invalid_argument{"dependency '" + record.name + + "' already has a source/provider"}; + } + record.source_kind = DependencySourceKind::package; + record.package = std::move(id); + record.version = std::move(range); + return *this; +} + +ImportedTarget Dependency::target(std::string exported_name) const { + (void)owner(owner_); + require_text(exported_name, "exported target name"); + return ImportedTarget{owner_, index_, std::move(exported_name)}; +} + +const DependencyRecord &Dependency::record() const { + return owner(owner_)->dependencies.at(index_); +} + +Project::Project(ProfileContext context) : state_{std::make_shared()} { + validate_context(context); + state_->context = std::move(context); +} +Project::~Project() = default; +const ProfileContext &Project::context() const noexcept { return state_->context; } + +Target Project::add_target(std::string name, TargetKind kind) { + require_text(name, "target name"); + if (std::ranges::any_of(state_->targets, + [&](const auto &record) { return record.name == name; })) { + throw std::invalid_argument{"duplicate target '" + name + "'"}; + } + state_->targets.push_back({std::move(name), kind, {}, {}, {}, {}}); + return Target{state_, state_->targets.size() - 1}; +} +Target Project::executable(std::string name) { + return add_target(std::move(name), TargetKind::executable); +} +Target Project::static_library(std::string name) { + return add_target(std::move(name), TargetKind::static_library); +} +Dependency Project::dependency(std::string name) { + require_text(name, "dependency name"); + if (std::ranges::any_of(state_->dependencies, + [&](const auto &record) { return record.name == name; })) { + throw std::invalid_argument{"duplicate dependency '" + name + "'"}; + } + DependencyRecord record; + record.name = std::move(name); + state_->dependencies.push_back(std::move(record)); + return Dependency{state_, state_->dependencies.size() - 1}; +} +SourceSet Project::glob(std::string pattern) const { return SourceSet::glob(std::move(pattern)); } +const std::vector &Project::targets() const noexcept { return state_->targets; } +const std::vector &Project::dependencies() const noexcept { + return state_->dependencies; +} + +std::string Project::to_json() const { + const auto &profile = context(); + std::string output = + "{\"schema_version\":" + std::to_string(schema_version) + + ",\"profile\":{\"name\":" + quote(profile.name) + + ",\"compiler\":" + quote(compiler_name(profile.compiler)) + ",\"os\":" + quote(profile.os) + + ",\"architecture\":" + quote(profile.architecture) + + ",\"compile_options\":" + array(profile.compile_options, quote) + "},\"targets\":"; + output += array(targets(), [](const TargetRecord &target) { + return "{\"name\":" + quote(target.name) + ",\"kind\":" + + quote(target.kind == TargetKind::executable ? "executable" : "static_library") + + ",\"sources\":" + + array(target.sources, + [](const SourceRecord &source) { + return "{\"kind\":" + + quote(source.kind == SourceKind::file ? "file" : "glob") + + ",\"path\":" + quote(source.path) + '}'; + }) + + ",\"include_directories\":" + + array(target.include_directories, + [](const IncludeDirectory &directory) { + return "{\"path\":" + quote(directory.path) + + ",\"visibility\":" + quote(visibility_name(directory.visibility)) + + '}'; + }) + + ",\"compile_options\":" + array(target.compile_options, quote) + ",\"links\":" + + array(target.links, + [](const LinkRecord &link) { + return "{\"kind\":" + + quote(link.kind == LinkKind::local ? "local" : "imported") + + ",\"target\":" + quote(link.target) + + ",\"dependency\":" + quote(link.dependency) + + ",\"visibility\":" + quote(visibility_name(link.visibility)) + '}'; + }) + + '}'; + }); + output += ",\"dependencies\":" + array(dependencies(), [](const DependencyRecord &dependency) { + if (dependency.source_kind == DependencySourceKind::unspecified) { + throw std::invalid_argument{"dependency '" + dependency.name + + "' has no source provider"}; + } + std::string result = + "{\"name\":" + quote(dependency.name) + ",\"source\":{\"kind\":"; + if (dependency.source_kind == DependencySourceKind::git) { + result += "\"git\",\"location\":" + quote(dependency.location) + + ",\"revision\":" + quote(dependency.revision); + } else { + result += "\"package\",\"package\":" + quote(dependency.package) + + ",\"version\":" + quote(dependency.version); + } + return result + "},\"builder\":" + quote(dependency.builder) + + ",\"options\":" + options_json(dependency.options) + '}'; + }); + return output + '}'; +} + +} // namespace vbs diff --git a/src/describe.cpp b/src/describe.cpp new file mode 100644 index 0000000..90d5fe0 --- /dev/null +++ b/src/describe.cpp @@ -0,0 +1,44 @@ +#include +#include +#include + +#include + +int main(int argc, char **argv) { + std::string profile; + std::string compiler; + Void::Argparse::Parser parser{ + "vbs_describe", + "Evaluate the compiled example description; no target compiler is invoked."}; + parser.option_default("--profile", "", "profile: debug or release", profile, "debug") + .option_default("--compiler", "", "target compiler context: gcc or clang", compiler, "gcc"); + if (argc == 2 && (std::string_view{argv[1]} == "--help" || std::string_view{argv[1]} == "-h")) { + std::cout << parser.help(); + return 0; + } + // Help is deliberately successful only as a standalone request. + for (int i = 1; i < argc; ++i) { + if (std::string_view{argv[i]} == "--help" || std::string_view{argv[i]} == "-h") { + std::cerr << "vbs_describe: --help must be used alone\n"; + return 2; + } + } + const auto parsed = parser.parse(argc, argv); + if (!parsed) { + std::cerr << "vbs_describe: " << parsed.error() << '\n'; + return 2; + } + try { + vbs::Profiles descriptions; + profiles(descriptions); + vbs::Project project{descriptions.resolve(profile, vbs::parse_compiler(compiler), + std::string{vbs::bootstrap::os}, + std::string{vbs::bootstrap::architecture})}; + build(project); + std::cout << project.to_json() << '\n'; + return 0; + } catch (const std::exception &error) { + std::cerr << "vbs_describe: " << error.what() << '\n'; + return 2; + } +} diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..b2297fc --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,43 @@ +#include +#include + +#include +#include + +int main(int argc, char **argv) { + bool version = false; + Void::Argparse::Parser parser{ + "vbs", "VoidBuildSystem bootstrap: help and version only.\n" + "Native build, test, compdb, deps and watch commands are planned and unavailable."}; + parser.flag("--version", "-V", "show bootstrap version", version); + const bool standalone_help = + argc == 2 && (std::string_view{argv[1]} == "--help" || std::string_view{argv[1]} == "-h"); + if (argc == 1 || standalone_help) { + std::cout << parser.help(); + return 0; + } + // Reject mixed help requests: Parser reports help through the same error channel as bad input. + for (int i = 1; i < argc; ++i) { + const std::string_view arg{argv[i]}; + if (arg == "--help" || arg == "-h") { + std::cerr << "vbs: --help must be used alone\n"; + return 2; + } + if (arg == "build" || arg == "test" || arg == "compdb" || arg == "deps" || arg == "watch") { + std::cerr << "vbs: native command '" << arg + << "' is not implemented in this bootstrap\n"; + return 2; + } + } + const auto parsed = parser.parse(argc, argv); + if (!parsed) { + std::cerr << "vbs: " << parsed.error() << '\n'; + return 2; + } + if (version) { + std::cout << "vbs " << vbs::bootstrap::version << " (bootstrap)\n"; + return 0; + } + std::cerr << "vbs: no supported request; use --help\n"; + return 2; +} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..2bee05f --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,17 @@ +add_executable(vbs_sdk_tests SdkDeclarations.cpp ExampleContexts.cpp) +target_link_libraries(vbs_sdk_tests PRIVATE vbs_example_description) +set_target_properties(vbs_sdk_tests PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") +add_test(NAME vbs_sdk_tests COMMAND "${CMAKE_COMMAND}" + "-DSDK_TESTS=$" -P "${CMAKE_CURRENT_SOURCE_DIR}/RunSdkTests.cmake") +void_add_tests(vbs_sdk_tests) + +add_test(NAME vbs_sdk_registration COMMAND "${CMAKE_COMMAND}" + "-DSDK_TESTS=$" -P "${CMAKE_CURRENT_SOURCE_DIR}/SdkRegistration.cmake") +add_test(NAME vbs_cli_contract COMMAND "${CMAKE_COMMAND}" + "-DVBS=$" "-DVBS_VERSION=${PROJECT_VERSION}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/CliContracts.cmake") +add_test(NAME vbs_description_contract COMMAND "${CMAKE_COMMAND}" + "-DDESCRIBE=$" + "-DEXPECTED_OS=${CMAKE_SYSTEM_NAME}" "-DEXPECTED_ARCH=${CMAKE_SYSTEM_PROCESSOR}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/DescribeContracts.cmake") diff --git a/tests/CliContracts.cmake b/tests/CliContracts.cmake new file mode 100644 index 0000000..3abec71 --- /dev/null +++ b/tests/CliContracts.cmake @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 4.0) + +function(check_process expected_code expected_stdout expected_stderr) + execute_process(COMMAND "${VBS}" ${ARGN} + RESULT_VARIABLE code OUTPUT_VARIABLE out ERROR_VARIABLE err TIMEOUT 10) + if(NOT "${code}" STREQUAL "${expected_code}" OR + NOT "${out}" STREQUAL "${expected_stdout}" OR + NOT "${err}" STREQUAL "${expected_stderr}") + message(FATAL_ERROR "vbs ${ARGN}: expected exit ${expected_code}, got ${code}\nstdout=[${out}]\nstderr=[${err}]") + endif() +endfunction() + +set(help "Usage: vbs [--version]\n\nVoidBuildSystem bootstrap: help and version only.\nNative build, test, compdb, deps and watch commands are planned and unavailable.\n\nFlags:\n --version, -V show bootstrap version\n --help, -h show this help\n") +check_process(0 "${help}" "") +check_process(0 "${help}" "" --help) +check_process(0 "${help}" "" -h) +check_process(0 "vbs ${VBS_VERSION} (bootstrap)\n" "" --version) +check_process(0 "vbs ${VBS_VERSION} (bootstrap)\n" "" -V) +check_process(2 "" "vbs: unknown option: --invalid\n" --invalid) +check_process(2 "" "vbs: unknown option: --invalid\n" --version --invalid) +check_process(2 "" "vbs: unexpected positional argument: invalid\n" invalid) +check_process(2 "" "vbs: --help must be used alone\n" --help --invalid) +foreach(command IN ITEMS build test compdb deps watch) + check_process(2 "" "vbs: native command '${command}' is not implemented in this bootstrap\n" "${command}") +endforeach() +check_process(2 "" "vbs: native command 'build' is not implemented in this bootstrap\n" build --profile debug) +check_process(2 "" "vbs: native command 'compdb' is not implemented in this bootstrap\n" compdb watch) +message(STATUS "16 CLI process contracts verified") diff --git a/tests/DescribeContracts.cmake b/tests/DescribeContracts.cmake new file mode 100644 index 0000000..81aef22 --- /dev/null +++ b/tests/DescribeContracts.cmake @@ -0,0 +1,75 @@ +cmake_minimum_required(VERSION 4.0) + +function(expect_json expected) + string(JSON actual GET "${graph}" ${ARGN}) + if(NOT "${actual}" STREQUAL "${expected}") + message(FATAL_ERROR "JSON ${ARGN}: expected [${expected}], got [${actual}]") + endif() +endfunction() + +foreach(profile IN ITEMS debug release) + foreach(compiler IN ITEMS gcc clang) + execute_process(COMMAND "${DESCRIBE}" --profile "${profile}" --compiler "${compiler}" + RESULT_VARIABLE code OUTPUT_VARIABLE graph ERROR_VARIABLE err TIMEOUT 10) + if(NOT "${code}" STREQUAL "0" OR NOT "${err}" STREQUAL "") + message(FATAL_ERROR "Description ${profile}/${compiler} failed: ${code}\n${err}") + endif() + expect_json(1 schema_version) + string(JSON schema_type TYPE "${graph}" schema_version) + if(NOT schema_type STREQUAL "NUMBER") + message(FATAL_ERROR "schema_version must be an integer JSON number") + endif() + expect_json("${profile}" profile name) + expect_json("${compiler}" profile compiler) + expect_json("${EXPECTED_OS}" profile os) + expect_json("${EXPECTED_ARCH}" profile architecture) + if(profile STREQUAL "debug") + expect_json(-O0 profile compile_options 0) + expect_json(-g profile compile_options 1) + else() + expect_json(-O3 profile compile_options 0) + expect_json(-DNDEBUG profile compile_options 1) + endif() + expect_json(vbs_sdk targets 0 name) + expect_json(static_library targets 0 kind) + expect_json(file targets 0 sources 0 kind) + expect_json(src/build.cpp targets 0 sources 0 path) + expect_json(public targets 0 include_directories 0 visibility) + expect_json(vbs targets 1 name) + expect_json(executable targets 1 kind) + expect_json(vbs_sdk targets 1 links 0 target) + expect_json(private targets 1 links 0 visibility) + expect_json(VoidLibrary targets 1 links 1 dependency) + expect_json(Void::Configuration targets 1 links 1 target) + foreach(index IN ITEMS 0 1) + if(compiler STREQUAL "gcc") + expect_json(-Wduplicated-cond targets "${index}" compile_options 2) + else() + expect_json(-Wextra-semi targets "${index}" compile_options 2) + endif() + endforeach() + expect_json(git dependencies 0 source kind) + expect_json(9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5 dependencies 0 source revision) + expect_json(cmake dependencies 0 builder) + string(JSON option_type TYPE "${graph}" dependencies 0 options BUILD_SHARED_LIBS) + if(NOT option_type STREQUAL "BOOLEAN") + message(FATAL_ERROR "CMake bool option lost its type") + endif() + endforeach() +endforeach() + +function(expect_error expected) + execute_process(COMMAND "${DESCRIBE}" ${ARGN} + RESULT_VARIABLE code OUTPUT_VARIABLE out ERROR_VARIABLE err TIMEOUT 10) + if(NOT "${code}" STREQUAL "2" OR NOT "${out}" STREQUAL "" OR + NOT "${err}" STREQUAL "vbs_describe: ${expected}\n") + message(FATAL_ERROR "Description error ${ARGN}: ${code}\nstdout=[${out}]\nstderr=[${err}]") + endif() +endfunction() +expect_error("unknown profile 'unknown'" --profile unknown) +expect_error("unknown compiler 'msvc' (expected gcc or clang)" --compiler msvc) +expect_error("option '--profile' requires a value" --profile) +expect_error("unknown option: --invalid" --invalid) +expect_error("unexpected positional argument: invalid" invalid) +expect_error("--help must be used alone" --help --invalid) +message(STATUS "Four runtime profile/compiler contexts and six error contracts verified") diff --git a/tests/ExampleContexts.cpp b/tests/ExampleContexts.cpp new file mode 100644 index 0000000..fcbf465 --- /dev/null +++ b/tests/ExampleContexts.cpp @@ -0,0 +1,57 @@ +#include +#include +#include + +#include + +Void::Testing::Test example_uses_runtime_compiler() { + vbs::Profiles definitions; + profiles(definitions); + vbs::Project gcc{definitions.resolve("debug", vbs::CompilerFamily::gcc, "linux", "x86_64")}; + vbs::Project clang{definitions.resolve("debug", vbs::CompilerFamily::clang, "linux", "x86_64")}; + build(gcc); + build(clang); + for (std::size_t index = 0; index < gcc.targets().size(); ++index) { + Void::Testing::expect(std::ranges::contains(gcc.targets().at(index).compile_options, + std::string{"-Wduplicated-cond"})); + Void::Testing::expect(!std::ranges::contains(gcc.targets().at(index).compile_options, + std::string{"-Wextra-semi"})); + Void::Testing::expect(std::ranges::contains(clang.targets().at(index).compile_options, + std::string{"-Wextra-semi"})); + Void::Testing::expect(!std::ranges::contains(clang.targets().at(index).compile_options, + std::string{"-Wduplicated-cond"})); + } +} + +Void::Testing::Test example_profile_options_are_separate() { + vbs::Profiles definitions; + profiles(definitions); + vbs::Project debug{definitions.resolve("debug", vbs::CompilerFamily::gcc, "linux", "x86_64")}; + vbs::Project release{ + definitions.resolve("release", vbs::CompilerFamily::gcc, "linux", "x86_64")}; + build(debug); + build(release); + Void::Testing::expect( + std::ranges::contains(debug.context().compile_options, std::string{"-g"})); + Void::Testing::expect( + std::ranges::contains(release.context().compile_options, std::string{"-O3"})); + Void::Testing::expect( + !std::ranges::contains(release.context().compile_options, std::string{"-g"})); + Void::Testing::expect(debug.to_json() != release.to_json()); +} + +Void::Testing::Test example_records_sources_links_and_pin() { + vbs::Project project{ + vbs::default_profiles().resolve("debug", vbs::CompilerFamily::gcc, "linux", "x86_64")}; + build(project); + Void::Testing::expect_eq(project.targets().size(), std::size_t{2}); + Void::Testing::expect_eq(project.targets().at(0).name, std::string{"vbs_sdk"}); + Void::Testing::expect_eq(project.targets().at(0).sources.at(0).path, + std::string{"src/build.cpp"}); + Void::Testing::expect_eq(project.targets().at(1).links.at(0).target, std::string{"vbs_sdk"}); + Void::Testing::expect_eq(project.targets().at(1).links.at(1).target, + std::string{"Void::Configuration"}); + Void::Testing::expect_eq(project.dependencies().at(0).revision, + std::string{"9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5"}); + Void::Testing::expect_eq(project.dependencies().at(0).builder, std::string{"cmake"}); +} diff --git a/tests/RunSdkTests.cmake b/tests/RunSdkTests.cmake new file mode 100644 index 0000000..ab327bb --- /dev/null +++ b/tests/RunSdkTests.cmake @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 4.0) + +execute_process(COMMAND "${SDK_TESTS}" --no-color + RESULT_VARIABLE code OUTPUT_VARIABLE out ERROR_VARIABLE err TIMEOUT 60) +message("${out}") +if(NOT "${code}" STREQUAL "0" OR NOT out MATCHES "17 tests:") + message(FATAL_ERROR "SDK suite must execute all 17 cases and exit zero; got ${code}\n${err}") +endif() diff --git a/tests/SdkDeclarations.cpp b/tests/SdkDeclarations.cpp new file mode 100644 index 0000000..66ef6a4 --- /dev/null +++ b/tests/SdkDeclarations.cpp @@ -0,0 +1,288 @@ +#include +#include +#include +#include + +#include +#include +#include + +namespace { +vbs::ProfileContext context() { + return vbs::default_profiles().resolve("debug", vbs::CompilerFamily::gcc, "linux", "x86_64"); +} +constexpr auto revision = "9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5"; +using Json = Void::Json::Strict::Value; +const Json &member(const Json &value, const std::string &key) { + return std::get(value.value).at(key); +} +const Json &element(const Json &value, std::size_t index) { + return std::get(value.value).at(index); +} +std::string text(const Json &value) { return std::get(value.value); } +} // namespace + +Void::Testing::Test default_profiles_and_overrides() { + const auto profiles = vbs::default_profiles(); + const auto debug = profiles.resolve("debug", vbs::CompilerFamily::clang, "linux", "aarch64"); + const auto release = profiles.resolve("release", vbs::CompilerFamily::gcc, "linux", "x86_64"); + Void::Testing::expect_eq(profiles.records().size(), std::size_t{2}); + Void::Testing::expect(debug.compiler == vbs::CompilerFamily::clang); + Void::Testing::expect_eq(debug.architecture, std::string{"aarch64"}); + Void::Testing::expect_eq(debug.compile_options.at(0), std::string{"-O0"}); + Void::Testing::expect_eq(release.compile_options.at(0), std::string{"-O3"}); +} + +Void::Testing::Test rejects_invalid_profiles() { + auto profiles = vbs::default_profiles(); + Void::Testing::expect_throw([&] { profiles.add("debug"); }); + Void::Testing::expect_throw([&] { profiles.add(""); }); + Void::Testing::expect_throw([&] { profiles.add("bad", {""}); }); + Void::Testing::expect_throw( + [&] { (void)profiles.resolve("unknown", vbs::CompilerFamily::gcc, "linux", "x86_64"); }); + Void::Testing::expect_throw([] { (void)vbs::parse_compiler("msvc"); }); + Void::Testing::expect_throw( + [&] { (void)profiles.resolve("debug", vbs::CompilerFamily::gcc, "", "x86_64"); }); +} + +Void::Testing::Test declaration_records_and_visibility() { + vbs::Project project{context()}; + auto library = project.static_library("library"); + library.sources({"one.cpp", "two.cpp"}) + .include_directory("include", vbs::Visibility::public_) + .compile_option("-Wall"); + auto executable = project.executable("app"); + executable.link(library).link(library, vbs::Visibility::interface_); + Void::Testing::expect(library.record().kind == vbs::TargetKind::static_library); + Void::Testing::expect_eq(library.record().sources.size(), std::size_t{2}); + Void::Testing::expect(library.record().include_directories.at(0).visibility == + vbs::Visibility::public_); + Void::Testing::expect(executable.record().links.at(0).visibility == vbs::Visibility::private_); + Void::Testing::expect(executable.record().links.at(1).visibility == + vbs::Visibility::interface_); +} + +Void::Testing::Test sources_are_symbolic() { + vbs::Project project{context()}; + auto target = project.executable("symbolic"); + target.sources({"missing/../literal.cpp"}).sources(project.glob("nonexistent/**/*.cpp")); + Void::Testing::expect_eq(target.record().sources.at(0).path, + std::string{"missing/../literal.cpp"}); + Void::Testing::expect(target.record().sources.at(0).kind == vbs::SourceKind::file); + Void::Testing::expect(target.record().sources.at(1).kind == vbs::SourceKind::glob); + Void::Testing::expect_eq(target.record().sources.at(1).path, + std::string{"nonexistent/**/*.cpp"}); +} + +Void::Testing::Test handles_survive_record_growth() { + vbs::Project project{context()}; + auto library = project.static_library("first"); + auto dependency = project.dependency("original"); + const auto imported = dependency.target("Original::Library"); + for (int i = 0; i != 256; ++i) { + (void)project.executable("target" + std::to_string(i)); + (void)project.dependency("dependency" + std::to_string(i)); + } + dependency.git("https://example.invalid/library.git", vbs::Commit{revision}).cmake(); + library.compile_option("-Wextra"); + auto app = project.executable("last"); + app.link(library).link(imported); + Void::Testing::expect_eq(project.targets().front().compile_options.at(0), + std::string{"-Wextra"}); + Void::Testing::expect_eq(app.record().links.at(0).target, std::string{"first"}); + Void::Testing::expect_eq(app.record().links.at(1).dependency, std::string{"original"}); + Void::Testing::expect_eq(project.dependencies().front().revision, std::string{revision}); +} + +Void::Testing::Test rejects_cross_project_links() { + vbs::Project first{context()}; + vbs::Project second{context()}; + auto app = first.executable("app"); + auto other = second.static_library("other"); + auto imported = second.dependency("remote").target("Remote::Library"); + Void::Testing::expect_throw([&] { app.link(other); }); + Void::Testing::expect_throw([&] { app.link(imported); }); + Void::Testing::expect(app.record().links.empty()); +} + +Void::Testing::Test rejects_expired_handles_and_owner_moves() { + static_assert(!std::is_move_constructible_v); + static_assert(!std::is_copy_constructible_v); + std::optional target; + std::optional dependency; + std::optional imported; + { + vbs::Project project{context()}; + target = project.executable("expired"); + dependency = project.dependency("expired"); + imported = dependency->target("Expired::Target"); + } + vbs::Project replacement{context()}; + auto app = replacement.executable("new"); + Void::Testing::expect_throw([&] { target->compile_option("-g"); }); + Void::Testing::expect_throw([&] { dependency->cmake(); }); + Void::Testing::expect_throw([&] { (void)target->record(); }); + Void::Testing::expect_throw([&] { app.link(*target); }); + Void::Testing::expect_throw([&] { app.link(*imported); }); +} + +Void::Testing::Test rejects_empty_and_duplicate_identifiers() { + vbs::Project project{context()}; + auto app = project.executable("app"); + auto dep = project.dependency("dep"); + Void::Testing::expect_throw( + [&] { (void)project.static_library("app"); }); + Void::Testing::expect_throw([&] { (void)project.dependency("dep"); }); + Void::Testing::expect_throw([&] { (void)project.executable(""); }); + Void::Testing::expect_throw([&] { (void)project.dependency(""); }); + Void::Testing::expect_throw([&] { (void)dep.target(""); }); + Void::Testing::expect_throw([&] { app.include_directory(""); }); + Void::Testing::expect_throw([&] { app.compile_option(""); }); + Void::Testing::expect_throw([] { (void)vbs::SourceSet::file(""); }); + Void::Testing::expect_throw([&] { (void)project.glob(""); }); +} + +Void::Testing::Test rejects_contradictory_providers() { + vbs::Project project{context()}; + auto git = project.dependency("git"); + git.git("https://example.invalid/repo", vbs::Commit{revision}).cmake(); + Void::Testing::expect_throw([&] { git.package("pkg", "^1"); }); + Void::Testing::expect_throw( + [&] { git.git("url", vbs::Commit{revision}); }); + Void::Testing::expect_throw([&] { git.cmake(); }); + auto package = project.dependency("package"); + package.package("pkg", "^1"); + Void::Testing::expect_throw( + [&] { package.git("url", vbs::Commit{revision}); }); + Void::Testing::expect_throw([&] { package.cmake(); }); + auto builder = project.dependency("builder"); + builder.cmake(); + Void::Testing::expect_throw([&] { builder.package("pkg", "^1"); }); + Void::Testing::expect_throw( + [&] { builder.git("url", vbs::Commit{"main"}); }); + Void::Testing::expect_throw([&] { (void)project.to_json(); }); +} + +Void::Testing::Test json_schema_types_and_escaping() { + vbs::Project project{context()}; + std::string escaped = "quote\" slash\\ newline\n\r\t"; + for (char c = 0; c < 32; ++c) + escaped += c; + auto dep = project.dependency("dependency"); + dep.git("https://example.invalid/\"repo", vbs::Commit{revision}) + .cmake({{"string", escaped}, + {"literal", "text"}, + {"bool", false}, + {"integer", -42}, + {"maximum", std::numeric_limits::max()}}); + auto library = project.static_library("library"); + library.sources(vbs::SourceSet::file(escaped)) + .sources(project.glob("src/**/*.cpp")) + .include_directory("include", vbs::Visibility::public_) + .link(dep.target("Remote::Library")); + auto app = project.executable("app"); + app.link(library, vbs::Visibility::public_).compile_option(escaped); + project.dependency("package").package("org/pkg", ">=1.2 <2"); + const auto json = project.to_json(); + Void::Testing::expect_eq(json, project.to_json()); + const auto parsed = Void::Json::Strict::parse(json); + Void::Testing::expect(parsed.has_value()); + if (!parsed) + return; + Void::Testing::expect_eq(std::get(member(*parsed, "schema_version").value), + std::int64_t{1}); + const auto &dependency = element(member(*parsed, "dependencies"), 0); + const auto &options = member(dependency, "options"); + Void::Testing::expect_eq(text(member(options, "string")), escaped); + Void::Testing::expect_eq(text(member(options, "literal")), std::string{"text"}); + Void::Testing::expect(!std::get(member(options, "bool").value)); + Void::Testing::expect_eq(std::get(member(options, "integer").value), + std::int64_t{-42}); + Void::Testing::expect_eq(std::get(member(options, "maximum").value), + std::numeric_limits::max()); + const auto &target = element(member(*parsed, "targets"), 0); + Void::Testing::expect_eq(text(member(element(member(target, "sources"), 0), "path")), escaped); + Void::Testing::expect_eq(text(member(element(member(target, "sources"), 1), "kind")), + std::string{"glob"}); + Void::Testing::expect_eq(text(member(element(member(target, "links"), 0), "dependency")), + std::string{"dependency"}); + Void::Testing::expect_eq( + text(member(member(element(member(*parsed, "dependencies"), 1), "source"), "package")), + std::string{"org/pkg"}); +} + +Void::Testing::Test json_preserves_valid_utf8() { + // Boundary scalar values for every UTF-8 width, including either side of surrogates. + const std::string unicode = "ASCII \xc2\x80\xdf\xbf\xe0\xa0\x80\xed\x9f\xbf" + "\xee\x80\x80\xef\xbf\xbf\xf0\x90\x80\x80\xf4\x8f\xbf\xbf"; + vbs::Project project{context()}; + project.executable(unicode).sources(vbs::SourceSet::file(unicode)); + project.dependency("unicode").git("url", vbs::Commit{revision}).cmake({{unicode, unicode}}); + const auto json = project.to_json(); + Void::Testing::expect(json.find(unicode) != std::string::npos); + const auto parsed = Void::Json::Strict::parse(json); + Void::Testing::expect(parsed.has_value()); + if (!parsed) + return; + const auto &target = element(member(*parsed, "targets"), 0); + Void::Testing::expect_eq(text(member(target, "name")), unicode); + Void::Testing::expect_eq(text(member(element(member(target, "sources"), 0), "path")), unicode); + const auto &options = member(element(member(*parsed, "dependencies"), 0), "options"); + Void::Testing::expect_eq(text(member(options, unicode)), unicode); +} + +Void::Testing::Test json_rejects_malformed_utf8() { + const std::vector invalid{ + "\x80", "\xbf", "\xc0\x80", "\xc1\xbf", "\xc2", + "\xc2 ", "\xe0\x80\x80", "\xe0\x9f\xbf", "\xe1\x80", "\xe1 \x80", + "\xe1\x80 ", "\xed\xa0\x80", "\xed\xbf\xbf", "\xf0\x80\x80\x80", "\xf0\x8f\xbf\xbf", + "\xf0\x90\x80", "\xf1\x80\x80 ", "\xf4\x90\x80\x80", "\xf5\x80\x80\x80", "\xfe", + "\xff"}; + for (const auto &bytes : invalid) { + const auto malformed = "prefix" + bytes + "suffix"; + vbs::Project named{context()}; + (void)named.executable(bytes); + Void::Testing::expect_throw([&] { (void)named.to_json(); }); + + vbs::Project sourced{context()}; + sourced.executable("source").sources(vbs::SourceSet::file(malformed)); + Void::Testing::expect_throw([&] { (void)sourced.to_json(); }); + + vbs::Project keyed{context()}; + keyed.dependency("key").git("url", vbs::Commit{revision}).cmake({{malformed, true}}); + Void::Testing::expect_throw([&] { (void)keyed.to_json(); }); + + vbs::Project valued{context()}; + valued.dependency("value").git("url", vbs::Commit{revision}).cmake({{"option", malformed}}); + Void::Testing::expect_throw([&] { (void)valued.to_json(); }); + + auto profile = context(); + profile.compile_options.push_back(malformed); + vbs::Project configured{profile}; + Void::Testing::expect_throw([&] { (void)configured.to_json(); }); + } +} + +Void::Testing::Test independent_projects_and_contexts() { + auto initial = context(); + vbs::Project first{initial}; + initial.name = "mutated"; + vbs::Project second{ + vbs::default_profiles().resolve("release", vbs::CompilerFamily::clang, "linux", "aarch64")}; + first.executable("first").compile_option("-g"); + Void::Testing::expect_eq(first.context().name, std::string{"debug"}); + Void::Testing::expect_eq(second.context().name, std::string{"release"}); + Void::Testing::expect(second.targets().empty()); + Void::Testing::expect(first.to_json() != second.to_json()); +} + +Void::Testing::Test rejects_option_errors_without_mutation() { + vbs::Project project{context()}; + auto dep = project.dependency("library"); + Void::Testing::expect_throw([&] { dep.cmake({{"", true}}); }); + Void::Testing::expect(dep.record().builder.empty()); + Void::Testing::expect_throw( + [] { (void)vbs::OptionValue{std::numeric_limits::max()}; }); + dep.cmake({{"enabled", true}}).git("url", vbs::Commit{revision}); + Void::Testing::expect_eq(dep.record().options.size(), std::size_t{1}); +} diff --git a/tests/SdkRegistration.cmake b/tests/SdkRegistration.cmake new file mode 100644 index 0000000..d501b3d --- /dev/null +++ b/tests/SdkRegistration.cmake @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 4.0) + +execute_process(COMMAND "${SDK_TESTS}" --list --no-color + RESULT_VARIABLE code OUTPUT_VARIABLE out ERROR_VARIABLE err TIMEOUT 20) +if(NOT "${code}" STREQUAL "0" OR NOT "${err}" STREQUAL "") + message(FATAL_ERROR "SDK test discovery failed: ${code}\n${out}\n${err}") +endif() +set(expected + SdkDeclarations.default_profiles_and_overrides + SdkDeclarations.rejects_invalid_profiles + SdkDeclarations.declaration_records_and_visibility + SdkDeclarations.sources_are_symbolic + SdkDeclarations.handles_survive_record_growth + SdkDeclarations.rejects_cross_project_links + SdkDeclarations.rejects_expired_handles_and_owner_moves + SdkDeclarations.rejects_empty_and_duplicate_identifiers + SdkDeclarations.rejects_contradictory_providers + SdkDeclarations.json_schema_types_and_escaping + SdkDeclarations.json_preserves_valid_utf8 + SdkDeclarations.json_rejects_malformed_utf8 + SdkDeclarations.independent_projects_and_contexts + SdkDeclarations.rejects_option_errors_without_mutation + ExampleContexts.example_uses_runtime_compiler + ExampleContexts.example_profile_options_are_separate + ExampleContexts.example_records_sources_links_and_pin) +string(REPLACE "\n" ";" discovered "${out}") +list(FILTER discovered EXCLUDE REGEX "^$") +foreach(name IN LISTS expected) + if(NOT name IN_LIST discovered) + message(FATAL_ERROR "Missing SDK regression case: ${name}\n${out}") + endif() +endforeach() +list(LENGTH discovered count) +if(count LESS 17) + message(FATAL_ERROR "Expected at least 17 SDK cases, found ${count}") +endif() +# Observe that filtering executes a named registered body, rather than only listing it. +execute_process(COMMAND "${SDK_TESTS}" --no-color --filter "^SdkDeclarations.json_schema_types_and_escaping$" + RESULT_VARIABLE code OUTPUT_VARIABLE out ERROR_VARIABLE err TIMEOUT 20) +if(NOT "${code}" STREQUAL "0" OR NOT out MATCHES "1 tests:" OR + NOT out MATCHES "json_schema_types_and_escaping") + message(FATAL_ERROR "Named SDK case did not execute successfully: ${code}\n${out}\n${err}") +endif() +message(STATUS "${count} SDK test registrations verified; named JSON case executed")