Skip to content

fix(enforcement): strengthen test-with-code rule -- new source files must include tests #294

@MScottAdams

Description

@MScottAdams

Problem

The existing testing gate in main.md (t1.6.1) says "no implementation is complete until tests are written and task check passes." Agents interpret this as "run existing tests and confirm they pass" rather than "write new tests for new code." The v0.17.0 swarm (#233) shipped 5 new Python scripts with zero unit tests because task check passed on the existing suite.

Proposal

Strengthen the test-with-code requirement across 4 surfaces:

1. AGENTS.md -- hard gate (always-loaded)

Add ! rule to "Before committing" section:

  • ! New source files (scripts/, src/, cmd/, *.py, *.go) MUST include corresponding test files in the same PR. Running existing tests is not sufficient -- new code requires new tests.

2. main.md -- strengthen existing testing gate

Update the Decision Making testing gate (t1.6.1) to explicitly distinguish:

  • "tests pass" = existing tests still pass (regression)
  • "tests written" = new code has new test coverage (forward)

3. deft-swarm prompt template -- CONSTRAINT line

Add to the CONSTRAINTS section of the prompt template:

  • New source files must have corresponding tests -- do not push a PR with untested new code

4. deft-build SKILL.md -- pre-commit checklist

Add explicit check: "For each new source file in this PR, verify a corresponding test file exists"

Future (deterministic enforcement, #233 scope)

A task verify:test-coverage that diffs new .py/.go files against new test_.py/_test.go files and fails if new code has no corresponding tests. This replaces the prompt-driven rule with a binary pass/fail gate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions