Capability Evidence

These contracts extend the existing capabilities/ library and GatePacks.

Capability evidence and report adapters

These contracts extend the existing `capabilities/` library and GatePacks. They do not execute pipelines or supply a universal shell runner. Select an implementation in the binding plan, review its tool and report adapters, and preserve inputs through provider `CI_INPUTS`. An exit code alone proves neither dependency identity nor a test result.

Evidence authority

Each evidence JSON carries `inputs` copied from the accepted capability inputs, `inputs_verified: true` only after an independent consumer compares them with the accepted pipeline/job binding, and an immutable full `revision`. Never let an untrusted report authorize its own input binding. Recompute file digests and verify files exist within the declared workspace before setting `*_verified`. Reject path escapes, stale reports, unknown adapters, missing files, mismatched digests and malformed data. Digests use `sha256:` plus 64 lowercase hex digits. The YAML `verification.command` checks normalized evidence; JSON booleans alone cannot prove filesystem contents, signatures or provenance. The reviewed implementation owns those independent checks.

Capture original statuses before collecting reports, retain failure evidence, and propagate the failing status after collection. An always-run collector must never overwrite a failed test or threshold command with its own zero exit. Runtime evidence proves actual runtime identity/version and lock digest; package-manager evidence additionally proves the pinned manager version.

Install and build

`ci-install-dependencies` requires workspace, revision, manifest/lock paths and digests, runtime evidence and `package_manager: {name, version}`. `mode: locked` uses the manager's frozen install (`npm ci` for npm). Set `frozen_install`, `runtime_verified`, `package_manager_verified`, `lock_verified` only after checking the actual operations. Emit `manifest_digest`, `manifest_after`, `lock_digest`, `lock_after` and a normalized installed `dependency_digest`. Cache restoration does not replace installation verification.

`mode: native-feature` additionally requires a verified base locked install and `feature: {script, package, version}`. Resolve the exact feature script from the hashed package manifest and preserve its flags. Emit matching `feature` fields with `script_verified`, `backend_load_verified` and `abi_verified`. A missing or unloadable native backend fails. For the current `features:sqlite` policy:

npm install --no-save --save-dev [email protected]

No `latest`, range, lock update or script substitution is equivalent. Keep the policy in package.json authoritative; a future exact-version policy change requires a new accepted manifest digest and binding, not a floating version.

`ci-build` requires revision, unchanged lock digest, dependency/runtime evidence, a package script `target` (`build` or `build:cli`, for example), and a nonempty list of exact artifact paths. Emit `script_verified`, `dependency_verified`, `runtime_verified`, `artifacts_verified`, `dependency_digest`, `lock_after`, `exit_code`, `build_seconds` and `artifacts: [{path, digest, size_bytes}]`. Verify actual nonempty output files from this build, not leftovers. Include retries in elapsed seconds. Feed verified seconds to `build-time-budget`; missing/failed builds emit no duration observation for acceptance.

An application `build` script that internally installs or tests needs explicit phase bindings when those boundaries affect gates. Split cockpit dependency, web build and test phases, and release-discovery build/pack/discovery phases. Do not hide an unverified sub-operation behind a successful aggregate command.

Source verification and advisory observations

`ci-verify-source` binds author/committer, checked-out revision and event revision to a separately trusted `trust_policy_ref`. `scope: push-range` verifies the full range from `before_revision`, including merge side parents. A trusted policy defines new-branch range selection; unavailable history blocks. `scope: head` is explicitly narrower and cannot stand in for a pushed-range policy. Emit `range_verified`, `trust_policy_verified`, `signature_verified`, `allowed_fingerprints`, the head `signer_fingerprint` and one `commits` record per enumerated commit with revision, author, committer and signature result. Every signer must match an allowed full fingerprint or have a verified primary key binding (`primary_key_verified`, `primary_fingerprint`). At most 10000 commits are accepted; larger ranges require a reviewed bounded implementation. Unsigned, unknown, mismatched or unverifiable source is a hard failure.

`ci-runner-diagnostics` takes allowlisted probe IDs, a 1–60 second per-probe timeout and 1–65536 total retained bytes. It covers runner headroom/resource observations and bounded listings of declared output paths. Record `observations: [{probe, status, exit_code}]`, with status `observed`, `unavailable` or `error`; retain the original nonzero statuses. Emit `collection_complete`, `advisory`, `redacted`, `probe_allowlist_verified`, `bounds_enforced`, `output_bytes`. Success verifies collection only. Never use these observations to claim tests passed or replace security verification.

Suite reports, prerequisites and coverage

`ci-test` resource version 2 requires `revision`, a reviewed `report_adapter` ID and nonempty unique `expected_suites` in addition to the existing suite, workspace and command. Adapters may normalize Vitest JSON, JUnit or a project suite report only when they preserve actual executed totals and failures. List one `reports` entry per suite with `suite`, `revision`, `adapter`, `path`, `digest`, `verified`, `outcome`, `exit_code`, `tests_total`, `tests_failed`. Aggregate `tests_total` equals the sum; every entry must be PASS, zero exit, zero failures and positive executed totals. The aggregate `report_path`, `report_digest` and `report_verified` bind the retained summary. Omitted child suites, duplicate names, empty reports and zero-test success all block.

Prerequisites use a separate reviewed probe, not a successful test command that exits early. Bind optional `prerequisite_probe: {id}` to evidence containing id, revision, digest, verified and status (`present`, `absent`, `unknown`). A present probe permits running. Absence may be recorded as NOT_APPLICABLE only with `not_applicable: {policy_ref, reason}` explicitly allowing that prerequisite. Retain the probe path/digest and observation even on failure. Unknown or missing probe evidence blocks. A skipped suite records `outcome: NOT_APPLICABLE`, null test totals/failures/report and a reason, never PASS or fabricated zero totals. The ci-test verifier rejects it. A separately reviewed exclusion may remove the suite from required scope; the original skipped observation remains visible.

For suites that enforce coverage inside their command, preserve that original threshold exit. Optional `coverage: {slices: [slice-id, ...]}` requires a nonempty unique `coverage_reports` list matching all slices. Each entry binds suite, revision, metric, path, digest, verified and `threshold_exit_code: 0`. Missing coverage blocks test acceptance when requested, even with passing test totals.

`ci-coverage` resource version 2 selects a suite, named slice and metric from a reviewed `report_adapter`, exact `test_report` and `test_report_digest`, and `coverage_report`. Evidence echoes these bindings (`report_path` is the coverage path), plus `report_digest`, `test_report_verified`, `coverage_report_verified`, `suite_outcome`, `suite_exit_code`, actual totals/failures and `coverage_percent`. Require PASS, zero exit and positive tests. Report adapters must check coverage include/exclude configuration and metric against the accepted slice binding. Never aggregate unrelated slices or turn missing evidence into zero coverage. Bind each verified named slice separately to the existing `coverage` metric slice consumed by `coverage-floor`; keep its suite/report identity in the receipt. A floor violation or missing observation HOLDs.

Trace verdicts as data

`ci-evidence-trace` requires a reviewed harness/report adapter, 1–3600 second timeout and 1–1048576 retained byte cap. Emit original `exit_code`, `verdict`, nonempty `reason`, `report_path`, `report_digest`, `trace_digest`, `report_verified`, `collection_complete`, `bounds_enforced`, `redacted`, `output_bytes`. `verdict` is PASS, FAIL or NOT-EXPRESSIBLE. Emit a nonempty `cases` list (at most 10000) with unique id, verdict, reason and trace_digest; retain the same detailed verdicts in the digest-bound report. Aggregate FAIL if any required case fails, otherwise NOT-EXPRESSIBLE if any required case is unsupported. Only all-supported PASS with zero exit has `gate_value: 1`; other verdicts have `gate_value: 0`. PASS with a nonzero harness exit is contradictory and rejected.

The verifier accepts a well-collected FAIL or NOT-EXPRESSIBLE as data. Feed `gate_value` to `aiwg:cicd-complete/evidence-verdict`, whose `evidence-verdict` slice requires 1. Missing or invalid evidence emits no observation and HOLDs. Collection success does not satisfy ci-test and cannot replace a test gate.

Compatibility and provider handoff

These are OpsCapability resources in the existing `ops.aiwg.io/v1` format; CIPipeline remains `cicd.aiwg.io/v1`. No pipeline schema migration is required to reference new capability names or input maps. The strengthened ci-test and ci-coverage resource contracts use version 2.0.0: migrate bindings by adding revision/report adapter, expected suites and exact report/slice bindings before accepting old reports. Retain the original required inputs and outputs; optional recovery stays intact. Legacy zero-exit reports cannot prove the new contracts.

Gitea and GitHub recipes must preserve these inputs, original process failures, probe/exclusion records, report digests and the collection/verdict distinction. Update both provider goldens together when adopting bindings. Project-owned adapters remain prerequisites; a resource definition or schema validation is not evidence that an install, build, verification or suite has executed.

The paired controls goldens show separate dependent gate jobs for the verified trace scalar and each coverage selector. CI_GATE_BINDING identifies `trace` or `coverage:<slice>` in the reviewed CI_BINDINGS plan and must match its gate job entry. Retain ci-evidence/ and raw coverage reports in the immutable provider artifact before these jobs run. Gate adapters download by run/revision, compare accepted input snapshots, recompute report/blob digests and check original statuses. Missing/invalid reports HOLD with a nonzero gate exit; collection success alone supplies no verdict. Selectors are evaluated separately, with the source pack parameters, never pooled into one coverage observation. Adapter implementation remains a project prerequisite; no runtime engine ships here.