{
  "title": "HIST backtest v0.3.2 PRIMARY/UNIQUE conflict-target coverage matrix",
  "schema_version": "0.3.2",
  "ack_of": [
    "e4b06c5a-daa1-4267-9b7b-069075f53947",
    "9b1c02e1-6230-4415-ba61-eef65c5c41d0",
    "67dbeb07-4034-4ed9-b2ac-53081762692e"
  ],
  "hub_job": "b73c292a-16e2-4f11-9370-1337d0239791",
  "research_job": "5c22fbd0-df24-481c-904b-be56cd64d2ea",
  "model_change": false,
  "d1_migration": false,
  "d1_runtime_proof": "deferred",
  "outbox_consumer_proof": "deferred",
  "notes": [
    "One consolidated patch (v0.3.2) — not sequential per-column claims.",
    "Absence/presence of insert trigger alone is not proof; each conflict target has an explicit guard classification.",
    "Identity-lock tables are append-only infrastructure (immutable_lock_infra).",
    "backtest_run_projections is intentionally mutable (derived cache).",
    "Same-payload idempotency is a WRITER property; changed-payload REPLACE is rejected."
  ],
  "targets": [
    {
      "table": "backtest_formula_pins",
      "class": "immutable_evidence",
      "primary_key": ["pin_id"],
      "unique_conflict_targets": [["pin_id"]],
      "guard": "identity_lock_exists_raise",
      "lock_table": "backtest_formula_pin_identity_locks",
      "replace_blocked": true,
      "since": "0.3.1"
    },
    {
      "table": "backtest_authorization_decisions",
      "class": "immutable_evidence",
      "primary_key": ["decision_id"],
      "unique_conflict_targets": [["decision_id"]],
      "guard": "identity_lock_exists_raise",
      "lock_table": "backtest_authorization_decision_identity_locks",
      "replace_blocked": true,
      "since": "0.3.1"
    },
    {
      "table": "backtest_runs",
      "class": "immutable_evidence",
      "primary_key": ["run_id"],
      "unique_conflict_targets": [["run_id"]],
      "guard": "identity_lock_exists_raise",
      "lock_table": "backtest_run_identity_locks",
      "replace_blocked": true,
      "since": "0.3.1",
      "notes": "git_or_worker_rev frozen; changes append runtime_provenance_events"
    },
    {
      "table": "backtest_input_manifests",
      "class": "immutable_evidence",
      "primary_key": ["manifest_id"],
      "unique_conflict_targets": [
        ["manifest_id"],
        ["pin_id", "artifact_kind", "artifact_path", "artifact_sha256"]
      ],
      "guard": "dual_identity_and_natural_key_locks",
      "lock_tables": [
        "backtest_input_manifest_identity_locks",
        "backtest_input_manifest_natural_key_locks"
      ],
      "replace_blocked": true,
      "since": "0.3.2",
      "codex_regression": "e4b06c5a",
      "notes": "v0.3.1 locked manifest_id only; v0.3.2 also locks alternate UNIQUE tuple"
    },
    {
      "table": "backtest_score_events",
      "class": "immutable_evidence",
      "primary_key": ["event_id"],
      "unique_conflict_targets": [
        ["event_id"],
        ["run_id", "construct_id", "score_date"]
      ],
      "guard": "dual_event_id_and_identity_locks",
      "lock_tables": [
        "backtest_score_identity_locks",
        "backtest_score_event_id_locks"
      ],
      "replace_blocked": true,
      "since": "0.3.2",
      "notes": "identity lock since 0.3; explicit event_id lock added in 0.3.2 (67dbeb07)"
    },
    {
      "table": "backtest_exposure_variant_events",
      "class": "immutable_evidence",
      "primary_key": ["event_id"],
      "unique_conflict_targets": [["event_id"]],
      "guard": "event_id_lock_exists_raise",
      "lock_table": "backtest_exposure_variant_event_id_locks",
      "replace_blocked": true,
      "since": "0.3.2",
      "codex_regression": "9b1c02e1"
    },
    {
      "table": "backtest_runtime_provenance_events",
      "class": "immutable_evidence",
      "primary_key": ["event_id"],
      "unique_conflict_targets": [["event_id"]],
      "guard": "event_id_lock_exists_raise",
      "lock_table": "backtest_runtime_provenance_event_id_locks",
      "replace_blocked": true,
      "since": "0.3.2",
      "codex_regression": "67dbeb07"
    },
    {
      "table": "backtest_run_projections",
      "class": "intentionally_mutable_projection",
      "primary_key": ["run_id"],
      "unique_conflict_targets": [["run_id"]],
      "guard": "none_projection_mutable",
      "replace_blocked": false,
      "since": "0.2",
      "notes": "Derived cache only; exposure_variant_ledger_json rebuilt from events"
    },
    {
      "table": "backtest_formula_pin_identity_locks",
      "class": "immutable_lock_infra",
      "primary_key": ["pin_id"],
      "unique_conflict_targets": [["pin_id"]],
      "guard": "append_only_update_delete_triggers",
      "replace_blocked": true,
      "since": "0.3.1"
    },
    {
      "table": "backtest_authorization_decision_identity_locks",
      "class": "immutable_lock_infra",
      "primary_key": ["decision_id"],
      "unique_conflict_targets": [["decision_id"]],
      "guard": "append_only_update_delete_triggers",
      "replace_blocked": true,
      "since": "0.3.1"
    },
    {
      "table": "backtest_run_identity_locks",
      "class": "immutable_lock_infra",
      "primary_key": ["run_id"],
      "unique_conflict_targets": [["run_id"]],
      "guard": "append_only_update_delete_triggers",
      "replace_blocked": true,
      "since": "0.3.1"
    },
    {
      "table": "backtest_input_manifest_identity_locks",
      "class": "immutable_lock_infra",
      "primary_key": ["manifest_id"],
      "unique_conflict_targets": [["manifest_id"]],
      "guard": "append_only_update_delete_triggers",
      "replace_blocked": true,
      "since": "0.3.1"
    },
    {
      "table": "backtest_input_manifest_natural_key_locks",
      "class": "immutable_lock_infra",
      "primary_key": ["pin_id", "artifact_kind", "artifact_path", "artifact_sha256"],
      "unique_conflict_targets": [["pin_id", "artifact_kind", "artifact_path", "artifact_sha256"]],
      "guard": "append_only_update_delete_triggers",
      "replace_blocked": true,
      "since": "0.3.2"
    },
    {
      "table": "backtest_score_identity_locks",
      "class": "immutable_lock_infra",
      "primary_key": ["run_id", "construct_id", "score_date"],
      "unique_conflict_targets": [["run_id", "construct_id", "score_date"]],
      "guard": "append_only_update_delete_triggers",
      "replace_blocked": true,
      "since": "0.3"
    },
    {
      "table": "backtest_score_event_id_locks",
      "class": "immutable_lock_infra",
      "primary_key": ["event_id"],
      "unique_conflict_targets": [["event_id"]],
      "guard": "append_only_update_delete_triggers",
      "replace_blocked": true,
      "since": "0.3.2"
    },
    {
      "table": "backtest_exposure_variant_event_id_locks",
      "class": "immutable_lock_infra",
      "primary_key": ["event_id"],
      "unique_conflict_targets": [["event_id"]],
      "guard": "append_only_update_delete_triggers",
      "replace_blocked": true,
      "since": "0.3.2"
    },
    {
      "table": "backtest_runtime_provenance_event_id_locks",
      "class": "immutable_lock_infra",
      "primary_key": ["event_id"],
      "unique_conflict_targets": [["event_id"]],
      "guard": "append_only_update_delete_triggers",
      "replace_blocked": true,
      "since": "0.3.2"
    }
  ]
}
