AI Gates Self-Test Checklist
Use this checklist to validate AI quality/security gates on a non-production test branch.
Preconditions
- Open a branch from
main. - Ensure GitHub branch protection includes required AI checks.
- Create a draft PR targeting
main.
Test 1: Policy Validation Gate
Goal: verify ai/policy-validation fails on invalid policy.
- Edit
scripts/ai-gates/policy.jsonwith an invalid broad rule:
json
{
"allowlist": [
{
"gate": "*",
"code": "*",
"reason": "too broad"
}
]
}- Push and confirm:
ai/policy-validationfails.artifacts/policy-validation.mdexplains why.
- Restore valid policy:
json
{
"allowlist": []
}Test 2: Tenant Isolation Gate + Annotations + SARIF
Goal: verify ai/tenant-isolation-audit fails, creates annotation, and appears in code scanning.
- Add a temporary line in a test branch PHP file (for example a temporary method in any service/controller):
php
DB::table('users')->count();- Push and confirm:
ai/tenant-isolation-auditfails.- Inline
::errorannotation appears on the file/line. - SARIF appears in GitHub Code Scanning under category
ai/tenant-isolation-audit.
- Remove the temporary line and push.
Test 3: Security Review Gate + Annotations + SARIF
Goal: verify ai/security-review catches high-severity mass assignment pattern.
- Add a temporary unsafe line:
php
$model->update($request->all());- Push and confirm:
ai/security-reviewfails.- Inline annotation appears.
- SARIF appears in Code Scanning under
ai/security-review.
- Remove the temporary line and push.
Test 4: PR Summary Comment
Goal: verify sticky summary comment is created/updated.
- After running at least one failing and one passing check, confirm:
- a comment with marker
<!-- ai-gates-summary -->exists, - re-push updates the same comment (no duplicates),
- statuses reflect latest run.
Test 5: Test Gaps Coverage Gate
Goal: verify ai/test-gaps fails when changed critical lines are uncovered.
- Change logic in
app/without adding/updating test coverage. - Push and confirm
ai/test-gapsfails. - Add coverage test and push again; confirm
ai/test-gapspasses.
Cleanup
- Remove all temporary unsafe test lines.
- Ensure
scripts/ai-gates/policy.jsonis restored. - Confirm PR is green.
- Squash or drop self-test commits before merging.
Expected Gate Signals
- Blocking checks fail on policy/security/tenant/coverage violations.
- Code scanning receives SARIF for tenant/security gates.
- PR summary comment always updates to latest status.