Vega
Capability Development

Quality

Production-quality Capabilities are validated before Runtime use, tested without hardware, tested with real dependencies in controlled conditions, and observed through structured logs, health, progress, and error contracts.

Concepts

  • Unit test: verifies Provider or adapter behavior in isolation.
  • Conformance test: exercises initialize, health, execute, and shutdown through the SDK harness.
  • Integration test: verifies a real vendor service or device boundary.
  • Hardware-in-the-loop test: verifies actual physical behavior and safety.
  • Observability: logs, traces, health, diagnostics, and progress evidence.

Testing workflow

Manifest validation
Unit tests
SDK conformance harness
Controlled integration
Hardware-in-the-loop
Release decision

Use fake_initialization_context, fake_execution_context, TestClock, ProgressCollector, and InMemoryArtifactStore for deterministic tests.

python
import pytest
from vega_capability_sdk import CapabilityExecutionRequest
from vega_capability_sdk.testing import ProviderContractHarness
@pytest.mark.asyncio
async def test_provider_contract() -> None:
provider = EchoProvider()
request = CapabilityExecutionRequest(
execution_id="e-1", capability_id="example.echo",
provider_id="example.echo.provider", action_id="example.echo.run",
action_version="1.0.0", inputs={"text": "hello"},
)
report = await ProviderContractHarness().run(provider, request)
report.raise_for_failures()

Validation and static analysis

Run package validation before tests:

bash
vega-capability validate . --json
pytest
ruff check src tests
mypy src

The validator checks package structure, manifest, schemas, paths, resources, execution declarations, contracts, and SDK compatibility. It does not import or start the Provider, validate live hardware, or install dependencies.

Debugging and observability

Observed failure
Reproduce with fake or mock
Structured logs & trace
Check schema, context, error category
Inspect adapter boundary
Fix & rerun tests

Use context-bound structured logging. Include non-secret identifiers and backend status; never include raw secret values. Health checks should be side-effect free. Test cancellation before I/O and during long-running work. Test recovery probes for each declared recovery behavior.

Reliability and performance

Measure latency, memory, vendor timeouts, cancellation response, and artifact size for your actual workload. Test resource contention and repeated startup/shutdown. The conformance harness is a protocol baseline, not proof of physical safety, vendor reliability, or Runtime integration correctness.