|
151 | 151 | }; |
152 | 152 | }; |
153 | 153 |
|
| 154 | + # Production variant for catalogs that declare wasm resource-profile resolvers. Keep the |
| 155 | + # default package lightweight; consumers opt into the wasmtime closure explicitly. |
| 156 | + st2WasmResolver = st2.overrideAttrs (old: { |
| 157 | + pname = "st2-wasm-resolver"; |
| 158 | + cargoBuildFeatures = (old.cargoBuildFeatures or [ ]) ++ [ "wasm-resolver" ]; |
| 159 | + cargoCheckFeatures = (old.cargoCheckFeatures or [ ]) ++ [ "wasm-resolver" ]; |
| 160 | + # Wasmtime's Cranelift build and the feature-gated resolver tests need the Rust toolchain |
| 161 | + # inherited from buildRustPackage plus an LLVM linker on every supported platform. |
| 162 | + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.lld ]; |
| 163 | + }); |
| 164 | + |
| 165 | + # Non-vacuous feature gate: both the runner's live resync integration and agent-spec's wasm |
| 166 | + # ABI/containment suite compile and execute with the same features as the production variant. |
| 167 | + st2WasmResolverCheck = st2WasmResolver.overrideAttrs (_: { |
| 168 | + pname = "st2-wasm-resolver-check"; |
| 169 | + cargoTestFlags = [ |
| 170 | + "--workspace" |
| 171 | + "--test" |
| 172 | + "resync" |
| 173 | + "--test" |
| 174 | + "profile_wasm" |
| 175 | + ]; |
| 176 | + }); |
| 177 | + |
154 | 178 | # Narrow sandbox-safe integration gate for the atomic snapshot boundary. The main package |
155 | 179 | # deliberately omits the broad doctor suite because some doctor cases exercise facilities |
156 | 180 | # unavailable in the Nix sandbox. A dedicated target containing exactly one test makes the |
|
249 | 273 | in |
250 | 274 | { |
251 | 275 | packages.st2 = st2; |
| 276 | + packages.st2-wasm-resolver = st2WasmResolver; |
252 | 277 | packages.default = st2; |
253 | 278 |
|
254 | 279 | # `nix flake check` is the whole CI: it builds the package — which runs |
|
266 | 291 | checks.message-cli = st2MessageCli; |
267 | 292 | checks.parked-recovery = st2ParkedRecovery; |
268 | 293 | checks.otel-export = st2OtelExport; |
| 294 | + checks.wasm-resolver-feature = st2WasmResolverCheck; |
| 295 | + # Exercise the shipped binary, not a cargo-side surrogate: its version entrypoint runs and |
| 296 | + # the same artifact strictly admits a catalog carrying a real wasm profile module. |
| 297 | + checks.wasm-resolver-artifact = pkgs.runCommand "st2-wasm-resolver-artifact-${version}" { } '' |
| 298 | + ${st2WasmResolver}/bin/st2 --version | |
| 299 | + ${pkgs.gnugrep}/bin/grep -E '^st2 [^[:space:]]+' >/dev/null |
| 300 | +
|
| 301 | + catalog="$TMPDIR/catalog" |
| 302 | + mkdir -p "$catalog/resolvers" "$catalog/h/worker" |
| 303 | + cp ${self}/crates/agent-spec/tests/fixtures/demo_resolver.wasm \ |
| 304 | + "$catalog/resolvers/goal.wasm" |
| 305 | + cat > "$catalog/catalog.kdl" <<'EOF' |
| 306 | + profile "dev.schickling.agent-goal" { |
| 307 | + wasm "resolvers/goal.wasm" |
| 308 | + class "immediate" |
| 309 | + } |
| 310 | + EOF |
| 311 | + cat > "$catalog/h/worker/agent.kdl" <<'EOF' |
| 312 | + agent "worker" { |
| 313 | + host "h" |
| 314 | + command "true" |
| 315 | + resource "goal" uri="dev.schickling.agent-goal://h/worker" reason="Mission." |
| 316 | + } |
| 317 | + EOF |
| 318 | +
|
| 319 | + ${st2WasmResolver}/bin/st2 validate "$catalog" --host h --strict |
| 320 | + touch "$out" |
| 321 | + ''; |
269 | 322 |
|
270 | 323 | # Real producer-consumer contract: st2 consumes `pty list --json` from the exact pty |
271 | 324 | # revision that owns fleet observation. Fake CLI fixtures below still cover malformed |
|
0 commit comments