diff --git a/.github/ci-paths-filter.yml b/.github/ci-paths-filter.yml index 2978e12489e..a14600b8694 100644 --- a/.github/ci-paths-filter.yml +++ b/.github/ci-paths-filter.yml @@ -288,3 +288,25 @@ storage: - 'rust-toolchain.toml' - '.gitmodules' - 'vendor/**' +# The host side of the inbound event queues against the verified TinyEventQueues +# release (tests/inbound_module_e2e.rs). Its `e2e-test-support` gate keeps that +# target out of the product feature set, so the rust-cov shards skip it; this +# area arms the one lane that runs it (#8155). The module pin is the gitlink. +inbound: + - '.github/workflows/ci-*.yml' + - '.github/ci-paths-filter.yml' + - 'scripts/ci/self-hosted/**' + - 'scripts/ci-cancel-aware.sh' + - 'crates/openhuman-core/src/inbound/**' + - 'crates/openhuman-core/src/modules/**' + - 'crates/openhuman-core/src/integrations/composio/bus/**' + - 'crates/openhuman-core/src/skills/webhooks/**' + - 'tests/inbound_module_e2e.rs' + - 'Cargo.toml' + - 'Cargo.lock' + - 'crates/openhuman-*/Cargo.toml' + - '.gitmodules' + - 'vendor/tinyeventqueues' + - 'vendor/tinyeventqueues/**' + - 'vendor/tinybus' + - 'vendor/tinybus/**' diff --git a/.github/workflows/ci-lanes.yml b/.github/workflows/ci-lanes.yml index 07c2e6db5f4..b70035a42d4 100644 --- a/.github/workflows/ci-lanes.yml +++ b/.github/workflows/ci-lanes.yml @@ -49,6 +49,7 @@ jobs: toolchain-image: ${{ steps.filter.outputs['toolchain-image'] }} install-ps1: ${{ steps.filter.outputs.install_ps1 }} storage: ${{ steps.filter.outputs.storage }} + inbound: ${{ steps.filter.outputs.inbound }} coverage: ${{ steps.filter.outputs.frontend == 'true' || steps.filter.outputs['rust-core'] == 'true' || steps.filter.outputs['rust-tauri'] == 'true' }} steps: - name: Checkout filter and lane plan @@ -80,6 +81,7 @@ jobs: CI_AREA_TOOLCHAIN_IMAGE: ${{ steps.filter.outputs['toolchain-image'] }} CI_AREA_INSTALL_PS1: ${{ steps.filter.outputs.install_ps1 }} CI_AREA_STORAGE: ${{ steps.filter.outputs.storage }} + CI_AREA_INBOUND: ${{ steps.filter.outputs.inbound }} run: | set -euo pipefail matrix="$(node scripts/ci/self-hosted/lanes.mjs --profile hosted --print-matrix)" @@ -124,6 +126,7 @@ jobs: CI_AREA_TOOLCHAIN_IMAGE: ${{ needs.plan.outputs['toolchain-image'] }} CI_AREA_INSTALL_PS1: ${{ needs.plan.outputs['install-ps1'] }} CI_AREA_STORAGE: ${{ needs.plan.outputs.storage }} + CI_AREA_INBOUND: ${{ needs.plan.outputs.inbound }} steps: - name: Free disk space # Inside the container /opt/hostedtoolcache is bind-mounted at /__t; @@ -195,7 +198,7 @@ jobs: run: bash scripts/ci/install-pinned-toolchain.sh - name: Cache Rust build artifacts - if: matrix.group == 'rust-lint' || startsWith(matrix.group, 'rust-cov-') || matrix.group == 'tauri' || matrix.group == 'storage' + if: matrix.group == 'rust-lint' || startsWith(matrix.group, 'rust-cov-') || matrix.group == 'tauri' || matrix.group == 'storage' || matrix.group == 'inbound-e2e' uses: Swatinem/rust-cache@v2 with: workspaces: | @@ -279,6 +282,10 @@ jobs: if: ${{ !cancelled() && contains(fromJSON(steps.lanes.outputs.lanes || '[]'), 'tauri') }} run: node scripts/ci/self-hosted/lanes.mjs --wait tauri + - name: "Lane: inbound module E2E" + if: ${{ !cancelled() && contains(fromJSON(steps.lanes.outputs.lanes || '[]'), 'inbound-e2e') }} + run: node scripts/ci/self-hosted/lanes.mjs --wait inbound-e2e + - name: "Lane: install.ps1 (Pester)" if: ${{ !cancelled() && contains(fromJSON(steps.lanes.outputs.lanes || '[]'), 'pester') }} run: node scripts/ci/self-hosted/lanes.mjs --wait pester diff --git a/docs/ci-self-hosted.md b/docs/ci-self-hosted.md index f6d9c2c43db..5461dfb7171 100644 --- a/docs/ci-self-hosted.md +++ b/docs/ci-self-hosted.md @@ -27,6 +27,7 @@ unused `ex63` profile. | `rust-gates-off` | gates-off checks and gate-contract tests, kernel floor, dep-sim calibration | | `tauri` | Tauri clippy and coverage | | `pester` | `install.ps1` tests | +| `inbound-e2e` | test modules from the registry, then `tests/inbound_module_e2e.rs` against the verified TinyEventQueues release (its `e2e-test-support` gate keeps it out of `rust-cov`); armed by the `inbound` area only | How lanes behave: @@ -90,7 +91,7 @@ Lanes are grouped into jobs sized for 4-core, ~14 GB runners: `checks`, `rust-lint` (lint and gates-off in turn), `rust-cov-core`, `rust-cov-product`, `rust-cov-facades` and `rust-cov-tui` (the `rust-cov` lane in four jobs, each a whole section of `scripts/ci/rust-coverage.sh`, picked by `OH_COV_SHARD`; the gate merges their -lcov files and fails if any is missing), `tauri` and `pester`. +lcov files and fails if any is missing), `tauri`, `pester` and `inbound-e2e`. Groups whose areas are untouched don't start. ## Measuring diff --git a/scripts/__tests__/self-hosted-lanes.test.mjs b/scripts/__tests__/self-hosted-lanes.test.mjs index aa83de8d76c..032d44f58e7 100644 --- a/scripts/__tests__/self-hosted-lanes.test.mjs +++ b/scripts/__tests__/self-hosted-lanes.test.mjs @@ -11,6 +11,7 @@ import { fileURLToPath } from "node:url"; import { AREA_ENV, HOSTED_GROUPS, + INBOUND_MODULE_E2E, RUST_COV_SHARDS, areasFromEnv, buildPlan, @@ -1241,3 +1242,93 @@ test("the ex63 profile logs where the scratch disk's space goes at each lane end ); assert.equal(diskUsageReport({ profile: "ex63", scratch: "", run }), null); }); + +test("the inbound area runs the inbound module E2E against the staged modules, and only then (#8155)", () => { + for (const profile of ["hosted", "ex63"]) { + const env = profile === "ex63" ? EX63_ENV : {}; + const armed = buildPlan({ profile, areas: { ...NONE, inbound: true }, env }); + assert.deepEqual(validatePlan(armed), [], profile); + const lane = armed.lanes.find((l) => l.name === "inbound-e2e"); + assert.equal(lane.active, true, profile); + const run = lane.checks.find((c) => c.name === "inbound-module-e2e"); + assert.equal(run.when, true); + assert.deepEqual(run.needs, ["install-test-modules"]); + // The staged release paths come from the installer's env file. + assert.match(run.run, /^set -a && \. ci-out\/test-modules\.env && set \+a && /); + assert.ok(run.run.endsWith(INBOUND_MODULE_E2E)); + assert.match( + lane.checks.find((c) => c.name === "install-test-modules").run, + /install-test-modules\.sh/, + ); + + const rustOnly = buildPlan({ profile, areas: { ...NONE, rustCore: true }, env }); + assert.equal( + rustOnly.lanes.find((l) => l.name === "inbound-e2e").active, + false, + `${profile}: a core change outside the inbound paths does not pay for the build`, + ); + } + const hosted = (areas) => + hostedMatrix(buildPlan({ profile: "hosted", areas })).map((g) => g.group); + assert.ok(hosted({ ...NONE, inbound: true }).includes("inbound-e2e")); + assert.ok(!hosted({ ...NONE, rustCore: true }).includes("inbound-e2e")); +}); + +test("the inbound module E2E names exactly the gates its target requires", () => { + const manifest = fs.readFileSync( + path.join(repoRoot, "crates/openhuman-cli/Cargo.toml"), + "utf8", + ); + const block = manifest + .split("[[test]]") + .find((b) => /^name = "inbound_module_e2e"$/m.test(b)); + assert.ok(block, "crates/openhuman-cli declares the inbound_module_e2e target"); + const required = JSON.parse(block.match(/^required-features = (\[.*\])$/m)[1]); + const features = INBOUND_MODULE_E2E.match(/--features (\S+)/)[1].split(","); + assert.deepEqual([...features].sort(), [...required].sort()); + assert.match(INBOUND_MODULE_E2E, /-p openhuman-cli .*--test inbound_module_e2e$/); +}); + +test("the inbound path filter arms its lane for the inbound host, the module host and the module pin", () => { + const filters = fs.readFileSync( + path.join(repoRoot, ".github/ci-paths-filter.yml"), + "utf8", + ); + const block = filters.split(/^inbound:\s*$/m)[1].split(/^\S[^\n]*:/m)[0]; + for (const entry of [ + ".github/ci-paths-filter.yml", + "scripts/ci/self-hosted/**", + "crates/openhuman-core/src/inbound/**", + "crates/openhuman-core/src/modules/**", + "tests/inbound_module_e2e.rs", + "vendor/tinyeventqueues", + ]) { + assert.ok(block.includes(`'${entry}'`), `${entry} must arm the inbound area`); + } + assert.match(ciLanes, /CI_AREA_INBOUND: \$\{\{ steps\.filter\.outputs\.inbound \}\}/); + // The plan job schedules the group; the lane job rebuilds the plan from + // its own environment, so the flag must reach it too or the lane runs + // nothing and passes. + assert.match(ciLanes, /^ {6}inbound: \$\{\{ steps\.filter\.outputs\.inbound \}\}$/m); + assert.match(ciLanes, /CI_AREA_INBOUND: \$\{\{ needs\.plan\.outputs\.inbound \}\}/); +}); + +test("every lane has a step in ci-lanes.yml that waits on it", () => { + const plan = buildPlan({ profile: "hosted", areas: ALL }); + for (const lane of plan.lanes) { + assert.ok( + ciLanes.includes(`lanes.mjs --wait ${lane.name}\n`), + `ci-lanes.yml has no \`Lane:\` step for ${lane.name}`, + ); + } +}); + +test("every area flag the plan job reads reaches the lane job", () => { + for (const name of Object.values(AREA_ENV)) { + assert.match( + ciLanes, + new RegExp(`${name}: \\$\\{\\{ needs\\.plan\\.outputs`), + `${name} is not forwarded to the lane job`, + ); + } +}); diff --git a/scripts/__tests__/test-module-installation.test.mjs b/scripts/__tests__/test-module-installation.test.mjs index 4cde2fe38bb..793d7118591 100644 --- a/scripts/__tests__/test-module-installation.test.mjs +++ b/scripts/__tests__/test-module-installation.test.mjs @@ -448,7 +448,7 @@ for (const runner of ["test-rust-with-mock.sh", "test-rust-e2e.sh"]) { writeFileSync(join(boxDir, "libtinybox.so"), "fixture"); // The E2E runner stages these releases too. Cache them as well: staging // stops on a download that fails, so an uncached one fails the runner. - for (const id of ["tinyconnectors", "tinyflows", "tinysearch"]) { + for (const id of ["tinyconnectors", "tinyflows", "tinysearch", "tinyeventqueues"]) { const dir = join(root, `target/test-modules/${id}/test-digest`); mkdirSync(dir, { recursive: true }); writeFileSync(join(dir, `lib${id}_module.so`), "fixture"); diff --git a/scripts/ci/self-hosted/lanes-plan.mjs b/scripts/ci/self-hosted/lanes-plan.mjs index e0fff2037fb..332738e1e91 100644 --- a/scripts/ci/self-hosted/lanes-plan.mjs +++ b/scripts/ci/self-hosted/lanes-plan.mjs @@ -26,6 +26,7 @@ export const AREA_ENV = { toolchainImage: "CI_AREA_TOOLCHAIN_IMAGE", installPs1: "CI_AREA_INSTALL_PS1", storage: "CI_AREA_STORAGE", + inbound: "CI_AREA_INBOUND", }; /** Read the area flags from an environment object. Missing means false. */ @@ -72,11 +73,27 @@ export const HOSTED_GROUPS = [ container: true, })), { group: "tauri", lanes: ["tauri"], maxParallel: 1, container: true }, + // One integration target with a feature set of its own: a runner and a + // Rust cache of its own, armed only by the `inbound` area. + { + group: "inbound-e2e", + lanes: ["inbound-e2e"], + maxParallel: 1, + container: true, + }, // pwsh ships on the bare ubuntu-latest image, not in the CI container. { group: "pester", lanes: ["pester"], maxParallel: 1, container: false }, ]; +/** + * The inbound module E2E, with the gates its target requires + * (crates/openhuman-cli/Cargo.toml), against the staged release modules. + */ +export const INBOUND_MODULE_E2E = + "bash scripts/ci-cancel-aware.sh cargo test -p openhuman-cli" + + " --features modules,inbound-queues,e2e-test-support --test inbound_module_e2e"; + const CORE_PRODUCT = '"$(bash scripts/ci/product-features.sh --core)"'; /** @@ -591,6 +608,32 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) { }, ], }, + { + // tests/inbound_module_e2e.rs: the Composio admission path into the + // digest-verified TinyEventQueues release and back through the host's + // production `Deliver` (#8155). Its `e2e-test-support` gate is not in + // the product set, so rust-coverage.sh skips the target; it runs here, + // for changes to the inbound host, the module host or the module pin. + name: "inbound-e2e", + // Compiles the core crate; hosted runners can cap heavy-compile slots + // (lanes.mjs). Lower number = served first. + heavy: 2, + targetDir: targetDir("build"), + env: { ...rustEnv }, + checks: [ + { + name: "install-test-modules", + when: areas.inbound, + run: `bash scripts/ci/self-hosted/install-test-modules.sh "${modulesDir}" ${modulesEnvFile}`, + }, + { + name: "inbound-module-e2e", + when: areas.inbound, + needs: ["install-test-modules"], + run: withModules(INBOUND_MODULE_E2E), + }, + ], + }, { name: "tauri", // Compiles the core crate; hosted runners can cap heavy-compile slots diff --git a/scripts/test-rust-e2e.sh b/scripts/test-rust-e2e.sh index 7a5089a1c5c..88b287a0775 100755 --- a/scripts/test-rust-e2e.sh +++ b/scripts/test-rust-e2e.sh @@ -232,8 +232,8 @@ else # Shell command analysis and the storage URL E2E suites load TinyBox through # the native module path; the ignored MCP registry cases need TinyMCP. Both # come from the registry-pinned release, digest-verified before any - # subprocess starts. - for released_id in tinyconnectors tinyflows tinysearch tinybox tinymcp; do + # subprocess starts. inbound_module_e2e loads the TinyEventQueues release. + for released_id in tinyconnectors tinyflows tinysearch tinybox tinymcp tinyeventqueues; do released_dir="$(stage_release_module "$released_id" "$module_platform" "$module_ext")" export OPENHUMAN_MODULE_PATH="$released_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" done @@ -260,6 +260,10 @@ fi if [ "${#e2e_source_ids[@]}" -gt 0 ]; then echo "[rust-e2e] Building pinned local test modules: ${e2e_source_ids[*]} ..." stage_source_modules "${e2e_source_ids[@]}" + # inbound_module_e2e loads the TinyEventQueues release in either mode; it is + # not among the modules built from source. + released_dir="$(stage_release_module tinyeventqueues "$module_platform" "$module_ext")" + export OPENHUMAN_MODULE_PATH="$released_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" fi for source_id in ${e2e_source_ids[@]+"${e2e_source_ids[@]}"}; do export OPENHUMAN_MODULE_PATH="$REPO_ROOT/target/module-sources/$source_id${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" @@ -386,6 +390,16 @@ for suite in "${SUITES[@]}"; do --test "$suite" -- --test-threads=1 ${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"} continue fi + if [ "$suite" = "inbound_module_e2e" ]; then + # The staged TinyEventQueues release under the host's production Deliver + # (#8155). Its e2e-test-support gate is outside the product set, so name + # it here instead of failing Cargo's required-features check. + echo "[rust-e2e] $CARGO_BIN test --manifest-path Cargo.toml --test $suite (e2e-test-support)" + bash "$SCRIPT_DIR/ci-cancel-aware.sh" "$CARGO_BIN" test \ + --manifest-path Cargo.toml --features "$PRODUCT_FEATURES,e2e-test-support" \ + --test "$suite" -- ${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"} + continue + fi if [ "$suite" = "tinydocs_linked_e2e" ]; then # This local-only E2E target is outside the product feature set. Enable # its required linked implementation explicitly instead of failing Cargo's diff --git a/scripts/test-rust-with-mock.sh b/scripts/test-rust-with-mock.sh index 15bf95ab6e3..95e74b07336 100755 --- a/scripts/test-rust-with-mock.sh +++ b/scripts/test-rust-with-mock.sh @@ -90,7 +90,7 @@ local_source_ids=() if local_module_source_is_source; then local_source_ids+=(tinyconnectors tinyflows tinyjuice tinysearch tinyhosts tinymcp) else - for released_id in tinychannels tinyflows tinyjuice tinysearch; do + for released_id in tinychannels tinyflows tinyjuice tinysearch tinyeventqueues; do released_dir="$(stage_release_module "$released_id" "$wallet_platform" "$module_ext")" if [ "$released_id" = "tinychannels" ]; then tinychannels_dir="$released_dir" @@ -108,6 +108,13 @@ if local_module_source_is_source; then export OPENHUMAN_MODULE_PATH="$released_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" fi +# inbound_module_e2e loads the TinyEventQueues release in either mode; it is +# not among the modules built from source above. +if local_module_source_is_source; then + released_dir="$(stage_release_module tinyeventqueues "$wallet_platform" "$module_ext")" + export OPENHUMAN_MODULE_PATH="$released_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" +fi + # Wallet JSON-RPC E2E sends a recovery phrase only to an attested module. Build # artifacts are deliberately not treated as release-pinned recipients, so use # the checksum-pinned release archive and its accompanying `modules.toml`. @@ -394,6 +401,10 @@ run_full_suite() { run_in_process_modules "$@" elif [[ "$target" =~ ^json_rpc_.*_e2e$ ]]; then run_json_rpc_e2e "$target" "$@" + elif [ "$target" = "inbound_module_e2e" ]; then + # Outside the product set (e2e-test-support); it loads the staged + # TinyEventQueues release from OPENHUMAN_MODULE_PATH (#8155). + cargo_test --features modules,inbound-queues,e2e-test-support --test "$target" -- "$@" elif [ "$target" = "tinymcp_storage_smoke_e2e" ]; then OPENHUMAN_MODULE_PATH="$tinymcp_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" \ cargo_test --features e2e-test-support --test "$target" -- "$@"