Skip to content

test(nexum-engine): supervisor integration tests for 5 production modules (COW-1068)#30

Open
brunota20 wants to merge 1 commit into
feat/sdk-doctests-cow-1067from
feat/supervisor-integration-tests-cow-1068
Open

test(nexum-engine): supervisor integration tests for 5 production modules (COW-1068)#30
brunota20 wants to merge 1 commit into
feat/sdk-doctests-cow-1067from
feat/supervisor-integration-tests-cow-1068

Conversation

@brunota20

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds 5 supervisor-level integration tests in `crates/nexum-engine/src/supervisor/tests.rs`, one per production module, so the real wit-bindgen + WitBindgenHost adapter + supervisor dispatch path is exercised - not just the MockHost strategy coverage.

Why

Surfaced by the COW-1063 QA pass. Today the 5 production modules have strong unit-test coverage via `&impl Host` + MockHost (145 tests), but they never go through the real supervisor in any test. A regression in the wit-bindgen adapter, the SDK <-> wit `HostError` conversion, or the `Guest::on_event` destructuring would only surface in testnet (COW-1064) or production.

Changes

5 new `tokio::test` cases mirroring the existing `e2e_supervisor_boots_example_module` shape:

Test Subscription path
`e2e_twap_monitor_block_dispatch` Block @ Sepolia 11155111
`e2e_ethflow_watcher_log_dispatch` Log dispatch via `dispatch_log`
`e2e_price_alert_block_dispatch` Block @ Sepolia
`e2e_balance_tracker_block_dispatch` Block @ Sepolia
`e2e_stop_loss_block_dispatch` Block @ Sepolia

Each test:

  • Uses `module_wasm_or_skip(name)` so local runs without `cargo build --target wasm32-wasip2 --release -p ` skip rather than fail (mirrors the BLEU-819 `example_wasm_or_skip()` pattern). COW-1066 ensures CI runs do have the artefacts.
  • Boots with the module's real `module.toml` (not a synthesised manifest), so capability declarations + subscription shapes are honest.
  • Asserts `dispatched == 1` + `alive_count() == 1`.

Shared helpers added next to existing `example_wasm()` ones: `module_wasm()`, `production_module_toml()`, `boot_production_module()`, `synthetic_sepolia_block()`.

Asserts intentionally minimal

Stronger module-specific assertions (local-store `submitted:{uid}` markers, etc.) need either hand-crafted ABI payloads or real chain / orderbook stubs - that work lives in COW-1064 (testnet integration). The MockHost coverage already exercises those state transitions per BLEU-851 / -852 / -854 / -855.

Breaking changes

None.

Testing

  • `cargo test -p nexum-engine` -> 46 passed (was 41).
  • `cargo test --workspace` -> 149 host tests + 6 doctests passing.
  • `cargo clippy --all-targets --workspace -- -D warnings` clean.
  • `cargo fmt --all --check` clean.
  • 0 em-dashes in new code.

AI assistance disclosure

AI Assistance: this change + description was produced by a Claude Code agent (Claude Opus 4.7 1M context). A human (Bruno) reviewed and is accountable for the result.

Linear: COW-1068. Stacks on #29 (COW-1067 SDK doctests) -> #28 (COW-1069 rustdoc gate) -> #27 (COW-1066 CI matrix) -> #26 (COW-1063 QA cleanup).

…ules (COW-1068)

Closes the M3 gap surfaced by the COW-1063 QA pass: every production
module had strong MockHost coverage on its strategy logic, but none
exercised the real wit-bindgen + WitBindgenHost adapter + supervisor
dispatch path. Wit-bindgen / wasmtime / linker regressions could
ship without any test catching them.

Adds 5 integration tests in `crates/nexum-engine/src/supervisor/
tests.rs`, one per production module, modelled on the existing
`e2e_supervisor_boots_example_module` shape:

  e2e_twap_monitor_block_dispatch
  e2e_ethflow_watcher_log_dispatch
  e2e_price_alert_block_dispatch
  e2e_balance_tracker_block_dispatch
  e2e_stop_loss_block_dispatch

Each test:

* Uses `module_wasm_or_skip(name)` so local runs without a fresh
  `cargo build --target wasm32-wasip2 --release -p <module>` are
  skipped rather than failing.
* Boots the supervisor with the module's real `module.toml` (not
  a synthesised manifest), so capability declarations + subscription
  shapes are honest.
* Dispatches a synthetic Block (block-subscribed modules) or Log
  (ethflow-watcher) on Sepolia chain id 11155111.
* Asserts the supervisor delivered the event and the module stayed
  alive.

Three shared helpers added next to the existing `example_wasm()`
ones:

  module_wasm(name) / module_wasm_or_skip(name)
  production_module_toml(rel_path)
  boot_production_module(...)
  synthetic_sepolia_block()

Asserts are intentionally minimal at this layer (dispatched ==
1 / alive_count == 1). Stronger module-specific assertions
(local-store keys for `submitted:{uid}`, etc.) require either
hand-crafted ABI payloads or a real chain/orderbook stub - that
work lives in COW-1064 (testnet integration). The MockHost
coverage already exercises those state transitions per BLEU-851
/ -852 / -854 / -855.

Verified locally:

  cargo test -p nexum-engine                    -> 46 passed (was 41)
  cargo test --workspace                         -> 149 host tests +
                                                    6 doctests passing
  cargo clippy --all-targets --workspace        -> clean
  cargo fmt --all --check                        -> clean
  grep -rn '—' crates/nexum-engine/src/supervisor/tests.rs -> 0

Linear: COW-1068. Stacks on COW-1066 + COW-1069 + COW-1067.
@linear-code

linear-code Bot commented Jun 17, 2026

Copy link
Copy Markdown

COW-1068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant