feat(daemon,registry): list lowered actions and expose binary variant detail
This commit is contained in:
1 parent
69d1a8d274
commit
34fe148eb4
10 files changed
+252
-3
No files matched your search
@@ -173,7 +173,13 @@ 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- **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- **Wave 43 (Workspace Members Request)**:\n - Added the `workspace_members` daemon request (`vbs daemon workspace members`): lists declared workspace members (`name`, canonical `path`) without evaluating member build descriptions; non-workspace roots return `workspace:false` with an empty list.\n - Added `Daemon.workspace_members_lists_declared_members` and a CLI help contract; Daemon suite is now 19 cases.\n\n- **Wave 44 (IDE Configs Request)**:\n - Added the `ide_configs` daemon request (`vbs daemon ide configs`): reports presence of `.clangd`, `.vscode/tasks.json`, `.zed/tasks.json`, and `.idea/customTargets.xml` so editor extensions can see what is configured.\n - Added `Daemon.ide_configs_reports_generated_files` (absent before generation, present after `ide_generate`) and a CLI help contract; Daemon suite is now 20 cases.\n\n- **Wave 45 (Compdb Generations Request)**:\n - Added the `compdb_generations` daemon request (`vbs daemon compdb generations --profile`): lists immutable editor generations (bounded 128) with active flag, per-generation entry counts, and the per-profile status/diagnostic record; profile names are validated against `[A-Za-z0-9._-]` to prevent traversal.\n - Added `Daemon.compdb_generations_lists_history_and_active_generation` (empty before export, then a valid generation with entries and an active selection; invalid profile rejected) and a CLI help contract; Daemon suite is now 21 cases.\n\n- **Wave 46 (Registry Package Search Pagination)**:\n - `GET /api/v1/packages` now supports bounded `limit` (0-500, default 100) and `offset` (0-1,000,000) pagination with a `total`/`limit`/`offset` envelope; malformed values return 400.\n - The registry RBAC test asserts a `limit=1` page contains exactly one package and that `limit=501` is rejected.\n\n- **Wave 47 (Registry Release Detail Endpoint)**:\n - Added `GET /api/v1/packages/<name>/<version>` returning release metadata (digest, size, yank state, publisher/epoch, optional signature/public key, binary variant summaries) under normal read permissions; unknown packages/releases return 404.\n - The registry binary-variant test asserts the release detail includes the version and published binary variant, and that an unknown version returns 404.\n\n- **Wave 48 (Daemon Deps Request)**:\n - Added the `deps` daemon request (`vbs daemon deps [--profile] [--member]`): evaluates the project, merges TOML/declared dependencies, resolves and materializes them with the pinned lock, registry environment, and trusted keys, then returns the lock context key and per-entry metadata (`alias`, `source_kind`, `package_name`, `version`, `sha256`, `signed`). Shared dependency-merge and resolve-option helpers were extracted for reuse by the build path.\n - Extended `Daemon.build_materializes_path_dependency` to assert a `deps` response with the `helper` path entry before building, plus a CLI help contract.\n\n- **Wave 49 (Daemon Info Request)**:\n - Added the `info` daemon request (`vbs daemon info`): reports the daemon version, host OS/architecture, project/build/lock roots, and socket path so editor extensions can discover the environment without guessing.\n - Added `Daemon.info_reports_daemon_paths_and_host` and a CLI help contract; Daemon suite is now 22 cases.\n\n- **Wave 50 (Registry Audit Query Filters)**:\n - `GET /api/v1/audit` now supports `actor`, `action` (substring), `outcome`, `limit` (0–2000, default 100) and `offset` filters with a `total`/`limit`/`offset` envelope; malformed limits return 400.\n - The registLine truncated
|
||||
- **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- **Wave 43 (Workspace Members Request)**:\n - Added the `workspace_members` daemon request (`vbs daemon workspace members`): lists declared workspace members (`name`, canonical `path`) without evaluating member build descriptions; non-workspace roots return `workspace:false` with an empty list.\n - Added `Daemon.workspace_members_lists_declared_members` and a CLI help contract; Daemon suite is now 19 cases.\n\n- **Wave 44 (IDE Configs Request)**:\n - Added the `ide_configs` daemon request (`vbs daemon ide configs`): reports presence of `.clangd`, `.vscode/tasks.json`, `.zed/tasks.json`, and `.idea/customTargets.xml` so editor extensions can see what is configured.\n - Added `Daemon.ide_configs_reports_generated_files` (absent before generation, present after `ide_generate`) and a CLI help contract; Daemon suite is now 20 cases.\n\n- **Wave 45 (Compdb Generations Request)**:\n - Added the `compdb_generations` daemon request (`vbs daemon compdb generations --profile`): lists immutable editor generations (bounded 128) with active flag, per-generation entry counts, and the per-profile status/diagnostic record; profile names are validated against `[A-Za-z0-9._-]` to prevent traversal.\n - Added `Daemon.compdb_generations_lists_history_and_active_generation` (empty before export, then a valid generation with entries and an active selection; invalid profile rejected) and a CLI help contract; Daemon suite is now 21 cases.\n\n- **Wave 46 (Registry Package Search Pagination)**:\n - `GET /api/v1/packages` now supports bounded `limit` (0-500, default 100) and `offset` (0-1,000,000) pagination with a `total`/`limit`/`offset` envelope; malformed values return 400.\n - The registry RBAC test asserts a `limit=1` page contains exactly one package and that `limit=501` is rejected.\n\n- **Wave 47 (Registry Release Detail Endpoint)**:\n - Added `GET /api/v1/packages/<name>/<version>` returning release metadata (digest, size, yank state, publisher/epoch, optional signature/public key, binary variant summaries) under normal read permissions; unknown packages/releases return 404.\n - The registry binary-variant test asserts the release detail includes the version and published binary variant, and that an unknown version returns 404.\n\n- **Wave 48 (Daemon Deps Request)**:\n - Added the `deps` daemon request (`vbs daemon deps [--profile] [--member]`): evaluates the project, merges TOML/declared dependencies, resolves and materializes them with the pinned lock, registry environment, and trusted keys, then returns the lock context key and per-entry metadata (`alias`, `source_kind`, `package_name`, `version`, `sha256`, `signed`). Shared dependency-merge and resolve-option helpers were extracted for reuse by the build path.\n - Extended `Daemon.build_materializes_path_dependency` to assert a `deps` response with the `helper` path entry before building, plus a CLI help contract.\n\n- **Wave 49 (Daemon Info Request)**:\n - Added the `info` daemon request (`vbs daemon info`): reports the daemon version, host OS/architecture, project/build/lock roots, and socket path so editor extensions can discover the environment without guessing.\n - Added `Daemon.info_reports_daemon_paths_and_host` and a CLI help contract; Daemon suite is now 22 cases.\n\n- **Wave 50 (Registry Audit Query Filters)**:\n - `GET /api/v1/audit` now supports `actor`, `action` (substring), `outcome`, `limit` (0–2000, default 100) and `offset` filters with a `total`/`limit`/`offset` envelope; malformed limits return 400.\n - The registLine truncated
|
||||
- Added the `actions` daemon request (`vbs daemon actions [--profile] [--limit]`): lists the lowered graph's actions with `id`, `kind`, `target`, `cacheable`, and bounded `outputs` (first 8), reporting `total`/`returned`. An optional `target` filter yields `total=0` when nothing matches; `limit` is bounded to 1000.
|
||||
- Added `GET /api/v1/packages/<name>/<version>/binaries/<variant>` returning one binary variant's metadata and download URL; missing variants return 404.
|
||||
- Tests: `Daemon.actions_lists_lowered_actions` and extended registry binary-variant assertions; Daemon suite is now 26 cases.
|
||||
- Note: a swarm retried for the daemon half stalled on its planning step again and was stopped; the work was then implemented directly.
|
||||
|
||||
## Remaining future scope"}"}"}"}"}"}, {"oldString": "Track E4 (the `Void::Net` registry-client transport and `Void::Sqlite` StateStore are adopted; further Net surfaces such as the registry HTTP server remain planned scope).", "newString": "Track E4 (`Void::Net` now backs both the registry client transport and the registry HTTP server when enabled, and `Void::Sqlite` backs the StateStore; the POSIX fallbacks remain for minimal toolchains)."}]"}, {"oldString": "Track E4 (`Void::Net` alignment; `Void::Sqlite` is now used by the StateStore when SQLite3 is available) remain planned scope.", "newString": "Track E4 (the `Void::Net` registry-client transport and `Void::Sqlite` StateStore are adopted; further Net surfaces such as the registry HTTP server remain planned scope)."}, {"oldString": "Live `conan` CLI verification (Track B3), Track C", "newString": "Track C"}"}, {"oldString": "Track E4 (`Void::Net`/`Void::Sqlite` alignment) remain planned scope.", "newString": "Track E4 (`Void::Net` alignment; `Void::Sqlite` is now used by the StateStore when SQLite3 is available) remain planned 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.
|
||||
|
||||
|
||||
@@ -64,4 +64,5 @@ Base HEAD: `fe0d1a6`
|
||||
| Wave 57 (Daemon clean request) | `Config::clean_build_tree` extraction; `clean` daemon request + `vbs daemon clean [--all]` returning a structured report | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 23/23, full CTest 8/8) | `include/Void/Build/Config/BuildTree.hpp`, `src/Config/BuildTree.cpp`, `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, build lists, docs |
|
||||
| Wave 58 (Daemon target info) | `target_info` daemon request + `vbs daemon target info --name`: kind, sources, outputs, runtime libraries | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 24/24, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs |
|
||||
| Wave 59 (Daemon pack request) | `pack` daemon request + `vbs daemon pack --output`: deterministic archive confined to the build root, returns path and SHA-256 | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 25/25, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs |
|
||||
| Wave 60 (Daemon actions + binary detail) | `actions` daemon request with target filter and limit; `GET .../binaries/<variant>` detail endpoint | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 26/26, Registry 7/7, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `registry/service/RegistryService.cpp`, `tests/DaemonTests.cpp`, `tests/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) |
|
||||
@@ -975,6 +975,27 @@ dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure
|
||||
- Full CTest: **8 / 8 passed** in 240.40 s.
|
||||
- `clang-format --dry-run --Werror` passes on the changed C++ files.
|
||||
|
||||
## Daemon Actions Request & Binary Variant Detail (GCC 16.2, pin `0002e74`)
|
||||
|
||||
```sh
|
||||
dev cpp-gcc -c cmake --build build/pinned --parallel 8
|
||||
dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color
|
||||
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. Daemon suite: **26 / 26 passed** in 50.70 s, including
|
||||
`actions_lists_lowered_actions` (`total >= 1`, `returned <= 5`, non-empty `id`/`target`/`kind`;
|
||||
unknown target filter gives `total=0`; `limit=1001` rejected).
|
||||
- Registry suite: **7 / 7 passed** in 12.56 s; the binary-variant test also checks
|
||||
`GET .../binaries/<variant>` returns the id, signature, and download URL, and an unknown variant
|
||||
returns 404.
|
||||
- Full CTest: **8 / 8 passed** in 238.86 s.
|
||||
- `clang-format --dry-run --Werror` passes on the changed C++ files.
|
||||
- Swarm note: a one-worker swarm was started for the daemon half, stalled on its planning task
|
||||
(same pattern as before), and was stopped before any file was written; the slice was then
|
||||
implemented directly.
|
||||
|
||||
## 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).
|
||||
|
||||
@@ -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 pack` creates a confined deterministic source archive, `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, and releases expose a version-specific detail endpoint. 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 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, and releases expose a version-specific detail endpoint. 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). |
|
||||
|
||||
---
|
||||
|
||||
@@ -1229,6 +1229,40 @@ HttpResponse RegistryService::handle_request(const HttpRequest &req) {
|
||||
",\"sha256\":" + json_quote(actual_sha) + "}\n");
|
||||
}
|
||||
|
||||
// Binary variant detail: GET /api/v1/packages/<name>/<version>/binaries/<variant>
|
||||
if (segs.size() == 7 && 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");
|
||||
}
|
||||
const auto bit = rit->second.binaries.find(segs[6]);
|
||||
if (bit == rit->second.binaries.end()) {
|
||||
return HttpResponse::error_json(404, "not_found", "binary variant not found");
|
||||
}
|
||||
const auto &binary = bit->second;
|
||||
return HttpResponse::json(
|
||||
200, "{\"variant_id\":" + json_quote(binary.variant_id) +
|
||||
",\"sha256\":" + json_quote(binary.sha256) +
|
||||
",\"size_bytes\":" + std::to_string(binary.size_bytes) +
|
||||
",\"yanked\":" + std::string{binary.yanked ? "true" : "false"} +
|
||||
",\"signature\":" + json_quote(binary.signature) +
|
||||
",\"public_key\":" + json_quote(binary.public_key) +
|
||||
",\"publisher\":" + json_quote(binary.publisher) +
|
||||
",\"published_epoch\":" + std::to_string(binary.published_epoch) +
|
||||
",\"download_url\":" +
|
||||
json_quote("/api/v1/packages/" + pkg_name + "/" + segs[4] + "/binaries/" +
|
||||
segs[6] + "/download") +
|
||||
"}\n");
|
||||
}
|
||||
|
||||
// Download a prebuilt binary variant:
|
||||
// GET /api/v1/packages/<name>/<version>/binaries/<variant>/download
|
||||
if (segs.size() == 8 && segs[5] == "binaries" && segs[7] == "download" &&
|
||||
|
||||
+104
-1
@@ -68,6 +68,8 @@ constexpr std::size_t kMaxCompdbArguments = 256U;
|
||||
constexpr std::size_t kMaxCompdbArgumentBytes = 1024U;
|
||||
constexpr std::size_t kMaxCompdbEntries = 500U;
|
||||
constexpr std::size_t kMaxCompdbGenerations = 128U;
|
||||
constexpr std::size_t kMaxActionOutputs = 8U;
|
||||
constexpr std::size_t kMaxActionLimit = 1000U;
|
||||
constexpr std::size_t kMaxPendingChanges = 4096U;
|
||||
constexpr std::int64_t kMaxWatchWaitMs = 5000;
|
||||
constexpr std::int64_t kDefaultWatchWaitMs = 2000;
|
||||
@@ -1177,6 +1179,83 @@ std::string target_info_project(const DaemonOptions &options, std::string_view p
|
||||
return serialize_response(JsonValue{std::move(object)});
|
||||
}
|
||||
|
||||
std::string_view action_kind_label(Graph::ActionKind kind) noexcept {
|
||||
switch (kind) {
|
||||
case Graph::ActionKind::Compile:
|
||||
return "compile";
|
||||
case Graph::ActionKind::PrecompiledHeader:
|
||||
return "pch";
|
||||
case Graph::ActionKind::HeaderUnit:
|
||||
return "header_unit";
|
||||
case Graph::ActionKind::ModuleScan:
|
||||
return "module_scan";
|
||||
case Graph::ActionKind::ModuleBmi:
|
||||
return "module_bmi";
|
||||
case Graph::ActionKind::Archive:
|
||||
return "archive";
|
||||
case Graph::ActionKind::Link:
|
||||
return "link";
|
||||
case Graph::ActionKind::Custom:
|
||||
return "custom";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
// 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<CompilerFamily> compiler_override,
|
||||
std::string_view target_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()));
|
||||
}
|
||||
auto evaluated =
|
||||
evaluate_project_graph(*effective_result, profile_name, compiler_override, "actions");
|
||||
if (!evaluated) {
|
||||
return error_response(evaluated.error());
|
||||
}
|
||||
auto graph = lower_graph(*effective_result, *evaluated, {}, "actions");
|
||||
if (!graph) {
|
||||
return error_response(graph.error());
|
||||
}
|
||||
|
||||
JsonValue::Array actions;
|
||||
std::size_t total = 0;
|
||||
for (const auto &action : graph->actions) {
|
||||
if (!target_filter.empty() && action.target_name != target_filter) {
|
||||
continue;
|
||||
}
|
||||
++total;
|
||||
if (actions.size() >= limit) {
|
||||
continue;
|
||||
}
|
||||
JsonValue::Object entry;
|
||||
entry.emplace("id", JsonValue{action.id});
|
||||
entry.emplace("kind", JsonValue{std::string{action_kind_label(action.kind)}});
|
||||
entry.emplace("target", JsonValue{action.target_name});
|
||||
entry.emplace("cacheable", JsonValue{action.cacheable});
|
||||
JsonValue::Array outputs;
|
||||
for (const auto &output : action.declared_outputs) {
|
||||
if (outputs.size() >= kMaxActionOutputs) {
|
||||
break;
|
||||
}
|
||||
outputs.emplace_back(output.string());
|
||||
}
|
||||
entry.emplace("outputs", JsonValue{std::move(outputs)});
|
||||
actions.emplace_back(std::move(entry));
|
||||
}
|
||||
|
||||
JsonValue::Object object;
|
||||
object.emplace("ok", JsonValue{true});
|
||||
object.emplace("op", JsonValue{std::string{"actions"}});
|
||||
object.emplace("profile", JsonValue{evaluated->context.name});
|
||||
object.emplace("total", JsonValue{static_cast<std::int64_t>(total)});
|
||||
object.emplace("returned", JsonValue{static_cast<std::int64_t>(actions.size())});
|
||||
object.emplace("actions", JsonValue{std::move(actions)});
|
||||
return serialize_response(JsonValue{std::move(object)});
|
||||
}
|
||||
|
||||
// Reports which editor configuration files are present for the project.
|
||||
std::string ide_configs_project(const DaemonOptions &options) {
|
||||
struct ConfigEntry {
|
||||
@@ -1880,7 +1959,7 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
|
||||
}
|
||||
if (*name == "describe" || *name == "build" || *name == "test" || *name == "ide_query" ||
|
||||
*name == "ide_generate" || *name == "compdb_export" || *name == "graph" ||
|
||||
*name == "deps" || *name == "target_info") {
|
||||
*name == "deps" || *name == "target_info" || *name == "actions") {
|
||||
std::string profile_name{"debug"};
|
||||
if (const auto entry = object->find("profile"); entry != object->end()) {
|
||||
const auto *value = std::get_if<std::string>(&entry->second.value);
|
||||
@@ -1927,6 +2006,30 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
|
||||
if (*name == "deps") {
|
||||
return {deps_project(options, profile_name, compiler_override, member), false};
|
||||
}
|
||||
if (*name == "actions") {
|
||||
std::string target_filter;
|
||||
if (const auto entry = object->find("target"); entry != object->end()) {
|
||||
const auto *value = std::get_if<std::string>(&entry->second.value);
|
||||
if (value == nullptr || value->size() > kMaxDescribeTargetNameBytes) {
|
||||
return {error_response("\"target\" must be a bounded string"), false};
|
||||
}
|
||||
target_filter = *value;
|
||||
}
|
||||
std::size_t limit = 100;
|
||||
if (const auto entry = object->find("limit"); entry != object->end()) {
|
||||
const auto *value = std::get_if<std::int64_t>(&entry->second.value);
|
||||
if (value == nullptr || *value < 0 ||
|
||||
*value > static_cast<std::int64_t>(kMaxActionLimit)) {
|
||||
return {error_response(std::format("\"limit\" must be an integer in [0, {}]",
|
||||
kMaxActionLimit)),
|
||||
false};
|
||||
}
|
||||
limit = static_cast<std::size_t>(*value);
|
||||
}
|
||||
return {actions_project(options, profile_name, compiler_override, target_filter, limit,
|
||||
member),
|
||||
false};
|
||||
}
|
||||
if (*name == "target_info") {
|
||||
const auto entry = object->find("target");
|
||||
if (entry == object->end()) {
|
||||
|
||||
@@ -1567,6 +1567,9 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
|
||||
request_json = std::format(R"({{"op":"graph","profile":{},"format":{}}})",
|
||||
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);
|
||||
} else if (sub == "target_info") {
|
||||
if (!opts.target_arg || opts.target_arg->empty()) {
|
||||
std::cerr << "vbs daemon target: --name must not be empty\n";
|
||||
@@ -2736,6 +2739,13 @@ int main(int argc, char **argv) {
|
||||
auto &daemon_workspace_members_cmd =
|
||||
daemon_workspace_cmd.subcommand("members", "List declared workspace members");
|
||||
configure_daemon_common(daemon_workspace_members_cmd);
|
||||
auto &daemon_actions_cmd =
|
||||
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("--limit", "", "Maximum actions returned (0-1000)", daemon_opts.limit_arg,
|
||||
"100");
|
||||
auto &daemon_graph_cmd =
|
||||
daemon_cmd.subcommand("graph", "Export the target dependency graph via the daemon");
|
||||
configure_daemon_common(daemon_graph_cmd);
|
||||
|
||||
@@ -75,6 +75,7 @@ check_process(0 "Usage: vbs daemon info " "" daemon info --help)
|
||||
check_process(0 "Usage: vbs daemon clean " "" daemon clean --help)
|
||||
check_process(0 "Usage: vbs daemon target info .*--name" "" daemon target info --help)
|
||||
check_process(0 "Usage: vbs daemon pack .*--output" "" daemon pack --help)
|
||||
check_process(0 "Usage: vbs daemon actions .*--limit" "" daemon actions --help)
|
||||
check_process(0 "Usage: vbs daemon ide wait .*--timeout-ms" "" daemon ide wait --help)
|
||||
check_process(2 "" "missing subcommand for 'vbs daemon'" daemon)
|
||||
|
||||
|
||||
@@ -1350,6 +1350,67 @@ void build(Void::Build::Project &project) {}
|
||||
Void::Testing::expect(!bool_field(*invalid, "ok", true));
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, actions_lists_lowered_actions) {
|
||||
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
|
||||
Void::Testing::require(temp.has_value());
|
||||
const auto options = make_options(temp->path());
|
||||
|
||||
{
|
||||
std::ofstream descriptor{options.project_root / "build.cpp"};
|
||||
descriptor << R"cpp(#include <Void/Build.hpp>
|
||||
|
||||
void build(Void::Build::Project &project) {
|
||||
auto app = project.executable("app");
|
||||
app.sources({"main.cpp"});
|
||||
}
|
||||
)cpp";
|
||||
Void::Testing::require(descriptor.good());
|
||||
}
|
||||
{
|
||||
std::ofstream source{options.project_root / "main.cpp"};
|
||||
source << "int main() { return 0; }\n";
|
||||
Void::Testing::require(source.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 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 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());
|
||||
worker.join();
|
||||
Void::Testing::expect(run_result.has_value());
|
||||
|
||||
Void::Testing::require(listed.has_value());
|
||||
Void::Testing::expect(bool_field(*listed, "ok"));
|
||||
Void::Testing::expect(int_field(*listed, "total") >= 1);
|
||||
Void::Testing::expect(int_field(*listed, "returned") <= 5);
|
||||
const auto *actions = field(*listed, "actions");
|
||||
Void::Testing::require(actions != nullptr);
|
||||
const auto *action_array = std::get_if<JsonValue::Array>(&actions->value);
|
||||
Void::Testing::require(action_array != nullptr && !action_array->empty());
|
||||
const auto *first = std::get_if<JsonObject>(&action_array->front().value);
|
||||
Void::Testing::require(first != nullptr);
|
||||
Void::Testing::expect(!str_field(*first, "id").empty());
|
||||
Void::Testing::expect(!str_field(*first, "target").empty());
|
||||
Void::Testing::expect(!str_field(*first, "kind").empty());
|
||||
|
||||
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(invalid.has_value());
|
||||
Void::Testing::expect(!bool_field(*invalid, "ok", true));
|
||||
}
|
||||
|
||||
VOID_TEST(Daemon, describe_empty_project_reports_zero_targets) {
|
||||
auto temp = Void::FileSystem::TempDir::open("vbs_daemon_");
|
||||
Void::Testing::require(temp.has_value());
|
||||
|
||||
@@ -620,6 +620,18 @@ VOID_TEST(RegistryTests, registry_binary_variant_publish_download_and_materializ
|
||||
Void::Testing::expect(listed->body.find("\"yanked\":false") != std::string::npos);
|
||||
}
|
||||
|
||||
auto binary_detail = send_loopback_http(port, "GET", binary_path);
|
||||
Void::Testing::expect(binary_detail.has_value() && binary_detail->status == 200);
|
||||
if (binary_detail) {
|
||||
Void::Testing::expect(binary_detail->body.find("\"variant_id\":\"" + variant_id + "\"") !=
|
||||
std::string::npos);
|
||||
Void::Testing::expect(binary_detail->body.find("\"signature\":\"" + *signature + "\"") !=
|
||||
std::string::npos);
|
||||
Void::Testing::expect(binary_detail->body.find("\"download_url\":") != std::string::npos);
|
||||
}
|
||||
auto missing_binary = send_loopback_http(port, "GET", binary_path + "-missing");
|
||||
Void::Testing::expect(missing_binary.has_value() && missing_binary->status == 404);
|
||||
|
||||
auto downloaded = send_loopback_http(port, "GET", binary_path + "/download");
|
||||
Void::Testing::expect(downloaded.has_value() && downloaded->status == 200);
|
||||
if (downloaded) {
|
||||
|
||||
Reference in new issue
Block a user