feat(package,daemon): yank releases from the CLI; report workspace and lockfile in info
This commit is contained in:
1 parent
f5eb489e79
commit
1a4c062021
11 files changed
+249
-20
No files matched your search
@@ -265,6 +265,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
||||
|
||||
- **Wave 86 (Shared Compdb Entry Query & `vbs compdb-entries`)**: extracted the bounded compile-database projection into `Editor::query_compdb_entries` (`CompdbEntry`/`CompdbQuery`/`CompdbQueryResult`), reused by the daemon `compdb_entries` request and exposed as the `vbs compdb-entries [--project] [--build-dir] [--file] [--limit]` CLI.
|
||||
|
||||
- **Wave 87 (`vbs releases yank` & Daemon `info` Workspace/Lockfile)**: added `Package::set_release_yanked` and `vbs releases yank --registry --name --version [--unyank]`, exercised live in the registry E2E. A swarm worker extended the daemon `info` response with `workspace` and `lockfile` ({path, exists}) fields and their test (4/4 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.
|
||||
@@ -90,4 +90,5 @@ Base HEAD: `fe0d1a6`
|
||||
| Wave 84 (Install CLI options + users pagination) | `daemon install --component/--no-cmake-export/--no-native-export`; swarm paginated `/api/v1/users` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 9/9, full CTest 8/8) | `src/Main.cpp`, `registry/service/RegistryService.cpp`, `tests/{RegistryTests,CliContracts}.cmake/cpp`, docs |
|
||||
| Wave 85 (Lock show + mermaid graph) | `vbs lock show`; swarm added daemon `graph --format mermaid` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; CLI contract passes, Daemon suite passes, full CTest 8/8) | `src/Main.cpp`, `src/Daemon/Daemon.cpp`, `tests/{DaemonTests,CliContracts}.cpp/cmake`, docs |
|
||||
| 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 |
|
||||
| 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) |
|
||||
@@ -1288,6 +1288,15 @@ dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color
|
||||
(4.56 s) and the CLI contract covers `--help` and the no-database error (13.73 s).
|
||||
- Full CTest: **8 / 8 passed** in 267.19 s.
|
||||
|
||||
## `vbs releases yank` & Daemon `info` Workspace/Lockfile (GCC 16.2, pin `0002e74`)
|
||||
|
||||
- `vbs releases yank`/`--unyank` against the live registry succeeds in the CLI E2E (the release
|
||||
list still resolves afterwards).
|
||||
- Swarm `swarm_mx8izkm6_lol7` (one worker) added `workspace` and `lockfile` to the daemon `info`
|
||||
response (4/4 substantive tasks; build task stopped and re-run by the orchestrator);
|
||||
`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.
|
||||
|
||||
## 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).
|
||||
|
||||
@@ -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 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`). |
|
||||
| **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 releases yank|unyank` manages release state, `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`). |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -49,6 +49,12 @@ struct TokenInfo {
|
||||
[[nodiscard]] Void::Result::Result<std::vector<TokenInfo>, Void::Result::Error>
|
||||
fetch_tokens(std::string_view registry_url, const RegistryAuth &auth = {});
|
||||
|
||||
// Marks a release yanked or unyanked via POST .../<version>/yank (bearer tokens are exempt
|
||||
// from CSRF; owner or admin authority required). Returns the resulting yank state.
|
||||
[[nodiscard]] Void::Result::Result<bool, Void::Result::Error>
|
||||
set_release_yanked(std::string_view registry_url, std::string_view package_name,
|
||||
std::string_view version, bool yanked, const RegistryAuth &auth = {});
|
||||
|
||||
// Revokes one API token via DELETE /api/v1/tokens/<token_id> (owner or admin only).
|
||||
[[nodiscard]] Void::Result::Result<void, Void::Result::Error>
|
||||
revoke_token(std::string_view registry_url, std::string_view token_id,
|
||||
|
||||
+10
-4
@@ -2118,10 +2118,16 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
|
||||
object.emplace("backends", JsonValue{std::move(backends)});
|
||||
object.emplace("project_root", JsonValue{options.project_root.string()});
|
||||
object.emplace("build_root", JsonValue{options.build_root.string()});
|
||||
object.emplace(
|
||||
"lock_root",
|
||||
JsonValue{
|
||||
(options.lock_root.empty() ? options.project_root : options.lock_root).string()});
|
||||
const auto lock_root = options.lock_root.empty() ? options.project_root : options.lock_root;
|
||||
object.emplace("lock_root", JsonValue{lock_root.string()});
|
||||
object.emplace("workspace", JsonValue{Config::is_workspace_root(options.project_root)});
|
||||
const auto lockfile_path = lock_root / "vbs.lock";
|
||||
std::error_code lockfile_ec;
|
||||
JsonValue::Object lockfile;
|
||||
lockfile.emplace("path", JsonValue{lockfile_path.string()});
|
||||
lockfile.emplace("exists",
|
||||
JsonValue{std::filesystem::is_regular_file(lockfile_path, lockfile_ec)});
|
||||
object.emplace("lockfile", JsonValue{std::move(lockfile)});
|
||||
object.emplace("socket", JsonValue{socket_path.string()});
|
||||
return {serialize_response(JsonValue{std::move(object)}), false};
|
||||
}
|
||||
|
||||
+42
-7
@@ -1297,8 +1297,8 @@ int execute_verify_command(const VerifyCmdOptions &opts) {
|
||||
<< *opts.version_arg << " sha256=" << *digest << '\n';
|
||||
return 1;
|
||||
}
|
||||
std::cout << "verified " << *opts.name_arg << '@' << *opts.version_arg
|
||||
<< " sha256=" << *digest << '\n';
|
||||
std::cout << "verified " << *opts.name_arg << '@' << *opts.version_arg << " sha256=" << *digest
|
||||
<< '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1347,6 +1347,26 @@ struct ReleasesCmdOptions {
|
||||
std::string token_env{"VBS_REGISTRY_TOKEN"};
|
||||
};
|
||||
|
||||
int execute_releases_yank_command(const ReleasesCmdOptions &opts, bool unyank) {
|
||||
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 yank: --registry, --name, and --version are required\n";
|
||||
return 2;
|
||||
}
|
||||
Package::RegistryAuth auth{Void::Configuration::get_env_or(opts.token_env, "")};
|
||||
auto state =
|
||||
Package::set_release_yanked(registry_url, *opts.name_arg, *opts.version_arg, !unyank, auth);
|
||||
if (!state) {
|
||||
std::cerr << "vbs releases yank: " << state.error().message() << '\n';
|
||||
return 1;
|
||||
}
|
||||
std::cout << (*state ? "yanked " : "unyanked ") << *opts.name_arg << '@' << *opts.version_arg
|
||||
<< '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
int execute_releases_list_command(const ReleasesCmdOptions &opts) {
|
||||
const std::string registry_url = opts.registry_arg
|
||||
? *opts.registry_arg
|
||||
@@ -2558,6 +2578,7 @@ int execute_ide_command(std::string_view sub, const IdeCmdOptions &opts) {
|
||||
int main(int argc, char **argv) {
|
||||
const std::string cwd = std::filesystem::current_path().string();
|
||||
bool show_version = false;
|
||||
bool releases_unyank = false;
|
||||
bool verbose = false;
|
||||
bool quiet = false;
|
||||
|
||||
@@ -2747,8 +2768,8 @@ int main(int argc, char **argv) {
|
||||
publish_binary_opts.token_env, "VBS_REGISTRY_TOKEN");
|
||||
add_log_flags(publish_binary_cmd, false); // `-v` is `--version` on publish-binary.
|
||||
|
||||
auto &compdb_entries_root_cmd =
|
||||
root.subcommand("compdb-entries", "Query bounded entries from the published compile database");
|
||||
auto &compdb_entries_root_cmd = root.subcommand(
|
||||
"compdb-entries", "Query bounded entries from the published compile database");
|
||||
compdb_entries_root_cmd
|
||||
.option_default("--project", "-C", "Project directory", compdb_entries_opts.project_arg,
|
||||
cwd)
|
||||
@@ -2761,8 +2782,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
auto &verify_cmd =
|
||||
root.subcommand("verify", "Verify a detached Ed25519 signature over a package artifact");
|
||||
verify_cmd
|
||||
.option("--name", "-n", "Package name", verify_opts.name_arg)
|
||||
verify_cmd.option("--name", "-n", "Package name", verify_opts.name_arg)
|
||||
.option("--version", "-v", "Package version", verify_opts.version_arg)
|
||||
.option("--file", "-f", "Artifact file whose SHA-256 is signed", verify_opts.file_arg)
|
||||
.option("--signature", "", "Detached signature hex", verify_opts.signature_arg)
|
||||
@@ -2811,6 +2831,17 @@ int main(int argc, char **argv) {
|
||||
releases_opts.token_env, "VBS_REGISTRY_TOKEN");
|
||||
add_log_flags(releases_show_cmd, false); // `-v` is `--version` on releases show.
|
||||
|
||||
auto &releases_yank_cmd = releases_cmd.subcommand("yank", "Yank or unyank a release");
|
||||
releases_yank_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")
|
||||
.flag("--unyank", "", "Restore a yanked release", releases_unyank);
|
||||
add_log_flags(releases_yank_cmd, false); // `-v` is `--version` on releases yank.
|
||||
|
||||
auto &binaries_cmd =
|
||||
root.subcommand("binaries", "Inspect prebuilt binary variants in a package registry");
|
||||
auto configure_binaries = [&](Void::Argparse::Parser &p) {
|
||||
@@ -3207,9 +3238,13 @@ 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") {
|
||||
const std::string releases_sub = parsed.matched_command_path.at(1);
|
||||
if (releases_sub == "show") {
|
||||
return execute_releases_show_command(releases_opts);
|
||||
}
|
||||
if (releases_sub == "yank") {
|
||||
return execute_releases_yank_command(releases_opts, releases_unyank);
|
||||
}
|
||||
return execute_releases_list_command(releases_opts);
|
||||
}
|
||||
if (cmd == "tokens") {
|
||||
|
||||
@@ -742,9 +742,59 @@ fetch_tokens(std::string_view registry_url, const RegistryAuth &auth) {
|
||||
return tokens;
|
||||
}
|
||||
|
||||
Void::Result::Result<bool, Void::Result::Error>
|
||||
set_release_yanked(std::string_view registry_url, std::string_view package_name,
|
||||
std::string_view version, bool yanked, const RegistryAuth &auth) {
|
||||
auto parsed_url = parse_registry_url(registry_url);
|
||||
if (!parsed_url) {
|
||||
return std::unexpected{parsed_url.error()};
|
||||
}
|
||||
std::map<std::string, std::string, std::less<>> headers;
|
||||
headers["Content-Type"] = "application/json";
|
||||
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) + "/yank";
|
||||
const std::string body = std::format("{{\"yanked\":{}}}", yanked ? "true" : "false");
|
||||
auto reply = send_http_request(*parsed_url, "POST", path, headers, body);
|
||||
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 POST {} 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 yank endpoint")};
|
||||
}
|
||||
const auto *object = std::get_if<JsonVal::Object>(&json->value);
|
||||
if (!object) {
|
||||
return std::unexpected{make_error(Void::System::SystemErrorCode::io_error,
|
||||
"registry yank response must be a JSON object")};
|
||||
}
|
||||
const auto it = object->find("yanked");
|
||||
if (it == object->end()) {
|
||||
return std::unexpected{make_error(Void::System::SystemErrorCode::io_error,
|
||||
"registry yank response is missing 'yanked'")};
|
||||
}
|
||||
const auto *flag = std::get_if<bool>(&it->second.value);
|
||||
if (!flag) {
|
||||
return std::unexpected{make_error(Void::System::SystemErrorCode::io_error,
|
||||
"registry yank 'yanked' must be a boolean")};
|
||||
}
|
||||
return *flag;
|
||||
}
|
||||
|
||||
Void::Result::Result<void, Void::Result::Error>
|
||||
revoke_token(std::string_view registry_url, std::string_view token_id,
|
||||
const RegistryAuth &auth) {
|
||||
revoke_token(std::string_view registry_url, std::string_view token_id, const RegistryAuth &auth) {
|
||||
auto parsed_url = parse_registry_url(registry_url);
|
||||
if (!parsed_url) {
|
||||
return std::unexpected{parsed_url.error()};
|
||||
@@ -759,12 +809,12 @@ revoke_token(std::string_view registry_url, std::string_view token_id,
|
||||
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 DELETE {} failed with HTTP {}", path, reply->status))};
|
||||
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 DELETE {} failed with HTTP {}", path, reply->status))};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ check_process(0 "Usage: vbs publish-binary " "" publish-binary --help)
|
||||
check_process(0 "Usage: vbs binaries <command>.*Commands:.*list.*fetch" "" binaries --help)
|
||||
check_process(0 "Usage: vbs binaries list " "" binaries list --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)
|
||||
check_process(0 "Usage: vbs tokens list " "" tokens list --help)
|
||||
check_process(0 "Usage: vbs lock show " "" lock show --help)
|
||||
check_process(0 "Usage: vbs verify " "" verify --help)
|
||||
|
||||
@@ -1661,6 +1661,21 @@ VOID_TEST(Daemon, info_reports_daemon_paths_and_host) {
|
||||
Void::Testing::expect(!str_field(*info, "version").empty());
|
||||
Void::Testing::expect_eq(str_field(*info, "project_root"), options.project_root.string());
|
||||
Void::Testing::expect_eq(str_field(*info, "build_root"), options.build_root.string());
|
||||
const auto *workspace = field(*info, "workspace");
|
||||
Void::Testing::require(workspace != nullptr);
|
||||
Void::Testing::expect(std::holds_alternative<bool>(workspace->value));
|
||||
Void::Testing::expect(!bool_field(*info, "workspace", true));
|
||||
const auto *lockfile_value = field(*info, "lockfile");
|
||||
Void::Testing::require(lockfile_value != nullptr);
|
||||
const auto *lockfile = as_object(*lockfile_value);
|
||||
Void::Testing::require(lockfile != nullptr);
|
||||
Void::Testing::expect(str_field(*lockfile, "path").find("vbs.lock") != std::string::npos);
|
||||
Void::Testing::expect_eq(str_field(*lockfile, "path"),
|
||||
(options.project_root / "vbs.lock").string());
|
||||
const auto *lockfile_exists = field(*lockfile, "exists");
|
||||
Void::Testing::require(lockfile_exists != nullptr);
|
||||
Void::Testing::expect(std::holds_alternative<bool>(lockfile_exists->value));
|
||||
Void::Testing::expect(!bool_field(*lockfile, "exists", true));
|
||||
Void::Testing::expect_eq(str_field(*info, "socket"), socket.string());
|
||||
Void::Testing::expect_eq(
|
||||
str_field(*info, "host_os"),
|
||||
@@ -1692,6 +1707,98 @@ VOID_TEST(Daemon, info_reports_daemon_paths_and_host) {
|
||||
Void::Testing::expect(std::holds_alternative<bool>(net_backend->value));
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, info_reports_workspace_and_lockfile) {
|
||||
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
|
||||
Void::Testing::require(temp.has_value());
|
||||
const auto options = make_options(temp->path());
|
||||
|
||||
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}));
|
||||
|
||||
// A lockfile created after startup must be reported by the next info request.
|
||||
auto before = request_object(socket, R"({"op":"info"})");
|
||||
Void::Testing::require(before.has_value());
|
||||
const auto *before_value = field(*before, "lockfile");
|
||||
Void::Testing::require(before_value != nullptr);
|
||||
const auto *before_lockfile = as_object(*before_value);
|
||||
Void::Testing::require(before_lockfile != nullptr);
|
||||
Void::Testing::expect(!bool_field(*before_lockfile, "exists", true));
|
||||
|
||||
{
|
||||
std::ofstream lockfile{options.project_root / "vbs.lock"};
|
||||
lockfile << "{}\n";
|
||||
Void::Testing::require(lockfile.good());
|
||||
}
|
||||
auto after = request_object(socket, R"({"op":"info"})");
|
||||
Void::Testing::require(after.has_value());
|
||||
const auto *after_value = field(*after, "lockfile");
|
||||
Void::Testing::require(after_value != nullptr);
|
||||
const auto *after_lockfile = as_object(*after_value);
|
||||
Void::Testing::require(after_lockfile != nullptr);
|
||||
Void::Testing::expect(bool_field(*after_lockfile, "exists"));
|
||||
Void::Testing::expect_eq(str_field(*after_lockfile, "path"),
|
||||
(options.project_root / "vbs.lock").string());
|
||||
|
||||
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());
|
||||
|
||||
// Workspace roots report workspace=true, and lockfile path/exists follow lock_root.
|
||||
auto workspace_temp = Void::FileSystem::TempDir::open("vbs_daemon_");
|
||||
Void::Testing::require(workspace_temp.has_value());
|
||||
auto workspace_options = make_options(workspace_temp->path());
|
||||
const auto workspace_root = workspace_options.project_root;
|
||||
{
|
||||
std::ofstream workspace{workspace_root / "workspace.cpp"};
|
||||
workspace << "#include <Void/Build.hpp>\n"
|
||||
"void workspace(Void::Build::Workspace &workspace) {\n"
|
||||
" workspace.member(\"lib\", \"packages/lib\");\n"
|
||||
"}\n";
|
||||
Void::Testing::require(workspace.good());
|
||||
}
|
||||
std::filesystem::create_directories(workspace_root / "packages" / "lib");
|
||||
const auto lock_root = workspace_temp->path() / "lock-root";
|
||||
std::filesystem::create_directories(lock_root);
|
||||
{
|
||||
std::ofstream lockfile{lock_root / "vbs.lock"};
|
||||
lockfile << "{}\n";
|
||||
Void::Testing::require(lockfile.good());
|
||||
}
|
||||
workspace_options.lock_root = lock_root;
|
||||
|
||||
auto workspace_server = Void::Build::Daemon::DaemonServer::create(workspace_options);
|
||||
Void::Testing::require(workspace_server.has_value());
|
||||
const auto workspace_socket = workspace_server->socket_path();
|
||||
|
||||
Void::Result::Result<void, Void::Result::Error> workspace_run_result;
|
||||
std::jthread workspace_worker{[&] { workspace_run_result = workspace_server->run(); }};
|
||||
Void::Testing::require(wait_for_path(workspace_socket, std::chrono::seconds{5}));
|
||||
|
||||
auto workspace_info = request_object(workspace_socket, R"({"op":"info"})");
|
||||
Void::Testing::require(workspace_info.has_value());
|
||||
Void::Testing::expect(bool_field(*workspace_info, "workspace"));
|
||||
Void::Testing::expect_eq(str_field(*workspace_info, "lock_root"), lock_root.string());
|
||||
const auto *workspace_value = field(*workspace_info, "lockfile");
|
||||
Void::Testing::require(workspace_value != nullptr);
|
||||
const auto *workspace_lockfile = as_object(*workspace_value);
|
||||
Void::Testing::require(workspace_lockfile != nullptr);
|
||||
Void::Testing::expect_eq(str_field(*workspace_lockfile, "path"),
|
||||
(lock_root / "vbs.lock").string());
|
||||
Void::Testing::expect(bool_field(*workspace_lockfile, "exists"));
|
||||
|
||||
auto workspace_shutdown =
|
||||
Void::Build::Daemon::request(workspace_socket, R"({"op":"shutdown"})");
|
||||
Void::Testing::expect(workspace_shutdown.has_value());
|
||||
workspace_worker.join();
|
||||
Void::Testing::expect(workspace_run_result.has_value());
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, doctor_reports_host_tools_and_backends) {
|
||||
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
|
||||
Void::Testing::require(temp.has_value());
|
||||
|
||||
@@ -1497,6 +1497,17 @@ target_include_directories(hello_pkg PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
}
|
||||
Void::Testing::expect(saw_revoked);
|
||||
|
||||
Platform::ProcessRequest releases_yank;
|
||||
releases_yank.executable = vbs_bin;
|
||||
releases_yank.arguments = {"releases", "yank", "--registry", reg_url,
|
||||
"--name", "hello-pkg", "--version", "1.0.0"};
|
||||
releases_yank.environment.set_vars["VBS_REGISTRY_TOKEN"] = *tok;
|
||||
auto yank_res = Platform::run_supervised(releases_yank);
|
||||
Void::Testing::expect(yank_res.has_value() && yank_res->succeeded());
|
||||
releases_yank.arguments.push_back("--unyank");
|
||||
auto unyank_res = Platform::run_supervised(releases_yank);
|
||||
Void::Testing::expect(unyank_res.has_value() && unyank_res->succeeded());
|
||||
|
||||
Platform::ProcessRequest releases_list;
|
||||
releases_list.executable = vbs_bin;
|
||||
releases_list.arguments = {"releases", "list", "--registry", reg_url, "--name", "hello-pkg"};
|
||||
|
||||
Reference in new issue
Block a user