Files
Build-System/docs/roadmap/18-self-host-voidlibrary.md
faumaray ab64147f9d
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
Implement VoidBuildSystem v1 (Plans 01-19) with VoidLibrary integration
2026-11-26 20:45:54 +03:00

4.7 KiB

18 — Native self-hosting and VoidLibrary migration

Implementation status: IMPLEMENTED & VERIFIED (2026-11-26). See STATE and VERIFICATION for implemented files and observed checks.

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; requirement authority is REQUIREMENTS. Return implementation evidence to VERIFICATION.