Skip to content

Testing strategy ​

1–4. Goals, constraints, context and strategy ​

Use the smallest test that observes a behavior at its ownership boundary. Deterministic rules, database concurrency, native SDK contracts and deployed acceptance need different evidence. Passing one layer does not establish another: compiling PostgreSQL tests does not run them, and a fixture is not a live provider.

This view explains the verification architecture. Use the testing guide for executable commands and prerequisites. Do not run live journeys against an unapproved target or replace a required PostgreSQL race with an in-memory implementation.

The strategy keeps fast pure tests near domain rules and uses the real local boundary where semantics depend on Git, PostgreSQL, native runtime or browser behavior. Controlled external transports make failures reproducible without claiming production credentials or service availability.

5. Building blocks ​

LocationResponsibility and evidence boundary
tests/.NET package/service tests; disposable PostgreSQL where transactions and locks matter
scripts/api-harness/OpenAPI discovery/client contracts and controlled HTTP
scripts/ui-harness/Injected-page observation and owner receipt contracts
scripts/mcp-harness/Retained compatibility transport, discovery and result tests
scripts/harness-shared/Target/auth guards, redaction, journeys and result contracts
scripts/acceptance/api/Normal-command CLI API acceptance cases
tools/Agentweaver.Cli/Native .NET CLI
apps/web/e2e/Playwright journeys against built Web with controlled Broker/Gateway
scripts/coverage/Coverage execution, report validation and receipt guards
.github/workflows/v1-ci.ymlSource validation aggregate and selected suites
.github/workflows/v1-docs-ci.ymlSite, link, source-map and diagram checks
.github/workflows/v1-integration-images.ymlDirect GHCR image build/publication, not acceptance
scripts/release/deploy-kustomize.mjsMigration-first apply and rollout checks, not product journey proof

6. Runtime view ​

Match the stimulus to the boundary ​

Contract under testRepresentative stimulus and observationNot established by that test
Pure workflow/provider rulesInvalid graph, cardinality, version or capability returns structured rejectionA database commit or available backend
Skill trust evidenceProjects PostgreSQL tests check exact report replay, refresh interleaving, changed-report conflict, current Owner authority, revoked replay denial, source-kind compatibility, fixed and backward-adjusted clocks, tuple tampering, singleton ordering, and isolation of Project B after a Project A revocationVerified Git origin, a deployed owner service, or a live model run
Kubernetes BuildTest Pod validationControlled provider tests model RuntimeClass selectors and reject changed Pod selectorsLive API-server admission or Kata node placement
Native ACS evaluationAgentweaver.Policy.Acs.Tests validates complete content-pinned artifacts, checks isolated composed action and network decisions, and runs native evaluation with the pinned Linux-x64 library and OPA; conversion goldens compare the existing YAML adapter; the native-acs CI shard requires the named native methods to passHost activation, live authorization, or a change to the deployed v4 Policy path
Native ACS policy sourceAgentweaver.Projects.Config.Tests checks shared Projects HTTPS composition for public, Broker, Environment and AgentHost clients; TLS fixtures check pin classification before issuer retrieval, peer validation, rotation, connection reuse and final response checks; PostgreSQL tests exercise the production Environment client and candidate compiler against the real Projects Kestrel route, including pending/null admission, changed revisions, unsupported artifacts, and source failureLive API access, deployment, policy admission or apply, or deployed policy behavior
Gateway Platform Policy receiptsAgentweaver.Identity.Broker.Tests compares new and pending-retry preparation payloads and legacy committed-retry write payloads with the served OpenAPI union; it checks nullable fields, no-store, and no activation from preparationA new write through a deployed Gateway or deployed policy enforcement
Native CLI Platform Policy applyAgentweaver.Cli.Tests.PolicyCommandTests uses a controlled Gateway to verify the apply request, saved recovery IDs, lost-response replay, and disabled-gate handlingA live Gateway write, database commit, or deployed policy enforcement
Broker credential publicationControlled HTTP tests verify the legacy path returns 503; PostgreSQL tests verify Draft pairing and legacy credential preservationLive Key Vault access or deployed service behavior
Project Skill scan admissionProjects & Config tests check owner-generated current reports, caller-report rejection, blocked packaging/import before writes, configuration/assignment/run-selection rejection, and runtime re-scanA deployed owner service or live model run
Revision-backed BYOK run admissionIdentity and Orchestrator contract tests check task-override admissions and runtime selection; Events PostgreSQL tests check provider-qualified pins; Projects PostgreSQL tests reject changed credential identity or SecretRefA live provider call, paid usage, or deployed dispatch
MAF dispatchProduction catalog binding and child intent/outbox/checkpoint transactions against disposable PostgreSQL; controlled Broker composition holds the independent-review gate until two RuntimeAgentHost children joinNative AKS execution, live owner services or paid model calls
Owner transactionsConcurrent claims, stale revisions, lost authority and restart replay against PostgreSQLDeployed service behavior
Source ControlReal isolated Git workspaces; controlled GitHub HTTP, expected heads and raw-byte HMACLive GitHub permission or merge approval
Broker/grantsConcurrent refresh redemption, exact-purpose checks and revocation after waitsLive upstream SSO or Key Vault access
AgentHostPinned native SDK against a controlled loopback endpoint; callback tests reject workspace escapes in structured paths, patch edits, and working directoriesHosted Copilot or paid BYOK acceptance; OS-level filesystem confinement
BrowserBuilt application with controlled services or injected page contract, depending on suiteProduction sign-in or a different browser journey
Deployment toolingManifest inputs, local renders and controlled transportsActual target permissions, rollout or native resource behavior

CheckpointRecoveryRequiresCacheOrSavedTurnHistory checks the AgentRuntime guard for missing, empty, and fresh-session material. It uses no database and does not prove a PostgreSQL recovery journey or production material restore.

For example, RubberDuck durable tests restore checkpointed operation and response after restart, preserve REQUEST_CHANGES as failure, and reject changed evidence before an owner call. Pure tests alone cannot establish that restart behavior.

Broker database tests reproduce SQLSTATE 42501, exercise the canonical migration/grant path, reject history writes and verify that read-only checks do not repair grants. Projects initialization tests verify dedicated-owner access before writes and rollback on reconciliation failure.

Orchestrator store tests exercise migration 032, its first-applied coverage time and partial-state rejection. A complete pre-032 schema remains valid during rollout; the project list returns 503 pull_request_records_unavailable until maintenance applies the migration.

Knowledge discovery tests verify project isolation, all-agent search, one global order across resources, and history access through accessRunId. They also verify that project-wide search requires AccessPrivateKnowledge but not ReadRunSelection. That access binding is not sourceRunId provenance or deployed discovery.

Run normal-command API cases ​

The checked-in API case scripts call the native CLI through public commands. The read-only Gateway case checks auth status, api operations, api describe, and rest against one approved target. It does not mutate resources, send model requests, or open a browser. The workflow-generation case uses api invoke to submit a draft, check its job and result, and cancel an approved disposable run. It uses separate run-bound and unbound identities for the same actor and tenant. The task-model-completion case uses api invoke to dispatch a claimed task, verify its completion and priced BYOK usage, and cancel an approved disposable run. It also uses separate run-bound and unbound identities. The harness:p1 -- --surface api launchers delegate to checked-in scripts; they do not provide a second API client or a test command.

Use the API case guide for the exact apphost, input, and evidence contract. A dry run validates local input only. The workflow-generation and task-model-completion cases check separate model-backed Gateway flows; neither replaces a full P1 API journey.

Child startup and cleanup sequence ​

The owner sequence below describes child startup and cleanup. The current read-only API case does not exercise that sequence. Controlled startup tests and live API case evidence are different evidence.

mermaid
sequenceDiagram
    actor Caller as Authorized owner caller
    participant Core as Orchestrator
    participant Environment
    participant Broker as Identity Broker
    participant Host as Child AgentHost
    Caller->>Core: Dispatch confirmed work
    Core->>Core: Commit child and stable startup intent
    Core->>Environment: Provision the exact child placement
    loop Same owned Sandbox and Pod
        Environment->>Environment: Read one current placement observation
        Environment->>Host: Check validated /health/live after start phases
    end
    Environment-->>Core: Return fresh pinned placement
    Core->>Core: Register the current child
    Core->>Broker: Request bootstrap with the saved operation ID
    Core->>Environment: Activate and check exact Host readiness
    Environment->>Host: Configure the registered child
    Host-->>Environment: Return current readiness evidence
    Core-->>Caller: Report pending, blocked, or ready
    Note over Core,Host: Only current readiness permits a task send.
    Caller->>Core: Request or resume cleanup of a terminal run
    Core->>Core: Check native work and clean children before root
    Core->>Environment: Retire each exact owned resource
    Environment-->>Core: Return release receipt; retain workspace data
    Core-->>Caller: Report aggregate cleanup state

The retained /mcp harness exercises compatibility code only. It preserves isError, validates discovery pages/cursors, and distinguishes accepted from completed results. It is not a supported product or acceptance surface; the API entrypoint rejects --surface mcp and --surface api,mcp.

The UI contract uses an already-authorized page on the exact Web origin. It does not sign in or seed browser storage. A fake-service Web end-to-end test and an injected-page test must not be reported as a live UI journey.

Preserve evidence and blocked outcomes ​

Harnesses keep HTTP errors, owner denials and 202 Accepted separate from completion. Redaction precedes durable JSON Lines output; transient raw bodies are not the transcript. Token helpers check metadata/expiry; servers still validate signatures and current authority.

The controlled Board-delete regression passes the owner-denial step only for HTTP 403 and an owner JSON error field equal to backlog_project_permission_denied; evidence retains that value as ownerIssueCode. A generic Gateway problem with code: "forbidden", a bodyless 403, or a changed authoritative graph is not a passing owner-denial result.

The controlled session-history-metric regressions cover both raw-context selection and interactive pending-run creation through the CLI runner. They check server-returned identities and selection revisions, forbid start and dispatch operations, and verify cancellation, advanced-fence retained-session readbacks, and project cleanup order. Lost create responses, malformed selection revisions, and failed cancellation must remain indeterminate rather than report the fixture absent or cleaned. These local tests do not establish live authorization or deployed owner behavior.

Native evidence must join registration, invocation binding, Environment creation, actual Pod/mount observations and Host evidence. Registration placementUid is the SandboxClaim identity, not the actual Pod UID. A policy readback, readiness receipt, usage read or locator-only no-send result cannot replace complete turn, cursor, effect and dispatch/recovery evidence.

The former native-material-recovery journey joined the current root registration, turn-completion and material receipts, ordinary Host replacement, exact replay, and cleanup. That acceptance runner has been removed. The current read-only API case does not exercise session-material recovery; source and controlled tests remain separate evidence.

Native and dispatch-recovery envelopes preserve supplied receipts and reject malformed, inconsistent, duplicate or extra fields. receiptSha256 detects content changes, not authorship. passed requires nonempty evidence; native cleanup must be completed or not required, and read-only recovery must report no created resources. Missing required evidence stays blocked.

Distinct-actor denial requires a genuinely distinct authorized test identity. Do not substitute the same user, a temporary role change or an invalid locator. A one-account flow does not establish full denied-actor coverage.

Artifact/source and deployment evidence remains separate from the product journey. Follow the release runbook for current publication/deployment operations; do not infer acceptance from their success or introduce an image archive/publication-receipt handoff.

7–9. Execution environments, shared concepts and decisions ​

Pure and controlled tests run locally or in CI. PostgreSQL cases require Docker-compatible Testcontainers; Broker browser integration requires Playwright Chromium; native tests require the configured pinned runtime/image. These dependencies are test environments, not a product deployment topology.

v1-ci.yml reports the foundation aggregate across selected image, Web, Node and .NET jobs. Path selection limits expensive suites without turning skipped work into evidence. Broker method shards retain per-shard TRX receipts; caches hold dependencies, not mutable databases, browser contexts or build output. Go reference tests under tools/agent-primitives produce AgentSessions fixtures compared with the .NET verifier.

Coverage is an artifact, not a passing-test count. .NET collection requires distinct Cobertura/TRX receipts and expected assemblies; Node coverage requires executed release-validator lines. Reports live under artifacts/coverage/dotnet/ and artifacts/coverage/node/. Weekly v1-coverage.yml instrumentation is separate from ordinary PR/push/manual CI. Combined reports retain the newest passing attempt for each suite.

Read CI and coverage details for the canonical execution contract. The system decision view retains actual ADR statuses; tests do not accept a proposal or establish a CLI/API compatibility policy.

10–12. Quality, risks and glossary ​

Context and stimulusResponse and measureVerification state
A regression changes an offending artifact or contractFocused assertion fails on its content, identity or state transition, not only exit codeTest-design criterion; inspect the actual assertion
A job produces no expected test/coverage receiptGuard fails rather than count an empty run as passingCI/coverage contract tests
A live acceptance prerequisite or cleanup result is missingPreserve failed/blocked status; do not aggregate into passHarness/CLI result tests; complete model-dependent live acceptance is separate
A new platform egress provider is addedIt must pass the shared conformance kit in PlatformEgressTests.csControlled tests with a fake store; not datapath proof
A reserved egress request is retried or delayedPostgreSQL recovers the exact reservation after restart; fake Kubernetes tests cover lost-response replay and reject a delayed PUT with a stale resourceVersion; the provider rejects a recreated object with a stale UIDPostgreSQL and fake API tests; not live Kubernetes or datapath proof
A Sandbox owner is provisioned or a flow write failsPostgreSQL retains the owner mapping before provider creation and stores known and unknown owners in separate append-only tables; a failed write remains retryable from the same source cursorPostgreSQL persistence, migration, and runtime-grant tests; no live flow-log collection or automatic expiry

The principal risk is overclaiming evidence. Source owners must identify the exact revision, executable, environment, executed suite and limitations. Controlled transport and fixture success do not establish native TLS, packet enforcement, mounted persistence or paid-provider behavior.

Terms: controlled means dependencies are supplied by the test; integration means real participating boundaries within the named environment; acceptance means the specified journey and all required evidence passed. Compiled, executed, released, deployed and proved are separate states.

Validate documentation changes ​

From the repository root, use the existing safe checks:

powershell
npm run docs:build
npm run docs:check-links
npm run docs:check-drift -- --base origin/v1
npm run docs:check-diagrams
npm run docs:check-flagship-diagrams
npm run test:docs-diagrams

These inspect site/artifact consistency, not technical correctness of every claim. Source review remains necessary.