From 27d909fdade5e6727471b40f3ba737ba3354bff3 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Fri, 4 Dec 2026 08:54:15 +0300 Subject: [PATCH] feat(package,daemon): show binary variant details; list installed files --- docs/agent-workflow/STATE.md | 2 + docs/agent-workflow/TASKS.md | 1 + docs/agent-workflow/VERIFICATION.md | 11 ++++ include/Void/Build/Package/RegistryClient.hpp | 6 ++ src/Daemon/Daemon.cpp | 29 +++++++++- src/Main.cpp | 22 ++++++++ src/Package/RegistryClient.cpp | 55 +++++++++++++++++++ tests/CliContracts.cmake | 1 + tests/DaemonTests.cpp | 5 ++ tests/RegistryTests.cpp | 14 +++++ 10 files changed, 145 insertions(+), 1 deletion(-) diff --git a/docs/agent-workflow/STATE.md b/docs/agent-workflow/STATE.md index 6970916..bc2351c 100644 --- a/docs/agent-workflow/STATE.md +++ b/docs/agent-workflow/STATE.md @@ -269,6 +269,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B - **Wave 88 (Track C1 Platform Boundaries)**: added explicit compile-time boundaries for the daemon Unix-socket transport (Windows `#error` pointing at Track C3) and the registry POSIX HTTP server/loopback client (swarm worker), and Windows-safe `_putenv_s` branches for the workspace member environment in `Main.cpp`/`Daemon.cpp`. Linux behavior is unchanged (full CTest 8/8). +- **Wave 89 (`vbs binaries show` & Daemon Install File List)**: added `Package::fetch_binary_detail` and `vbs binaries show --variant` (digest, size, yank, signed state), exercised in the CLI E2E. A swarm worker added a bounded, sorted `installed_files` array (with truncation marker) to the daemon `install` response and its test; the worker then stalled on its remaining verification tasks and was stopped after its edits landed. + ## 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 aa8e962..4aa2d21 100644 --- a/docs/agent-workflow/TASKS.md +++ b/docs/agent-workflow/TASKS.md @@ -92,4 +92,5 @@ Base HEAD: `fe0d1a6` | Wave 86 (Shared compdb query + CLI) | `Editor::query_compdb_entries` reused by the daemon and the new `vbs compdb-entries` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon test and CLI contract pass, full CTest 8/8) | `include/Void/Build/Editor/CompDb.hpp`, `src/Editor/CompDb.cpp`, `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/CliContracts.cmake`, docs | | Wave 87 (Releases yank + info workspace) | `set_release_yanked`/`vbs releases yank --unyank`; swarm added daemon `info` workspace/lockfile fields | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 9/9, Daemon suite passes, full CTest 8/8) | `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/{RegistryTests,DaemonTests}.cpp`, `tests/CliContracts.cmake`, docs | | Wave 88 (Track C1 boundaries) | Windows compile-time boundaries for the daemon socket and registry POSIX HTTP; `_putenv_s` branches for workspace env vars | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `registry/service/HttpServer.cpp`, docs | +| Wave 89 (Binaries show + install file list) | `fetch_binary_detail`/`vbs binaries show`; swarm added bounded sorted `installed_files` to daemon install | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry and Daemon tests pass, full CTest 8/8) | `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/{RegistryTests,DaemonTests}.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 0ed9ab7..a4208ed 100644 --- a/docs/agent-workflow/VERIFICATION.md +++ b/docs/agent-workflow/VERIFICATION.md @@ -1297,6 +1297,17 @@ dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color `info_reports_daemon_paths_and_host` passes (17 ms). - Registry suite: **9 / 9 passed** (11.11 s); full CTest: **8 / 8 passed** in 281.17 s. +## `vbs binaries show` & Daemon Install File List (GCC 16.2, pin `0002e74`) + +- `vbs binaries show --variant cli-variant` prints the variant id, digest, size, yank state, and + signed state in the CLI E2E (`cli_publish_deps_resolve_and_locked_build_against_live_registry`, + 3.74 s). +- Swarm `swarm_mx8jylnc_zi6j` (one worker) added a bounded, sorted `installed_files` array (with a + truncation marker) to the daemon `install` response and its assertions; the worker stalled on its + remaining tasks and was stopped after its edits landed. `install_stages_prefix_and_writes_manifest` + passes (2.60 s). +- Full CTest: **8 / 8 passed** in 283.27 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/include/Void/Build/Package/RegistryClient.hpp b/include/Void/Build/Package/RegistryClient.hpp index cf6ab3c..2074a0f 100644 --- a/include/Void/Build/Package/RegistryClient.hpp +++ b/include/Void/Build/Package/RegistryClient.hpp @@ -92,6 +92,12 @@ struct BinaryReleaseInfo { std::optional public_key; }; +// Fetches one binary variant's metadata (GET .../binaries/) including its signed state. +[[nodiscard]] Void::Result::Result +fetch_binary_detail(std::string_view registry_url, std::string_view package_name, + std::string_view version, std::string_view variant_id, + const RegistryAuth &auth = {}); + // Publishes a prebuilt binary variant for an existing release (optionally Ed25519-signed over // the canonical binary message) and returns the artifact SHA-256. [[nodiscard]] Void::Result::Result diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index e5f1094..5afd0be 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -54,7 +54,8 @@ // The daemon control socket is a POSIX Unix-domain socket (Linux/macOS). Windows support is // planned (Track C3) and would need a named-pipe transport instead. #if defined(_WIN32) -#error "The vbs daemon Unix-socket transport requires a POSIX host (Track C3 Windows port is planned)." +#error \ + "The vbs daemon Unix-socket transport requires a POSIX host (Track C3 Windows port is planned)." #endif #include @@ -75,6 +76,8 @@ constexpr std::size_t kMaxDescribeTargetNames = 128U; constexpr std::size_t kMaxDescribeTargetNameBytes = 200U; constexpr std::size_t kMaxDoctorToolPathBytes = 4096U; constexpr std::size_t kMaxBuildTargets = 64U; +constexpr std::size_t kMaxInstallFiles = 128U; +constexpr std::size_t kMaxInstallPathBytes = 512U; constexpr std::size_t kMaxCompdbArguments = 256U; constexpr std::size_t kMaxCompdbArgumentBytes = 1024U; constexpr std::size_t kMaxCompdbEntries = 500U; @@ -982,6 +985,30 @@ std::string install_project_op(const DaemonOptions &options, State::StateStore & object.emplace("manifest", JsonValue{installed->manifest_path.string()}); object.emplace("files", JsonValue{static_cast(installed->installed_files.size())}); + std::vector installed_paths; + installed_paths.reserve(installed->installed_files.size()); + for (const auto &file : installed->installed_files) { + installed_paths.push_back(file.string()); + } + std::ranges::sort(installed_paths); + bool installed_files_truncated = false; + if (installed_paths.size() > kMaxInstallFiles) { + installed_paths.resize(kMaxInstallFiles); + installed_files_truncated = true; + } + JsonValue::Array installed_files; + installed_files.reserve(installed_paths.size()); + for (auto &path : installed_paths) { + if (path.size() > kMaxInstallPathBytes) { + path.resize(kMaxInstallPathBytes); + installed_files_truncated = true; + } + installed_files.emplace_back(std::move(path)); + } + object.emplace("installed_files", JsonValue{std::move(installed_files)}); + if (installed_files_truncated) { + object.emplace("installed_files_truncated", JsonValue{true}); + } return serialize_response(JsonValue{std::move(object)}); } diff --git a/src/Main.cpp b/src/Main.cpp index a7b39fd..5bfd8e3 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1441,6 +1441,25 @@ int execute_binaries_command(std::string_view sub, const BinariesCmdOptions &opt } Package::RegistryAuth auth{Void::Configuration::get_env_or(opts.token_env, "")}; + if (sub == "show") { + if (!opts.variant_arg) { + std::cerr << "vbs binaries show: --variant is required\n"; + return 2; + } + auto detail = Package::fetch_binary_detail(registry_url, *opts.name_arg, *opts.version_arg, + *opts.variant_arg, auth); + if (!detail) { + std::cerr << "vbs binaries show: " << detail.error().message() << '\n'; + return 1; + } + std::cout << "variant=" << detail->variant_id << " sha256=" << detail->sha256 + << " size=" << detail->size_bytes + << " yanked=" << (detail->yanked ? "true" : "false") + << " signed=" << ((detail->signature && detail->public_key) ? "yes" : "no") + << '\n'; + return 0; + } + // Listing shows yanked variants (marked); fetch below only resolves non-yanked ones. auto variants = Package::fetch_binary_variants(registry_url, *opts.name_arg, *opts.version_arg, auth, sub == "list"); @@ -2859,6 +2878,9 @@ int main(int argc, char **argv) { }; configure_binaries(binaries_cmd.subcommand( "list", "List a release's binary variants (id, digest, size, signature state)")); + auto &binaries_show_cmd = binaries_cmd.subcommand("show", "Show one binary variant's metadata"); + configure_binaries(binaries_show_cmd); + binaries_show_cmd.option("--variant", "", "Binary variant id", binaries_opts.variant_arg); auto &binaries_fetch_cmd = binaries_cmd.subcommand("fetch", "Download one binary variant artifact"); configure_binaries(binaries_fetch_cmd); diff --git a/src/Package/RegistryClient.cpp b/src/Package/RegistryClient.cpp index c45dd92..1f07258 100644 --- a/src/Package/RegistryClient.cpp +++ b/src/Package/RegistryClient.cpp @@ -431,6 +431,61 @@ download_release_archive(std::string_view registry_url, std::string_view package return dest_file; } +Void::Result::Result +fetch_binary_detail(std::string_view registry_url, std::string_view package_name, + std::string_view version, std::string_view variant_id, + 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) + "/binaries/" + + Void::Encoding::Url::encode(variant_id); + auto reply = send_http_request(*parsed_url, "GET", path, headers, {}); + if (!reply) { + return std::unexpected{reply.error()}; + } + if (reply->status != 200) { + return std::unexpected{ + make_error(reply->status == 404 ? Void::System::SystemErrorCode::not_found + : reply->status == 401 || reply->status == 403 + ? Void::System::SystemErrorCode::permission_denied + : Void::System::SystemErrorCode::io_error, + std::format("registry GET {} failed with HTTP {}", path, reply->status))}; + } + 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 binary endpoint")}; + } + const auto *object = std::get_if(&json->value); + if (!object) { + return std::unexpected{make_error(Void::System::SystemErrorCode::io_error, + "registry binary response must be a JSON object")}; + } + BinaryReleaseInfo info; + info.variant_id = get_str(*object, "variant_id"); + info.sha256 = get_str(*object, "sha256"); + info.size_bytes = static_cast(get_i64(*object, "size_bytes", 0)); + info.yanked = get_bool(*object, "yanked", false); + if (const auto sig = get_str(*object, "signature"); !sig.empty()) { + info.signature = sig; + } + if (const auto key = get_str(*object, "public_key"); !key.empty()) { + info.public_key = key; + } + if (info.variant_id.empty()) { + return std::unexpected{make_error(Void::System::SystemErrorCode::io_error, + "registry binary response is missing variant_id")}; + } + return info; +} + Void::Result::Result publish_binary_variant(const BinaryPublishOptions &options) { if (!Void::Semver::parse_strict(options.version)) { diff --git a/tests/CliContracts.cmake b/tests/CliContracts.cmake index 07626cd..a44b9fd 100644 --- a/tests/CliContracts.cmake +++ b/tests/CliContracts.cmake @@ -49,6 +49,7 @@ check_process(0 "Usage: vbs publish " "" publish --help) check_process(0 "Usage: vbs publish-binary " "" publish-binary --help) check_process(0 "Usage: vbs binaries .*Commands:.*list.*fetch" "" binaries --help) check_process(0 "Usage: vbs binaries list " "" binaries list --help) +check_process(0 "Usage: vbs binaries show " "" binaries show --help) check_process(0 "Usage: vbs releases list " "" releases list --help) check_process(0 "Usage: vbs releases yank " "" releases yank --help) check_process(2 "" "--registry, --name, and --version are required" releases yank) diff --git a/tests/DaemonTests.cpp b/tests/DaemonTests.cpp index e2a79ed..fa204e8 100644 --- a/tests/DaemonTests.cpp +++ b/tests/DaemonTests.cpp @@ -2235,6 +2235,11 @@ void build(Void::Build::Project &project) { Void::Testing::expect(int_field(*installed, "files") >= 1); Void::Testing::expect(std::filesystem::exists(prefix / "bin" / "app")); Void::Testing::expect(std::filesystem::exists(str_field(*installed, "manifest"))); + const auto installed_files = string_array_field(*installed, "installed_files"); + Void::Testing::require(!installed_files.empty()); + Void::Testing::expect(std::filesystem::exists(installed_files.front())); + Void::Testing::expect(installed_files.size() <= + static_cast(int_field(*installed, "files"))); Void::Testing::require(missing_prefix.has_value()); Void::Testing::expect(!bool_field(*missing_prefix, "ok", true)); diff --git a/tests/RegistryTests.cpp b/tests/RegistryTests.cpp index 5dff57c..6571127 100644 --- a/tests/RegistryTests.cpp +++ b/tests/RegistryTests.cpp @@ -1433,6 +1433,20 @@ target_include_directories(hello_pkg PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include std::string(64, 'a')}; trusted_fetch.environment.set_vars["VBS_REGISTRY_TOKEN"] = *tok; auto trusted_binary_res = Platform::run_supervised(trusted_fetch); + + Platform::ProcessRequest binaries_show; + binaries_show.executable = vbs_bin; + binaries_show.arguments = {"binaries", "show", "--registry", reg_url, "--name", + "hello-pkg", "--version", "1.1.0", "--variant", "cli-variant"}; + binaries_show.environment.set_vars["VBS_REGISTRY_TOKEN"] = *tok; + auto binaries_show_res = Platform::run_supervised(binaries_show); + Void::Testing::expect(binaries_show_res.has_value() && binaries_show_res->succeeded()); + if (binaries_show_res) { + Void::Testing::expect(binaries_show_res->stdout_data.find("variant=cli-variant") != + std::string::npos); + Void::Testing::expect(binaries_show_res->stdout_data.find("signed=") != std::string::npos); + } + Void::Testing::expect(trusted_binary_res.has_value() && !trusted_binary_res->succeeded()); Platform::ProcessRequest tokens_list;