{
  "filename": "Sources/App/process.swift",
  "rule": "- name: processing-observes-task-cancellation\n  where: \"Sources/App/process.swift\"\n  ensure: >-\n    processOrders must call Task.checkCancellation before starting each next order operation.",
  "corrected": "import Foundation\n\nfunc processOrders(_ ids: [UUID], apply: @Sendable (UUID) async throws -> Void) async throws {\n    for id in ids {\n        try Task.checkCancellation()\n        try await apply(id)\n    }\n}\n",
  "broken": "import Foundation\n\nfunc processOrders(_ ids: [UUID], apply: @Sendable (UUID) async throws -> Void) async throws {\n    for id in ids {\n        try await apply(id)\n    }\n}\n",
  "regression": [
    "        try Task.checkCancellation()\n",
    ""
  ],
  "test_scenarios": [
    [
      "Task active",
      "Each order processed"
    ],
    [
      "Task canceled before iteration",
      "Cancellation thrown before next apply"
    ],
    [
      "Cancellation during apply",
      "Adapter-specific cancellation and reconciliation"
    ],
    [
      "Detached work",
      "Separate shutdown ownership test required"
    ]
  ],
  "test_source": null,
  "test_command": "swift test --filter ProcessingCancellationTests"
}