Skip to content

test(reborn): add phase 1 integration coverage - #3076

Merged
serrrfirat merged 2 commits into
reborn-integrationfrom
reborn-integration-tests-phase1
Apr 29, 2026
Merged

serrrfirat merged 2 commits into
reborn-integrationfrom
reborn-integration-tests-phase1

Conversation

@serrrfirat

Copy link
Copy Markdown
Collaborator

Summary

Adds Phase 1 Reborn caller-level integration coverage from #3067 now that ironclaw_processes (#3017) and ironclaw_dispatcher (#3023) have landed on reborn-integration.

This PR intentionally adds tests only; no production behavior changes.

Coverage

  • crates/ironclaw_dispatcher/tests/runtime_dispatcher_integration.rs

    • routes an already-authorized request through the public CapabilityDispatcher trait object
    • preserves scope/capability/input/mounts into the runtime adapter
    • returns normalized dispatch results and reconciles resources
    • emits dispatch lifecycle events
    • fails closed for missing runtime backends before reservation/adapter execution
    • verifies descriptor/package runtime mismatch is rejected at the public extension registry seam
  • crates/ironclaw_processes/tests/process_dispatch_integration.rs

    • completes a background process through ProcessServices + ProcessHost
    • persists/readbacks result and output through the host surface
    • emits process lifecycle events through EventingProcessStore
    • verifies kill transitions to Killed, signals cancellation, blocks late executor success from overwriting terminal state, and suppresses misleading completion events

Verification

CARGO_TARGET_DIR=/tmp/ironclaw-reborn-integration-target \
  cargo test -p ironclaw_dispatcher -p ironclaw_processes

CARGO_TARGET_DIR=/tmp/ironclaw-reborn-integration-target \
  cargo clippy -q -p ironclaw_dispatcher -p ironclaw_processes --all-targets -- -D warnings

cargo fmt --check
git diff --check

Refs #3067.

@github-actions github-actions Bot added size: XS < 10 changed lines (excluding docs) risk: low Changes to docs, tests, or low-risk modules contributor: core 20+ merged PRs labels Apr 29, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive integration tests for the RuntimeDispatcher and process dispatching services. The new tests cover scenarios such as authorized request routing, handling missing runtime backends, registry validation, background process completion, and process termination logic. Feedback was provided to improve the accuracy of the dispatch_error_for_runtime test helper by passing the actual capability ID instead of using a hardcoded value, which enhances the reusability of the helper.

Comment on lines +243 to +256
fn dispatch_error_for_runtime(
runtime: RuntimeKind,
kind: RuntimeDispatchErrorKind,
) -> DispatchError {
match runtime {
RuntimeKind::Wasm => DispatchError::Wasm { kind },
RuntimeKind::Script => DispatchError::Script { kind },
RuntimeKind::Mcp => DispatchError::Mcp { kind },
RuntimeKind::FirstParty | RuntimeKind::System => DispatchError::UnsupportedRuntime {
capability: CapabilityId::new("system.unsupported").unwrap(),
runtime,
},
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dispatch_error_for_runtime helper function uses a hardcoded capability ID system.unsupported when creating a DispatchError::UnsupportedRuntime. This could be misleading if this helper is used in more tests.

The RecordingAdapter has access to the actual capability_id from the RuntimeAdapterRequest. It would be better to pass this to dispatch_error_for_runtime and use it to construct the error, making the test helper more accurate and reusable. This aligns with the repository practice of providing semantically correct and clear error messages.

Note: You will also need to update the call sites in RecordingAdapter::dispatch_json to pass request.capability_id.

Suggested change
fn dispatch_error_for_runtime(
runtime: RuntimeKind,
kind: RuntimeDispatchErrorKind,
) -> DispatchError {
match runtime {
RuntimeKind::Wasm => DispatchError::Wasm { kind },
RuntimeKind::Script => DispatchError::Script { kind },
RuntimeKind::Mcp => DispatchError::Mcp { kind },
RuntimeKind::FirstParty | RuntimeKind::System => DispatchError::UnsupportedRuntime {
capability: CapabilityId::new("system.unsupported").unwrap(),
runtime,
},
}
}
fn dispatch_error_for_runtime(
runtime: RuntimeKind,
kind: RuntimeDispatchErrorKind,
capability_id: &CapabilityId,
) -> DispatchError {
match runtime {
RuntimeKind::Wasm => DispatchError::Wasm { kind },
RuntimeKind::Script => DispatchError::Script { kind },
RuntimeKind::Mcp => DispatchError::Mcp { kind },
RuntimeKind::FirstParty | RuntimeKind::System => DispatchError::UnsupportedRuntime {
capability: capability_id.clone(),
runtime,
},
}
}
References
  1. Create specific error variants for different failure modes to provide semantically correct and clear error messages.

@serrrfirat
serrrfirat merged commit 6aed6f8 into reborn-integration Apr 29, 2026
15 checks passed
@serrrfirat
serrrfirat deleted the reborn-integration-tests-phase1 branch April 29, 2026 13:40
theredspoon pushed a commit to theredspoon/ironclaw that referenced this pull request Jun 21, 2026
* test(reborn): add phase 1 integration coverage

* test(reborn): stabilize process kill integration test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: low Changes to docs, tests, or low-risk modules size: XS < 10 changed lines (excluding docs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant