Skip to content
rad-oxPublic

About

Release gate that fails CI when an AI coding agent weakens, skips, or deletes a test — backed by owner-approved TOML contracts and an open MIT verifier.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

DRIFT — Behaviour-Contract Release Gate

AI agents can change your code. They shouldn't be able to change what correct means. DRIFT is a release gate that binds test evidence to owner-approved TOML behaviour contracts by digest. It does not replace branch protection: an agent that can edit .drift/** and self-approve still wins — see GUARANTEES §1.1.

Live Blocked PR #1 · 60s Demo & Codespaces · GitHub Action · Verifier-Only CI · 12 Bridges · Error Catalog · Editions


Caught in the Act: Test Runner vs. DRIFT Gate (Inspect Live PR #1 →)

When an agent breaks GET /items/1 and "fixes" CI by weakening or deleting the test, ordinary runners still exit 0:

Agent Shortcut Standard Runner (pytest / node --test / go test / mvn test) drift gate & MIT verifier/drift_verify.py
Drops name assertion PASS (False Green) — status 200 passes; runner exits 0. FAIL — d.check throws no check for then.name; incomplete reads stay bound, never verified.
Edits then.status = 500 in .toml PASS (False Green) — test reads 500 and passes. FAIL (DR-E601) — dr2b: digest changes; stale owner seal blocks the gate.
Deletes the failing test PASS (False Green) — remaining tests pass. FAIL (gone: 1, when coverage drops) — .meta.json inventory discards orphaned events and blocks the unproved case.
Red-team benchmark setup Attacks caught (A01–A15)
Editable tests, no DRIFT 0/15
Read-only tests, no DRIFT 15/15
DRIFT Free default 9/15
DRIFT + protected .drift/ & harness 15/15

If you can freeze independently written acceptance tests, do so. DRIFT helps when tests evolve alongside code, but a green gate does not rule out implementation shortcuts.

Anti-cheat guards, real-world showcases (FastAPI, Zod, serde_json, {fmt}, Spring) & proof states
  • Empty / tautology callbacks ((v) => {}, () => true, (v) => true, lambda v: None, lambda v: True) fail immediately with AssertionError; self-stubbed d.buildOutput(...) checks stay bound and surface oracle.self_stubbed.
  • Strict proof progression: missing → red → bound → verified → killed. Enterprise proof = "killed" verifies contract-oracle sensitivity: bound tests catch mutated contract predicates, not mutations of implementation code. See GUARANTEES.md · Residual B and the 27-scenario red-team benchmark.
  • Live real-world showcases: FastAPI · Zod · serde_json · {fmt} · Spring Petclinic · Benchmark Suite.

Try in 60 Seconds (Zero Binary Install)

Reproduce all 3 false-green cheats and the verified control using only Python 3.11+ standard library (or launch .devcontainer/ in GitHub Codespaces):

git clone --depth=1 https://github.com/rad-ox/drift.git && cd drift
./drift-demo                                # Runs 3 false-green cheats vs. MIT verifier in <2s
python3 benchmarks/false-green-evals/run_eval.py  # Standalone AI-agent eval fixtures (zero DRIFT dep)

Add to GitHub Actions (4 Lines, Zero-Binary Default)

Pinned example: uses: rad-ox/drift@d515a37c495782c9e4074a2970c478e066212470. For the newest release SHA, see GitHub Releases. The Action defaults to mode: verifier (MIT Python stdlib, no closed binary). When a check produces a report or the gate reports an error, the combined Correctness Receipt is always written to $GITHUB_STEP_SUMMARY (distinguishing verified vs bound). PR comments are opt-in (pr-comment: true, default false) and require pull-requests: write. The Action can also emit SARIF 2.1.0.

  1. Step 0 — Zero-TOML PR Guards: pass test: pytest (Base-Tests Replay overlays changed/deleted base tests via git cat-file --batch with anti-self-ack) and/or junit-base + junit-head (JUnit Ratchet catching vanished or newly skipped tests) — zero TOML required.
  2. Step 1 — Prove one contract: bootstrap in one command with drift start, bind one case using a primary bridge to reach verified, and pass contracts + events to the Action.
  3. Step 2 — Protect the gate: use CODEOWNERS with required external review, separate trusted base authority from untrusted PR files (--subject-root, --base-profiles, --strict-hex), and isolate independent acceptance checks (for example, run MIT verifier/drift_blackbox_observer.py from trusted CI). See the benchmark methodology and CI governance.
- uses: rad-ox/drift@d515a37c495782c9e4074a2970c478e066212470
  with:
    contracts: .drift/contracts
    events: .drift-work/events
    test: pytest                     # Optional: Zero-TOML Base-Tests Replay on changed/deleted tests
    require-baseline: true           # Optional: fail on any uncomparable replay
    pr-comment: false                # Optional: set true with pull-requests: write
    sarif-file: drift.sarif          # Optional: inline PR annotations via Code Scanning
    junit-base: reports/base.xml     # Optional: fail if tests vanish or turn skipped (no TOML needed)
    junit-head: reports/head.xml

Replay can be uncomparable when the base is missing, an API was removed, a prerequisite is missing, base tests are flaky, or the replay budget runs out.


Trust Without Taking Our Word For It

  • Verifier-Only CI (MIT) + Native V CLI: The drift CLI engine is a fast static compiled V binary (0 runtime dependencies, CLI release 0.14.1), while verifier/drift_verify.py (100% Python 3.11+ stdlib, MIT License, structurally inventoried via verifier/manifest.json; pinned example: uvx --from git+https://github.com/rad-ox/drift@d515a37c495782c9e4074a2970c478e066212470 drift-verify) independently recomputes RFC 8785 dr2b:/dr2a:/dr1: digests and enforces fail-closed gate verdicts offline without invoking drift. The inventory describes module roles and imports, not release archive provenance.
  • Self-Hosted, Fuzz-Tested & Cryptographically Signed: DRIFT is built under its own gate (358 self-hosted contracts). Verification work includes differential CLI↔Python fuzzers (verifier/json_diff_fuzz.py, verifier/verdict_diff_fuzz.py) and Lean 4 theorem source plus an SMT-LIB2 differential oracle. Every release archive (drift-0.14.1-linux-x64.tar.gz, macOS, Windows) ships with SHA256SUMS, OpenSSH RELEASE_SIGNERS, SLSA v1.0 provenance, Sigstore Cosign bundles, and TUF metadata.
  • Honest trust boundaries: Seals detect edits; authenticating who approved belongs to Git CODEOWNERS on .drift/** + signed commits (--ssh-sign / --trust-root).

How It Works & Quick Start

Declare expected behaviour once in schema 0.3 .toml, seal with drift approve (or the local drift-ask-ui Observatory Deck), and bind tests:

drift = "0.3"
id = "item-get"
intent = "Return catalog item 1 or 404 when absent."

[use]
profile = "http-json@1"

[scope]
surface = "GET /items/{id}"
writes = []
reads = ["items"]
indirect = "none"

[cases.found]
at = ["http"]
when.request = "GET /items/1"
then.status = 200
then.name = "lamp"
./install.sh                                        # Install verified CLI, bridges & agent skills
drift fmt .drift/contracts/item-get.toml            # 1. Canonical TOML layout
drift check .drift                                  # 2. Static validation
drift approve .drift/contracts/item-get.toml        # 3. Human owner seal (--by defaults to sole approver)
drift run --gate --junit drift-junit.xml -- pytest  # 4. Cached view export, run tests & fail-closed gate

Bootstrap a New Project Area

With the example area installed, initialize and scaffold a health-check contract step by step:

drift init alice .
drift approve .drift/config.toml --by alice
drift new .drift/profiles/http-json@1.toml --from http-json@1
drift new .drift/contracts/health-check.toml --profile http-json@1 --intent "Report service readiness."

Bootstrap a New Project Area (One Command)

Alternatively, scaffold directly from a bundled profile and pin a test path:

drift start alice . --profile http-json@1 --pin tests/test_items.py
drift record --runs 3 -- pytest tests/test_items.py   # Optional local-only observed draft starter (never in CI)

Evaluate any existing repository with zero committed files via Shadow Mode (drift init alice /path/to/repo --state-dir ~/.drift-shadows/svc) or expose read-only agent inspection over stdio with drift mcp --stdio — see Brownfield & Shadow Mode and AI Agents, Hooks & drift-ask-ui.


Polyglot Test Bridges (12 Bridges, Zero Lock-In)

Runtimes CI Verification Tier Artifacts & Guide
Java 17–25 (JUnit 5), JS/TS, Python 3 Public CI E2E (live HTTP + CLI/verifier parity) drift-junit, drift.mjs, drift.py · Primary
Go 1.22+, Rust, C++20, C#/.NET, PHP 8.2+, COBOL Public CI Smoke, go test & cargo test bridges/go, bridges/rust, drift_cpp.hpp, Drift.cs, Drift.php, drift_cobol.py · Bridges
V, Scala 2.12–3.9, JUnit 4, Godot 4 Shared JVM / Experimental drift_v, drift-junit, DriftJUnit4.java, drift.gd · Matrix
Guides, Advanced & Regulated Workflows, Editions & Repository Surface

About

Release gate that fails CI when an AI coding agent weakens, skips, or deletes a test — backed by owner-approved TOML contracts and an open MIT verifier.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages