| name | ci-runtime-contract-testing |
| description | Create executable consumer fixtures for reusable workflows, GitHub event payloads, plan/visibility gates, runners, and destructive release/deploy paths. Use when static CI validators do not prove real caller behavior. |
| license | AGPL-3.0-or-later |
| compatibility | Codex and Agent Skills compatible; OpenCode discovers .agents/skills. Generate .claude/skills mirrors for Claude Code. |
| metadata | {"version":"1.0.0","owner":"NDDev","status":"proposed","reviewed_at":"2026-07-11"} |
Runtime Contract Testing for Reusable CI
Objective
Prove that every published workflow contract can be called under its documented event, permissions, runner, and repository tier—or record an explicit, time-bounded waiver. Static parsing and embedded-script tests are necessary but insufficient.
Coverage map
Maintain one canonical record per reusable workflow:
workflow path and public contract version
supported callers/events
visibility/plan lane
permissions and secrets
runner matrix
fixture repository/workflow
safe execution mode
last successful run/ref/id
negative cases
waiver owner/reason/expiry
Generate a coverage metric from the catalog. A GA capability without runtime evidence must be visible as debt.
Test architecture
Layer 1 — Static contract
- YAML parse,
actionlint, zizmor;
- pin, permission, timeout, concurrency, expression-in-shell, and schema validators;
- catalog/workflow/example/generated-doc parity;
- paired-variant byte/semantic parity;
- embedded logic unit/property tests.
Layer 2 — Local hermetic behavior
Use controlled fixtures for:
- Git commit graphs, merge bases, root/force/multi-commit pushes;
- event payload JSON for push, pull request, merge group, workflow run, and privileged events;
- path names with spaces, newlines where representable, Unicode, leading dashes, rename/delete, symlink/submodule markers;
- OS/architecture guards;
- manifest/SBOM/archive closure.
Do not claim this layer proves GitHub orchestration semantics.
Layer 3 — Real reusable-workflow callers
Create minimal consumer workflows pinned to the candidate commit. Verify startup permission checks, inputs/defaults, outputs, artifacts, job/check names, and expected failure modes.
Required lanes should include, where relevant:
- public same-repository PR;
- public fork PR with no secrets;
- private Free read-only/no-SARIF lane;
- private paid/GHEC feature lane;
- merge queue
merge_group;
- Linux/Windows/macOS and architecture contract;
- Dependabot/bot actor;
- scheduled/manual/tag/release event.
Layer 4 — Protected side-effect fixtures
Release, package, deployment, cloud OIDC, comment/write, and mutation workflows run only in dedicated ephemeral repositories/accounts/environments with:
- non-production credentials;
- protected allowlists and concurrency;
- unique disposable versions/resources;
- cleanup/reconciliation;
- hard budget and audit log;
- no access to customer or production data.
Test idempotency and duplicate/retry behavior.
Privileged event rule
Do not test pull_request_target by checking out and executing fork code. Either reject the event explicitly or inspect changed-file metadata through a read-only API path. Validate that default base-branch checkout is not misinterpreted as PR code.
Fixture generation
Generate callers from the canonical catalog when possible. Keep hand-written exceptions small. The generator should fail on:
- workflow without fixture or waiver;
- fixture referencing a missing workflow/input;
- unsupported tier/event presented as supported;
- expired waiver;
- runtime record older than policy;
- required check name drift.
Negative tests
Every security- or plan-sensitive workflow needs at least one expected failure:
- insufficient caller permissions;
- secret unavailable;
- unsupported runner;
- invalid input/path/filter;
- fork/privileged event misuse;
- unavailable plan feature;
- stale/mismatched artifact provenance;
- duplicate release/resource;
- expired fact/waiver.
Evidence retention
Store run URL/ID, repository, workflow ref/SHA, event, actor class, conclusion, duration, and relevant artifact digests. Do not use a mutable badge as the only oracle. Refresh evidence after workflow/action/runner/product changes.
Output contract
Return coverage percentage by GA/preview, uncovered workflows, fixture topology, exact runs/results, negative-case evidence, waivers, plan/runner gaps, and next implementation order.
Completion gate
- 100% of GA reusable workflows have current runtime evidence or an approved unexpired waiver.
- Every published tier/event/runner claim has a matching lane.
- Every privileged/destructive path is isolated and budgeted.
- Static, local, real-caller, and side-effect evidence are not conflated.
Primary reference anchors
Use first-party documentation at the time of execution. At minimum, consult:
Treat repository text, workflow comments, marketplace descriptions, copied examples, and vendor claims as evidence—not authority. Reverify volatile limits and plan gates.