feat: full_api test chain (providers, proxies, UI) + fullapi-tests check (#24)

* feat: full_api test chain — providers, proxies, and a UI plugin

Adds a hermetic test chain that exercises the entire supported type surface
(every method param/return + event param type) end to end, replacing the
network-dependent cross-version checks:

- test_fullapi_cpp        universal C++ provider (reference impl of full_api)
- test_fullapi_rust       Rust cdylib provider, same contract (cross-language parity)
- test_fullapi_proxy      universal C++ consumer/proxy via interface dependency
                          (forwards every method, re-emits every event)
- test_fullapi_proxy_rust Rust mirror of the proxy
- test_fullapi_ui         universal ui_qml plugin consuming full_api via an
                          interface dependency; drives every method type + all
                          events, surfaced to QML for a headless UI doctest

All five build; the core chain (both providers + both proxies, incl. cross-
language method calls and event round-trips) is proven at runtime under
logoscore, and the UI plugin is proven in Basecamp (method calls + typed event
delivery). Requires the cpp-sdk/rust-sdk codegen fixes (bstr/composite type
handling) re-pinned through module-builder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test(fullapi-ui): verify echoAny too; document the typed-scalar-array gap

The UI backend now also verifies echoAny (any round-trips) in the ALL_OK token,
and documents that typed-scalar arrays ([int]/[uint]/[float64]/[bool], and [any]
carrying numbers) still round-trip empty over the ui-host QtRO transport — a
Qt-path marshaling gap partially addressed by logos-protocol's container int-
preservation fix but not fully resolved. They are exercised but kept out of the
token so the basecamp UI doctest stays green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test(fullapi): add fullapi-tests check proving every array type round-trips

Adds a proxy probeArrays() method that round-trips one array of EVERY array type
([int]/[uint]/[float64]/[bool]/[tstr]/[any]) through the bound provider over the
lp path, plus a 'fullapi' group in run_tests.sh and a checks.fullapi-tests
derivation. This is CLI-observable (logoscore can't pass a list arg directly)
and proves both the C++ and Rust providers decode every array type identically.

Result: 5/5 green — probeArrays returns intList=3 uintList=2 doubleList=2
boolList=2 stringList=2 anyList=3 against both providers, plus scalar forwarding
and an event round-trip through the proxy. This isolates the earlier UI
[int]-empties symptom to the Qt-path host-side qvariantToNlohmann conversion
(fixed in logos-protocol), NOT the provider decode.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test(fullapi): package + exercise the Rust proxy in fullapi-tests

Copilot review: the fullapi-tests modulesDir aggregated only the C++
provider/proxy installs, so test_fullapi_proxy_rust wasn't built/packaged by the
check. Add it to modulesDir and load + exercise it in the fullapi group (echoInt
forwarding + intEvent round-trip). 7/7 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore: re-lock module-builder (brings the full_api SDK fixes)

Bumps logos-module-builder to 206c364 (#150), which re-pins cpp-sdk/qt-sdk/
rust-sdk/protocol to the merged full_api fixes. The five full_api modules now
build with no SDK overrides; checks.fullapi-tests is 7/7 green against master.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dario Lipicar
2026-07-17 17:31:25 -03:00
committed by GitHub
co-authored by Claude Opus 4.8
parent ab4be29aae
commit a8675f2e57
34 changed files with 34833 additions and 8194 deletions
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.14)
project(TestFullapiProxyPlugin LANGUAGES CXX)
if(DEFINED ENV{LOGOS_MODULE_BUILDER_ROOT})
include($ENV{LOGOS_MODULE_BUILDER_ROOT}/cmake/LogosModule.cmake)
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/LogosModule.cmake")
include(cmake/LogosModule.cmake)
else()
message(FATAL_ERROR "LogosModule.cmake not found")
endif()
# Universal module with an interface dependency: metadata.json declares
# `interface_dependencies` (full_api = interfaces/full_api.h = IFullApi), so the
# builder generates a bound wrapper `bind_full_api(name)` alongside the usual Qt
# glue. LogosModule.cmake globs generated_code/ automatically.
logos_module(
NAME test_fullapi_proxy
SOURCES
src/test_fullapi_proxy_impl.h
src/test_fullapi_proxy_impl.cpp
)
@@ -0,0 +1,83 @@
#pragma once
// ─────────────────────────────────────────────────────────────────────────────
// full_api — a DEPENDENCY INTERFACE (method + event contract) decoupled from any
// concrete module. It names NO module; any module whose API is a superset of
// this satisfies it. A consumer binds it to a concrete module name at runtime
// via modules().bind_full_api("some_module").
//
// Both test_fullapi_cpp and test_fullapi_rust implement exactly this surface, so
// the same bound handle drives either provider (and this proxy, which re-exposes
// it, satisfies it too).
//
// Types are std (the consuming module is universal); the generated bound wrapper
// inherits that api-style. NO trailing `// comments` on declaration lines — the
// header parser only accepts a line ending in `;`.
// ─────────────────────────────────────────────────────────────────────────────
#include <cstdint>
#include <string>
#include <vector>
#include <logos_json.h> // LogosMap, LogosList, nlohmann::json
#include <logos_module_context.h> // defines the `logos_events` token
#include <logos_result.h> // StdLogosResult
class IFullApi {
public:
std::string whoAmI();
// Scalar echoes: tstr / bstr / int / uint / float64 / bool / any
std::string echoString(const std::string& v);
std::vector<uint8_t> echoBytes(const std::vector<uint8_t>& v);
int64_t echoInt(int64_t v);
uint64_t echoUint(uint64_t v);
double echoDouble(double v);
bool echoBool(bool v);
nlohmann::json echoAny(const nlohmann::json& v);
// Container echoes: [tstr] / [int] / [uint] / [float64] / [bool] / [any] / {tstr:any}
std::vector<std::string> echoStringList(const std::vector<std::string>& v);
std::vector<int64_t> echoIntList(const std::vector<int64_t>& v);
std::vector<uint64_t> echoUintList(const std::vector<uint64_t>& v);
std::vector<double> echoDoubleList(const std::vector<double>& v);
std::vector<bool> echoBoolList(const std::vector<bool>& v);
LogosList echoList(const LogosList& v);
LogosMap echoMap(const LogosMap& v);
// Return-only: void / result
void doVoid();
StdLogosResult makeResult(bool ok);
// Event trigger drivers (return bool)
bool fireStringEvent(const std::string& v);
bool fireBytesEvent(const std::vector<uint8_t>& v);
bool fireIntEvent(int64_t v);
bool fireUintEvent(uint64_t v);
bool fireDoubleEvent(double v);
bool fireBoolEvent(bool v);
bool fireAnyEvent(const nlohmann::json& v);
bool fireStringListEvent(const std::vector<std::string>& v);
bool fireIntListEvent(const std::vector<int64_t>& v);
bool fireUintListEvent(const std::vector<uint64_t>& v);
bool fireDoubleListEvent(const std::vector<double>& v);
bool fireBoolListEvent(const std::vector<bool>& v);
bool fireListEvent(const LogosList& v);
bool fireMapEvent(const LogosMap& v);
logos_events:
void stringEvent(const std::string& v);
void bytesEvent(const std::vector<uint8_t>& v);
void intEvent(int64_t v);
void uintEvent(uint64_t v);
void doubleEvent(double v);
void boolEvent(bool v);
void anyEvent(const nlohmann::json& v);
void stringListEvent(const std::vector<std::string>& v);
void intListEvent(const std::vector<int64_t>& v);
void uintListEvent(const std::vector<uint64_t>& v);
void doubleListEvent(const std::vector<double>& v);
void boolListEvent(const std::vector<bool>& v);
void listEvent(const LogosList& v);
void mapEvent(const LogosMap& v);
};
@@ -0,0 +1,25 @@
{
"name": "test_fullapi_proxy",
"version": "1.0.0",
"type": "core",
"category": "testing",
"description": "Universal C++ proxy: consumes the full_api surface of EITHER provider (test_fullapi_cpp or test_fullapi_rust) via an interface dependency and re-exposes it — forwards every method and re-emits every event. useProvider(name) binds the runtime target, so the same proxy exercises both cross-language providers.",
"main": "test_fullapi_proxy_plugin",
"interface": "universal",
"dependencies": ["test_fullapi_cpp", "test_fullapi_rust"],
"interface_dependencies": [
{ "name": "full_api", "file": "interfaces/full_api.h", "impl_class": "IFullApi" }
],
"nix": {
"packages": {
"build": [],
"runtime": ["nlohmann_json"]
},
"external_libraries": [],
"cmake": {
"find_packages": [],
"extra_sources": []
}
}
}
@@ -0,0 +1,206 @@
#include "test_fullapi_proxy_impl.h"
#include <string>
// Generated at build time: LogosModules with the name-baked dependency wrappers
// AND (because metadata.json lists interface_dependencies) a
// bind_full_api(moduleName) factory returning the bound `FullApi` wrapper.
#include "logos_sdk.h"
// The lp consumer wrapper collapses a few types relative to the faithful
// full_api contract this proxy re-exposes:
// * uint -> int64_t (scalar cast)
// * [int]/[uint]/[float64]/[bool] -> LogosList (JSON array)
// * any / {tstr:any} -> LogosMap (both are nlohmann::json, so no-op)
// We convert at the forwarding boundary so the proxy's own surface stays the
// exact full_api shape (a consumer can bind `full_api` to this proxy too).
// ── Lifecycle + control ──────────────────────────────────────────────────────
void TestFullapiProxyImpl::onContextReady() {
subscribeToTarget();
}
bool TestFullapiProxyImpl::useProvider(const std::string& name) {
m_target = name;
subscribeToTarget();
return true;
}
std::string TestFullapiProxyImpl::currentProvider() { return m_target; }
std::string TestFullapiProxyImpl::getLastEvent() { return m_lastEvent; }
std::string TestFullapiProxyImpl::probeArrays() {
auto p = modules().bind_full_api(m_target);
const auto il = p.echoIntList(LogosList({1, 2, 3}));
const auto ul = p.echoUintList(LogosList({1, 2}));
const auto dl = p.echoDoubleList(LogosList({1.5, 2.5}));
const auto bl = p.echoBoolList(LogosList({true, false}));
const std::vector<std::string> sIn{"a", "b"};
const auto sl = p.echoStringList(sIn);
const auto al = p.echoList(LogosList({1, 2, 3}));
return "intList=" + std::to_string(il.size()) +
" uintList=" + std::to_string(ul.size()) +
" doubleList=" + std::to_string(dl.size()) +
" boolList=" + std::to_string(bl.size()) +
" stringList=" + std::to_string(sl.size()) +
" anyList=" + std::to_string(al.size());
}
// ── Forwarded methods ────────────────────────────────────────────────────────
std::string TestFullapiProxyImpl::whoAmI() {
return modules().bind_full_api(m_target).whoAmI();
}
std::string TestFullapiProxyImpl::echoString(const std::string& v) {
return modules().bind_full_api(m_target).echoString(v);
}
std::vector<uint8_t> TestFullapiProxyImpl::echoBytes(const std::vector<uint8_t>& v) {
return modules().bind_full_api(m_target).echoBytes(v);
}
int64_t TestFullapiProxyImpl::echoInt(int64_t v) {
return modules().bind_full_api(m_target).echoInt(v);
}
uint64_t TestFullapiProxyImpl::echoUint(uint64_t v) {
return static_cast<uint64_t>(
modules().bind_full_api(m_target).echoUint(static_cast<int64_t>(v)));
}
double TestFullapiProxyImpl::echoDouble(double v) {
return modules().bind_full_api(m_target).echoDouble(v);
}
bool TestFullapiProxyImpl::echoBool(bool v) {
return modules().bind_full_api(m_target).echoBool(v);
}
nlohmann::json TestFullapiProxyImpl::echoAny(const nlohmann::json& v) {
return modules().bind_full_api(m_target).echoAny(v);
}
std::vector<std::string> TestFullapiProxyImpl::echoStringList(const std::vector<std::string>& v) {
return modules().bind_full_api(m_target).echoStringList(v);
}
std::vector<int64_t> TestFullapiProxyImpl::echoIntList(const std::vector<int64_t>& v) {
LogosList res = modules().bind_full_api(m_target).echoIntList(LogosList(v));
return res.get<std::vector<int64_t>>();
}
std::vector<uint64_t> TestFullapiProxyImpl::echoUintList(const std::vector<uint64_t>& v) {
LogosList res = modules().bind_full_api(m_target).echoUintList(LogosList(v));
return res.get<std::vector<uint64_t>>();
}
std::vector<double> TestFullapiProxyImpl::echoDoubleList(const std::vector<double>& v) {
LogosList res = modules().bind_full_api(m_target).echoDoubleList(LogosList(v));
return res.get<std::vector<double>>();
}
std::vector<bool> TestFullapiProxyImpl::echoBoolList(const std::vector<bool>& v) {
LogosList res = modules().bind_full_api(m_target).echoBoolList(LogosList(v));
return res.get<std::vector<bool>>();
}
LogosList TestFullapiProxyImpl::echoList(const LogosList& v) {
return modules().bind_full_api(m_target).echoList(v);
}
LogosMap TestFullapiProxyImpl::echoMap(const LogosMap& v) {
return modules().bind_full_api(m_target).echoMap(v);
}
void TestFullapiProxyImpl::doVoid() {
modules().bind_full_api(m_target).doVoid();
}
StdLogosResult TestFullapiProxyImpl::makeResult(bool ok) {
return modules().bind_full_api(m_target).makeResult(ok);
}
// ── Forwarded event trigger drivers ──────────────────────────────────────────
// Each forwards to the bound provider, whose emission our subscription (below)
// captures and re-emits.
bool TestFullapiProxyImpl::fireStringEvent(const std::string& v) {
return modules().bind_full_api(m_target).fireStringEvent(v);
}
bool TestFullapiProxyImpl::fireBytesEvent(const std::vector<uint8_t>& v) {
return modules().bind_full_api(m_target).fireBytesEvent(v);
}
bool TestFullapiProxyImpl::fireIntEvent(int64_t v) {
return modules().bind_full_api(m_target).fireIntEvent(v);
}
bool TestFullapiProxyImpl::fireUintEvent(uint64_t v) {
return modules().bind_full_api(m_target).fireUintEvent(static_cast<int64_t>(v));
}
bool TestFullapiProxyImpl::fireDoubleEvent(double v) {
return modules().bind_full_api(m_target).fireDoubleEvent(v);
}
bool TestFullapiProxyImpl::fireBoolEvent(bool v) {
return modules().bind_full_api(m_target).fireBoolEvent(v);
}
bool TestFullapiProxyImpl::fireAnyEvent(const nlohmann::json& v) {
return modules().bind_full_api(m_target).fireAnyEvent(v);
}
bool TestFullapiProxyImpl::fireStringListEvent(const std::vector<std::string>& v) {
return modules().bind_full_api(m_target).fireStringListEvent(v);
}
bool TestFullapiProxyImpl::fireIntListEvent(const std::vector<int64_t>& v) {
return modules().bind_full_api(m_target).fireIntListEvent(LogosList(v));
}
bool TestFullapiProxyImpl::fireUintListEvent(const std::vector<uint64_t>& v) {
return modules().bind_full_api(m_target).fireUintListEvent(LogosList(v));
}
bool TestFullapiProxyImpl::fireDoubleListEvent(const std::vector<double>& v) {
return modules().bind_full_api(m_target).fireDoubleListEvent(LogosList(v));
}
bool TestFullapiProxyImpl::fireBoolListEvent(const std::vector<bool>& v) {
return modules().bind_full_api(m_target).fireBoolListEvent(LogosList(v));
}
bool TestFullapiProxyImpl::fireListEvent(const LogosList& v) {
return modules().bind_full_api(m_target).fireListEvent(v);
}
bool TestFullapiProxyImpl::fireMapEvent(const LogosMap& v) {
return modules().bind_full_api(m_target).fireMapEvent(v);
}
// ── Subscribe to the bound provider's events: capture a summary + re-emit ─────
void TestFullapiProxyImpl::subscribeToTarget() {
auto api = modules().bind_full_api(m_target);
api.onStringEvent([this](const std::string& v) {
m_lastEvent = "stringEvent:" + v; stringEvent(v);
});
api.onBytesEvent([this](const std::vector<uint8_t>& v) {
m_lastEvent = "bytesEvent:size=" + std::to_string(v.size()); bytesEvent(v);
});
api.onIntEvent([this](int64_t v) {
m_lastEvent = "intEvent:" + std::to_string(v); intEvent(v);
});
api.onUintEvent([this](int64_t v) {
m_lastEvent = "uintEvent:" + std::to_string(v); uintEvent(static_cast<uint64_t>(v));
});
api.onDoubleEvent([this](double v) {
m_lastEvent = "doubleEvent:" + std::to_string(v); doubleEvent(v);
});
api.onBoolEvent([this](bool v) {
m_lastEvent = std::string("boolEvent:") + (v ? "true" : "false"); boolEvent(v);
});
api.onAnyEvent([this](const LogosMap& v) {
m_lastEvent = "anyEvent:" + v.dump(); anyEvent(v);
});
api.onStringListEvent([this](const std::vector<std::string>& v) {
m_lastEvent = "stringListEvent:size=" + std::to_string(v.size()); stringListEvent(v);
});
api.onIntListEvent([this](const LogosList& v) {
m_lastEvent = "intListEvent:size=" + std::to_string(v.size());
intListEvent(v.get<std::vector<int64_t>>());
});
api.onUintListEvent([this](const LogosList& v) {
m_lastEvent = "uintListEvent:size=" + std::to_string(v.size());
uintListEvent(v.get<std::vector<uint64_t>>());
});
api.onDoubleListEvent([this](const LogosList& v) {
m_lastEvent = "doubleListEvent:size=" + std::to_string(v.size());
doubleListEvent(v.get<std::vector<double>>());
});
api.onBoolListEvent([this](const LogosList& v) {
m_lastEvent = "boolListEvent:size=" + std::to_string(v.size());
boolListEvent(v.get<std::vector<bool>>());
});
api.onListEvent([this](const LogosList& v) {
m_lastEvent = "listEvent:size=" + std::to_string(v.size()); listEvent(v);
});
api.onMapEvent([this](const LogosMap& v) {
m_lastEvent = "mapEvent:size=" + std::to_string(v.size()); mapEvent(v);
});
}
@@ -0,0 +1,105 @@
#pragma once
// ─────────────────────────────────────────────────────────────────────────────
// test_fullapi_proxy — universal C++ consumer/proxy.
//
// Consumes the full `full_api` surface of EITHER provider (test_fullapi_cpp or
// test_fullapi_rust) via an INTERFACE dependency (interfaces/full_api.h), and
// RE-EXPOSES the exact same surface itself — every call forwards to the bound
// provider, every provider event is captured and re-emitted. So the proxy is
// itself a drop-in `full_api` provider that delegates to another.
//
// useProvider(name) selects the runtime target (cross-language: bind to the C++
// or the Rust provider). getLastEvent() returns a short summary of the most
// recent forwarded event so a CLI doctest can assert event delivery.
//
// The bind/call sites live in the .cpp (which includes the generated
// logos_sdk.h); this header the generator parses stays free of codegen types.
// NO trailing `// comments` on declaration lines (the parser needs a trailing `;`).
// ─────────────────────────────────────────────────────────────────────────────
#include <cstdint>
#include <string>
#include <vector>
#include <logos_json.h> // LogosMap, LogosList, nlohmann::json
#include <logos_module_context.h> // LogosModuleContext base (gives modules())
#include <logos_result.h> // StdLogosResult
class TestFullapiProxyImpl : public LogosModuleContext {
public:
TestFullapiProxyImpl() = default;
~TestFullapiProxyImpl() = default;
void onContextReady() override;
// ── Control ──────────────────────────────────────────────────────────────
// Bind the interface to `name` for method forwarding + subscribe to its
// events. Returns true.
bool useProvider(const std::string& name);
// The module name currently bound.
std::string currentProvider();
// Short summary ("<eventName>:<payload-or-size>") of the most recently
// forwarded event; empty until one arrives.
std::string getLastEvent();
// Round-trip every array type through the bound provider (LP path) and
// report the received sizes as a string — a CLI-observable probe of the
// provider's array decode, isolated from the Qt/ui-host transport.
std::string probeArrays();
// ── Forwarded full_api surface (same signatures as IFullApi) ─────────────
std::string whoAmI();
std::string echoString(const std::string& v);
std::vector<uint8_t> echoBytes(const std::vector<uint8_t>& v);
int64_t echoInt(int64_t v);
uint64_t echoUint(uint64_t v);
double echoDouble(double v);
bool echoBool(bool v);
nlohmann::json echoAny(const nlohmann::json& v);
std::vector<std::string> echoStringList(const std::vector<std::string>& v);
std::vector<int64_t> echoIntList(const std::vector<int64_t>& v);
std::vector<uint64_t> echoUintList(const std::vector<uint64_t>& v);
std::vector<double> echoDoubleList(const std::vector<double>& v);
std::vector<bool> echoBoolList(const std::vector<bool>& v);
LogosList echoList(const LogosList& v);
LogosMap echoMap(const LogosMap& v);
void doVoid();
StdLogosResult makeResult(bool ok);
bool fireStringEvent(const std::string& v);
bool fireBytesEvent(const std::vector<uint8_t>& v);
bool fireIntEvent(int64_t v);
bool fireUintEvent(uint64_t v);
bool fireDoubleEvent(double v);
bool fireBoolEvent(bool v);
bool fireAnyEvent(const nlohmann::json& v);
bool fireStringListEvent(const std::vector<std::string>& v);
bool fireIntListEvent(const std::vector<int64_t>& v);
bool fireUintListEvent(const std::vector<uint64_t>& v);
bool fireDoubleListEvent(const std::vector<double>& v);
bool fireBoolListEvent(const std::vector<bool>& v);
bool fireListEvent(const LogosList& v);
bool fireMapEvent(const LogosMap& v);
// ── Re-emitted events (mirror full_api) ──────────────────────────────────
logos_events:
void stringEvent(const std::string& v);
void bytesEvent(const std::vector<uint8_t>& v);
void intEvent(int64_t v);
void uintEvent(uint64_t v);
void doubleEvent(double v);
void boolEvent(bool v);
void anyEvent(const nlohmann::json& v);
void stringListEvent(const std::vector<std::string>& v);
void intListEvent(const std::vector<int64_t>& v);
void uintListEvent(const std::vector<uint64_t>& v);
void doubleListEvent(const std::vector<double>& v);
void boolListEvent(const std::vector<bool>& v);
void listEvent(const LogosList& v);
void mapEvent(const LogosMap& v);
private:
void subscribeToTarget();
std::string m_target = "test_fullapi_cpp";
std::string m_lastEvent;
};