feat(registry): add a binary-variant listing endpoint
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 4s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 24s

This commit is contained in:
faumaray committed 2026-12-03 23:18:41 +03:00
1 parent 349ec257f5
commit 8f68ec56e9
7 files changed
+77 -38

No files matched your search

+1 -1
View File
@@ -173,7 +173,7 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
- Added the `compdb_entries` daemon request (`vbs daemon compdb entries [--file SUFFIX] [--limit N]`): reads the active published compilation database (selection state or root alias), returns bounded projected entries (`file`, `directory`, `output`, `command`, bounded `arguments`), reports `total`/`returned`, and errors explicitly when nothing is published.
- Added `Daemon.compdb_entries_queries_published_database` (unpublished → error, then all entries, a `main.cpp` filter with `limit:1`, and an invalid limit) and a CLI help contract; Daemon suite is now 18 cases.
- **Wave 40 (Authenticated Binary-Variant Downloads)**:\n - `download_binary_artifact` now accepts `RegistryAuth` and sends the bearer token, so private registry binary artifacts can be fetched; `BinaryFetchOptions` gained `bearer_token` and `materialize_binary_variant` forwards it; `vbs binaries fetch` passes the configured token.\n - Added `RegistryTests.private_binary_variant_download_requires_auth`: anonymous download of a private binary → 401, authenticated client download and signed materialization succeed.\n\n- **Wave 41 (Yanked Binary Variants in Listing)**:\n - `fetch_binary_variants` gained `include_yanked` (default false, so selection/materialization still never sees yanked variants); `vbs binaries list` opts in and marks yanked entries while `binaries fetch` keeps the filtered view.\n - Extended the registry binary-variant test to assert the yanked variant is returned with `yanked=true` only when requested.\n\n## Remaining future scope
- **Wave 40 (Authenticated Binary-Variant Downloads)**:\n - `download_binary_artifact` now accepts `RegistryAuth` and sends the bearer token, so private registry binary artifacts can be fetched; `BinaryFetchOptions` gained `bearer_token` and `materialize_binary_variant` forwards it; `vbs binaries fetch` passes the configured token.\n - Added `RegistryTests.private_binary_variant_download_requires_auth`: anonymous download of a private binary → 401, authenticated client download and signed materialization succeed.\n\n- **Wave 41 (Yanked Binary Variants in Listing)**:\n - `fetch_binary_variants` gained `include_yanked` (default false, so selection/materialization still never sees yanked variants); `vbs binaries list` opts in and marks yanked entries while `binaries fetch` keeps the filtered view.\n - Extended the registry binary-variant test to assert the yanked variant is returned with `yanked=true` only when requested.\n\n- **Wave 42 (Registry Binary-Variant Listing Endpoint)**:\n - Added `GET /api/v1/packages/<name>/<version>/binaries` returning the release's binary variants (`variant_id`, `sha256`, `size_bytes`, `yanked`, optional signature/public key) under normal read permissions; `RegistryClient::fetch_binary_variants` now queries this endpoint directly instead of parsing package detail JSON.\n - The registry binary-variant test asserts the listing endpoint returns the published variant with `yanked:false`.\n\n## 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.
+1
View File
@@ -48,4 +48,5 @@ Base HEAD: `fe0d1a6`
| Wave 39 (Compdb entries query) | `compdb_entries` daemon request + `vbs daemon compdb entries --file --limit`: bounded projected entries from the active compdb | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 18/18, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs |
| Wave 40 (Authenticated binary downloads) | `download_binary_artifact` bearer auth, `BinaryFetchOptions::bearer_token`, `vbs binaries fetch` token | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 7/7, full CTest 8/8) | `include/Void/Build/Package/{RegistryClient,Fetch}.hpp`, `src/Package/{RegistryClient,Fetch}.cpp`, `src/Main.cpp`, `tests/RegistryTests.cpp`, docs |
| Wave 41 (Yanked binary listing) | `fetch_binary_variants(include_yanked)`, `vbs binaries list` marks yanked entries, fetch stays filtered | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 7/7, full CTest 8/8) | `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `src/Main.cpp`, `tests/RegistryTests.cpp`, docs |
| Wave 42 (Registry binary listing endpoint) | `GET .../binaries` listing endpoint; client queries it directly | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 7/7, full CTest 8/8) | `registry/service/RegistryService.cpp`, `src/Package/RegistryClient.cpp`, `tests/RegistryTests.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) |
+14
View File
@@ -716,6 +716,20 @@ dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure
- Full CTest: **8 / 8 passed** in 239.95 s.
- `clang-format --dry-run --Werror` passes on the changed C++ files.
## Registry Binary-Variant Listing Endpoint (GCC 16.2, pin `0002e74`)
```sh
dev cpp-gcc -c cmake --build build/pinned --parallel 8
dev cpp-gcc -c build/pinned/bin/vbs_registry_tests --no-color
dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure
```
- Build: exit 0. Registry suite: **7 / 7 passed** in 12.63 s; the binary-variant test asserts
`GET /api/v1/packages/demo-bin/1.0.0/binaries` returns the published variant with
`"yanked":false`, and the client listing/download tests still pass against the new endpoint.
- Full CTest: **8 / 8 passed** in 221.10 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).
+1 -1
View File
@@ -61,7 +61,7 @@ flowchart LR
| --- | --- | --- |
| **D1 — Shared HTTP Content-Addressed Action Cache (CAS)** *(verified: cross-build-directory 100% cache hit)* | Push/pull action records and output blobs (`PUT/GET /api/v1/cas/blobs/{sha256}`, `/api/v1/cas/actions/{action_key}`) against `vbs-registry` or any compatible HTTP CAS server with bearer auth and digest verification on every read. Action keys are normalized to be build-directory independent; `vbs build/test --remote-cache URL [--remote-cache-token-env VAR]` (or `VBS_REMOTE_CACHE` / `VBS_REMOTE_CACHE_TOKEN`). | Cold CI build populates remote CAS; second clean machine achieves 100% cache hit with verified SHA-256 outputs. |
| **D2 — Fast Hashing & Parallel Snapshot Pipeline** *(verified: 5,001-file warm no-op 374 ms)* | Adopt `Void::Crypto` BLAKE2b / hardware-accelerated SHA-256 (when available) + parallel snapshot hashing across `Void::Concurrency::ThreadPool` + optional `Void::Sqlite` indexed state store for >10k-file monorepos. Snapshot capture revalidation now hashes on a bounded thread pool for trees of 32+ files. | Sub-second warm no-op on 5,000-file synthetic benchmark fixture (`vbs_benchmarks`). |
| **D3 — Supply-Chain Provenance & Signed Packages** *(SBOM, Ed25519 signing primitives, and trusted-key enforcement implemented; OpenSSL or the built-in Ed25519 backend)* | Emit SPDX/CycloneDX SBOM JSON from `vbs.lock` + `BuildGraph` (`vbs build/test --sbom FILE --sbom-format spdx\|cyclonedx`, `src/Provenance/Sbom.cpp`); Ed25519 detached-signature primitives in `Void::Build::Provenance::Signing` (`include/Void/Build/Provenance/Signing.hpp`, `src/Provenance/Signing.cpp`): 0600 seed generation, public-key derivation, canonical `vbs-package-v1` package message, and sign/verify; package signature/public-key metadata persisted in `vbs.lock` and registry releases; `vbs publish --signing-key FILE`; `vbs build\|test --trusted-public-key HEX` enforced before extraction via `Provenance::verify_trusted_package_signature` (`include/Void/Build/Provenance/Verification.hpp`); trusted keys can also come from `--trusted-key-file`, a project `vbs.keys` ring, or `VBS_TRUSTED_PUBLIC_KEYS` (`Provenance::load_trusted_keys`); prebuilt binary variants carry optional signatures verified by `select_compatible_signed_binary` over the canonical `vbs-binary-v1` message, `materialize_binary_variant` downloads digest-verified artifacts with cached-digest revalidation, `vbs-registry` stores/serves per-release binary variants with optional signature metadata and CSRF-protected yank (the client never selects yanked variants), `vbs publish-binary` publishes signed variants through `RegistryClient`, `vbs binaries list|fetch` inspects and downloads them (with bearer auth for private artifacts; yanked variants are marked in listings but never selected). | SBOM is deterministic and valid JSON; signing primitives pass round-trip/tamper/malformed tests (`tests/SigningTests.cpp`); trusted-key policy tests pass with and without OpenSSL (`tests/SignatureEnforcementTests.cpp`); a signed publish -> deps update -> `--locked` trusted build succeeds and an untrusted/unsigned package fails closed before extraction (`RegistryTests.cpp`). |
| **D3 — Supply-Chain Provenance & Signed Packages** *(SBOM, Ed25519 signing primitives, and trusted-key enforcement implemented; OpenSSL or the built-in Ed25519 backend)* | Emit SPDX/CycloneDX SBOM JSON from `vbs.lock` + `BuildGraph` (`vbs build/test --sbom FILE --sbom-format spdx\|cyclonedx`, `src/Provenance/Sbom.cpp`); Ed25519 detached-signature primitives in `Void::Build::Provenance::Signing` (`include/Void/Build/Provenance/Signing.hpp`, `src/Provenance/Signing.cpp`): 0600 seed generation, public-key derivation, canonical `vbs-package-v1` package message, and sign/verify; package signature/public-key metadata persisted in `vbs.lock` and registry releases; `vbs publish --signing-key FILE`; `vbs build\|test --trusted-public-key HEX` enforced before extraction via `Provenance::verify_trusted_package_signature` (`include/Void/Build/Provenance/Verification.hpp`); trusted keys can also come from `--trusted-key-file`, a project `vbs.keys` ring, or `VBS_TRUSTED_PUBLIC_KEYS` (`Provenance::load_trusted_keys`); prebuilt binary variants carry optional signatures verified by `select_compatible_signed_binary` over the canonical `vbs-binary-v1` message, `materialize_binary_variant` downloads digest-verified artifacts with cached-digest revalidation, `vbs-registry` stores/serves per-release binary variants with optional signature metadata and CSRF-protected yank (the client never selects yanked variants), `vbs publish-binary` publishes signed variants through `RegistryClient`, `vbs binaries list|fetch` inspects and downloads them via a dedicated `GET .../binaries` listing endpoint (with bearer auth for private artifacts; yanked variants are marked in listings but never selected). | SBOM is deterministic and valid JSON; signing primitives pass round-trip/tamper/malformed tests (`tests/SigningTests.cpp`); trusted-key policy tests pass with and without OpenSSL (`tests/SignatureEnforcementTests.cpp`); a signed publish -> deps update -> `--locked` trusted build succeeds and an untrusted/unsigned package fails closed before extraction (`RegistryTests.cpp`). |
---
+30
View File
@@ -1187,6 +1187,36 @@ HttpResponse RegistryService::handle_request(const HttpRequest &req) {
return resp;
}
// List binary variants: GET /api/v1/packages/<name>/<version>/binaries
if (segs.size() == 6 && segs[5] == "binaries" && req.method == "GET") {
const auto pit = packages_.find(pkg_name);
if (pit == packages_.end()) {
return HttpResponse::error_json(404, "not_found", "package not found");
}
if (!can_read_pkg(pit->second)) {
return HttpResponse::error_json(principal ? 403 : 401, "forbidden",
"private package requires authorization");
}
const auto rit = pit->second.releases.find(segs[4]);
if (rit == pit->second.releases.end()) {
return HttpResponse::error_json(404, "not_found", "release not found");
}
return HttpResponse::json(
200,
"{\"binaries\":" + json_array(rit->second.binaries, [](const auto &entry) {
const auto &b = entry.second;
return "{\"variant_id\":" + json_quote(b.variant_id) +
",\"sha256\":" + json_quote(b.sha256) +
",\"size_bytes\":" + std::to_string(b.size_bytes) +
",\"yanked\":" + std::string{b.yanked ? "true" : "false"} +
(b.signature.empty() ? std::string{}
: ",\"signature\":" + json_quote(b.signature)) +
(b.public_key.empty() ? std::string{}
: ",\"public_key\":" + json_quote(b.public_key)) +
'}';
}) + "}\n");
}
// Yank/unyank a binary variant:
// POST /api/v1/packages/<name>/<version>/binaries/<variant>/yank
if (segs.size() == 8 && segs[5] == "binaries" && segs[7] == "yank" &&
+23 -36
View File
@@ -459,7 +459,8 @@ fetch_binary_variants(std::string_view registry_url, std::string_view package_na
if (!auth.bearer_token.empty()) {
headers["Authorization"] = "Bearer " + auth.bearer_token;
}
const std::string path = "/api/v1/packages/" + Void::Encoding::Url::encode(package_name);
const std::string path = "/api/v1/packages/" + Void::Encoding::Url::encode(package_name) + "/" +
Void::Encoding::Url::encode(version) + "/binaries";
auto reply = send_http_request(*parsed_url, "GET", path, headers, {});
if (!reply) {
return std::unexpected{reply.error()};
@@ -473,7 +474,7 @@ fetch_binary_variants(std::string_view registry_url, std::string_view package_na
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 package endpoint")};
"invalid JSON returned by registry binaries endpoint")};
}
const auto *root = std::get_if<JsonVal::Object>(&json->value);
if (!root) {
@@ -482,48 +483,34 @@ fetch_binary_variants(std::string_view registry_url, std::string_view package_na
}
std::vector<BinaryReleaseInfo> variants;
const auto rit = root->find("releases");
if (rit == root->end()) {
const auto bit = root->find("binaries");
if (bit == root->end()) {
return variants;
}
const auto *releases = std::get_if<JsonVal::Array>(&rit->second.value);
if (!releases) {
const auto *binaries = std::get_if<JsonVal::Array>(&bit->second.value);
if (!binaries) {
return variants;
}
for (const auto &rv : *releases) {
const auto *ro = std::get_if<JsonVal::Object>(&rv.value);
if (!ro || get_str(*ro, "version") != version) {
for (const auto &bv : *binaries) {
const auto *bo = std::get_if<JsonVal::Object>(&bv.value);
if (!bo) {
continue;
}
const auto bit = ro->find("binaries");
if (bit == ro->end()) {
continue;
BinaryReleaseInfo info;
info.variant_id = get_str(*bo, "variant_id");
info.sha256 = get_str(*bo, "sha256");
info.size_bytes = static_cast<std::uint64_t>(get_i64(*bo, "size_bytes", 0));
info.yanked = get_bool(*bo, "yanked", false);
if (const auto sig = get_str(*bo, "signature"); !sig.empty()) {
info.signature = sig;
}
const auto *binaries = std::get_if<JsonVal::Array>(&bit->second.value);
if (!binaries) {
continue;
if (const auto key = get_str(*bo, "public_key"); !key.empty()) {
info.public_key = key;
}
for (const auto &bv : *binaries) {
const auto *bo = std::get_if<JsonVal::Object>(&bv.value);
if (!bo) {
continue;
}
BinaryReleaseInfo info;
info.variant_id = get_str(*bo, "variant_id");
info.sha256 = get_str(*bo, "sha256");
info.size_bytes = static_cast<std::uint64_t>(get_i64(*bo, "size_bytes", 0));
info.yanked = get_bool(*bo, "yanked", false);
if (const auto sig = get_str(*bo, "signature"); !sig.empty()) {
info.signature = sig;
}
if (const auto key = get_str(*bo, "public_key"); !key.empty()) {
info.public_key = key;
}
// Yanked variants are hidden by default so they are never selected for
// materialization; listing callers can opt in for inspection.
if (!info.variant_id.empty() && (include_yanked || !info.yanked)) {
variants.push_back(std::move(info));
}
// Yanked variants are hidden by default so they are never selected for
// materialization; listing callers can opt in for inspection.
if (!info.variant_id.empty() && (include_yanked || !info.yanked)) {
variants.push_back(std::move(info));
}
}
return variants;
+7
View File
@@ -571,6 +571,13 @@ VOID_TEST(RegistryTests, registry_binary_variant_publish_download_and_materializ
Void::Testing::expect(detail->body.find(artifact_sha) != std::string::npos);
}
auto listed = send_loopback_http(port, "GET", "/api/v1/packages/demo-bin/1.0.0/binaries");
Void::Testing::expect(listed.has_value() && listed->status == 200);
if (listed) {
Void::Testing::expect(listed->body.find(variant_id) != std::string::npos);
Void::Testing::expect(listed->body.find("\"yanked\":false") != std::string::npos);
}
auto downloaded = send_loopback_http(port, "GET", binary_path + "/download");
Void::Testing::expect(downloaded.has_value() && downloaded->status == 200);
if (downloaded) {