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 @@
# refactor_preserves_behavior
## v1
**Why this iteration:** New rule, no prior source. The behavior-preservation contract is implicit in the word "refactor" but never explicitly stated.
**Source:** new rule
---
**Lifted:** 2026-07-05
@@ -0,0 +1,26 @@
# A refactor must preserve observable behavior — tests passing before must pass after
## What it says
A refactor is a change to internal structure that does NOT change observable behavior. The contract: every test that passed before the refactor MUST pass after. If a test fails after the refactor, either the refactor broke behavior (fix the refactor) or the test was testing an implementation detail (fix the test — but only if the implementation detail was not part of the public contract).
## Why
A refactor that breaks tests is not a refactor — it is a behavior change disguised as a refactor. The user reviews "refactor" commits differently than "feature" commits; a refactor is expected to be behavior-neutral. If the refactor breaks tests, the user's review assumption (this is safe) is violated.
## The pattern
```bash
# Before refactor: capture the test baseline
uv run python scripts/run_tests_batched.py --tier tier3 > tests/artifacts/tier2_state/<track>/before_refactor.log 2>&1
# After refactor: run the same tier
uv run python scripts/run_tests_batched.py --tier tier3 > tests/artifacts/tier2_state/<track>/after_refactor.log 2>&1
# Compare: every test that passed before must pass after
```
## See also
- `conductor/directives/contract_change_audit` — audit all callers when changing a public interface
- `conductor/directives/search_all_call_sites_after_signature_change` — search all call sites