fix(tdd-criteria): review findings — v0.1.0→v0.2.0

- Remove session-authorship trigger loophole (applies to ALL code changes)
- Add composite-tasks paragraph (criterion applies per artefact, not per task)
- Add refactoring carve-out (existing passing tests sufficient, no new tests)
- Expand file-extension list (go, rs, java, rb, ex, swift, kt, cs, php)
- Clarify wrapper line-count (non-blank non-comment lines)
- Add spike-survivor fallback (TODO/GitHub issue if no .tasks/)
- Fix "чужая schema" → "foreign schema" in algorithm + design doc
- Define TDD procedurally (red→green→refactor) in Default mode section
- Sync design doc with same changes
- Rebuild dist + dist-hermes + reinstall

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 10:12:17 +03:00
parent e260fe6cb1
commit 94b4c441e6
6 changed files with 46 additions and 58 deletions

View File

@@ -4,7 +4,7 @@ source: .meeting-room/.archive/2026-05-07-tdd-criteria.md
status: promoted
type: design
title: tdd-criteria-design
amended: "2026-05-07: added test-immutability defence (Anti-loophole rule 4) after user noted symmetric vandalism risk on tests"
amended: "2026-05-07: added test-immutability defence (Anti-loophole rule 4) after user noted symmetric vandalism risk on tests; 2026-05-07 v0.2.0 review: removed session-authorship trigger loophole, added composite-tasks/refactoring sections, expanded file-extension list, clarified wrapper line-count"
ingested_at: '2026-05-07T04:01:23.616Z'
ingested_by: OpeItcLoc03@DESKTOP-NSEF0UK
source_project: .meeting-room
@@ -55,7 +55,7 @@ Walk through 8 questions top-to-bottom. First «yes» determines mode. All «no
```
1. Это исправление бага? → TDD (red-test первым)
2. Это код, потребляющий внешний контракт → TDD (contract-test)
(SDK, REST API, чужая schema)?
(SDK, REST API, foreign schema)?
3. Это security / auth / money / identifiers? → TDD
4. Это pure logic — функция (input → output) → TDD
без I/O, без global state, bounded inputs?
@@ -73,6 +73,10 @@ Walk through 8 questions top-to-bottom. First «yes» determines mode. All «no
(default) → TDD
```
**Composite tasks.** A task that doesn't fit one category is composite — break it down per artefact type. The criterion applies per artefact, not per task.
**Refactoring.** Restructuring existing code without changing observable behaviour, where existing tests already cover it, does not require new tests. If the refactoring introduces new behaviour, that part is a separate artefact subject to the decision algorithm.
## Ironclad — why TDD is cheaper than skipping
| # | Rule | Checkable property | Why TDD here |
@@ -93,7 +97,7 @@ Not «TDD doesn't apply». **«You accept that an agent can vandalise this witho
| 5 | Visual / config | CSS, layout, design tokens, `.env.example`, prompts, wiki, README | `[skip-tdd: visual]` | Eyeball on next render. Visual regression infra exists (Playwright screenshots, Percy) but heavyweight for most projects. |
| 6 | Spike | Explicit POC «throwaway» in commit/PR/task subject | `[skip-tdd: spike]` | Throwaway by contract — deletion isn't a problem. **Survivor rule**: if spike code reaches master, the same merge-commit creates `[backfill-tests-<slug>]` task. Otherwise this category becomes the loophole. |
| 7 | One-shot | Migrations, ETL backfill, ad-hoc cleanup; runs once | `[skip-tdd: oneshot]` | Test never re-executes — cost not recovered. After run, deletion is irrelevant. |
| 8 | Wrapper | ≤10 lines, no branching (re-export, glue) | `[skip-tdd: wrapper]` | Test on `function foo(x) { return bar(x) }` re-states `bar`. Reconstruct cost ≈ delete cost. The defence is on `bar`, not `foo`. |
| 8 | Wrapper | ≤10 non-blank non-comment lines, no branching (re-export, glue) | `[skip-tdd: wrapper]` | Test on `function foo(x) { return bar(x) }` re-states `bar`. Reconstruct cost ≈ delete cost. The defence is on `bar`, not `foo`. |
## Anti-loophole
@@ -149,7 +153,7 @@ Example: «add a user-profile-settings page»:
- Validation form (email format, password strength) → Ironclad-4 (security) → TDD
- API call wrapper for save → Ironclad-3 (third-party contract if PUT to external endpoint) → TDD
- Update Pinia store reducer → Ironclad-2 (pure logic if bounded reducer) → TDD
- Hook `useProfileForm` composing the above → wrapper if ≤10 lines glue, else Ironclad-2
- Hook `useProfileForm` composing the above → wrapper if ≤10 non-blank non-comment lines glue, else Ironclad-2
One «task» yields 4-5 commits with different modes. **The criterion applies per artefact, not per task.** This is the point — no «overall this is exploratory».

View File

@@ -53,3 +53,5 @@ Parseable: `grep "^## \[" .wiki/log.md | tail -20`.
## [2026-05-06] ingest | concepts/hermes-skills-rollout-design
## [2026-05-07] ingest | concepts/tdd-criteria-design
## [2026-05-07] review | tdd-criteria v0.2.0 — 4 findings applied: trigger-loophole fix (removed session-authorship clause), composite-tasks + refactoring sections, expanded file-extension list, clarified wrapper line-count + spike-survivor fallback + foreign-schema fix; design doc synced