feat(platform,daemon): isolate executable lookup and report host backends
This commit is contained in:
1 parent
105519924a
commit
9f4477b8d4
10 files changed
+93
-7
No files matched your search
@@ -231,6 +231,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
||||
|
||||
- **Wave 69 (RegistryClient Owners Helper, via swarm)**: a swarm worker added `Package::fetch_package_owners` (GET `/api/v1/packages/<name>/owners`, explicit 404/401/403 mapping) and RegistryTests coverage (owner list contains `pub_alice`, missing package fails, anonymous private access fails); the orchestrator reviewed, built, and verified it.
|
||||
|
||||
- **Wave 70 (Track C1: Portable Executable Path & Daemon Host Reporting)**: added `Platform::current_executable_path()` (`FileOps.hpp`, implemented in `src/Platform/Linux/FileOps.cpp` with an explicit error on failure) and replaced the hard-coded `/proc/self/exe` reads in `src/Main.cpp`; `CoreEngineTests.current_executable_path_resolves_running_binary` covers it. A swarm worker (5/5 tasks) extended the daemon `info` response with `host_os`, `host_supported`, and a `backends` object (file ops, process supervisor, directory watcher, sqlite, net), asserted in `Daemon.info_reports_daemon_paths_and_host`.
|
||||
|
||||
## Remaining future scope
|
||||
|
||||
- **Post-v1 Expansion Roadmap ([21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md) & [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md))**: Track C (macOS/Windows ports + dual-profile cross-compilation) and dedicated external editor plugins remain planned; Track D3 signing (SBOM, Ed25519 primitives, trusted-key enforcement/distribution, binary-variant signing/distribution) and Track E3 daemon capabilities are implemented, and Track E4 now uses `Void::Net` for the registry client/server and remote cache plus `Void::Sqlite` for the StateStore when available.
|
||||
@@ -73,4 +73,5 @@ Base HEAD: `fe0d1a6`
|
||||
| Wave 66 (Signed binaries fetch) | `binaries fetch --trusted-public-key/--trusted-key-file` verifies the variant signature before download; E2E covers unsigned rejection | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 7/7, full CTest 8/8) | `src/Main.cpp`, `tests/RegistryTests.cpp`, docs |
|
||||
| Wave 67 (Daemon init request) | `Config::scaffold_project` extraction; `init` daemon request + `vbs daemon init --dir`: confined project scaffolding | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 29/29, full CTest 8/8) | `include/Void/Build/Config/Scaffold.hpp`, `src/Config/Scaffold.cpp`, `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, build lists, docs |
|
||||
| Wave 69 (RegistryClient owners helper, via swarm) | `fetch_package_owners` in RegistryClient + RegistryTests coverage (owners list, missing package 404, anonymous private 401) | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 7/7, full CTest 8/8) | `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `tests/RegistryTests.cpp`, docs |
|
||||
| Wave 70 (Track C1 executable path + daemon host info) | `Platform::current_executable_path()` replacing `/proc/self/exe` in Main.cpp; daemon `info` reports `host_os`/`host_supported`/`backends` (swarm, 5/5 tasks) | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Core and Daemon suites pass, full CTest 8/8) | `include/Void/Build/Platform/FileOps.hpp`, `src/Platform/Linux/FileOps.cpp`, `src/Main.cpp`, `src/Daemon/Daemon.cpp`, `tests/{CoreEngineTests,DaemonTests}.cpp`, docs |
|
||||
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
|
||||
@@ -1119,6 +1119,16 @@ dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color
|
||||
- Registry suite after integration: **7 / 7 passed** (11.02 s); full CTest: **8 / 8 passed** in
|
||||
271.07 s.
|
||||
|
||||
## Track C1 Executable Path & Daemon Host Info (GCC 16.2, pin `0002e74`)
|
||||
|
||||
- `Platform::current_executable_path()` replaces the hard-coded `/proc/self/exe` reads in
|
||||
`src/Main.cpp`; `CoreEngineTests.current_executable_path_resolves_running_binary` passes (the
|
||||
returned path is absolute and a regular file).
|
||||
- Swarm `swarm_mx8a5ush_g8oa` (one worker) completed 5/5 tasks: the daemon `info` response now
|
||||
includes `host_os`, `host_supported`, and a `backends` object; `Daemon.info_reports_daemon_paths_and_host`
|
||||
passes.
|
||||
- Full CTest after both slices: **8 / 8 passed** in 242.99 s.
|
||||
|
||||
## Limits and Unrun Checks
|
||||
|
||||
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
|
||||
|
||||
@@ -46,7 +46,7 @@ flowchart LR
|
||||
|
||||
| Phase | Concrete Scope | Acceptance Gate |
|
||||
| --- | --- | --- |
|
||||
| **C1 — Platform Backend Split** *(Linux backend split implemented; macOS/Windows pending)* | Split `src/Platform/` into `Linux/`, `MacOS/`, and `Windows/` behind clean interfaces (`FileOps`, `ProcessSupervisor`, `DirectoryWatcher`), delegating to `Void::System` as upstream adds OS backends. Linux implementations now live under `src/Platform/Linux/` and `src/Watch/Linux/` (inotify watcher) with an explicit `HostOs`/`host_supported()` boundary in `include/Void/Build/Platform/Host.hpp`; macOS/Windows backends await real hosts (`vbs doctor` reports the detected host and enabled backends). | Zero Linux regressions; clean platform abstraction boundary. |
|
||||
| **C1 — Platform Backend Split** *(Linux backend split implemented; macOS/Windows pending)* | Split `src/Platform/` into `Linux/`, `MacOS/`, and `Windows/` behind clean interfaces (`FileOps`, `ProcessSupervisor`, `DirectoryWatcher`), delegating to `Void::System` as upstream adds OS backends. Linux implementations now live under `src/Platform/Linux/` and `src/Watch/Linux/` (inotify watcher) with an explicit `HostOs`/`host_supported()` boundary in `include/Void/Build/Platform/Host.hpp`; macOS/Windows backends await real hosts (`vbs doctor` and the daemon `info` request report the detected host and enabled backends, and `Platform::current_executable_path()` isolates the executable-path lookup). | Zero Linux regressions; clean platform abstraction boundary. |
|
||||
| **C2 — macOS / Apple Clang & `ld64`** | Apple Clang toolchain probes, `.dylib` + `@rpath`/`@loader_path` install-name lowering, `FSEvents` watcher, Mach-O deterministic timestamps. | Real macOS CI runner passing all SDK, core, module, and install tests. |
|
||||
| **C3 — Windows / MSVC & `clang-cl`** | MSVC (`cl.exe`, `lib.exe`, `link.exe`, `/showIncludes`, `.pdb`, `/FS`, `.dll`/`.lib` import libraries), Job Object process-tree kill, `ReadDirectoryChangesW` watcher, case-insensitive path conflict detection. | Real Windows CI runner passing process-tree kill, header-shadowing, and install relocation tests. |
|
||||
| **C4 — True Host-vs-Target Cross-Compilation** | Dual-context evaluation (`host` profile for code generators and `build_dependency` tools vs `target` profile for cross-compiled products), sysroot & `--target=` triple propagation. | `linux-x86_64` host cross-compiling `linux-aarch64` fixture while executing host-compiled generator natively. |
|
||||
|
||||
@@ -92,4 +92,9 @@ resolve_confined_path(const std::filesystem::path &root, const std::filesystem::
|
||||
[[nodiscard]] bool path_is_within(const std::filesystem::path &root,
|
||||
const std::filesystem::path &path);
|
||||
|
||||
// Absolute path of the running executable (Linux: /proc/self/exe). Hosts without a supported
|
||||
// mechanism return an explicit error instead of a guessed path.
|
||||
[[nodiscard]] Void::Result::Result<std::filesystem::path, Void::Result::Error>
|
||||
current_executable_path();
|
||||
|
||||
} // namespace Void::Build::Platform
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <Void/Build/Package/Resolver.hpp>
|
||||
#include <Void/Build/Package/Toml.hpp>
|
||||
#include <Void/Build/Platform/FileOps.hpp>
|
||||
#include <Void/Build/Platform/Host.hpp>
|
||||
#include <Void/Build/Platform/ProcessSupervisor.hpp>
|
||||
#include <Void/Build/Provenance/TrustedKeys.hpp>
|
||||
#include <Void/Build/Provider/Provider.hpp>
|
||||
@@ -1868,6 +1869,26 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
|
||||
object.emplace("version", JsonValue{std::string{Bootstrap::version}});
|
||||
object.emplace("os", JsonValue{std::string{Bootstrap::os}});
|
||||
object.emplace("architecture", JsonValue{std::string{Bootstrap::architecture}});
|
||||
object.emplace("host_os",
|
||||
JsonValue{std::string{Platform::host_os_name(Platform::host_os())}});
|
||||
object.emplace("host_supported", JsonValue{Platform::host_supported()});
|
||||
#if defined(VBS_HAS_VOID_SQLITE)
|
||||
constexpr bool has_sqlite = true;
|
||||
#else
|
||||
constexpr bool has_sqlite = false;
|
||||
#endif
|
||||
#if defined(VBS_HAS_VOID_NET)
|
||||
constexpr bool has_net = true;
|
||||
#else
|
||||
constexpr bool has_net = false;
|
||||
#endif
|
||||
JsonValue::Object backends;
|
||||
backends.emplace("file_ops", JsonValue{Platform::host_supported()});
|
||||
backends.emplace("process_supervisor", JsonValue{Platform::host_supported()});
|
||||
backends.emplace("directory_watcher", JsonValue{Platform::host_supported()});
|
||||
backends.emplace("sqlite", JsonValue{has_sqlite});
|
||||
backends.emplace("net", JsonValue{has_net});
|
||||
object.emplace("backends", JsonValue{std::move(backends)});
|
||||
object.emplace("project_root", JsonValue{options.project_root.string()});
|
||||
object.emplace("build_root", JsonValue{options.build_root.string()});
|
||||
object.emplace(
|
||||
|
||||
+4
-6
@@ -128,9 +128,8 @@ make_frontend_opts(const std::filesystem::path &project_root,
|
||||
opts.sdk_source_dir = std::filesystem::path{Bootstrap::sdk_source_dir};
|
||||
std::error_code ec;
|
||||
std::vector<std::filesystem::path> sdk_candidates;
|
||||
if (const auto self_exe = std::filesystem::read_symlink("/proc/self/exe", ec);
|
||||
!ec && !self_exe.empty()) {
|
||||
const auto self_root = self_exe.parent_path().parent_path();
|
||||
if (const auto self_exe = Platform::current_executable_path(); self_exe) {
|
||||
const auto self_root = self_exe->parent_path().parent_path();
|
||||
sdk_candidates.push_back(self_root / "libVoidBuildSdk.a");
|
||||
sdk_candidates.push_back(self_root / "libVoidBuild_Sdk.a");
|
||||
sdk_candidates.push_back(self_root / "lib" / "libVoidBuildSdk.a");
|
||||
@@ -2287,9 +2286,8 @@ int execute_ide_command(std::string_view sub, const IdeCmdOptions &opts) {
|
||||
}
|
||||
|
||||
std::filesystem::path vbs_exe{"vbs"};
|
||||
if (const auto self_exe = std::filesystem::read_symlink("/proc/self/exe", ec);
|
||||
!ec && !self_exe.empty()) {
|
||||
vbs_exe = self_exe;
|
||||
if (const auto self_exe = Platform::current_executable_path(); self_exe) {
|
||||
vbs_exe = *self_exe;
|
||||
}
|
||||
|
||||
Editor::IdeConfigOptions ide_opts;
|
||||
|
||||
@@ -315,4 +315,17 @@ resolve_confined_path(const std::filesystem::path &root, const std::filesystem::
|
||||
EACCES)};
|
||||
}
|
||||
|
||||
Void::Result::Result<std::filesystem::path, Void::Result::Error> current_executable_path() {
|
||||
std::error_code ec;
|
||||
const auto path = std::filesystem::read_symlink("/proc/self/exe", ec);
|
||||
if (ec || path.empty()) {
|
||||
return std::unexpected{Void::System::make_system_error(
|
||||
Void::System::SystemErrorCode::io_error,
|
||||
std::format("current_executable_path: cannot resolve /proc/self/exe: {}",
|
||||
ec ? ec.message() : "empty path"),
|
||||
ec.value())};
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
} // namespace Void::Build::Platform
|
||||
@@ -206,6 +206,13 @@ VOID_TEST(CoreEngineTests, snapshot_content_mutations_symlinks_shadowing_and_iso
|
||||
Void::Testing::expect(!loop_snap.has_value());
|
||||
}
|
||||
|
||||
VOID_TEST(CoreEngineTests, current_executable_path_resolves_running_binary) {
|
||||
auto path = Platform::current_executable_path();
|
||||
Void::Testing::require(path.has_value());
|
||||
Void::Testing::expect(std::filesystem::is_regular_file(*path));
|
||||
Void::Testing::expect(path->is_absolute());
|
||||
}
|
||||
|
||||
VOID_TEST(CoreEngineTests, state_store_cas_corruption_recovery_and_gc) {
|
||||
Void::FileSystem::TempDir tmp{"vbs_state_"};
|
||||
auto store = State::StateStore::open(tmp / ".vbs");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <Void/Build/Daemon/Daemon.hpp>
|
||||
#include <Void/Build/Platform/Host.hpp>
|
||||
#include <Void/Build/Util/Json.hpp>
|
||||
#include <Void/Data/StrictJson.hpp>
|
||||
#include <Void/System/TempDir.hpp>
|
||||
@@ -1197,6 +1198,34 @@ VOID_TEST(Daemon, info_reports_daemon_paths_and_host) {
|
||||
Void::Testing::expect_eq(str_field(*info, "project_root"), options.project_root.string());
|
||||
Void::Testing::expect_eq(str_field(*info, "build_root"), options.build_root.string());
|
||||
Void::Testing::expect_eq(str_field(*info, "socket"), socket.string());
|
||||
Void::Testing::expect_eq(
|
||||
str_field(*info, "host_os"),
|
||||
std::string{Void::Build::Platform::host_os_name(Void::Build::Platform::host_os())});
|
||||
const auto *host_supported = field(*info, "host_supported");
|
||||
Void::Testing::require(host_supported != nullptr);
|
||||
Void::Testing::expect(std::holds_alternative<bool>(host_supported->value));
|
||||
Void::Testing::expect(bool_field(*info, "host_supported") ==
|
||||
Void::Build::Platform::host_supported());
|
||||
const auto *backends_value = field(*info, "backends");
|
||||
Void::Testing::require(backends_value != nullptr);
|
||||
const auto *backends = as_object(*backends_value);
|
||||
Void::Testing::require(backends != nullptr);
|
||||
const auto expect_backend = [&](std::string_view name) {
|
||||
const auto *backend = field(*backends, name);
|
||||
Void::Testing::require(backend != nullptr);
|
||||
Void::Testing::expect(std::holds_alternative<bool>(backend->value));
|
||||
Void::Testing::expect(bool_field(*backends, name) ==
|
||||
Void::Build::Platform::host_supported());
|
||||
};
|
||||
expect_backend("file_ops");
|
||||
expect_backend("process_supervisor");
|
||||
expect_backend("directory_watcher");
|
||||
const auto *sqlite_backend = field(*backends, "sqlite");
|
||||
Void::Testing::require(sqlite_backend != nullptr);
|
||||
Void::Testing::expect(std::holds_alternative<bool>(sqlite_backend->value));
|
||||
const auto *net_backend = field(*backends, "net");
|
||||
Void::Testing::require(net_backend != nullptr);
|
||||
Void::Testing::expect(std::holds_alternative<bool>(net_backend->value));
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, clean_removes_profile_outputs_and_preserves_cache) {
|
||||
|
||||
Reference in new issue
Block a user