Develop and extend
Guide Available

Testing and Verification

Changed behavior needs the lowest reliable coverage plus authentication, authorization, validation, not-found, and conflict cases where relevant. Widen verification only when the contract depends on the wider environment.

For
All contributors
On this page
  1. Runtime workflow selection
  2. Inbound Email Worker
  3. API and isolation coverage
  4. Communications and Runtime coverage
  5. UI coverage
  6. Commands and failure handling
01

Runtime workflow selection

CI selects runtime image workflows using explicit path expressions. OpenClaw startup scripts are included: a change under api/domains/agents/scripts/openclaw/, including init-openclaw.js, selects the OpenClaw image workflow. Shared messaging scripts select both runtime workflows.

  1. 01.1

    The OpenClaw builder and shared Communications runtime adapter remain image-workflow selection gaps. API paths still select the normal API workflow; “neither” does not mean no CI runs. Automatic selection also does not determine which runtime contracts a change needs. Follow the change's actual boundary and the repository's verification guidance.

  2. 01.2

    The image contracts include runtime-facing behavior beyond telemetry: Hermes scheduler/boot-related integration and messaging capture, and OpenClaw completion/tool hooks have dedicated source and fixtures. A successful generic API suite is not proof that the pinned runtime image accepts the generated configuration or invokes its hooks.

  3. 01.3

    hermes-base/: Hermes.

  4. 01.4

    api/domains/agents/builders/hermes.py: Hermes.

  5. 01.5

    api/domains/agents/scripts/hermes/: Hermes.

  6. 01.6

    api/runtime_tests/: Hermes.

  7. 01.7

    Under api/tests/fixtures/: hermes_pvc_permissions_driver.py, hermes_session_store_driver.py, or hermes_message_completion_driver.py: Hermes.

  8. 01.8

    openclaw-base/: OpenClaw.

  9. 01.9

    api/domains/agents/scripts/openclaw/: OpenClaw.

  10. 01.10

    api/tests/fixtures/openclaw_message_hooks_driver.mjs: OpenClaw.

  11. 01.11

    api/domains/agents/scripts/messaging/: Both.

  12. 01.12

    api/domains/agents/builders/openclaw.py alone: Neither image workflow.

  13. 01.13

    api/domains/agents/scripts/communications-runtime-adapter.py alone: Neither image workflow.

02

Inbound Email Worker

Worker source lives under workers/email-inbound/. Worker-path changes select the reusable Worker workflow. Its check job installs pinned dependencies and bundles the staging and production Wrangler environments with dry-run deployment commands. This describes CI behavior; bundling is not proof that routing, matching secrets, or end-to-end mail delivery is configured.

03

API and isolation coverage

Integration tests use the real FastAPI app and migrated PostgreSQL with additive dependency overrides. Follow the Given/When/Then helpers, use Hamcrest matchers, and keep each test focused on one behavior. Add unit tests for services, repositories, parsers, builders, and adapters when HTTP composition is not the contract.

  1. 03.1

    Every user-facing route must test the authorization boundary appropriate to its resource. Agent-subordinate Communication Connections, Conversations, Tool Calls, Secrets, configuration, logs, costs, and Agent-private Skills must prove Agent Access as well as Organization isolation.

  2. 03.2

    Connection coverage proves that one Agent may own multiple Connections, including Connections for the same Platform; credentials remain isolated to their owning Connection; plugin-defined duplicate provider identities are rejected; retirement releases credential identity; Conversation and durable thread state retain connection_id; and diagnostics and journal responses remain content- and credential-safe. See api/tests/integration/test_communication_connections.py, api/tests/integration/test_communication_deliveries.py, and api/tests/integration/test_conversations.py.

  3. 03.3

    Missing authentication: 401; missing, cross-Organization, or inaccessible Agent resource: 404.

  4. 03.4

    Visible resource without required action Permission: 403; stale revision or incompatible lifecycle: 409 where defined.

  5. 03.5

    Invalid schema or business input returns the appropriate validation response; list, count, search, and pagination exclude inaccessible resources before totals.

04

Communications and Runtime coverage

Platform Plugins belong to Communications, not Hermes or OpenClaw. Test plugin behavior directly unless a contract truly depends on an external packaged Runtime. api/tests/unit/test_communications_plugins.py covers registry keys and duplicate detection, settings and credential validation, safe fingerprints, event normalization, mention/direct-message/group/thread admission, typed dispositions, outbound idempotency, directory discovery, name enrichment, webhook verification, optional manifests, and redacted provider failures.

  1. 04.1

    Gateway, processor, and supervisor tests prove lifecycle around a Platform Plugin: denied events create no Delivery; accepted inbound events are idempotent; enrichment or journal failure does not discard valid provider traffic; one ingress lease is active per Connection; supervisor failures isolate by Connection; reconnect backoff is bounded; retries do not duplicate provider-visible replies; and terminal failures remain distinct from retryable failures. Use api/tests/unit/test_communications_gateway.py, test_communications_processor.py, test_communications_supervisor.py, and test_communications_operations.py.

  2. 04.2

    Hermes and OpenClaw use the shared Communications Runtime adapter. Test the protocol once at that seam, then prove both builders mount and launch it with required environment, bounded idle backoff and reset after work, Delivery claim/reply/completion paths, stable Connection and thread session identity, Delivery-ID idempotency, supported protocol-version headers, and explicit successful or failed completion. Use api/tests/unit/test_communications_runtime_adapter.py, test_hermes_builders.py, test_openclaw_builders.py, and api/tests/integration/test_agents.py. Use a pinned Runtime image only when the actual Runtime API or packaged contents are the contract.

  3. 04.3

    Ingest receives Tool Call and Tool Result telemetry only. Validate tool_calls and tool_results against real IngestBatchRequest models. Conversation Messages are written by Communications and must not appear in Ingest payload assertions.

  4. 04.4

    Bundled Skill coverage verifies one root SKILL.md, isolated aai-<integration> directories, valid relative references, non-empty files, deterministic manifests, provider metadata, collision detection, predefined Template references, missing-only bootstrap publishing, exact Agent and Template pins, and correct Hermes and OpenClaw mount roots. Use api/tests/unit/test_aai_cli_skills.py, test_template_skill_paths.py, api/tests/integration/test_skills.py, test_templates.py, and test_agents.py.

05

UI coverage

Playwright specs own assertions, page objects own stable interactions and selectors, data-support helpers own interception, and fixtures own backend wire-format responses. Prefer accessible roles and labels over test IDs. Update Zod schemas, hooks, mocks, and browser expectations together.

  1. 05.1

    Communication Connection UI coverage exercises platform discovery, schema-driven forms, credential replacement, diagnostics, journals, reconnects, retries, and permission-aware controls. Skill coverage preserves Platform, Organization, and Agent route scopes. Browser mocks prove UI behavior; backend integration tests remain the tenant-isolation and authorization proof. Representative support files are ui/tests/pages/communication-connection-detail-page.po.ts, ui/tests/pages/data-support/communication-connection-data-support.po.ts, ui/tests/pages/data-support/skill-data-support.po.ts, and ui/tests/fixtures/communication-connections.ts.

06

Commands and failure handling

Use the repository Make targets for API checks/tests, UI lint/typecheck/Playwright, Kubernetes integration, coverage, migration, and monitoring checks. The current targets are make check-api, make test-api, make test-api-k8s, make coverage, make lint-ui, make check-ui, make test-ui, make check-migrations, and make check-monitoring.

  1. 06.1

    Run the smallest complete set for the touched contract and widen only when behavior depends on a larger environment. Documentation changes require relevant documentation checks. Report unrelated failures exactly and do not alter unrelated code to make checks pass.

Documentation