Skip to content

Commit 6f0b8b6

Browse files
committed
fix(ffi): pin musl toolchain, fix builtins default-features, bundle cel + valkey
- release-ffi.yaml: install the Rust toolchain with @1.96.0 (matching rust-toolchain.toml) instead of @stable. @stable added the musl target to the stable toolchain, but the repo override forced 1.96.0 at build time, so the cross target was missing (E0463: can't find crate for core). The two musl legs failed; gnu/darwin (host targets) passed. - Cargo.toml: set default-features = false on the cpex-builtins workspace dependency. Members declared default-features = false but it was being ignored (the inherited workspace entry didn't specify it), so cpex-builtins built with all defaults. This restores cpex's granular jwt/oauth/... feature subsetting and clears the 'default-features is ignored' warning. - cpex-ffi: bundle both PDPs (cedar-direct + cel) and the Valkey session store in the default .a; drop the now-redundant opt-in valkey feature. Factory registration is feature-driven via cpex-builtins, so no code wiring needed. Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
1 parent 0d4efb3 commit 6f0b8b6

4 files changed

Lines changed: 27 additions & 17 deletions

File tree

.github/workflows/release-ffi.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@ jobs:
6363
uses: actions/checkout@v7
6464

6565
- name: Install Rust toolchain
66-
# dtolnay/rust-toolchain is the de-facto rustup action.
67-
# `stable` picks the latest stable; pin if we need a floor.
68-
uses: dtolnay/rust-toolchain@stable
66+
# Pin to the same toolchain as rust-toolchain.toml (1.96.0). Using
67+
# @stable here installs the matrix target onto `stable`, but the
68+
# repo's rust-toolchain.toml overrides cargo to 1.96.0 at build time,
69+
# so the cross (musl) target ends up missing on the toolchain actually
70+
# used (E0463: can't find crate for `core`). Pinning installs the
71+
# target onto 1.96.0 directly. Mirrors the other workflows.
72+
uses: dtolnay/rust-toolchain@1.96.0
6973
with:
7074
targets: ${{ matrix.target }}
7175

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ regex = "1"
105105
cpex-core = { path = "crates/cpex-core", version = "0.2.0-alpha.5" }
106106
cpex-orchestration = { path = "crates/cpex-orchestration", version = "0.2.0-alpha.5" }
107107
cpex-sdk = { path = "crates/cpex-sdk", version = "0.2.0-alpha.5" }
108-
cpex-builtins = { path = "crates/cpex-builtins", version = "0.2.0-alpha.5" }
108+
cpex-builtins = { path = "crates/cpex-builtins", version = "0.2.0-alpha.5", default-features = false }
109109
apl-core = { path = "crates/apl-core", version = "0.2.0-alpha.5" }
110110
apl-cmf = { path = "crates/apl-cmf", version = "0.2.0-alpha.5" }
111111
apl-cpex = { path = "crates/apl-cpex", version = "0.2.0-alpha.5" }

crates/cpex-ffi/Cargo.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,18 @@ apl-cpex = { workspace = true }
3333
# cpex-builtins, whose `register_builtins` expands to explicit
3434
# `register_factory` calls — so the factory symbols survive in the
3535
# staticlib (no inventory/linkme link-section GC hazard). The feature set
36-
# below is the exact bundle the default `.a` ships: four hook plugins plus
37-
# the cedar-direct PDP (note: NOT `cel`, matching the prior footprint).
36+
# below is the exact bundle the default `.a` ships: four hook plugins, both
37+
# bundled PDPs (cedar-direct and cel), and the Valkey session store. Valkey
38+
# pulls a redis client + rustls TLS stack, so it adds materially to the `.a`
39+
# size and to the musl cross-build surface.
3840
cpex-builtins = { workspace = true, default-features = false, features = [
3941
"pii-scanner",
4042
"audit-logger",
4143
"identity-jwt",
4244
"delegator-oauth",
4345
"cedar-direct",
46+
"cel",
47+
"valkey",
4448
] }
4549
tokio = { workspace = true }
4650
serde = { workspace = true }
@@ -50,11 +54,9 @@ serde_bytes = { workspace = true }
5054
tracing = { workspace = true }
5155

5256
[features]
57+
# No opt-in features: the bundled set (including the Valkey session store) is
58+
# fixed in the cpex-builtins dependency above.
5359
default = []
54-
# Opt-in Valkey-backed SessionStore (redis client + rustls TLS stack).
55-
# Routed through cpex-builtins so the `.a` artifact size is unaffected
56-
# without the feature. Build with `cargo build -p cpex-ffi --features valkey`.
57-
valkey = ["cpex-builtins/valkey"]
5860

5961
[dev-dependencies]
6062
async-trait = { workspace = true }

crates/cpex-ffi/src/apl.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ use crate::{CpexManagerInner, RC_INVALID_HANDLE, RC_OK, RC_PANIC};
4141
/// - `identity/jwt` → identity-jwt
4242
/// - `delegator/oauth` → delegator-oauth
4343
///
44-
/// Bundled PDP factory (consulted for `global.apl.pdp[]` entries):
44+
/// Bundled PDP factories (consulted for `global.apl.pdp[]` entries):
4545
/// - `cedar-direct` → cedar-direct
46+
/// - `cel` → cel
4647
///
47-
/// With the `valkey` cargo feature, the Valkey-backed session store factory
48-
/// is additionally wired.
48+
/// Bundled session store factory (consulted for `global.apl.session_store`):
49+
/// - `valkey` → Valkey-backed SessionStore
50+
///
51+
/// The default in-process `MemorySessionStore` stays active unless the config
52+
/// selects a `session_store`.
4953
///
5054
/// Returns `RC_OK` on success, `RC_INVALID_HANDLE` if `mgr` is null, or
5155
/// `RC_PANIC` if registration panicked (caught at the FFI boundary).
@@ -69,10 +73,10 @@ pub unsafe extern "C" fn cpex_apl_install(mgr: *const CpexManagerInner) -> c_int
6973

7074
// APL config visitor + PDP / session-store factories. The factory
7175
// sets are consulted for `global.apl.pdp[]` and
72-
// `global.apl.session_store` entries; cedar-direct is the bundled
73-
// PDP default and the Valkey store is wired when the `valkey`
74-
// feature is on (otherwise the lists are empty and the in-process
75-
// MemorySessionStore default stays active). The visitor keeps a
76+
// `global.apl.session_store` entries; cedar-direct and cel are the
77+
// bundled PDPs and the Valkey session-store factory is bundled too.
78+
// Unless the config selects a `session_store`, the in-process
79+
// MemorySessionStore default stays active. The visitor keeps a
7680
// Weak<PluginManager> (see CpexManagerInner) that upgrades during
7781
// load_config_yaml.
7882
let mut opts = apl_cpex::AplOptions::in_process();

0 commit comments

Comments
 (0)