feat(directives): add 15 engagement-specific directives + tags.toml entries

This commit is contained in:
ed
2026-07-05 14:17:51 -04:00
parent 9434e4c6e9
commit 0c4a7621d4
31 changed files with 499 additions and 0 deletions
@@ -0,0 +1,9 @@
# audit_script_as_gate
## v1
**Why this iteration:** New rule, no prior source. Encodes the pattern already followed by the 4 existing audit scripts (`audit_weak_types.py`, `audit_exception_handling.py`, `audit_main_thread_imports.py`, `audit_no_models_config_io.py`) so new audit scripts follow the same `--strict` gate convention.
**Source:** new rule (pattern inferred from existing `scripts/audit_*.py`)
---
**Lifted:** 2026-07-05
@@ -0,0 +1,32 @@
# Audit scripts that classify or summarize must have a `--strict` quality gate that exits 1 on regression
## What it says
Every audit script in `scripts/audit_*.py` that produces classified output (weak types, exception handling, tier2 leaks, etc.) MUST implement a `--strict` mode that exits non-zero when the audit finds violations. The default mode (no `--strict`) is informational — it prints a human-readable report and exits 0. The `--strict` mode is the CI gate.
## Why
An audit without a gate is a suggestion. An audit with a `--strict` gate is a convention enforced before merge. The project's 4 existing audit scripts (`audit_weak_types.py`, `audit_exception_handling.py`, `audit_main_thread_imports.py`, `audit_no_models_config_io.py`) all follow this pattern. New audit scripts MUST follow it too.
## The pattern
```python
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--strict", action="store_true", help="Exit 1 on any violation")
parser.add_argument("--json", action="store_true", help="Machine-readable output")
args = parser.parse_args()
violations = run_audit()
if args.json:
print(json.dumps(violations))
else:
print_human_report(violations)
if args.strict and violations:
return 1
return 0
```
## See also
- `conductor/directives/convention_enforcement_4_mechanisms` — the 4-mechanism enforcement model (styleguide + checklist + audit script + CI gate)
- `conductor/directives/quality_gate_catches_broken_classifier_before_ship` — the quality gate for classifier scripts