From d6bbd95cedcaaa27f8079f7bc95198a5bcfa6ca4 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Thu, 3 Dec 2026 21:19:15 +0300 Subject: [PATCH] feat(daemon): support workspace member describe and build --- docs/agent-workflow/STATE.md | 5 + docs/agent-workflow/TASKS.md | 1 + docs/agent-workflow/VERIFICATION.md | 16 +++ docs/roadmap/21-expansion-roadmap.md | 2 +- include/Void/Build/Daemon/Daemon.hpp | 1 + src/Daemon/Daemon.cpp | 181 +++++++++++++++++++++++---- tests/DaemonTests.cpp | 68 ++++++++-- 7 files changed, 240 insertions(+), 34 deletions(-) diff --git a/docs/agent-workflow/STATE.md b/docs/agent-workflow/STATE.md index aa5189f..cb641be 100644 --- a/docs/agent-workflow/STATE.md +++ b/docs/agent-workflow/STATE.md @@ -140,6 +140,11 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B - Added `vbs binaries list|fetch` backed by `Package::fetch_binary_variants`: `list` prints one line per variant (`id sha256 size signed|unsigned`), and `fetch` resolves the variant, builds the registry download URL, and downloads the artifact with SHA-256 verification via `download_binary_artifact`. - `vbs_cli_contract` covers the help/error contracts; the live registry CLI E2E now publishes a binary variant with `vbs publish-binary`, lists it, and fetches it byte-for-byte. +- **Wave 31 (Daemon Workspace Support)**: + - Daemon `describe` now evaluates `workspace.cpp` roots: it canonicalizes members, exports `VBS_WORKSPACE_MEMBER_`, and returns a bounded per-member summary (`name`, `path`, `targets`, `actions`, `target_names`). + - Daemon `build` accepts a `member` field for workspace roots (shared root `vbs.lock` via a new `lock_root` option) and builds that member's graph; a workspace build without `member` is rejected explicitly. `DaemonOptions` gained `lock_root` (empty = project root). + - `Daemon.describe_and_build_workspace_members` replaces the old workspace-rejection test. + ## 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))**: Live `conan` CLI verification (Track B3), Track C (macOS/Windows ports + dual-profile cross-compilation), Track D3 signing (SBOM, Ed25519 primitives, trusted-key enforcement and distribution, binary-variant signing and distribution materialization, the #52 built-in-backend capability probe, and the VoidLibrary pin bump to `0002e74` done), Track E3 (daemon core, bounded `describe`, build-serving, dependency materialization, daemon-backed IDE metadata, compdb export, IDE config generation, editor watch poll and bounded long-poll done; dedicated external editor plugins remain), and Track E4 (`Void::Net`/`Void::Sqlite` alignment) remain planned scope. diff --git a/docs/agent-workflow/TASKS.md b/docs/agent-workflow/TASKS.md index 960e868..eb50828 100644 --- a/docs/agent-workflow/TASKS.md +++ b/docs/agent-workflow/TASKS.md @@ -37,4 +37,5 @@ Base HEAD: `fe0d1a6` | Wave 28 (Registry binary-variant endpoints) | `BinaryReleaseMeta` storage, `PUT .../binaries/` + `GET .../binaries//download`, metadata persistence/detail listing, signature header validation, immutable conflicts | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry suite 6/6, full CTest 8/8) | `registry/include/Void/Build/Registry/RegistryService.hpp`, `registry/service/RegistryService.cpp`, `tests/RegistryTests.cpp`, docs | | Wave 29 (RegistryClient binary API + signed CLI) | `publish_binary_variant`/`fetch_binary_variants` in RegistryClient; `vbs publish-binary` CLI with optional signing; registry test extended | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry suite 6/6, full CTest 8/8) | `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `src/Main.cpp`, `tests/RegistryTests.cpp`, `tests/CliContracts.cmake`, docs | | Wave 30 (`vbs binaries list|fetch`) | CLI over `fetch_binary_variants`: list id/digest/size/signature state; fetch resolves the variant and downloads with SHA-256 verification | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry suite 6/6, full CTest 8/8) | `src/Main.cpp`, `tests/RegistryTests.cpp`, `tests/CliContracts.cmake`, docs | +| Wave 31 (Daemon workspace support) | Workspace `describe` member summaries; workspace `build` with `member` + shared root lock (`DaemonOptions::lock_root`) | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 13/13, full CTest 8/8) | `include/Void/Build/Daemon/Daemon.hpp`, `src/Daemon/Daemon.cpp`, `tests/DaemonTests.cpp`, docs | | Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions, E4, live `conan`) | 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) | diff --git a/docs/agent-workflow/VERIFICATION.md b/docs/agent-workflow/VERIFICATION.md index 0cfac40..e2d62e3 100644 --- a/docs/agent-workflow/VERIFICATION.md +++ b/docs/agent-workflow/VERIFICATION.md @@ -554,6 +554,22 @@ dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure - Full CTest: **8 / 8 passed** in 207.71 s. - `clang-format --dry-run --Werror` passes on the changed C++ files. +## Daemon Workspace Support (GCC 16.2, pin `0002e74`) + +```sh +dev cpp-gcc -c cmake --build build/pinned --parallel 8 +dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color +dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure +``` + +- Build: exit 0. Daemon suite: **13 / 13 passed** in 25.35 s, including + `describe_and_build_workspace_members`: a two-member `workspace.cpp` root is described as + `workspace:true` with both member names, a workspace build without `member` is rejected with a + `member` diagnostic, and `{"op":"build","member":"app"}` builds the member executable + (`profiles/debug/out/bin/ws_app`) sharing the workspace root lock. +- Full CTest: **8 / 8 passed** in 208.57 s. +- `clang-format --dry-run --Werror` passes on the changed C++ files. + ## 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). diff --git a/docs/roadmap/21-expansion-roadmap.md b/docs/roadmap/21-expansion-roadmap.md index 7830804..50b4470 100644 --- a/docs/roadmap/21-expansion-roadmap.md +++ b/docs/roadmap/21-expansion-roadmap.md @@ -73,7 +73,7 @@ flowchart LR | --- | --- | --- | | **E1 — Everyday CLI Ergonomics (Implemented in Wave 8)** | `vbs init` project scaffolding, `vbs clean`, `vbs doctor` environment diagnostics, `vbs graph --format dot|json`, and `vbs build --native-foreign`. | End-to-end CLI & integration tests passing in `vbs_cli_contract` and `vbs_v1_tests`. | | **E2 — Multi-Package Workspaces (`workspace.cpp`)** *(verified in Docker GCC 16)* | Shared root `vbs.lock` and `build/.vbs` CAS, `workspace_dependency()` cross-member native linking, and affected-member selection (`vbs build/test --member ` / `--changed-since `). | 3-package workspace fixture (shared library + app + tests) builds/tests with one root lockfile; member selection and `--changed-since` verified in `FullV1Tests.workspace_members_shared_build_and_member_selection`. | -| **E3 — IDE Config/Query & Background Daemon** | `build.cpp`/`build.profiles.cpp`/`build-support/` SDK entries in `compile_commands.json` + `vbs ide generate` (`.clangd`, `.vscode/`, `.zed/`, `.idea/customTargets.xml`) & `vbs ide query` (**Implemented & Verified in Wave 10**); Unix-socket daemon core holding a warm `StateStore` + project `DirectoryWatcher` with `vbs daemon run\|status\|stop\|gc\|recover\|describe` (**Implemented & Verified in Wave 14; bounded `describe` added in the post-v1 daemon follow-up**). `describe` returns a bounded graph summary (`target_names` ≤ 128 entries × 200 bytes, `profile` ≤ 128 bytes, 10 s evaluation timeout); `vbs daemon build` executes the lowered graph in-process against the warm state store with bounded `profile`/`targets`/`jobs`, including daemon-side dependency resolution/materialization and provider import via `Package::resolve_and_materialize_dependencies`; `vbs daemon ide query` publishes/selects the profile compilation database and serves the IDE workspace/target metadata JSON over the socket, `vbs daemon compdb export` returns the published compilation-database path and entry count, `vbs daemon ide generate` writes the editor presets over the socket, `vbs daemon ide poll` exposes a bounded editor-extension watch protocol (changed paths, sequence, overflow state), and `vbs daemon ide wait` adds a bounded long-poll variant. Dedicated editor extensions remain planned. | `vbs ide` & `build.cpp` syntax-check verified in `FullV1Tests.cpp`; daemon lifecycle/status/gc/shutdown/describe verified in `DaemonTests.cpp` (6/6 under `dev cpp-gcc`); the live `vbs daemon describe` CLI round-trip is verified in `vbs_cli_contract`. | +| **E3 — IDE Config/Query & Background Daemon** | `build.cpp`/`build.profiles.cpp`/`build-support/` SDK entries in `compile_commands.json` + `vbs ide generate` (`.clangd`, `.vscode/`, `.zed/`, `.idea/customTargets.xml`) & `vbs ide query` (**Implemented & Verified in Wave 10**); Unix-socket daemon core holding a warm `StateStore` + project `DirectoryWatcher` with `vbs daemon run\|status\|stop\|gc\|recover\|describe` (**Implemented & Verified in Wave 14; bounded `describe` added in the post-v1 daemon follow-up**). `describe` returns a bounded graph summary (`target_names` ≤ 128 entries × 200 bytes, `profile` ≤ 128 bytes, 10 s evaluation timeout); `vbs daemon build` executes the lowered graph in-process against the warm state store with bounded `profile`/`targets`/`jobs`, including daemon-side dependency resolution/materialization and provider import via `Package::resolve_and_materialize_dependencies`; `vbs daemon ide query` publishes/selects the profile compilation database and serves the IDE workspace/target metadata JSON over the socket, `vbs daemon compdb export` returns the published compilation-database path and entry count, `vbs daemon ide generate` writes the editor presets over the socket, `vbs daemon ide poll` exposes a bounded editor-extension watch protocol (changed paths, sequence, overflow state), and `vbs daemon ide wait` adds a bounded long-poll variant. Daemon workspace support now describes members and builds a selected member with the shared root lock. Dedicated editor extensions remain planned. | `vbs ide` & `build.cpp` syntax-check verified in `FullV1Tests.cpp`; daemon lifecycle/status/gc/shutdown/describe verified in `DaemonTests.cpp` (6/6 under `dev cpp-gcc`); the live `vbs daemon describe` CLI round-trip is verified in `vbs_cli_contract`. | | **E4 — Transport & Storage Upstream Alignment** | Adopt `Void::Net` (`VL-004`/`VL-005`) and `Void::Sqlite` (`VL-011b`) when lightweight/bundled builds become available in minimal Nix toolchains, reducing VBS transport code further. | All `vbs_registry_tests` and `vbs_core_tests` pass on both minimal and full toolchains. | --- diff --git a/include/Void/Build/Daemon/Daemon.hpp b/include/Void/Build/Daemon/Daemon.hpp index ca49077..55bad7f 100644 --- a/include/Void/Build/Daemon/Daemon.hpp +++ b/include/Void/Build/Daemon/Daemon.hpp @@ -17,6 +17,7 @@ namespace Void::Build::Daemon { struct DaemonOptions { std::filesystem::path project_root; std::filesystem::path build_root; + std::filesystem::path lock_root; // Empty => project_root (workspace members share a root lock) std::filesystem::path socket_path; // empty => build_root/".vbs/vbs-daemon.sock" std::chrono::milliseconds poll_interval{200}; std::size_t max_requests{0}; // 0 => unlimited diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 27a5f13..b2c9c30 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -389,6 +390,81 @@ evaluate_project_graph(const DaemonOptions &options, std::string_view profile_na return evaluated; } +struct WorkspaceMemberDir { + std::string name; + std::filesystem::path path; +}; + +// Evaluates workspace.cpp, canonicalizes members, and exports VBS_WORKSPACE_MEMBER_ +// so member descriptors resolve cross-member dependencies exactly like the CLI. +Void::Result::Result, std::string> +evaluate_workspace_members(const DaemonOptions &options) { + const auto frontend = make_frontend_options(options); + auto compiled = Config::compile_descriptor(frontend); + if (!compiled) { + return std::unexpected{std::format("workspace: {}", compiled.error().format())}; + } + auto workspace = Config::evaluate_workspace(*compiled, frontend); + if (!workspace) { + return std::unexpected{std::format("workspace: {}", workspace.error().format())}; + } + if (workspace->members.empty()) { + return std::unexpected{std::string{"workspace declares no members"}}; + } + if (workspace->members.size() > 64) { + return std::unexpected{std::string{"workspace declares too many members (max 64)"}}; + } + + std::vector members; + for (const auto &member : workspace->members) { + std::filesystem::path dir = member.path; + if (!dir.is_absolute()) { + dir = options.project_root / dir; + } + std::error_code ec; + const auto canonical = std::filesystem::weakly_canonical(dir, ec); + if (ec || !std::filesystem::is_directory(canonical)) { + return std::unexpected{std::format("workspace member '{}' path '{}' is not a directory", + member.name, dir.string())}; + } + const std::string env_name = "VBS_WORKSPACE_MEMBER_" + member.name; + (void)::setenv(env_name.c_str(), canonical.c_str(), 1); + members.push_back(WorkspaceMemberDir{member.name, canonical}); + } + return members; +} + +DaemonOptions member_options(const DaemonOptions &options, + const std::filesystem::path &member_dir) { + DaemonOptions member = options; + member.project_root = member_dir; + member.lock_root = options.project_root; + return member; +} + +JsonValue::Array bounded_target_names(const Graph::BuildGraph &graph, bool &truncated) { + std::vector target_names; + target_names.reserve(graph.targets.size()); + for (const auto &target : graph.targets) { + target_names.push_back(target.name); + } + std::ranges::sort(target_names); + if (target_names.size() > kMaxDescribeTargetNames) { + target_names.resize(kMaxDescribeTargetNames); + truncated = true; + } + JsonValue::Array names_json; + names_json.reserve(target_names.size()); + for (auto &name : target_names) { + if (name.size() > kMaxDescribeTargetNameBytes) { + name.resize(kMaxDescribeTargetNameBytes); + truncated = true; + } + names_json.emplace_back(std::move(name)); + } + return names_json; +} + Void::Result::Result lower_graph(const DaemonOptions &options, const EvaluatedProject &evaluated, std::map> imported_targets, @@ -435,7 +511,8 @@ Void::Result::Result materialize_project_dependencies( return 0; } - auto pinned_lock = Package::load_pinned_lock(options.project_root / "vbs.lock"); + const auto lock_root = options.lock_root.empty() ? options.project_root : options.lock_root; + auto pinned_lock = Package::load_pinned_lock(lock_root / "vbs.lock"); if (!pinned_lock) { return std::unexpected{std::format("build: {}", pinned_lock.error().format())}; } @@ -511,19 +588,41 @@ Void::Result::Result materialize_project_dependencies( std::string build_project(const DaemonOptions &options, State::StateStore &state, std::string_view profile_name, std::optional compiler_override, - const std::vector &selected_targets, std::size_t jobs) { - auto evaluated = evaluate_project_graph(options, profile_name, compiler_override, "build"); + const std::vector &selected_targets, std::size_t jobs, + std::string_view selected_member) { + DaemonOptions effective = options; + std::string member_name; + if (Config::is_workspace_root(options.project_root)) { + auto members = evaluate_workspace_members(options); + if (!members) { + return error_response(members.error()); + } + if (selected_member.empty()) { + return error_response("build: workspace roots require \"member\""); + } + const auto match = std::ranges::find_if(*members, [&](const WorkspaceMemberDir &member) { + return member.name == selected_member; + }); + if (match == members->end()) { + return error_response( + std::format("build: unknown workspace member '{}'", selected_member)); + } + effective = member_options(options, match->path); + member_name = match->name; + } + + auto evaluated = evaluate_project_graph(effective, profile_name, compiler_override, "build"); if (!evaluated) { return error_response(evaluated.error()); } std::map> imported_targets; auto materialized = - materialize_project_dependencies(options, state, *evaluated, jobs, imported_targets); + materialize_project_dependencies(effective, state, *evaluated, jobs, imported_targets); if (!materialized) { return error_response(materialized.error()); } - auto graph = lower_graph(options, *evaluated, std::move(imported_targets), "build"); + auto graph = lower_graph(effective, *evaluated, std::move(imported_targets), "build"); if (!graph) { return error_response(graph.error()); } @@ -559,6 +658,9 @@ std::string build_project(const DaemonOptions &options, State::StateStore &state object.emplace("failed", JsonValue{static_cast(report->failed_count)}); object.emplace("diagnostic", JsonValue{report->diagnostic}); object.emplace("failed_actions", JsonValue{std::move(failed_actions)}); + if (!member_name.empty()) { + object.emplace("member", JsonValue{member_name}); + } return serialize_response(JsonValue{std::move(object)}); } @@ -704,6 +806,44 @@ std::string ide_query_project(const DaemonOptions &options, std::string_view pro // Lowers the project graph to a bounded summary without executing it. std::string describe_project(const DaemonOptions &options, std::string_view profile_name, std::optional compiler_override) { + if (Config::is_workspace_root(options.project_root)) { + auto members = evaluate_workspace_members(options); + if (!members) { + return error_response(members.error()); + } + JsonValue::Array member_array; + for (const auto &member : *members) { + const auto member_opts = member_options(options, member.path); + auto evaluated = + evaluate_project_graph(member_opts, profile_name, compiler_override, "describe"); + if (!evaluated) { + return error_response(evaluated.error()); + } + auto lowered = lower_graph(member_opts, *evaluated, {}, "describe"); + if (!lowered) { + return error_response(lowered.error()); + } + bool truncated = false; + JsonValue::Array names = bounded_target_names(*lowered, truncated); + JsonValue::Object entry; + entry.emplace("name", JsonValue{member.name}); + entry.emplace("path", JsonValue{member.path.string()}); + entry.emplace("targets", JsonValue{static_cast(lowered->targets.size())}); + entry.emplace("actions", JsonValue{static_cast(lowered->actions.size())}); + entry.emplace("target_names", JsonValue{std::move(names)}); + if (truncated) { + entry.emplace("target_names_truncated", JsonValue{true}); + } + member_array.emplace_back(std::move(entry)); + } + JsonValue::Object object; + object.emplace("ok", JsonValue{true}); + object.emplace("op", JsonValue{std::string{"describe"}}); + object.emplace("workspace", JsonValue{true}); + object.emplace("members", JsonValue{std::move(member_array)}); + return serialize_response(JsonValue{std::move(object)}); + } + auto evaluated = evaluate_project_graph(options, profile_name, compiler_override, "describe"); if (!evaluated) { return error_response(evaluated.error()); @@ -715,27 +855,8 @@ std::string describe_project(const DaemonOptions &options, std::string_view prof const auto &graph = *lowered; const auto &context = evaluated->context; - std::vector target_names; - target_names.reserve(graph.targets.size()); - for (const auto &target : graph.targets) { - target_names.push_back(target.name); - } - std::ranges::sort(target_names); - bool truncated = false; - if (target_names.size() > kMaxDescribeTargetNames) { - target_names.resize(kMaxDescribeTargetNames); - truncated = true; - } - JsonValue::Array names_json; - names_json.reserve(target_names.size()); - for (auto &name : target_names) { - if (name.size() > kMaxDescribeTargetNameBytes) { - name.resize(kMaxDescribeTargetNameBytes); - truncated = true; - } - names_json.emplace_back(std::move(name)); - } + JsonValue::Array names_json = bounded_target_names(graph, truncated); JsonValue::Object object; object.emplace("ok", JsonValue{true}); @@ -1027,8 +1148,16 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view } jobs = static_cast(*value); } + std::string member; + if (const auto entry = object->find("member"); entry != object->end()) { + const auto *value = std::get_if(&entry->second.value); + if (value == nullptr || value->empty() || value->size() > 128) { + return {error_response("\"member\" must be a bounded non-empty string"), false}; + } + member = *value; + } return {build_project(options, state_store, profile_name, compiler_override, - selected_targets, jobs), + selected_targets, jobs, member), false}; } if (*name == "shutdown") { diff --git a/tests/DaemonTests.cpp b/tests/DaemonTests.cpp index f6c567c..4dc174b 100644 --- a/tests/DaemonTests.cpp +++ b/tests/DaemonTests.cpp @@ -775,16 +775,51 @@ void build(Void::Build::Project &project) { Void::Testing::expect(!std::filesystem::exists(socket)); } -VOID_TEST(Daemon, describe_rejects_workspace_root) { +VOID_TEST(Daemon, describe_and_build_workspace_members) { auto temp = Void::FileSystem::TempDir::open("vbs_daemon_"); Void::Testing::require(temp.has_value()); const auto options = make_options(temp->path()); + const auto ws = options.project_root; { - std::ofstream workspace{options.project_root / "workspace.cpp"}; - workspace << "void workspace(Void::Build::Workspace &workspace) {}\n"; + std::ofstream workspace{ws / "workspace.cpp"}; + workspace << "#include \n" + "void workspace(Void::Build::Workspace &workspace) {\n" + " workspace.member(\"lib\", \"packages/lib\");\n" + " workspace.member(\"app\", \"packages/app\");\n" + "}\n"; Void::Testing::require(workspace.good()); } + std::filesystem::create_directories(ws / "packages" / "lib" / "src"); + std::filesystem::create_directories(ws / "packages" / "app" / "src"); + { + std::ofstream descriptor{ws / "packages" / "lib" / "build.cpp"}; + descriptor << R"cpp(#include +void build(Void::Build::Project &project) { + project.static_library("libcore").sources({"src/core.cpp"}); +} +)cpp"; + Void::Testing::require(descriptor.good()); + } + { + std::ofstream source{ws / "packages" / "lib" / "src" / "core.cpp"}; + source << "int ws_core() { return 7; }\n"; + Void::Testing::require(source.good()); + } + { + std::ofstream descriptor{ws / "packages" / "app" / "build.cpp"}; + descriptor << R"cpp(#include +void build(Void::Build::Project &project) { + project.executable("ws_app").sources({"src/main.cpp"}); +} +)cpp"; + Void::Testing::require(descriptor.good()); + } + { + std::ofstream source{ws / "packages" / "app" / "src" / "main.cpp"}; + source << "int main() { return 0; }\n"; + Void::Testing::require(source.good()); + } auto server = Void::Build::Daemon::DaemonServer::create(options); Void::Testing::require(server.has_value()); @@ -794,14 +829,33 @@ VOID_TEST(Daemon, describe_rejects_workspace_root) { std::jthread worker{[&] { run_result = server->run(); }}; Void::Testing::require(wait_for_path(socket, std::chrono::seconds{5})); - auto describe = request_object(socket, R"({"op":"describe"})"); - Void::Testing::require(describe.has_value()); - Void::Testing::expect(!bool_field(*describe, "ok", true)); - Void::Testing::expect(str_field(*describe, "error").find("workspace") != std::string::npos); + auto describe_raw = + Void::Build::Daemon::request(socket, R"({"op":"describe"})", std::chrono::seconds{120}); + Void::Testing::require(describe_raw.has_value()); + Void::Testing::expect(describe_raw->find("\"workspace\":true") != std::string::npos); + Void::Testing::expect(describe_raw->find("\"name\":\"lib\"") != std::string::npos); + Void::Testing::expect(describe_raw->find("\"name\":\"app\"") != std::string::npos); + auto no_member = request_object(socket, R"({"op":"build"})", std::chrono::seconds{120}); + Void::Testing::require(no_member.has_value()); + Void::Testing::expect(!bool_field(*no_member, "ok", true)); + Void::Testing::expect(str_field(*no_member, "error").find("member") != std::string::npos); + + auto build_raw = Void::Build::Daemon::request(socket, R"({"op":"build","member":"app"})", + std::chrono::seconds{120}); auto shutdown = Void::Build::Daemon::request(socket, R"({"op":"shutdown"})"); Void::Testing::expect(shutdown.has_value()); worker.join(); Void::Testing::expect(run_result.has_value()); + + Void::Testing::require(build_raw.has_value()); + const auto parsed = parse_json(*build_raw); + Void::Testing::require(parsed.has_value()); + const auto *object = as_object(*parsed); + Void::Testing::require(object != nullptr); + Void::Testing::expect(bool_field(*object, "ok")); + Void::Testing::expect_eq(str_field(*object, "member"), std::string{"app"}); + Void::Testing::expect(std::filesystem::exists(options.build_root / "profiles" / "debug" / + "out" / "bin" / "ws_app")); Void::Testing::expect(!std::filesystem::exists(socket)); }