Deterministic Iterative Development Protocol (DIDP) v3
DIDP v3
Supersedes: DIDP v2
This version adds testing semantics to DIDP without changing core workflow mechanics. All v1 and v2 behaviors remain intact.
Testing Strategy Block (New in v3)
Schema Addition
Add to iteration_state.yaml:
testing_strategy:
methodology: tdd | test-after | hybrid # REQUIRED at spec_lock
coverage_target: 80 # OPTIONAL: percentage target
required_test_levels: # OPTIONAL: list of required levels
- unit
- integration
- e2e
evidence_required: true # OPTIONAL: preserve test artifacts
enforcement: required | recommended # OPTIONAL: default is recommended
Field Definitions
| Field | Type | Required | Description |
|---|---|---|---|
methodology | enum | Yes (at spec_lock) | Testing approach: tdd, test-after, or hybrid |
coverage_target | integer | No | Target code coverage percentage (0-100) |
required_test_levels | string[] | No | Required testing levels (unit, integration, e2e) |
evidence_required | boolean | No | Whether to preserve test artifacts in archive |
enforcement | enum | No | required blocks transitions, recommended warns |
Testing Methodologies
TDD (Test-Driven Development)
testing_strategy:
methodology: tdd
When methodology: tdd:
- Tests MUST be written before implementation code
- Red/green/refactor cycle MUST be followed
- Implementation phase produces tests alongside code
- Agent MUST refuse to write implementation without corresponding test
Test-After
testing_strategy:
methodology: test-after
When methodology: test-after:
- Implementation may proceed without tests
- Tests MUST be written before testing phase exit
- Agent SHOULD warn if implementation lacks tests
Hybrid
testing_strategy:
methodology: hybrid
When methodology: hybrid:
- Critical paths use TDD
- Non-critical paths may use test-after
- Agent uses judgment based on complexity
Phase-Level Testing Semantics
| Phase | v3 Addition |
|---|---|
planning | Define test intent (acceptance criteria, test scenarios) |
analysis | Validate testability of requirements |
spec_lock | Declare testing_strategy.methodology (REQUIRED) |
implementation | Follow declared methodology (TDD/test-after/hybrid) |
testing | Execute full validation, defect-only fixes |
archive | Preserve evidence if evidence_required: true |
Planning Phase
During planning, SHOULD define:
- Acceptance criteria (what proves success)
- Test scenarios (how to validate)
- Risk areas requiring coverage
Analysis Phase
During analysis, MUST validate:
- Requirements are testable
- Test boundaries are clear
- No untestable assumptions
If requirements are not testable:
analysis_outcome:
replan_required: true
reason: "Requirements X, Y are not testable as specified"
Spec Lock Phase
At spec_lock, MUST declare:
testing_strategy:
methodology: tdd # or test-after, hybrid
If enforcement: required and methodology not declared, phase transition MUST fail.
Implementation Phase
Follow declared methodology:
TDD workflow:
- Write failing test (red)
- Write minimal code to pass (green)
- Refactor while keeping green
- Repeat
Test-after workflow:
- Write implementation
- Write tests before phase exit
Testing Phase
- Execute all tests
- Only defect fixes allowed (no new features)
- Document test results
- If tests fail, remain in testing phase
Archive Phase
When evidence_required: true, preserve:
- Test reports
- Coverage snapshots
- Performance benchmarks
- Any validation artifacts
TDD vs Testing Phase Distinction
TDD belongs inside the implementation phase, not instead of the testing phase.
| Concern | Phase | Purpose |
|---|---|---|
| TDD | Implementation | Build correctly |
| Testing | Testing | Prove correctness |
TDD optimizes how code is written. Testing phase validates what was delivered.
Both are complementary, not substitutes.
Agent Behavioral Rules
Agents operating under DIDP v3 MUST:
- Respect declared methodology — Follow TDD, test-after, or hybrid as specified
- Refuse invalid transitions — Block phase advancement if testing rules violated (when
enforcement: required) - Surface testability issues — Report untestable requirements during analysis
- Preserve evidence — Archive test artifacts when
evidence_required: true - Separate concerns — TDD in implementation, validation in testing
Agents MUST NOT:
- Skip tests when
methodology: tdd - Advance from testing with failing tests
- Add features during testing phase
- Delete test evidence before archive
Enforcement Levels
| Level | Behavior |
|---|---|
required | Phase transitions blocked if testing rules violated |
recommended | Warnings emitted but transitions allowed |
Default enforcement level is recommended.
When enforcement: required:
- Missing
methodologyat spec_lock blocks transition - Failing tests block testing → archive transition
- Missing evidence blocks archive → merge (if
evidence_required: true)
Example: Full Testing Configuration
iteration:
id: "ITER-2025-12-26-E"
goal: "Add user authentication"
testing_strategy:
methodology: tdd
coverage_target: 90
required_test_levels:
- unit
- integration
evidence_required: true
enforcement: required
phase:
name: implementation
Backwards Compatibility
DIDP v3 is backwards compatible with v1 and v2:
testing_strategyblock is optional- If omitted, no testing enforcement applies
- All v1 phase rules remain in effect
- All v2 versioning rules remain in effect
Projects can adopt v3 incrementally by adding testing_strategy when ready.
References
- DIDP v1 — Core workflow
- DIDP v2 — Versioning semantics
- Workflow Contract — Agent constitution
- Phase Model — Phase state machine