Chock.sh Build your plugin
Blocksv0.0.3 preset: Test integrity

Protect Test Integrity

Blocks on an agent's file writes and at turn end.

Acts on

File write · Turn end

When

Before the file write · at turn end

Tested

17 of 19 pass

In a git repo

At commit

What it does

Blocks weakening tests to turn them green: a deleted test file (commit only), a net loss of assertions, or an added vacuous assertion (assert True, expect(true).toBe(true)). Added skips are block-test-skips. Runs: commit (incl. an agent's commit: CHOCK_AGENT_COMMIT, CLAUDECODE=1, AI_AGENT or agent_commit_env), agent write (vs disk), turn's end (vs HEAD). Waiver: 'chock: allow test-integrity' on an added line. Person's commit: honoured. Agent: only if already in HEAD; it asks a person.

Chock adds friction. It is not a security boundary.

Its label on each agent

The catalog grades each policy on each agent. Pick an agent to build with this policy:

  • Claude Code TestedBlocks Blocks on an agent's file writes and at turn endBuild →
  • Cursor TestedBlocks Blocks on an agent's file writes and at turn endBuild →
  • Codex TestedBlocks Blocks on an agent's file writes and at turn end. If the hook errors, the action goes through (not witnessed; the vendor's row is only partly live-run)Build →
  • GitHub Copilot TestedBlocks Blocks at turn end only. It does not check a file write when it happens. If the hook errors, the action goes through (not witnessed; the vendor's row is only partly live-run)Build →
  • Devin TestedBlocks Blocks at turn end only. It does not check a file write when it happens. If the hook errors, the action goes through (vendor docs only, not witnessed)Build →
  • Grok Tested Not graded yet for GrokBuild →
  • goose Tested Not graded yet for gooseBuild →
  • Antigravity Tested Not graded yet for AntigravityBuild →
  • OpenHands Untested Not graded yet for OpenHandsBuild →
  • Kimi Code Untested Not graded yet for Kimi CodeBuild →
  • Factory Droid Untested Not graded yet for Factory DroidBuild →

See it in action

Refused

A failing test is made green by cutting two of its three assertions.

Allowed

A test is refactored: assertions are reworded and moved into a helper, and none is lost.

Both examples are this policy's own test cases.

What it misses

This policy does not state what it misses.

Latest change

0.0.3 · · Wording fix, no behaviour change: the description and the gate message said a waiver is 'never honoured in the agent'. Since chock 0.14.0 a waiver already committed in HEAD counts in the agent (tool use, the turn's end, an agent's commit), the same as block-test-skips; a waiver on a new line does not. The description, the gate message, the tc-017 expect text and the same sentence in the 0.0.2 entry below are corrected. The description names where each check runs, and fits the 500-char budget.