{
  "id": "diff_patch_replace_engine",
  "label": "Diff / Patch / Replace Engine Canonical",
  "phase": "phase-09",
  "category": "operational_flows",
  "status": "ACTIVE_DH_MIRROR",
  "purpose": "Govern code mutation strategy for replace, insert and refusal decisions.",
  "function": "Prevent uncontrolled append, duplicate logic, branch pollution and unvalidated code mutation.",
  "technology_requirements": [
    {
      "technology": "Diff Patch Replace Engine",
      "required_for": "Govern code mutation strategy for replace, insert and refusal decisions.",
      "required_by_phase": "phase-09",
      "required_by_category": "diff_patch_replace_engine",
      "required_by_buckets": [
        "Prerequisites",
        "Installation",
        "Configuration",
        "Validation",
        "Observable Evidence",
        "Failure Modes & Recovery",
        "Completion & Promotion"
      ],
      "expected_version": "MISSING until Diff Patch Replace Engine is implemented and validated in the future Execution & Monitoring Panel",
      "validation_command": "MISSING until diff_patch_replace_engine can prove scope, evidence, execution state and promotion decision",
      "evidence_path": "/home/yeff/public_html/devon/canon/execution/state/dh_sources/diff_patch_replace_engine.json",
      "status_source": "Documentation Hub + future Execution & Monitoring Panel",
      "blocking_if_missing": true,
      "failure_impact": "The project has already exposed the cost of weak patch discipline: code enters, the UI does not change, and later cleanup becomes harder than the original fix. This category blocks patch sediment by forcing every mutation to justify its exact insertion, replacement or refusal point."
    }
  ],
  "depends_on": [
    "filesystem_operations",
    "backup_rollback",
    "simulation_dry_run_engine"
  ],
  "used_by": [
    "patch_outcome_tracker",
    "code_quality_gate",
    "release_governance"
  ],
  "overview": {
    "summary": "Diff / Patch / Replace Engine Canonical owns the surgical layer of DEVON-DEV code change. It decides whether a patch should replace an existing canonical point, insert a missing branch or refuse mutation because the target cannot be proven.",
    "function": "FUNCTION: Convert intended edits into bounded diffs with target signature, before state, after state, replacement rule, backup reference, validation rule and rollback route.",
    "system_position": "This category is where the project’s anti-bloat discipline becomes executable. Filesystem Operations controls the file surface, but this engine controls the mutation strategy. Code Quality Gate later judges whether the edit reduced risk or just added more code that future patches must work around.",
    "failure_impact": "The project has already exposed the cost of weak patch discipline: code enters, the UI does not change, and later cleanup becomes harder than the original fix. This category blocks patch sediment by forcing every mutation to justify its exact insertion, replacement or refusal point."
  },
  "failure_impact": "The project has already exposed the cost of weak patch discipline: code enters, the UI does not change, and later cleanup becomes harder than the original fix. This category blocks patch sediment by forcing every mutation to justify its exact insertion, replacement or refusal point."
}
