feat(registry,daemon): patch package metadata; report workspace info
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 10s

This commit is contained in:
faumaray committed 2026-12-04 06:13:13 +03:00
1 parent 85ff7a8c75
commit e7698a411d
8 files changed
+250 -4

No files matched your search

+2
View File
@@ -249,6 +249,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
- **Wave 78 (Download ETag/304 & Daemon `status` Pending Changes)**: release and binary downloads now carry an `ETag` equal to the artifact digest and answer matching `If-None-Match` requests with a bodyless 304 before reading any bytes. A swarm worker added `pending_changes` to the daemon `status` response and covered it in the watch test (4/4 substantive tasks; build task stopped and re-run).
- **Wave 79 (Registry Metadata PATCH & Daemon `workspace_info`)**: `PATCH /api/v1/packages/<name>` updates mutable `description`/`private` metadata (auth + CSRF, publish authority, validated body, audited `package.update`), covered in the RBAC test with a dedicated private package. A swarm worker added the `workspace_info` daemon request (members plus root lockfile presence/size, `workspace:false` for plain projects) with tests (5/5 substantive tasks; build task stopped and re-run).
## 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.
+1
View File
@@ -82,4 +82,5 @@ Base HEAD: `fe0d1a6`
| Wave 76 (Range downloads + install option tests) | `Range` support on registry downloads (206/416, Accept-Ranges); swarm extended daemon install tests | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 8/8, Daemon suite passes, full CTest 8/8) | `registry/service/RegistryService.cpp`, `tests/{RegistryTests,DaemonTests}.cpp`, docs |
| Wave 77 (ETag/304 + deps offline) | registry read endpoints emit ETag and answer If-None-Match with 304; swarm added daemon `deps` `offline` flag | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 8/8, Daemon suite passes, full CTest 8/8) | `registry/service/RegistryService.cpp`, `src/Daemon/Daemon.cpp`, `tests/{RegistryTests,DaemonTests}.cpp`, docs |
| Wave 78 (Download ETag + status pending changes) | download ETag/If-None-Match 304 before reads; swarm added daemon `status` `pending_changes` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 8/8, Daemon suite passes, full CTest 8/8) | `registry/service/RegistryService.cpp`, `src/Daemon/Daemon.cpp`, `tests/{RegistryTests,DaemonTests}.cpp`, docs |
| Wave 79 (Registry metadata PATCH + workspace_info) | `PATCH /api/v1/packages/<name>` for description/private (audited); swarm added daemon `workspace_info` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 8/8, Daemon suite passes, full CTest 8/8) | `registry/service/RegistryService.cpp`, `src/Daemon/Daemon.cpp`, `tests/{RegistryTests,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) |
+10
View File
@@ -1208,6 +1208,16 @@ dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color
`watch_poll_reports_changed_paths` passes (71 ms).
- Registry suite: **8 / 8 passed** (11.01 s); full CTest: **8 / 8 passed** in 257.22 s.
## Registry Metadata PATCH & Daemon `workspace_info` (GCC 16.2, pin `0002e74`)
- `PATCH /api/v1/packages/meta-pkg` with an owner token updates the description (reflected by the
detail endpoint); anonymous (401), non-owner (403), empty body (400), and invalid `private`
type (400) are rejected (in `registry_rbac_immutability_csrf_xss_web_and_backup_restore`, 1.01 s).
- Swarm `swarm_mx8e977a_v5d6` (one worker) added `workspace_info` (5/5 substantive tasks; build
task stopped and re-run by the orchestrator); `workspace_info_reports_members_and_lockfile`
passes (2.28 s).
- Registry suite: **8 / 8 passed** (11.00 s); full CTest: **8 / 8 passed** in 276.04 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).
+1 -1
View File
@@ -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 <pkg>` / `--changed-since <ref>`). | 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), `vbs daemon ide wait` adds a bounded long-poll variant, `vbs daemon ide status` reports the active editor selection and compdb state, `vbs daemon compdb use` switches the active editor profile under the selection lock, `vbs daemon graph` exports the target dependency graph (DOT/JSON), `vbs daemon test` builds and runs declared test targets, `vbs daemon clean` removes generated outputs while preserving the shared cache, `vbs daemon target info` reports per-target sources/outputs, `vbs daemon actions` lists bounded lowered actions, `vbs daemon pack` creates a confined deterministic source archive, `vbs daemon install` stages an install prefix (and `uninstall` removes only manifest-owned files), `vbs daemon gen-tests` generates the native test registration unit, `vbs daemon init` scaffolds confined projects, `vbs daemon compdb entries` serves bounded per-file compile arguments to editor extensions, `vbs daemon workspace members` lists workspace members cheaply, `vbs daemon ide configs` reports which editor configuration files exist, `vbs daemon compdb generations` lists editor generation history with the active selection, `vbs daemon info` exposes the daemon environment, `vbs daemon deps` resolves/materializes dependencies over the socket, registry package search and audit queries support bounded pagination/filters, releases expose a version-specific detail endpoint, package ownership is managed through an audited owners API, and `RegistryClient::fetch_package_owners` reads it. Daemon workspace support describes members, builds all members in order (or a selected member) with the shared root lock, and serves member-scoped IDE query/generate/compdb requests via `--member`. 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), `vbs daemon ide wait` adds a bounded long-poll variant, `vbs daemon ide status` reports the active editor selection and compdb state, `vbs daemon compdb use` switches the active editor profile under the selection lock, `vbs daemon graph` exports the target dependency graph (DOT/JSON), `vbs daemon test` builds and runs declared test targets, `vbs daemon clean` removes generated outputs while preserving the shared cache, `vbs daemon target info` reports per-target sources/outputs, `vbs daemon actions` lists bounded lowered actions, `vbs daemon pack` creates a confined deterministic source archive, `vbs daemon install` stages an install prefix (and `uninstall` removes only manifest-owned files), `vbs daemon gen-tests` generates the native test registration unit, `vbs daemon init` scaffolds confined projects, `vbs daemon compdb entries` serves bounded per-file compile arguments to editor extensions, `vbs daemon workspace members` lists workspace members cheaply, `vbs daemon ide configs` reports which editor configuration files exist, `vbs daemon compdb generations` lists editor generation history with the active selection, `vbs daemon info` exposes the daemon environment, `vbs daemon deps` resolves/materializes dependencies over the socket, registry package search and audit queries support bounded pagination/filters, releases expose a version-specific detail endpoint, package ownership and mutable metadata are managed through audited APIs, and `RegistryClient::fetch_package_owners` reads owners. Daemon workspace support describes members, builds all members in order (or a selected member) with the shared root lock, and serves member-scoped IDE query/generate/compdb requests via `--member`. 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** *(Sqlite and Net client adopted)* | 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. `Void::Sqlite` backs the `StateStore` when SQLite3 is present, `Void::Net` backs the `RegistryClient`, remote-cache, and registry-server HTTP transports (TLS-verifying `HttpClient`/`HttpServer`) when `Net` is enabled (`-p openssl -p boost`), keeping the pure-POSIX fallbacks. | All `vbs_registry_tests` and `vbs_core_tests` pass on both minimal and full toolchains (verified: registry 7/7 on the Net transport; default and SQLite builds 8/8). |
---
+58
View File
@@ -999,6 +999,64 @@ HttpResponse RegistryService::handle_request(const HttpRequest &req) {
"}\n");
}
// Update mutable package metadata: PATCH /api/v1/packages/<name>
if (segs.size() == 4 && req.method == "PATCH") {
if (!principal) {
return HttpResponse::error_json(401, "unauthorized", "authentication required");
}
if (!check_csrf_locked(req, *principal)) {
return HttpResponse::error_json(403, "csrf_failed",
"missing or invalid CSRF token");
}
const auto pit = packages_.find(pkg_name);
if (pit == packages_.end()) {
return HttpResponse::error_json(404, "not_found", "package not found");
}
if (!can_publish_pkg(&pit->second)) {
return HttpResponse::error_json(403, "forbidden",
"insufficient publish authority or ownership");
}
auto parsed = Void::Json::Strict::parse(req.body);
const auto *obj = parsed ? std::get_if<JsonVal::Object>(&parsed->value) : nullptr;
if (!obj) {
return HttpResponse::error_json(400, "invalid_request",
"PATCH body must be a JSON object");
}
bool changed = false;
if (const auto it = obj->find("description"); it != obj->end()) {
const auto *value = std::get_if<std::string>(&it->second.value);
if (!value || value->size() > 4096) {
return HttpResponse::error_json(
400, "invalid_description",
"description must be a string of at most 4096 bytes");
}
pit->second.description = *value;
changed = true;
}
if (const auto it = obj->find("private"); it != obj->end()) {
const auto *value = std::get_if<bool>(&it->second.value);
if (!value) {
return HttpResponse::error_json(400, "invalid_private",
"private must be a boolean");
}
pit->second.is_private = *value;
changed = true;
}
if (!changed) {
return HttpResponse::error_json(400, "invalid_request",
"no updatable fields (description, private)");
}
append_audit_locked(principal->username, "package.update", pkg_name, "ok", "");
if (auto saved = save_locked(); !saved) {
return HttpResponse::error_json(500, "metadata_commit_failed",
saved.error().message());
}
return HttpResponse::json(
200, "{\"name\":" + json_quote(pkg_name) + ",\"description\":" +
json_quote(pit->second.description) + ",\"is_private\":" +
std::string{pit->second.is_private ? "true" : "false"} + "}\n");
}
// Owners: GET/PUT/DELETE /api/v1/packages/<name>/owners[/<user>]
if ((segs.size() == 5 || segs.size() == 6) && segs[4] == "owners") {
const auto pit = packages_.find(pkg_name);
+49
View File
@@ -1481,6 +1481,52 @@ std::string workspace_members_project(const DaemonOptions &options) {
return serialize_response(JsonValue{std::move(object)});
}
// Reports workspace membership plus the root lockfile state (presence and size). Non-workspace
// roots report no members and a null lockfile; workspace roots stat <lock root>/vbs.lock.
std::string workspace_info_project(const DaemonOptions &options) {
JsonValue::Object object;
object.emplace("ok", JsonValue{true});
object.emplace("op", JsonValue{std::string{"workspace_info"}});
if (!Config::is_workspace_root(options.project_root)) {
object.emplace("workspace", JsonValue{false});
object.emplace("members", JsonValue{JsonValue::Array{}});
object.emplace("lockfile", JsonValue{nullptr});
return serialize_response(JsonValue{std::move(object)});
}
auto members = evaluate_workspace_members(options);
if (!members) {
return error_response(members.error());
}
JsonValue::Array member_array;
for (const auto &member : *members) {
JsonValue::Object entry;
entry.emplace("name", JsonValue{member.name});
entry.emplace("path", JsonValue{member.path.string()});
member_array.emplace_back(std::move(entry));
}
const auto lock_root = options.lock_root.empty() ? options.project_root : options.lock_root;
const auto lockfile_path = lock_root / "vbs.lock";
std::error_code ec;
const bool lockfile_exists = std::filesystem::is_regular_file(lockfile_path, ec);
std::int64_t lockfile_size = 0;
if (lockfile_exists) {
const auto size = std::filesystem::file_size(lockfile_path, ec);
if (!ec) {
lockfile_size = static_cast<std::int64_t>(size);
}
}
JsonValue::Object lockfile;
lockfile.emplace("path", JsonValue{lockfile_path.string()});
lockfile.emplace("exists", JsonValue{lockfile_exists});
lockfile.emplace("size_bytes", JsonValue{lockfile_size});
object.emplace("workspace", JsonValue{true});
object.emplace("members", JsonValue{std::move(member_array)});
object.emplace("lockfile", JsonValue{std::move(lockfile)});
return serialize_response(JsonValue{std::move(object)});
}
// Returns bounded compile_commands entries from the active compilation database, optionally
// filtered by a path suffix. Editor extensions use this instead of parsing the file themselves.
std::string compdb_entries_project(const DaemonOptions &options, std::string_view file_filter,
@@ -2021,6 +2067,9 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
if (*name == "workspace_members") {
return {workspace_members_project(options), false};
}
if (*name == "workspace_info") {
return {workspace_info_project(options), false};
}
if (*name == "ide_configs") {
return {ide_configs_project(options), false};
}
+88
View File
@@ -1113,6 +1113,94 @@ VOID_TEST(Daemon, workspace_members_lists_declared_members) {
Void::Testing::expect(raw->find("packages/lib") != std::string::npos);
}
VOID_TEST(Daemon, workspace_info_reports_members_and_lockfile) {
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{ws / "workspace.cpp"};
workspace << "#include <Void/Build.hpp>\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");
std::filesystem::create_directories(ws / "packages" / "app");
{
std::ofstream lockfile{ws / "vbs.lock"};
lockfile << "{}\n";
Void::Testing::require(lockfile.good());
}
auto server = Void::Build::Daemon::DaemonServer::create(options);
Void::Testing::require(server.has_value());
const auto socket = server->socket_path();
Void::Result::Result<void, Void::Result::Error> run_result;
std::jthread worker{[&] { run_result = server->run(); }};
Void::Testing::require(wait_for_path(socket, std::chrono::seconds{5}));
auto raw = Void::Build::Daemon::request(socket, R"({"op":"workspace_info"})",
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(raw.has_value());
const auto parsed = parse_json(*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, "op"), std::string{"workspace_info"});
Void::Testing::expect(bool_field(*object, "workspace"));
Void::Testing::expect(raw->find("\"name\":\"lib\"") != std::string::npos);
Void::Testing::expect(raw->find("\"name\":\"app\"") != std::string::npos);
const auto *lockfile_value = field(*object, "lockfile");
Void::Testing::require(lockfile_value != nullptr);
const auto *lockfile_object = as_object(*lockfile_value);
Void::Testing::require(lockfile_object != nullptr);
Void::Testing::expect(bool_field(*lockfile_object, "exists"));
Void::Testing::expect(int_field(*lockfile_object, "size_bytes") > 0);
Void::Testing::expect(str_field(*lockfile_object, "path").find("vbs.lock") !=
std::string::npos);
// A plain project is not a workspace and reports a null lockfile.
auto plain_temp = Void::FileSystem::TempDir::open("vbs_daemon_");
Void::Testing::require(plain_temp.has_value());
const auto plain_options = make_options(plain_temp->path());
auto plain_server = Void::Build::Daemon::DaemonServer::create(plain_options);
Void::Testing::require(plain_server.has_value());
const auto plain_socket = plain_server->socket_path();
Void::Result::Result<void, Void::Result::Error> plain_run_result;
std::jthread plain_worker{[&] { plain_run_result = plain_server->run(); }};
Void::Testing::require(wait_for_path(plain_socket, std::chrono::seconds{5}));
auto plain = request_object(plain_socket, R"({"op":"workspace_info"})");
auto plain_shutdown = Void::Build::Daemon::request(plain_socket, R"({"op":"shutdown"})");
Void::Testing::expect(plain_shutdown.has_value());
plain_worker.join();
Void::Testing::expect(plain_run_result.has_value());
Void::Testing::require(plain.has_value());
Void::Testing::expect(bool_field(*plain, "ok"));
Void::Testing::expect(!bool_field(*plain, "workspace", true));
const auto *plain_members = field(*plain, "members");
Void::Testing::require(plain_members != nullptr);
const auto *plain_members_array = std::get_if<JsonValue::Array>(&plain_members->value);
Void::Testing::require(plain_members_array != nullptr);
Void::Testing::expect(plain_members_array->empty());
const auto *plain_lockfile = field(*plain, "lockfile");
Void::Testing::require(plain_lockfile != nullptr);
Void::Testing::expect(std::holds_alternative<std::nullptr_t>(plain_lockfile->value));
}
VOID_TEST(Daemon, ide_configs_reports_generated_files) {
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
Void::Testing::require(temp.has_value());
+41 -3
View File
@@ -205,6 +205,44 @@ VOID_TEST(RegistryTests, registry_rbac_immutability_csrf_xss_web_and_backup_rest
*bytes1);
Void::Testing::expect(half_sig_pub.has_value() && half_sig_pub->status == 400);
// Mutable metadata: an owner can patch the description; invalid updates are rejected.
// A private package keeps anonymous search totals unchanged for later assertions.
auto meta_pub = send_loopback_http(port, "PUT", "/api/v1/packages/meta-pkg/1.0.0",
{{"Authorization", "Bearer " + *alice_tok},
{"X-Content-SHA256", *sha1},
{"X-Package-Private", "true"}},
*bytes1);
Void::Testing::expect(meta_pub.has_value() && meta_pub->status == 201);
auto patched = send_loopback_http(
port, "PATCH", "/api/v1/packages/meta-pkg",
{{"Authorization", "Bearer " + *alice_tok}, {"Content-Type", "application/json"}},
"{\"description\":\"patched description\"}");
Void::Testing::expect(patched.has_value() && patched->status == 200);
auto patched_detail = send_loopback_http(port, "GET", "/api/v1/packages/meta-pkg",
{{"Authorization", "Bearer " + *alice_tok}});
Void::Testing::expect(patched_detail.has_value() && patched_detail->status == 200);
if (patched_detail) {
Void::Testing::expect(patched_detail->body.find("patched description") !=
std::string::npos);
}
auto patch_no_auth = send_loopback_http(port, "PATCH", "/api/v1/packages/meta-pkg", {},
"{\"description\":\"x\"}");
Void::Testing::expect(patch_no_auth.has_value() && patch_no_auth->status == 401);
auto patch_non_owner = send_loopback_http(
port, "PATCH", "/api/v1/packages/meta-pkg",
{{"Authorization", "Bearer " + *bob_tok}, {"Content-Type", "application/json"}},
"{\"description\":\"x\"}");
Void::Testing::expect(patch_non_owner.has_value() && patch_non_owner->status == 403);
auto patch_empty = send_loopback_http(
port, "PATCH", "/api/v1/packages/meta-pkg",
{{"Authorization", "Bearer " + *alice_tok}, {"Content-Type", "application/json"}}, "{}");
Void::Testing::expect(patch_empty.has_value() && patch_empty->status == 400);
auto patch_bad_private = send_loopback_http(
port, "PATCH", "/api/v1/packages/meta-pkg",
{{"Authorization", "Bearer " + *alice_tok}, {"Content-Type", "application/json"}},
"{\"private\":\"yes\"}");
Void::Testing::expect(patch_bad_private.has_value() && patch_bad_private->status == 400);
// Package ownership management (bearer tokens are not ambient browser credentials).
auto owner_pkg_pub = send_loopback_http(
port, "PUT", "/api/v1/packages/owner-pkg/1.0.0",
@@ -878,15 +916,15 @@ VOID_TEST(RegistryTests, registry_binary_variant_publish_download_and_materializ
Void::Testing::expect(etag_it != etag_head->headers.end());
if (etag_it != etag_head->headers.end()) {
auto cached = send_loopback_http(port, "GET", binary_path + "/download",
{{"If-None-Match", etag_it->second}});
{{"If-None-Match", etag_it->second}});
Void::Testing::expect(cached.has_value() && cached->status == 304);
if (cached) {
Void::Testing::expect(cached->body.empty());
}
}
}
auto ranged = send_loopback_http(port, "GET", binary_path + "/download",
{{"Range", "bytes=0-3"}});
auto ranged =
send_loopback_http(port, "GET", binary_path + "/download", {{"Range", "bytes=0-3"}});
Void::Testing::expect(ranged.has_value() && ranged->status == 206);
if (ranged) {
Void::Testing::expect_eq(ranged->body, artifact.substr(0, 4));