Skip to content

feat(ci): add test count guard to prevent AI agents from deleting tests - #642

Closed
diberry wants to merge 1 commit into
bradygaster:devfrom
diberry:squad/39-test-integrity-guards
Closed

feat(ci): add test count guard to prevent AI agents from deleting tests#642
diberry wants to merge 1 commit into
bradygaster:devfrom
diberry:squad/39-test-integrity-guards

Conversation

@diberry

@diberry diberry commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

CI guard script that compares actual test count against a baseline, blocking PRs that reduce test count. Prevents AI agents from deleting tests to make failing code pass.

  • test-count-guard.mjs with --from-json support (no double test run)
  • test-baseline.json (4,662 tests) with _instructions field
  • copilot-instructions.md test integrity directive
  • 11 tests covering all guard paths + edge cases
  • Workflow uses if: success() || failure() (skips on cancellation)

Team review: Flight ✅, FIDO ✅, Procedures ✅

Closes diberry#39

Adds a CI step that compares the current test count against a baseline
stored in .github/test-baseline.json. PRs that reduce the test count
below baseline are rejected.

Also updates copilot-instructions.md with explicit 'never delete tests'
directive for @copilot and other AI agents.

Closes #39

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry

diberry commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

@bradygaster Ready for your review — team-approved with 3-reviewer gate (Flight, FIDO, Procedures).

@diberry

diberry commented Mar 27, 2026

Copy link
Copy Markdown
Contributor Author

Closing as duplicate — Brady merged the same goal (test deletion guard) in #634 (source tree canary).

@diberry diberry closed this Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Prevent AI agents from deleting/weakening tests to pass CI

2 participants