Dario LipicarandClaude Opus 5 3da8de93df fix(codec): a whole-valued float still decodes as an integer (#32)
The signedness/range check in #31 went one step too far: it rejected 3.0 for an
`int`, not just 3.7. That broke four long-standing test_basic_module_cpp cases
(`addInts(3.0, 4.0)`, `echoInt(42.0)`, `isPositive(5.0)`, `twoArgs(hi, 3.0)`)
which pass a whole-valued double where the contract declares an integer.

They are right and the check was wrong. JSON does not distinguish 3 from 3.0,
and this codec already says so in the other direction — Codec<double> accepts an
integral number because "2 and 2.0 are the same value to JSON, and every encoder
that sees a whole double may emit either". The two directions have to agree.

It also matters in practice rather than in principle: logoscore's CLI types its
arguments by parsing, so `logoscore call m addInts 3.0 4.0` produces JSON floats.
Refusing them rejects a caller over a spelling of the same number.

So a float decodes as an integer when it has no fractional part and fits;
3.7 is still refused, which is what the original change was actually for. Bounds
are strict on the upper end for the same reason as the QJsonValue guard:
double(int64max) rounds UP to 2^63, so `<=` would admit a value the cast cannot
represent.

verified: test-modules 176/176 with the four cases green again, and the
conformance matrix unchanged at 170 pass / 2 xfail — hostile/int/fractional
still expects dispatch_failed and gets it.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 13:52:04 -03:00
2026-06-09 23:33:17 -03:00
2026-06-09 23:37:23 -03:00
2026-06-09 23:37:23 -03:00
2026-06-09 23:33:17 -03:00

logos-protocol

The Logos protocol layer: transports, token exchange, and the language-neutral lp_* C ABI (cpp/logos_protocol.h) that every Logos SDK builds on.

Extracted from logos-cpp-sdk so that non-C++ SDKs (Rust, …) consume the same transports, capability/token flow and wire behavior through one stable, versioned boundary instead of re-wrapping the C++/Qt SDK.

What lives here

  • Public C ABIcpp/logos_protocol.h: consumer surface (lp_client_*, lp_invoke[_async], lp_subscribe, tokens, lp_get_methods), provider groundwork (lp_provider_*), and the protocol version (LOGOS_PROTOCOL_VERSION_*, lp_protocol_version(), lp_protocol_abi_major()). JSON-in-strings data model; bytes cross the boundary as {"_bytes":"<base64url>"} (lossless, NUL-safe).
  • Transports — plain TCP / TCP+TLS (Boost.Asio + OpenSSL + nlohmann, Qt-free), qt_local, in-memory mock, and Qt Remote Objects (qt_remote — the only Qt-bearing transport).
  • Consumer coreLogosAPIClient / LogosAPIConsumer including the automatic capability_module.requestModule token-fetch flow (behind the protocol boundary: every language gets it for free).
  • Provider-side plumbingModuleProxy (auth gate the transports publish) and the abstract LogosProviderObject interface (logos_provider_interface.h).
  • Token manager, transport/registry factories, mode config (remote/local/mock), and the canonical QVariant↔JSON conversion used at the QRO boundary.

logos-cpp-sdk layers the typed C++ developer API (LogosAPI, module context, code generator, provider base classes) on top of this repo.

Versioning

This repo carries the logos-protocol semver — the single number that governs Logos load/call compatibility. Two participants (modules, hosts, SDKs in any language) interoperate iff they share the same MAJOR. MINOR is additive/back-compatible; PATCH never affects compatibility. SDKs must re-expose the version of the protocol they linked (never mint their own).

Building

# Via workspace
ws build logos-protocol

# Standalone
nix build

# Tests
nix build .#tests

Layering invariant

logos-protocol depends only on Qt / Boost / OpenSSL / nlohmann_json — it must NEVER depend on logos-cpp-sdk, logos-qt-sdk, logos-rust-sdk, liblogos or logos-lidl. Everything points inward.

S
Description
No description provided
Readme
1.6 MiB
Languages
C++ 91.5%
C 3.9%
CMake 2.7%
Nix 1.1%
Shell 0.8%