Deterministic Iterative Development Protocol (DIDP) v3

3.0 Foundation 2025-12-26

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

FieldTypeRequiredDescription
methodologyenumYes (at spec_lock)Testing approach: tdd, test-after, or hybrid
coverage_targetintegerNoTarget code coverage percentage (0-100)
required_test_levelsstring[]NoRequired testing levels (unit, integration, e2e)
evidence_requiredbooleanNoWhether to preserve test artifacts in archive
enforcementenumNorequired 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

Phasev3 Addition
planningDefine test intent (acceptance criteria, test scenarios)
analysisValidate testability of requirements
spec_lockDeclare testing_strategy.methodology (REQUIRED)
implementationFollow declared methodology (TDD/test-after/hybrid)
testingExecute full validation, defect-only fixes
archivePreserve 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:

  1. Write failing test (red)
  2. Write minimal code to pass (green)
  3. Refactor while keeping green
  4. Repeat

Test-after workflow:

  1. Write implementation
  2. 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.

ConcernPhasePurpose
TDDImplementationBuild correctly
TestingTestingProve 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:

  1. Respect declared methodology — Follow TDD, test-after, or hybrid as specified
  2. Refuse invalid transitions — Block phase advancement if testing rules violated (when enforcement: required)
  3. Surface testability issues — Report untestable requirements during analysis
  4. Preserve evidence — Archive test artifacts when evidence_required: true
  5. Separate concerns — TDD in implementation, validation in testing

Agents MUST NOT:

  1. Skip tests when methodology: tdd
  2. Advance from testing with failing tests
  3. Add features during testing phase
  4. Delete test evidence before archive

Enforcement Levels

LevelBehavior
requiredPhase transitions blocked if testing rules violated
recommendedWarnings emitted but transitions allowed

Default enforcement level is recommended.

When enforcement: required:

  • Missing methodology at 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_strategy block 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