fix: emit cdylib glue with logos-qt-host-generator, not qt-sdk's stale copy

B1 relocated the cdylib Qt-plugin glue generator to logos-plugin-qt (the Qt
plugin BACKEND owns the glue; the SDK does not), but universalCodegen and
cdylibCodegen still called `logos-qt-generator` from logos-qt-sdk, which ships
an OLDER copy of the same emitter. Both copies compile and both emit working
glue, so nothing failed — the builds simply used stale glue.

That is not theoretical. It is why the Phase C host-services grant never
reached a module: the new glue reads the `hostServices` property and forwards
it across the C ABI, the old one does not, and every build stayed green while
capability_module refused every requestModule for want of a grant that was
delivered to its process and then dropped on the floor.

Measured: `hostServices` appears 4 times in logos-plugin-qt's copy and 0 times
in logos-qt-sdk's. After the switch the built capability_module plugin
references logos_module_grant_host_services twice (the export plus the glue's
call) where it previously referenced it once.

Threads the plugin-qt FLAKE (not its lib — the generator is a package of it)
from flake.nix through lib/default.nix into buildCppPlugin, mkLogosModule and
mkLogosModuleTests, and puts logos-qt-host-generator on PATH everywhere
logos-qt-generator already was. `--backend ui` still uses qt-sdk's generator:
the view backend has not moved.

logos-test-modules ipc-tests: FAIL -> PASS, which is the end-to-end proof that
a universal capability_module now mints tokens under a host-granted privilege.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Dario Gabriel Lipicar
2026-08-16 10:32:46 -03:00
co-authored by Claude Opus 5
parent 85dfb349ce
commit ed507316f1
6 changed files with 50 additions and 10 deletions
+2
View File
@@ -63,6 +63,8 @@
inherit nixpkgs nix-bundle-lgx nix-bundle-logos-module-install logos-standalone-app;
inherit logos-nix;
inherit logos-cpp-sdk logos-protocol logos-qt-sdk logos-module logos-test-framework logos-rust-sdk;
# The FLAKE, not its lib: the cdylib glue generator is a package of it.
inherit logos-plugin-qt;
inherit rust-overlay;
inherit (nixpkgs) lib;
uiBackend = logos-plugin-qt.rawLib or logos-plugin-qt.lib;
+16 -2
View File
@@ -2,7 +2,7 @@
# resolution, plugin compilation (via backend), header generation, dev shells,
# and LGX bundling. Callers (mkLogosModule, mkLogosQmlModule) compose final
# `packages` and `apps` outputs differently.
{ nixpkgs, lib, common, parseMetadata, logos-cpp-sdk, logos-protocol ? null, logos-qt-sdk ? null, logos-module, uiBackend, coreBackend, nix-bundle-lgx, nix-bundle-logos-module-install }:
{ nixpkgs, lib, common, parseMetadata, logos-cpp-sdk, logos-protocol ? null, logos-qt-sdk ? null, logos-plugin-qt ? null, logos-module, uiBackend, coreBackend, nix-bundle-lgx, nix-bundle-logos-module-install }:
{
src,
@@ -149,6 +149,13 @@ let
# The Qt glue generator (universal/cdylib/ui backends) — Qt code is
# the Qt layer's product; logos-cpp-generator keeps Qt-free outputs.
logosQtGenerator = logos-qt-sdk.packages.${common.buildSystemFor system}.logos-qt-generator;
# The cdylib Qt-plugin glue generator lives in logos-plugin-qt (the Qt
# plugin BACKEND owns the glue; the SDK does not). logos-qt-sdk still
# ships an older copy of the SAME emitter, and calling that one is not a
# compile error — it silently emits STALE glue. That is how a
# host-services grant went undelivered while every build stayed green.
logosQtHostGenerator =
logos-plugin-qt.packages.${common.buildSystemFor system}.logos-qt-host-generator;
logosProtocolPkg = logos-protocol.packages.${system}.default;
logosModule = logos-module.packages.${system}.default;
@@ -215,7 +222,7 @@ let
inherit externalLibs;
# pkgs.jq is target-typed too and jq runs in preConfigure
# (modulePreConfigure.nix:203). buildPackages == pkgs natively.
extraNativeBuildInputs = extraNativeBuildInputs ++ buildPkgs ++ [ logosSdkBuild logosQtGenerator pkgs.buildPackages.jq ];
extraNativeBuildInputs = extraNativeBuildInputs ++ buildPkgs ++ [ logosSdkBuild logosQtGenerator logosQtHostGenerator pkgs.buildPackages.jq ];
extraBuildInputs = extraBuildInputs ++ runtimePkgs ++ [ logosQtSdk logosProtocolPkg ];
# Qt splits each module's TOOLS (repc, moc, qmltyperegistrar) into a
# SEPARATE package that must run on the BUILD machine. Without these
@@ -297,6 +304,13 @@ let
# The Qt glue generator (universal/cdylib/ui backends) — Qt code is
# the Qt layer's product; logos-cpp-generator keeps Qt-free outputs.
logosQtGenerator = logos-qt-sdk.packages.${common.buildSystemFor system}.logos-qt-generator;
# The cdylib Qt-plugin glue generator lives in logos-plugin-qt (the Qt
# plugin BACKEND owns the glue; the SDK does not). logos-qt-sdk still
# ships an older copy of the SAME emitter, and calling that one is not a
# compile error — it silently emits STALE glue. That is how a
# host-services grant went undelivered while every build stayed green.
logosQtHostGenerator =
logos-plugin-qt.packages.${common.buildSystemFor system}.logos-qt-host-generator;
logosProtocolPkg = logos-protocol.packages.${system}.default;
logosModule = logos-module.packages.${system}.default;
+4 -2
View File
@@ -4,7 +4,7 @@
#
# logos-cpp-sdk and logos-module are owned by this builder and injected into
# backends — backends never resolve these deps themselves.
{ nixpkgs, lib, logos-nix ? null, uiBackend, coreBackend, logos-cpp-sdk, logos-protocol ? null, logos-qt-sdk ? null, logos-module, logos-test-framework, logos-rust-sdk ? null, nix-bundle-lgx, nix-bundle-logos-module-install, logos-standalone-app, builderRoot, rust-overlay ? null }:
{ nixpkgs, lib, logos-nix ? null, uiBackend, coreBackend, logos-plugin-qt ? null, logos-cpp-sdk, logos-protocol ? null, logos-qt-sdk ? null, logos-module, logos-test-framework, logos-rust-sdk ? null, nix-bundle-lgx, nix-bundle-logos-module-install, logos-standalone-app, builderRoot, rust-overlay ? null }:
let
# Import common utilities (backend-agnostic)
@@ -18,6 +18,7 @@ let
inherit nixpkgs nix-bundle-lgx nix-bundle-logos-module-install logos-standalone-app lib;
inherit common parseMetadata builderRoot uiBackend coreBackend;
inherit logos-cpp-sdk logos-protocol logos-qt-sdk logos-module logos-test-framework logos-rust-sdk;
inherit logos-plugin-qt;
inherit rust-overlay;
};
@@ -25,6 +26,7 @@ let
buildCppPlugin = import ./buildCppPlugin.nix {
inherit nixpkgs nix-bundle-lgx nix-bundle-logos-module-install lib;
inherit common parseMetadata logos-cpp-sdk logos-protocol logos-qt-sdk logos-module uiBackend coreBackend;
inherit logos-plugin-qt;
};
# Import the ui_qml module builder (QML view + optional C++ backend)
@@ -40,7 +42,7 @@ let
# Import the test builder
mkLogosModuleTests = import ./mkLogosModuleTests.nix {
inherit nixpkgs lib common parseMetadata;
inherit logos-cpp-sdk logos-protocol logos-qt-sdk logos-test-framework;
inherit logos-cpp-sdk logos-protocol logos-qt-sdk logos-plugin-qt logos-test-framework;
};
in {
+17 -3
View File
@@ -2,7 +2,7 @@
# This is the main entry point for building Logos modules.
# Plugin compilation and header generation are delegated to a backend selected
# by metadata.json "type": core modules use coreBackend, UI modules use uiBackend.
{ nixpkgs, lib, common, parseMetadata, builderRoot, uiBackend, coreBackend, logos-cpp-sdk, logos-protocol ? null, logos-qt-sdk ? null, logos-module, logos-test-framework, logos-rust-sdk ? null, nix-bundle-lgx, nix-bundle-logos-module-install, logos-standalone-app, rust-overlay ? null }:
{ nixpkgs, lib, common, parseMetadata, builderRoot, uiBackend, coreBackend, logos-cpp-sdk, logos-protocol ? null, logos-qt-sdk ? null, logos-plugin-qt ? null, logos-module, logos-test-framework, logos-rust-sdk ? null, nix-bundle-lgx, nix-bundle-logos-module-install, logos-standalone-app, rust-overlay ? null }:
{
# Required: Path to the module source
@@ -342,6 +342,13 @@ let
# The Qt glue generator (universal/cdylib/ui backends) — Qt code is
# the Qt layer's product; logos-cpp-generator keeps Qt-free outputs.
logosQtGenerator = logos-qt-sdk.packages.${common.buildSystemFor system}.logos-qt-generator;
# The cdylib Qt-plugin glue generator lives in logos-plugin-qt (the Qt
# plugin BACKEND owns the glue; the SDK does not). logos-qt-sdk still
# ships an older copy of the SAME emitter, and calling that one is not a
# compile error — it silently emits STALE glue. That is how a
# host-services grant went undelivered while every build stayed green.
logosQtHostGenerator =
logos-plugin-qt.packages.${common.buildSystemFor system}.logos-qt-host-generator;
logosProtocolPkg = logos-protocol.packages.${system}.default;
logosModule = logos-module.packages.${system}.default;
@@ -592,7 +599,7 @@ let
inherit externalLibs;
# pkgs.jq is target-typed too and jq runs in preConfigure
# (modulePreConfigure.nix:203). buildPackages == pkgs natively.
extraNativeBuildInputs = extraNativeBuildInputs ++ buildPkgs ++ [ logosSdkBuild logosQtGenerator pkgs.buildPackages.jq ];
extraNativeBuildInputs = extraNativeBuildInputs ++ buildPkgs ++ [ logosSdkBuild logosQtGenerator logosQtHostGenerator pkgs.buildPackages.jq ];
extraBuildInputs = extraBuildInputs ++ runtimePkgs ++ [ logosQtSdk logosProtocolPkg ]
# A Rust staticlib's vendored C may want winpthreads: with <sched.h>
# reachable, aws-lc-sys compiles aws-lc's thread_pthread.c and the
@@ -819,6 +826,13 @@ let
# The Qt glue generator (universal/cdylib/ui backends) — Qt code is
# the Qt layer's product; logos-cpp-generator keeps Qt-free outputs.
logosQtGenerator = logos-qt-sdk.packages.${common.buildSystemFor system}.logos-qt-generator;
# The cdylib Qt-plugin glue generator lives in logos-plugin-qt (the Qt
# plugin BACKEND owns the glue; the SDK does not). logos-qt-sdk still
# ships an older copy of the SAME emitter, and calling that one is not a
# compile error — it silently emits STALE glue. That is how a
# host-services grant went undelivered while every build stayed green.
logosQtHostGenerator =
logos-plugin-qt.packages.${common.buildSystemFor system}.logos-qt-host-generator;
logosProtocolPkg = logos-protocol.packages.${system}.default;
logosModule = logos-module.packages.${system}.default;
@@ -931,7 +945,7 @@ let
# Build unit tests — explicit config wins, otherwise auto-detect tests/CMakeLists.txt
mkTests = import ./mkLogosModuleTests.nix {
inherit nixpkgs lib common parseMetadata;
inherit logos-cpp-sdk logos-protocol logos-qt-sdk;
inherit logos-cpp-sdk logos-protocol logos-qt-sdk logos-plugin-qt;
logos-test-framework = logos-test-framework;
};
+9 -1
View File
@@ -13,7 +13,7 @@
# flakeInputs = inputs;
# mockCLibs = ["gowalletsdk"]; # optional
# };
{ nixpkgs, lib, common, parseMetadata, logos-cpp-sdk, logos-protocol, logos-qt-sdk, logos-test-framework }:
{ nixpkgs, lib, common, parseMetadata, logos-cpp-sdk, logos-protocol, logos-qt-sdk, logos-plugin-qt ? null, logos-test-framework }:
let
modulePreConfigure = import ./modulePreConfigure.nix { inherit lib; };
@@ -79,6 +79,13 @@ let
# The Qt glue generator (universal/cdylib/ui backends) — Qt code is
# the Qt layer's product; logos-cpp-generator keeps Qt-free outputs.
logosQtGenerator = logos-qt-sdk.packages.${common.buildSystemFor system}.logos-qt-generator;
# The cdylib Qt-plugin glue generator lives in logos-plugin-qt (the Qt
# plugin BACKEND owns the glue; the SDK does not). logos-qt-sdk still
# ships an older copy of the SAME emitter, and calling that one is not a
# compile error — it silently emits STALE glue. That is how a
# host-services grant went undelivered while every build stayed green.
logosQtHostGenerator =
logos-plugin-qt.packages.${common.buildSystemFor system}.logos-qt-host-generator;
logosProtocolPkg = logos-protocol.packages.${system}.default;
testFramework = logos-test-framework.packages.${system}.default;
@@ -170,6 +177,7 @@ let
qt6.wrapQtAppsNoGuiHook
logosSdkBuild
logosQtGenerator
logosQtHostGenerator
] ++ extraBuildInputs;
buildInputs = with pkgs; [
+2 -2
View File
@@ -84,7 +84,7 @@ let
-o ./generated_code/${config.name}.lidl
# 2. The uniform Qt-plugin glue over the common module-impl C ABI
# (logos_host loads it unchanged load ABI preserved).
logos-qt-generator --lidl ./generated_code/${config.name}.lidl \
logos-qt-host-generator --lidl ./generated_code/${config.name}.lidl \
--backend cdylib \
${lib.optionalString ((config.concurrency or "single") == "multi") "--concurrency multi"} \
--output-dir ./generated_code
@@ -135,7 +135,7 @@ let
in
''
echo "logos-module-builder: generating cdylib Qt glue (${config.name})..."
logos-qt-generator --lidl "${lidlFile}" \
logos-qt-host-generator --lidl "${lidlFile}" \
--backend cdylib \
${lib.optionalString ((config.concurrency or "single") == "multi") "--concurrency multi"} \
--output-dir ./generated_code