Skip to content

v0.32.0 — M028 TDD Discipline for aihaus Clients

Choose a tag to compare

@overdrive-dev overdrive-dev released this 10 May 04:30
· 223 commits to main since this release

v0.32.0 — M028 TDD Discipline for aihaus Clients

aihaus agora prescreve TDD discipline aos usuários do pacote (clientes que instalam aihaus em seus próprios repos), sem violar stack-agnosticism. 7 stories, 4 ADRs (260510-A/B/C/D) + 2 curator ADRs (M028-A/B) capturando padrões generalizados.

Highlights

testing_discipline em project.md (Surface 1 — ADR-260510-A)

Novo ## Practices section (10ª H2 no template) com structured key:

testing_discipline: tdd | test-after | none

Default none (preserva comportamento atual). aih-init auto-detecta no install:

  • tests/ ou __tests__/ ou framework declarado em package.json/pyproject.toml → seed test-after
  • .tdd-discipline marker file ou tdd: commit-prefix em últimas 30 commits → seed tdd
  • Else → none

Auto-detection é zero-prompt (preserva aih-init invariant). Usuário pode override post-install editando project.md direto.

tdd-guard.sh PreToolUse hook (Surface 5 — ADR-260510-C)

Novo hook em pkg/.aihaus/hooks/tdd-guard.sh (195 LOC) que bloqueia Write|Edit em arquivos não-test quando testing_discipline=tdd AND nenhum test file foi editado na mesma session. Test-file allowlist regex extensível: tests/, __tests__/, *_test.*, *.test.*, spec/, *.spec.*, _test.go, cypress/integration/, e2e/, __specs__/.

Bypass mechanisms:

  • AIHAUS_TDD_GUARD=0 env var (single-session) — aih-quick Step 0 set / Step 6 unset lifecycle
  • --no-tdd flag (per-skill-invocation, audit-logged via manifest-append.sh --audit tdd-skip)

Hook reads AIHAUS_TESTING_DISCIPLINE from cached env (parent skill exports at session start, hook reads — R4 performance mitigation). Audit emission a .claude/audit/hook.jsonl event:"tdd-guard".

Step 7.6 calibration-style annex (Surface 2 — aih-feature/annexes/tdd-discipline.md)

87-line annex following M027/S5 calibration-gate.md precedent. Triggered when project.md.testing_discipline=tdd AND --no-tdd not in args. Implementer briefing prepended com red-green-refactor cycle instruction. --no-tdd honored via skip + audit-log.

/aih-plan Phase 3.6 + /aih-milestone --plan propagam --no-tdd flag para downstream dispatches.

Surface 4 permanently REJECTED (ADR-260510-D scope-fence)

aihaus's próprio bash hooks/scripts NÃO usam TDD (autonomy-guard.sh = 864 LOC, zero unit tests, integration-tested via smoke). Pretender baseline-stance test-first em implementer/frontend-dev/code-fixer seria self-eating-cake theater. ADR documenta honest scoping: TDD discipline aplica-se a USER code, não aihaus internals. Verification command shipped: wc -l pkg/.aihaus/hooks/autonomy-guard.sh = 864.

## Practices governance (ADR-260510-B)

Sunset clause: 2 milestones post-introduction com zero downstream consumers → key removed via amendment ADR. Flat namespace (no nesting). Reserved namespace claimed by aihaus: testing_discipline, commit_convention, style_discipline, ci_gates, code_review_discipline. Future milestones extending.

Curator generalizations (ADR-M028-CURATE-A + B)

  • A: Hook bypass for skill-specific lifecycles uses explicit env-var, not implicit marker file. Generalizes Decision B.
  • B: Honest-scope-fence pattern for self-modifying tooling. Future discipline ADRs MUST include Scope section + verification commands.

Smoke Checks 78 → 80

  • Check 79: tdd-guard.sh PreToolUse hook fixture-fail tests. 3 fixtures (tdd-on-no-test, tdd-on-with-test, aih-quick-bypass).
  • Check 80: tdd-discipline annex pointer + --no-tdd flag wiring across aih-feature/aih-plan/aih-milestone.

ADRs Accepted

  • ADR-260510-A — testing_discipline schema for project.md
  • ADR-260510-B — project.md structured-keys governance + sunset clause
  • ADR-260510-C — tdd-guard.sh PreToolUse hook contract
  • ADR-260510-D — TDD discipline scope-fence (user code only)
  • ADR-M028-CURATE-A — Hook bypass via explicit env-var pattern (curator generalization)
  • ADR-M028-CURATE-B — Honest-scope-fence pattern (curator generalization)

Other Changes

  • planner.md L52-60 vestigial Plan Structure code block DELETED (M024/M025 LSDD vocabulary cleanup). plugin/agents/planner.md duplicate also cleaned.
  • implementer.md + frontend-dev.md extended Stack-read prose with runtime testing_discipline awareness. NO baseline stance change — stack-agnosticism preserved.

Validation

  • Smoke test: 80/80 PASS
  • Purity check: PASS (zero foreign framework references)
  • 8 commits + merge to main (2f2e25b)
  • Plan-checker: APPROVED post-remediation (4 BLOCKERs surgical-fixed)
  • Reviewer adversarial pass: APPROVED 0 BLOCKER + 4 MED + 4 LOW (all non-blocking)

Open Items for M029+

  • Pre-existing M027 Check 78 stderr warning ([[: 0\n0: syntax error) at smoke-test.sh:4119 — fix candidate.
  • Cross-story Check N collision detector — grep '^# Check [0-9]+:' tools/smoke-test.sh | sort | uniq -d as new smoke check (lesson from M028 S2/S3 collision).
  • ## Practices section governance automated check (per ADR-260510-B sunset clause).
  • ADR scope-fence verification-command discipline (per ADR-M028-CURATE-B).

Migration Notes

  • No breaking changes — testing_discipline defaults to none for existing installs. Behavior preserved.
  • New installs auto-detect via aih-init heuristic.
  • Users can opt into TDD by editing project.md ## Practices section directly: testing_discipline: tdd.
  • Users can opt out per-invocation via --no-tdd flag (audit-logged).
  • Users can disable globally per-session via AIHAUS_TDD_GUARD=0.