diff --git a/docs/agent-workflow/STATE.md b/docs/agent-workflow/STATE.md index 9f67134..7e148f9 100644 --- a/docs/agent-workflow/STATE.md +++ b/docs/agent-workflow/STATE.md @@ -237,6 +237,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B - **Wave 72 (Daemon Target Flags & Registry Search Test Depth)**: added the `target_flags` daemon request (`vbs daemon target flags --name [--file] [--profile] [--member]`) returning each compilation unit's bounded arguments, defines, and compile options (unknown targets rejected, file-suffix filter). A swarm worker extended `RegistryTests` with search `q` filtering (name and description), offset pagination envelope assertions, far-offset empty pages, and invalid offset/limit rejection (4/4 substantive tasks; its final build task was stopped and re-run by the orchestrator). +- **Wave 73 (Actions Kind Filter & `vbs releases show`)**: the daemon `actions` request gained a `kind` filter (`--kind`), asserted in `Daemon.actions_lists_lowered_actions`. A swarm worker (7/7 tasks) added `Package::fetch_release_detail` (`ReleaseInfo`) and `vbs releases show --registry --name --version`, covered by CLI contracts and the live registry E2E. + ## 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. diff --git a/docs/agent-workflow/TASKS.md b/docs/agent-workflow/TASKS.md index 3ce3f68..779fe2e 100644 --- a/docs/agent-workflow/TASKS.md +++ b/docs/agent-workflow/TASKS.md @@ -76,4 +76,5 @@ Base HEAD: `fe0d1a6` | 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 | | Wave 71 (Member-filtered describe + test path cleanup) | `describe` `member` filter in the daemon; swarm replaced `/proc/self/exe` in three test files | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon suite and full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/{DaemonTests,RegistryTests,FullV1Tests,SelfHostTests}.cpp`, docs | | Wave 72 (Daemon target flags + registry search tests) | `target_flags` daemon request + `vbs daemon target flags`; swarm deepened RegistryTests search/pagination coverage | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon and Registry suites pass, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/{DaemonTests,RegistryTests}.cpp`, `tests/CliContracts.cmake`, docs | +| Wave 73 (Actions kind filter + releases show) | daemon `actions --kind` filter; swarm added `fetch_release_detail` and `vbs releases show` with tests | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon and Registry suites pass, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `tests/{DaemonTests,RegistryTests}.cpp`, `tests/CliContracts.cmake`, 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) | diff --git a/docs/agent-workflow/VERIFICATION.md b/docs/agent-workflow/VERIFICATION.md index df3f512..95ece37 100644 --- a/docs/agent-workflow/VERIFICATION.md +++ b/docs/agent-workflow/VERIFICATION.md @@ -1151,6 +1151,16 @@ dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color - `registry_rbac_immutability_csrf_xss_web_and_backup_restore` passes (975 ms) with the extended assertions; full CTest: **8 / 8 passed** in 243.47 s. +## Actions Kind Filter & `vbs releases show` (GCC 16.2, pin `0002e74`) + +- `Daemon.actions_lists_lowered_actions` passes (2.49 s): `kind:"link"` returns only link actions, + `kind:"nope"` returns `total=0`, and a non-string `kind` is rejected. +- Swarm `swarm_mx8beiy5_3ws7` (one worker) completed 7/7 tasks: `Package::fetch_release_detail` + (`ReleaseInfo`) plus `vbs releases show --registry --name --version`, with CLI contracts and a + live E2E assertion. +- `cli_publish_deps_resolve_and_locked_build_against_live_registry` passes (3.66 s); full CTest: + **8 / 8 passed** in 244.47 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). diff --git a/docs/roadmap/21-expansion-roadmap.md b/docs/roadmap/21-expansion-roadmap.md index 101d5a2..5414cf8 100644 --- a/docs/roadmap/21-expansion-roadmap.md +++ b/docs/roadmap/21-expansion-roadmap.md @@ -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` and the daemon `info` request report the detected host and enabled backends, `Platform::current_executable_path()` isolates the executable-path lookup across sources and tests, the daemon `describe` request can be scoped to one workspace member, and `vbs daemon target flags` serves per-unit compile arguments). | 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, `Platform::current_executable_path()` isolates the executable-path lookup across sources and tests, the daemon `describe` request can be scoped to one workspace member, `vbs daemon target flags` serves per-unit compile arguments, and `vbs releases show` prints one release's detail). | 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. | diff --git a/include/Void/Build/Package/RegistryClient.hpp b/include/Void/Build/Package/RegistryClient.hpp index 988b3b3..b43fb40 100644 --- a/include/Void/Build/Package/RegistryClient.hpp +++ b/include/Void/Build/Package/RegistryClient.hpp @@ -4,6 +4,8 @@ #include #include +#include +#include #include #include #include @@ -78,6 +80,24 @@ fetch_binary_variants(std::string_view registry_url, std::string_view package_na std::string_view version, const RegistryAuth &auth = {}, bool include_yanked = false); +struct ReleaseInfo { + std::string name; + std::string version; + std::string sha256; + std::uint64_t size_bytes{0}; + bool yanked{false}; + std::optional signature; + std::optional public_key; + std::size_t binary_count{0}; +}; + +// Queries GET /api/v1/packages// on a VBS registry and returns the release +// metadata (digest, size, yank state, signature presence, binary variant count). A missing +// package or release is not_found; private packages without credentials are permission_denied. +[[nodiscard]] Void::Result::Result +fetch_release_detail(std::string_view registry_url, std::string_view package_name, + std::string_view version, const RegistryAuth &auth = {}); + // Lists package owners from GET /api/v1/packages//owners. Requires read permission on // the package (or ownership): a missing package is not_found, missing credentials are // permission_denied. diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 60648d3..843e929 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -1341,8 +1341,8 @@ std::string target_info_project(const DaemonOptions &options, std::string_view p // Lists the lowered graph's actions (bounded) for editor extensions and diagnostics. std::string actions_project(const DaemonOptions &options, std::string_view profile_name, std::optional compiler_override, - std::string_view target_filter, std::size_t limit, - std::string_view member) { + std::string_view target_filter, std::string_view kind_filter, + std::size_t limit, std::string_view member) { auto effective_result = resolve_member_options(options, member); if (!effective_result) { return error_response(std::format("actions: {}", effective_result.error())); @@ -1363,6 +1363,9 @@ std::string actions_project(const DaemonOptions &options, std::string_view profi if (!target_filter.empty() && action.target_name != target_filter) { continue; } + if (!kind_filter.empty() && action_kind_label(action.kind) != kind_filter) { + continue; + } ++total; if (actions.size() >= limit) { continue; @@ -2372,6 +2375,14 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view } target_filter = *value; } + std::string kind_filter; + if (const auto entry = object->find("kind"); entry != object->end()) { + const auto *value = std::get_if(&entry->second.value); + if (value == nullptr || value->size() > 64) { + return {error_response("\"kind\" must be a bounded string"), false}; + } + kind_filter = *value; + } std::size_t limit = 100; if (const auto entry = object->find("limit"); entry != object->end()) { const auto *value = std::get_if(&entry->second.value); @@ -2383,8 +2394,8 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view } limit = static_cast(*value); } - return {actions_project(options, profile_name, compiler_override, target_filter, limit, - member), + return {actions_project(options, profile_name, compiler_override, target_filter, + kind_filter, limit, member), false}; } if (*name == "target_info" || *name == "target_flags") { diff --git a/src/Main.cpp b/src/Main.cpp index 615aae0..20a78f4 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1157,6 +1157,7 @@ int execute_publish_binary_command(const PublishBinaryCmdOptions &opts) { struct ReleasesCmdOptions { std::optional registry_arg; std::optional name_arg; + std::optional version_arg; std::string token_env{"VBS_REGISTRY_TOKEN"}; }; @@ -1182,6 +1183,29 @@ int execute_releases_list_command(const ReleasesCmdOptions &opts) { return 0; } +int execute_releases_show_command(const ReleasesCmdOptions &opts) { + const std::string registry_url = opts.registry_arg + ? *opts.registry_arg + : Void::Configuration::get_env_or("VBS_REGISTRY_URL", ""); + if (registry_url.empty() || !opts.name_arg || !opts.version_arg) { + std::cerr << "vbs releases show: --registry, --name, and --version are required\n"; + return 2; + } + Package::RegistryAuth auth{Void::Configuration::get_env_or(opts.token_env, "")}; + auto release = + Package::fetch_release_detail(registry_url, *opts.name_arg, *opts.version_arg, auth); + if (!release) { + std::cerr << "vbs releases show: " << release.error().message() << '\n'; + return 1; + } + std::cout << "name=" << release->name << " version=" << release->version + << " sha256=" << release->sha256 << " size=" << release->size_bytes + << " yanked=" << (release->yanked ? "true" : "false") + << " binaries=" << release->binary_count + << " signed=" << (release->signature && release->public_key ? "yes" : "no") << '\n'; + return 0; +} + struct BinariesCmdOptions { std::optional registry_arg; std::optional name_arg; @@ -1534,6 +1558,7 @@ struct DaemonCmdOptions { std::optional member_arg; std::string graph_format_arg{"dot"}; std::optional target_arg; + std::optional action_kind_arg; std::optional pack_output_arg; std::optional prefix_arg; std::optional input_arg; @@ -1634,19 +1659,23 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) { Util::json_quote(opts.profile_arg), Util::json_quote(opts.graph_format_arg)); } else if (sub == "actions") { - request_json = std::format(R"({{"op":"actions","profile":{},"limit":{}}})", - Util::json_quote(opts.profile_arg), opts.limit_arg); + request_json = std::format( + R"({{"op":"actions","profile":{},"limit":{}{}}})", Util::json_quote(opts.profile_arg), + opts.limit_arg, + opts.action_kind_arg + ? std::format(",\"kind\":{}", Util::json_quote(*opts.action_kind_arg)) + : std::string{}); } else if (sub == "target_flags") { if (!opts.target_arg || opts.target_arg->empty()) { std::cerr << "vbs daemon target flags: --name must not be empty\n"; return 2; } - request_json = std::format( - R"({{"op":"target_flags","profile":{},"target":{}{}}})", - Util::json_quote(opts.profile_arg), Util::json_quote(*opts.target_arg), - opts.file_filter_arg - ? std::format(",\"file\":{}", Util::json_quote(*opts.file_filter_arg)) - : std::string{}); + request_json = + std::format(R"({{"op":"target_flags","profile":{},"target":{}{}}})", + Util::json_quote(opts.profile_arg), Util::json_quote(*opts.target_arg), + opts.file_filter_arg + ? std::format(",\"file\":{}", Util::json_quote(*opts.file_filter_arg)) + : std::string{}); } else if (sub == "target_info") { if (!opts.target_arg || opts.target_arg->empty()) { std::cerr << "vbs daemon target: --name must not be empty\n"; @@ -2527,6 +2556,16 @@ int main(int argc, char **argv) { releases_opts.token_env, "VBS_REGISTRY_TOKEN"); add_log_flags(releases_list_cmd); + auto &releases_show_cmd = releases_cmd.subcommand("show", "Show one release's details"); + releases_show_cmd + .option("--registry", "-r", "Registry base URL (or VBS_REGISTRY_URL)", + releases_opts.registry_arg) + .option("--name", "-n", "Package name", releases_opts.name_arg) + .option("--version", "-v", "Release version", releases_opts.version_arg) + .option_default("--token-env", "", "Environment variable holding bearer token", + releases_opts.token_env, "VBS_REGISTRY_TOKEN"); + add_log_flags(releases_show_cmd, false); // `-v` is `--version` on releases show. + auto &binaries_cmd = root.subcommand("binaries", "Inspect prebuilt binary variants in a package registry"); auto configure_binaries = [&](Void::Argparse::Parser &p) { @@ -2672,9 +2711,9 @@ int main(int argc, char **argv) { daemon_cmd.subcommand("describe", "Describe a project's build graph via the daemon"); configure_daemon_common(daemon_describe_cmd); daemon_describe_cmd - .option_default("--profile", "-p", "Profile to evaluate", daemon_opts.profile_arg, - "debug") - .option("--member", "", "Workspace member to describe (default: all)", daemon_opts.member_arg); + .option_default("--profile", "-p", "Profile to evaluate", daemon_opts.profile_arg, "debug") + .option("--member", "", "Workspace member to describe (default: all)", + daemon_opts.member_arg); auto &daemon_build_cmd = daemon_cmd.subcommand("build", "Build a project graph via the daemon"); configure_daemon_common(daemon_build_cmd); daemon_build_cmd @@ -2779,8 +2818,7 @@ int main(int argc, char **argv) { "flags", "Report one target's bounded compile arguments per unit"); configure_daemon_common(daemon_target_flags_cmd); daemon_target_flags_cmd - .option_default("--profile", "-p", "Profile to evaluate", daemon_opts.profile_arg, - "debug") + .option_default("--profile", "-p", "Profile to evaluate", daemon_opts.profile_arg, "debug") .option("--name", "-n", "Target name", daemon_opts.target_arg) .option("--file", "", "Only units whose source path ends with this value", daemon_opts.file_filter_arg); @@ -2793,7 +2831,9 @@ int main(int argc, char **argv) { daemon_cmd.subcommand("actions", "List lowered build actions via the daemon"); configure_daemon_common(daemon_actions_cmd); daemon_actions_cmd - .option_default("--profile", "-p", "Profile to evaluate", daemon_opts.profile_arg, "debug") + .option_default("--profile", "-p", "Profile to evaluate", daemon_opts.profile_arg, + "debug") + .option("--kind", "", "Only actions of this kind (compile|link|archive|...)", daemon_opts.action_kind_arg) .option_default("--limit", "", "Maximum actions returned (0-1000)", daemon_opts.limit_arg, "100"); auto &daemon_graph_cmd = @@ -2912,6 +2952,9 @@ int main(int argc, char **argv) { return execute_binaries_command(parsed.matched_command_path.at(1), binaries_opts); } if (cmd == "releases") { + if (parsed.matched_command_path.at(1) == "show") { + return execute_releases_show_command(releases_opts); + } return execute_releases_list_command(releases_opts); } if (cmd == "bridge") { diff --git a/src/Package/RegistryClient.cpp b/src/Package/RegistryClient.cpp index c976bee..0ce3d72 100644 --- a/src/Package/RegistryClient.cpp +++ b/src/Package/RegistryClient.cpp @@ -558,6 +558,66 @@ fetch_binary_variants(std::string_view registry_url, std::string_view package_na return variants; } +Void::Result::Result +fetch_release_detail(std::string_view registry_url, std::string_view package_name, + std::string_view version, const RegistryAuth &auth) { + auto parsed_url = parse_registry_url(registry_url); + if (!parsed_url) { + return std::unexpected{parsed_url.error()}; + } + std::map> headers; + if (!auth.bearer_token.empty()) { + headers["Authorization"] = "Bearer " + auth.bearer_token; + } + const std::string path = "/api/v1/packages/" + Void::Encoding::Url::encode(package_name) + "/" + + Void::Encoding::Url::encode(version); + auto reply = send_http_request(*parsed_url, "GET", path, headers, {}); + if (!reply) { + return std::unexpected{reply.error()}; + } + if (reply->status != 200) { + auto code = Void::System::SystemErrorCode::io_error; + if (reply->status == 404) { + code = Void::System::SystemErrorCode::not_found; + } else if (reply->status == 401 || reply->status == 403) { + code = Void::System::SystemErrorCode::permission_denied; + } + return std::unexpected{ + make_error(code, std::format("registry GET {} failed with HTTP {}: {}", path, + reply->status, reply->body))}; + } + auto json = Void::Json::Strict::parse(reply->body); + if (!json) { + return std::unexpected{make_error(Void::System::SystemErrorCode::io_error, + "invalid JSON returned by registry release endpoint")}; + } + const auto *root = std::get_if(&json->value); + if (!root) { + return std::unexpected{make_error(Void::System::SystemErrorCode::io_error, + "registry response root must be a JSON object")}; + } + + ReleaseInfo info; + info.name = get_str(*root, "name"); + info.version = get_str(*root, "version"); + info.sha256 = get_str(*root, "sha256"); + info.size_bytes = static_cast(get_i64(*root, "size_bytes", 0)); + info.yanked = get_bool(*root, "yanked", false); + if (const auto sig = get_str(*root, "signature"); !sig.empty()) { + info.signature = sig; + } + if (const auto key = get_str(*root, "public_key"); !key.empty()) { + info.public_key = key; + } + const auto bit = root->find("binaries"); + if (bit != root->end()) { + if (const auto *binaries = std::get_if(&bit->second.value)) { + info.binary_count = binaries->size(); + } + } + return info; +} + Void::Result::Result, Void::Result::Error> fetch_package_owners(std::string_view registry_url, std::string_view package_name, const RegistryAuth &auth) { diff --git a/tests/CliContracts.cmake b/tests/CliContracts.cmake index 12b19e9..2e95188 100644 --- a/tests/CliContracts.cmake +++ b/tests/CliContracts.cmake @@ -51,6 +51,8 @@ check_process(0 "Usage: vbs binaries .*Commands:.*list.*fetch" "" binar check_process(0 "Usage: vbs binaries list " "" binaries list --help) check_process(0 "Usage: vbs releases list " "" releases list --help) check_process(2 "" "--registry and --name are required" releases list) +check_process(0 "Usage: vbs releases show " "" releases show --help) +check_process(2 "" "--registry, --name, and --version are required" releases show) check_process(0 "Usage: vbs binaries fetch " "" binaries fetch --help) check_process(2 "" "--registry, --name, and --version are required" binaries list) check_process(2 "" "--variant and --output are required" binaries fetch --registry http://127.0.0.1:1 --name p --version 1.0.0) diff --git a/tests/DaemonTests.cpp b/tests/DaemonTests.cpp index 86ba345..0226b5f 100644 --- a/tests/DaemonTests.cpp +++ b/tests/DaemonTests.cpp @@ -1460,8 +1460,13 @@ void build(Void::Build::Project &project) { auto listed = request_object(socket, R"({"op":"actions","limit":5})", std::chrono::seconds{120}); - auto filtered = - request_object(socket, R"({"op":"actions","target":"nope"})", std::chrono::seconds{120}); + auto filtered = request_object(socket, R"({"op":"actions","target":"nope"})", + std::chrono::seconds{120}); + auto by_kind = request_object(socket, R"({"op":"actions","kind":"link"})", + std::chrono::seconds{120}); + auto unknown_kind = request_object(socket, R"({"op":"actions","kind":"nope"})", + std::chrono::seconds{120}); + auto invalid_kind = request_object(socket, R"({"op":"actions","kind":5})"); auto invalid = request_object(socket, R"({"op":"actions","limit":1001})"); auto shutdown = Void::Build::Daemon::request(socket, R"({"op":"shutdown"})"); Void::Testing::expect(shutdown.has_value()); @@ -1485,6 +1490,24 @@ void build(Void::Build::Project &project) { Void::Testing::require(filtered.has_value()); Void::Testing::expect(bool_field(*filtered, "ok")); Void::Testing::expect_eq(int_field(*filtered, "total"), std::int64_t{0}); + + Void::Testing::require(by_kind.has_value()); + Void::Testing::expect(bool_field(*by_kind, "ok")); + Void::Testing::expect(int_field(*by_kind, "total") >= 1); + const auto *kind_actions = field(*by_kind, "actions"); + Void::Testing::require(kind_actions != nullptr); + const auto *kind_array = std::get_if(&kind_actions->value); + Void::Testing::require(kind_array != nullptr); + for (const auto &item : *kind_array) { + const auto *entry = std::get_if(&item.value); + Void::Testing::require(entry != nullptr); + Void::Testing::expect_eq(str_field(*entry, "kind"), std::string{"link"}); + } + Void::Testing::require(unknown_kind.has_value()); + Void::Testing::expect_eq(int_field(*unknown_kind, "total"), std::int64_t{0}); + Void::Testing::require(invalid_kind.has_value()); + Void::Testing::expect(!bool_field(*invalid_kind, "ok", true)); + Void::Testing::require(invalid.has_value()); Void::Testing::expect(!bool_field(*invalid, "ok", true)); } diff --git a/tests/RegistryTests.cpp b/tests/RegistryTests.cpp index baef954..62b0a10 100644 --- a/tests/RegistryTests.cpp +++ b/tests/RegistryTests.cpp @@ -1176,6 +1176,41 @@ target_include_directories(hello_pkg PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include Void::Testing::expect(releases_res->stdout_data.find("active") != std::string::npos); } + // `vbs releases show` prints the release detail fetched from the live registry. + std::string release_sha; + if (r2) { + const auto sha_pos = r2->stdout_data.find("sha256="); + if (sha_pos != std::string::npos) { + release_sha = r2->stdout_data.substr(sha_pos + 7, 64); + } + } + Void::Testing::expect(!release_sha.empty()); + + Platform::ProcessRequest releases_show; + releases_show.executable = vbs_bin; + releases_show.arguments = {"releases", "show", "--registry", reg_url, + "--name", "hello-pkg", "--version", "1.1.0"}; + releases_show.environment.set_vars["VBS_REGISTRY_TOKEN"] = *tok; + auto releases_show_res = Platform::run_supervised(releases_show); + Void::Testing::expect(releases_show_res.has_value() && releases_show_res->succeeded()); + if (releases_show_res) { + Void::Testing::expect(releases_show_res->stdout_data.find("version=1.1.0") != + std::string::npos); + if (!release_sha.empty()) { + Void::Testing::expect(releases_show_res->stdout_data.find("sha256=" + release_sha) != + std::string::npos); + } + Void::Testing::expect(releases_show_res->stdout_data.find("binaries=") != + std::string::npos); + } + + // An unknown release version fails instead of printing a bogus detail line. + Platform::ProcessRequest releases_show_missing = releases_show; + releases_show_missing.arguments.back() = "9.9.9"; + auto releases_show_missing_res = Platform::run_supervised(releases_show_missing); + Void::Testing::expect(releases_show_missing_res.has_value() && + !releases_show_missing_res->succeeded()); + // 2. Create a consumer project declaring `.package("hello-pkg", "^1.0").registry(reg_url)`. const auto cons_dir = tmp / "consumer"; const auto cons_build = tmp / "consumer_build";