feat: adopt VoidLibrary VL-001..VL-013, self-building build.cpp, live logs, and generated CLI help
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 10s

This commit is contained in:
faumaray committed 2026-11-27 01:43:06 +03:00
1 parent ab64147f9d
commit 363fb8200e
33 files changed
+1754 -3155

No files matched your search

+33 -249
View File
@@ -1,259 +1,43 @@
# VoidLibrary Upstream Feature Requests
Pinned baseline inspected: `9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5`.
Pinned VoidLibrary revision: `3e254055e081a104f08df68dde39711bc7813518` (merged `feat/upstream-vbs-requests` covering `VL-001`..`VL-013`; upgraded from `9931c5ffc4844a5e09e1b1db35b3d29c5097c3a5`).
This ledger tracks reusable, non-build-system-specific capabilities needed by
VoidBuildSystem that are absent, incomplete, or tightly bound to external
system libraries in the pinned VoidLibrary revision. Until a dedicated
VoidLibrary worker implements these items and the pin is updated, VBS keeps
swappable local adapters behind clean internal interfaces.
## Status Summary
| ID | Capability | Upstream Status (`3e254055...`) | VBS Adoption Status |
| --- | --- | --- | --- |
| `VL-001` | Process group supervision (`Void::Process::spawn`, `communicate_blocking`, `enable_subreaper`) | Implemented | **Adopted** (`src/Platform/ProcessSupervisor.cpp`) |
| `VL-002` | TOML 1.0 parser & serializer (`Void::Data::Toml`) | Implemented | **Adopted** (`src/Package/Toml.cpp`) |
| `VL-003` | Kernel `inotify` recursive directory watcher (`Void::FileSystem::DirectoryWatcher`) | Implemented | **Adopted** (`src/Watch/Watcher.cpp`, `include/Void/Build/Watch/Watcher.hpp`) |
| `VL-004` | Concrete HTTP/1.1 server (`Void::Net::HttpServer`) | Implemented (requires Boost + OpenSSL) | Local loopback POSIX adapter retained for minimal `dev cpp-gcc` (no Boost/OpenSSL) |
| `VL-005` | Streaming HTTP client & TLS default (`Void::Net::HttpClient`) | Implemented (requires Boost + OpenSSL) | Local loopback POSIX + `curl` adapter retained for minimal `dev cpp-gcc` (no Boost/OpenSSL) |
| `VL-006` | Deterministic archive creation & safe staged extraction (`Void::Archive::create`, `extract_staged`) | Implemented (zero external deps for `.tar`) | **Adopted** (`src/Package/Archive.cpp`, always linked via `Void::Archive`) |
| `VL-007` | Zero-dependency built-in SHA-256 / BLAKE2b (`Void::Crypto::Hasher`) | Implemented (zero external deps when OpenSSL absent) | **Adopted** (`include/Void/Build/Util/Sha256.hpp`, `src/Util/Sha256.cpp`, always linked via `Void::Crypto`) |
| `VL-008` | Strict UTF-8 validation (`Void::Json::Strict`, `Void::Unicode::validate_utf8`) | Implemented | **Adopted** (`src/Util/Json.cpp`, `Void::Json::Strict` throughout) |
| `VL-009` | Native non-CMake `Void::Testing` registration API | Implemented | **Adopted** (supported alongside `vbs gen-tests` in `src/SelfHost/TestRegistryGen.cpp`) |
| `VL-010` | Advisory `FileLock`, `reflink_copy_file`, `set_canonical_mtime`, `atomic_symlink_swap` (`Void::FileSystem`) | Implemented | **Adopted** (`include/Void/Build/Platform/FileOps.hpp`, `src/Platform/FileOps.cpp`) |
| `VL-011a` | Subcommands, `option_many`, `positional_many`, `ParseOutcome::Help` (`Void::Argparse::Parser`) | Implemented | **Adopted** (`src/Main.cpp`, `src/Describe.cpp`, `registry/service/Main.cpp`, `benchmarks/EngineBenchmarks.cpp` — 100% auto-generated help) |
| `VL-011b` | Optional SQLite3 FetchContent (`Void::Sqlite`) | Implemented (`VOID_FETCH_SQLITE3`) | Opportunistic when system `SQLite3` is installed (`VOID_FETCH_SQLITE3=OFF` to keep offline configures fast); journaled atomic CAS store retained |
| `VL-012` | Naming consistency observation | Noted | VBS strictly uses `Void::Build`, `PascalCase` types/enums/paths, `snake_case` functions/methods |
| `VL-013` | Shorthand SemVer ranges (`^1.0`, `~1.2`, `>=1.2 <2`) in `Void::Semver::parse_range` | Implemented | **Adopted** (`src/Package/Solver.cpp` delegates directly to `Void::Semver::parse_range`) |
---
## VL-001: Robust Process Descendant Lifecycle Supervision (`Void::Process`)
## Detailed Notes
- **Target module**: `System` (`include/Void/System/Process.hpp`)
- **Priority**: High (Plan 06 — Execution & Cancellation)
- **Current gap**: `Void::Process::Child::terminate()` signals the process
group and waits for the direct leader PID, but returns immediately once the
leader exits even if grandchildren remain alive in the process group (e.g.
ignoring `SIGTERM`).
- **Requested API / behavior**:
- Track the entire owned process group (and optionally opt into Linux
`PR_SET_CHILD_SUBREAPER` or `pidfd` / `waitpid(-pgid, ...)` draining).
- `Child::terminate(grace)` must send `SIGTERM` to `-pgid`, poll/wait until
**all** members of the process group exit (not only the leader), escalate
to `SIGKILL` on `-pgid` when `grace` expires, and reap/confirm no members
remain (`kill(-pgid, 0) == -1 && errno == ESRCH`).
- **Acceptance test**: Leader spawns grandchild that ignores `SIGTERM`, leader
exits immediately; `terminate(100ms)` escalates to `SIGKILL` and verifies the
grandchild cannot write after `terminate()` returns.
- **VBS temporary adapter**: `Void::Build::Platform::SupervisedProcess` in
`src/Platform/ProcessSupervisor.cpp`.
### Adopted Upstream Capabilities (`VL-001`, `VL-002`, `VL-003`, `VL-006`, `VL-007`, `VL-008`, `VL-009`, `VL-010`, `VL-011a`, `VL-013`)
## VL-002: TOML 1.0 Parser and Serializer (`Void::Data::Toml`)
- **`VL-001` (`Void::Process`)**: `src/Platform/ProcessSupervisor.cpp` delegates process spawning, pipe multiplexing, timeouts, cancellation, `PR_SET_CHILD_SUBREAPER`, and `-pgid` `SIGTERM -> SIGKILL` termination to `Void::Process::spawn`, `Void::Process::communicate_blocking`, and `Void::Process::enable_subreaper`, adding post-leader process-group drain supervision for detached grandchildren with redirected stdio.
- **`VL-002` (`Void::Data::Toml`)**: `src/Package/Toml.cpp` delegates all TOML 1.0 parsing and canonical table serialization to `Void::Data::Toml::parse` and `Void::Data::Toml::serialize_table`.
- **`VL-003` (`Void::FileSystem::DirectoryWatcher`)**: `src/Watch/Watcher.cpp` wraps `Void::FileSystem::DirectoryWatcher` for recursive Linux `inotify` observation, ignore predicates, and `RescanRequired` overflow handling.
- **`VL-006` (`Void::Archive`)**: `CMakeLists.txt`, `cmake/VoidDependency.cmake`, `recipes/VoidLibrary/VoidLibraryRecipe.cpp`, and `recipes/SelfHost/VbsSelfHostRecipe.cpp` unconditionally enable `Void::Archive` (`VOID_ARCHIVE_HAS_LIBARCHIVE=0` built-in USTAR/PAX tar), and `src/Package/Archive.cpp` delegates archive creation and staged security-checked extraction to `Void::Archive::create` and `Void::Archive::extract_staged` + `StagedTree::publish`.
- **`VL-007` (`Void::Crypto`)**: `Void::Crypto` (`VOID_CRYPTO_HAS_OPENSSL=0` built-in FIPS 180-4 SHA-256) is unconditionally linked, and `src/Util/Sha256.cpp` delegates directly to `Void::Crypto::Hasher`, `Void::Crypto::sha256`, and `Void::Crypto::sha256_file`.
- **`VL-008` (`Void::Json::Strict` / `Void::Unicode`)**: Strict UTF-8 validation is active across `Void::Json::Strict` and `src/Util/Json.cpp`.
- **`VL-010` (`Void::FileSystem`)**: `src/Platform/FileOps.cpp` delegates `FileLock`, `copy_isolated`, `set_canonical_mtime`, and `atomic_swap_symlink` directly to `Void::FileSystem::FileLock`, `reflink_copy_file`, `set_canonical_mtime`, and `atomic_symlink_swap`.
- **`VL-011a` (`Void::Argparse::Parser`)**: Every VBS executable (`vbs`, `vbs-registry`, `vbs_describe`, `vbs_benchmarks`) uses `Void::Argparse::Parser::parse_detailed()` with native `subcommand()`, `option_many()`, `positional_many()`, and `require_subcommand()` — eliminating all custom help strings, manual `--help` checks, and manual repeatable-argument slicing.
- **`VL-013` (`Void::Semver::parse_range`)**: `src/Package/Solver.cpp` calls `Void::Semver::parse_range()` directly without local range normalization.
- **Target module**: `Data` (`include/Void/Data/Toml.hpp`)
- **Priority**: High (Plan 11 — Dependency Declarations & Lockfiles)
- **Current gap**: `Void::Data` provides `Json`, `StrictJson`, `Ini`, `Csv`,
and `Reflect`, with no TOML 1.0 parser/serializer.
- **Requested API / behavior**:
- Full TOML 1.0 parser returning `Void::Result::Result<Document, ParseError>`
with line/column source locations (`Origin{line, column}`) on every node
and error.
- Typed values preserving string, boolean, signed 64-bit integer, double,
datetime, array, inline table, table, and array-of-tables, plus
deterministic canonical serializer.
- **Acceptance test**: Round-trip TOML 1.0 compliance fixtures including
multiline strings, dotted keys, inline tables, arrays of tables, comments,
and exact line/column error reporting on duplicate/malformed keys.
- **VBS temporary adapter**: `Void::Build::Package::Toml` in
`src/Package/Toml.cpp`.
### Remaining Optional External-Dependency Adapters (`VL-004`, `VL-005`, `VL-011b`)
## VL-003: Kernel-Event Recursive Directory Watcher (`Void::System` / `Void::SystemAsync`)
- **Target module**: `System` / `SystemAsync`
(`include/Void/System/DirectoryWatcher.hpp` or extension to `AsyncWatcher.hpp`)
- **Priority**: High (Plan 10 — Build & Metadata Watchers)
- **Current gap**: `Void::FileSystem::FileWatcher` and
`Void::SystemAsync::WatcherService` are polling-only per explicit path. They
do not use Linux `inotify` for low-latency recursive tree observation or emit
kernel queue-overflow (`IN_Q_OVERFLOW`) rescan signals.
- **Requested API / behavior**:
- Linux `inotify`-backed recursive directory watcher with ignore predicates
(to skip `.git`, `build/`, etc.), automatic watch attachment on newly
created subdirectories, rename pairing (`IN_MOVED_FROM` / `IN_MOVED_TO`),
and explicit `RescanRequired` events on `IN_Q_OVERFLOW` or watch-limit
errors (`ENOSPC`).
- **Acceptance test**: Recursive create/modify/rename/delete storms, directory
replacement, and simulated overflow reliably trigger `RescanRequired`.
- **VBS temporary adapter**: `Void::Build::Watch::InotifyWatcher` in
`src/Watch/Watcher.cpp`.
## VL-004: Concrete HTTP/1.1 Server Transport (`Void::Net::HttpServer`)
- **Target module**: `Net` (`include/Void/Net/HttpServer.hpp`)
- **Priority**: High (Plan 16 & 17 — Hosted Registry Service & Web UI)
- **Current gap**: `Void::Net::Server.hpp` provides transport-neutral `Router`,
`StaticFileResolver`, and `WebSocketSessions`, while `Void::Net::Socket.hpp`
only provides `UdpSocket`. There is no concrete TCP/HTTP server listener.
- **Requested API / behavior**:
- Concrete loopback/configurable TCP HTTP/1.1 server dispatching through
`Void::Net::Router`, supporting ephemeral port binding (`port == 0` with
`bound_port()` query), configurable header/body size limits, graceful
shutdown, and streaming request/response bodies to/from files.
- **Acceptance test**: Ephemeral-port loopback server handling concurrent
GET/PUT/POST/DELETE requests, oversized body rejection (413), and clean
shutdown without dangling sockets.
- **VBS temporary adapter**: `Void::Build::Registry::HttpServer` in
`registry/service/HttpServer.cpp`.
## VL-005: Streaming HTTP Client & Secure TLS Default (`Void::Net::HttpClient`)
- **Target module**: `Net` (`include/Void/Net/Http.hpp`)
- **Priority**: Medium (Plan 12 — Package Fetching)
- **Current gap**: `HttpClient::send()` buffers the entire response body in
`std::string` and defaults `m_verify_tls = false`.
- **Requested API / behavior**:
- Add streaming download-to-file (`download_to_file`) and streaming
upload-from-file (`upload_file`) with byte quotas, cancellation
(`std::stop_token`), and incremental digest/progress callbacks.
- Provide a secure constructor/preset with TLS certificate verification
enabled by default and explicit redaction of `Authorization` headers in
diagnostics.
- **Acceptance test**: Streaming multi-megabyte transfer with quota overflow
abort and TLS verification check.
- **VBS temporary adapter**: `Void::Build::Package::HttpTransfer` in
`src/Package/Fetch.cpp`.
## VL-006: Archive Creation and Multi-Format Support (`Void::Archive`)
- **Target module**: `Archive` (`include/Void/Archive/Archive.hpp`)
- **Priority**: Medium (Plan 12 & 15 — Source/Binary Packaging)
- **Current gap**: `Void::Archive` currently exposes only `extract()` for
`tar`/`tar.zst` and requires external `LibArchive::LibArchive`. There is no
archive creation API (`create()`), nor pure-C++ USTAR/PAX tar fallback.
- **Requested API / behavior**:
- Add deterministic `Void::Archive::create()` accepting sorted entries,
canonical mtime/uid/gid/mode metadata (for reproducible archives), and
safe extraction for `.tar`, `.tar.gz`, `.tar.zst`.
- **Acceptance test**: Deterministic archive creation (byte-identical across
runs with fixed epoch), round-trip extraction, and traversal/symlink-escape
rejection.
- **VBS temporary adapter**: `Void::Build::Package::TarArchive` (pure-C++
deterministic PAX/USTAR tar reader/writer + optional gzip/zstd piping) in
`src/Package/Archive.cpp`.
## VL-007: Zero-Dependency Built-In SHA-256 / BLAKE2b Fallback (`Void::Crypto`)
- **Target module**: `Crypto` (`include/Void/Crypto/Crypto.hpp`)
- **Priority**: Medium (Plan 05, 07, 11, 12, 16)
- **Current gap**: `Void::Crypto` requires external `OpenSSL::Crypto`, which is
not installed in minimal C++ toolchain environments such as `dev cpp-gcc`.
- **Requested API / behavior**:
- Support a built-in pure-C++ FIPS 180-4 SHA-256 (and SHA-512) implementation
in `Void::Crypto` when OpenSSL is absent (or as a lightweight
`Void::CryptoHash` module without external dependencies), keeping the exact
`Void::Crypto::Hasher` API.
- **Acceptance test**: NIST CAVP SHA-256 vectors + streaming file hashing
compile and pass with zero external crypto packages.
- **VBS temporary adapter**: `Void::Build::Util::Sha256Hasher` in
`src/Util/Sha256.cpp` (with compile-time switch to `Void::Crypto::Hasher`
when `VBS_HAS_VOID_CRYPTO` is enabled).
## VL-008: Strict UTF-8 Validation in `Void::Json::Strict` (`Void::Data`)
- **Target module**: `Data` (`include/Void/Data/StrictJson.hpp`)
- **Priority**: Medium (Observed in V-002 review)
- **Current gap**: `Void::Json::Strict::parse()` accepts raw invalid UTF-8
bytes (e.g. `0xff`, overlong sequences, UTF-8 encoded surrogates) inside JSON
strings instead of rejecting them per RFC 8259.
- **Requested API / behavior**:
- Validate every UTF-8 byte sequence in JSON strings and object keys during
both `parse()` and serialization (reusing `Void::Unicode::is_scalar_value`
/ UTF-8 validation).
- **Acceptance test**: Reject stray continuation bytes, overlong encodings,
surrogates (`U+D800..U+DFFF`), and code points `> U+10FFFF` while preserving
all valid 1..4-byte Unicode scalars.
- **VBS temporary adapter**: `src/Util/Json.cpp` now delegates to
`Void::Unicode::validate_utf8` whenever `VBS_HAS_VOID_UNICODE` is enabled
(preserving a pure-C++ fallback for standalone SDK compilation), and
`src/Build.cpp` enforces `require_utf8()`.
## VL-009: Native Non-CMake Test Registration API (`Void::Testing`)
- **Target module**: `Testing` (`include/Void/Testing/Test.hpp`,
`cmake/VoidTestScanner.cmake`)
- **Priority**: High (Plan 18 — Strict Native Self-Hosting)
- **Current gap**: Test discovery currently relies on CMake running
`VoidTestScanner.cmake` at configure time to scan `.cpp` files and emit a
generated registration translation unit. Strict native self-hosting stages
cannot depend on CMake.
- **Requested API / behavior**:
- Provide either a first-class self-registering C++ macro/helper API in
`Void::Testing` (e.g. `VOID_TEST(suite, name)` with path-disambiguated
unique symbols avoiding basename collisions) or an officially supported
standalone C++ registration generator library/header contract.
- **Acceptance test**: Build and run a multi-file `Void::Testing` binary
purely with `g++` (zero CMake), verifying `--list`, `--filter`, and exact
nonzero test count even when two files share the same stem in different
subdirectories.
- **VBS temporary adapter**: Native C++ test registration generator in
`src/SelfHost/TestRegistryGen.cpp` (Plan 18).
## VL-010: Advisory File Locks, Atomic Symlink Swap, Reflink Copy & Canonical Timestamps (`Void::FileSystem`)
- **Target module**: `System` (`include/Void/System/Path.hpp`)
- **Priority**: Medium (Plan 05, 07, 09, 11)
- **Current gap**: `Void::FileSystem::replace_file()` covers atomic durable
regular-file replacement, but lacks:
- RAII advisory file locks (`flock` / `fcntl` shared & exclusive, blocking
and try-lock).
- Atomic symlink swap (`symlink` to temp name + `rename` + parent dir
`fsync`).
- Copy-on-write reflink copy (`ioctl(FICLONE)` with private-copy fallback,
explicitly never hardlinking).
- Canonical timestamp setter (`utimensat(..., AT_SYMLINK_NOFOLLOW)`).
- **Requested API / behavior**: Add these primitives to `Void::FileSystem` with
`Void::Result::Result` error reporting matching `replace_file()`.
- **VBS temporary adapter**: `Void::Build::Platform::FileOps` in
`src/Platform/FileOps.cpp`.
## VL-011: Embedded/Optional SQLite & Argparse Subcommands (`Void::Sqlite`, `Void::Argparse`)
- **Target modules**: `Sqlite`, `Configuration`
- **Priority**: Low–Medium (Plan 07, 10, 16)
- **Current gaps**:
1. `Void::Argparse::Parser` does not natively support subcommands
(`vbs build`, `vbs compdb use`, `vbs deps resolve`) or repeatable options
(`--target a --target b`, `--profile debug --profile release`), and
reports `--help` through the error channel.
2. `Void::Sqlite` requires system `SQLite3::SQLite3` (`find_package`) with no
optional FetchContent/amalgamation fallback when building in minimal tool
environments (`dev cpp-gcc`).
- **Requested API / behavior**:
- Add subcommand dispatch, repeatable `option_many()`, and distinct
`ParseOutcome::Help` vs `ParseOutcome::Error` in `Void::Argparse::Parser`.
- Allow optional FetchContent/amalgamation SQLite3 in
`cmake/Dependencies.cmake` (parallel to Boost) so `Void::Sqlite` works in
minimal shells.
- **VBS temporary adapter**: `src/Main.cpp`, `registry/service/Main.cpp`,
`src/Describe.cpp`, and `benchmarks/EngineBenchmarks.cpp` all delegate option
parsing and `--help` generation to `Void::Argparse::Parser` (with only thin
subcommand-dispatch and repeatable-flag extraction wrappers in `src/Main.cpp`).
`src/State/StateStore.cpp` provides a crash-safe journaled atomic-replace
backend using `Void::FileSystem::replace_file` while preserving a compile-time
`Void::Sqlite` switch when `SQLite3` is present.
## VL-012: VoidLibrary Naming Consistency Note
- **Observation**: Most VoidLibrary modules use `PascalCase` enums
(`Void::Crypto::HashAlgorithm::Sha256`, `Void::Sqlite::OpenMode::ReadOnly`,
`Void::Net::Method::Get`, `Void::Security::PasswordHashStrength::Moderate`)
and `snake_case` functions/methods. A few headers mix styles
(`Void::Crypto::sha256File` camelCase vs `Void::Security::hash_password`
snake_case; `Void::Process::EnvMode::inherit` snake_case vs
`Void::Sqlite::OpenMode::ReadOnly` PascalCase). VoidBuildSystem standardizes
strictly on `Void::Build` (`PascalCase` types/enums/filenames, `snake_case`
functions/methods) to align with the primary VoidLibrary style.
## VL-013: Shorthand SemVer Range Comparators (`Void::Semver::VersionRange`)
- **Target module**: `Text` (`include/Void/Text/Semver.hpp`)
- **Priority**: Medium (Plan 11 — Native Dependency Solver)
- **Current gap**: `Void::Semver::VersionRange::parse()` calls
`parse_strict()` on comparator/caret/tilde operands and rejects omitted minor
or patch components such as `^1`, `^1.0`, `^11.0`, `~1.2`, `>=1.2 <2`, or
`<2`. While wildcard tokens (`1.*`, `1.2.x`) are accepted, standard
Cargo/npm-style shorthand comparators fail to parse.
- **Requested API / behavior**:
- Support partial version bounds in `Void::Semver::VersionRange::parse()`:
- `^M` -> `>=M.0.0 <(M+1).0.0` (including `^0` -> `<1.0.0`)
- `^M.m` -> `^M.m.0`
- `~M` -> `>=M.0.0 <(M+1).0.0`, `~M.m` -> `~M.m.0`
- `>=M`, `>=M.m`, `<M`, `<M.m`, etc. padded to `.0` / `.0.0`.
- **Acceptance test**: `parse_range("^1.0")`, `parse_range("^11.0")`,
`parse_range("~1.2")`, `parse_range(">=1.2 <2")`, and `parse_range("<1.2.0")`
all parse cleanly and match the expected versions.
- **VBS temporary adapter**: `parse_semver_range_compat()` in
`src/Package/Solver.cpp`.
- **`VL-004` / `VL-005` (`Void::Net`)**: `Void::Net` in VoidLibrary still requires external `Boost` + `OpenSSL` (`src/Net/module.cmake`), which are absent in minimal `dev cpp-gcc`. VBS keeps its zero-dependency POSIX loopback `HttpServer` (`registry/service/HttpServer.cpp`) and `RegistryClient` (`src/Package/RegistryClient.cpp`) until a Boost-free/minimal-dependency transport is desired or available in the base toolchain.
- **`VL-011b` (`Void::Sqlite`)**: `cmake/VoidDependency.cmake` disables network fetches during CMake configure (`VOID_FETCH_SQLITE3=OFF`) and opportunistically enables `Void::Sqlite` when system `SQLite3` is installed; `src/State/StateStore.cpp` continues providing crash-safe atomic-replace CAS persistence in minimal shells.