{
  "created_at_utc": "20260729T075746Z",
  "source_db": "/home/agent/jarvis_runtime/finance-system/data/finance.sqlite3",
  "backup_copy": "/home/agent/jarvis_runtime/finance-system/legacy_fk_repair/preflight-restored-copy-20260729T075746Z.sqlite3",
  "backup_mode": "0o600",
  "integrity_check": "ok",
  "foreign_key_findings": [
    {
      "table": "broker_import_execution_plans",
      "rowid": 1,
      "parent": "transactions",
      "fkid": 0
    },
    {
      "table": "broker_import_execution_plans",
      "rowid": 2,
      "parent": "transactions",
      "fkid": 0
    },
    {
      "table": "broker_import_execution_plans",
      "rowid": 3,
      "parent": "transactions",
      "fkid": 0
    }
  ],
  "plan_table_info": [
    {
      "cid": 0,
      "name": "execution_plan_id",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 1
    },
    {
      "cid": 1,
      "name": "dry_run_id",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 2,
      "name": "review_item_id",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 3,
      "name": "source_platform",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 4,
      "name": "target_account_id",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 5,
      "name": "target_instrument_id",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 6,
      "name": "transaction_type",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": "'initial_position_snapshot'",
      "pk": 0
    },
    {
      "cid": 7,
      "name": "snapshot_date",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 8,
      "name": "payload_status",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 9,
      "name": "payload_quality_flags_json",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": "'[]'",
      "pk": 0
    },
    {
      "cid": 10,
      "name": "source_row_hash",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 11,
      "name": "planned_write_summary_json",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": "'{}'",
      "pk": 0
    },
    {
      "cid": 12,
      "name": "execution_status",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": "'planned'",
      "pk": 0
    },
    {
      "cid": 13,
      "name": "transaction_id",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 14,
      "name": "created_at",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 15,
      "name": "updated_at",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 16,
      "name": "executed_at",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 17,
      "name": "notes",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    }
  ],
  "plan_foreign_keys": [
    {
      "id": 0,
      "seq": 0,
      "table": "transactions",
      "from": "transaction_id",
      "to": "transaction_id",
      "on_update": "NO ACTION",
      "on_delete": "NO ACTION",
      "match": "NONE"
    },
    {
      "id": 1,
      "seq": 0,
      "table": "instruments",
      "from": "target_instrument_id",
      "to": "instrument_id",
      "on_update": "NO ACTION",
      "on_delete": "NO ACTION",
      "match": "NONE"
    },
    {
      "id": 2,
      "seq": 0,
      "table": "accounts",
      "from": "target_account_id",
      "to": "account_id",
      "on_update": "NO ACTION",
      "on_delete": "NO ACTION",
      "match": "NONE"
    },
    {
      "id": 3,
      "seq": 0,
      "table": "broker_import_review_items",
      "from": "review_item_id",
      "to": "review_item_id",
      "on_update": "NO ACTION",
      "on_delete": "NO ACTION",
      "match": "NONE"
    },
    {
      "id": 4,
      "seq": 0,
      "table": "broker_import_dry_runs",
      "from": "dry_run_id",
      "to": "dry_run_id",
      "on_update": "NO ACTION",
      "on_delete": "NO ACTION",
      "match": "NONE"
    }
  ],
  "transaction_table_info": [
    {
      "cid": 0,
      "name": "transaction_id",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 1
    },
    {
      "cid": 1,
      "name": "transaction_type",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 2,
      "name": "account_id",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 3,
      "name": "instrument_id",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 4,
      "name": "trade_date",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 5,
      "name": "settlement_date",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 6,
      "name": "quantity",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 7,
      "name": "price_original",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 8,
      "name": "gross_amount_original",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 9,
      "name": "fee_original",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": "0",
      "pk": 0
    },
    {
      "cid": 10,
      "name": "tax_original",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": "0",
      "pk": 0
    },
    {
      "cid": 11,
      "name": "net_amount_original",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 12,
      "name": "currency_original",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 13,
      "name": "fx_rate_to_chf",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 14,
      "name": "fx_source",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 15,
      "name": "fx_status",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": "'ok'",
      "pk": 0
    },
    {
      "cid": 16,
      "name": "gross_amount_chf",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 17,
      "name": "fee_chf",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 18,
      "name": "tax_chf",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 19,
      "name": "net_amount_chf",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 20,
      "name": "source_type",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 21,
      "name": "source_id",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 22,
      "name": "external_transaction_id",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 23,
      "name": "row_hash",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 24,
      "name": "is_confirmed",
      "type": "INTEGER",
      "notnull": 1,
      "dflt_value": "1",
      "pk": 0
    },
    {
      "cid": 25,
      "name": "quality_status",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": "'ok'",
      "pk": 0
    },
    {
      "cid": 26,
      "name": "notes",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 27,
      "name": "created_at",
      "type": "TEXT",
      "notnull": 1,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 28,
      "name": "updated_at",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 29,
      "name": "is_voided",
      "type": "INTEGER",
      "notnull": 1,
      "dflt_value": "0",
      "pk": 0
    },
    {
      "cid": 30,
      "name": "voided_at",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 31,
      "name": "void_reason",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 32,
      "name": "voided_by",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 33,
      "name": "correction_of_transaction_id",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 34,
      "name": "correction_reason",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 35,
      "name": "activity_kind",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 36,
      "name": "booking_date",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 37,
      "name": "event_timestamp",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 38,
      "name": "base_currency",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 39,
      "name": "internal_transfer_group_id",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 40,
      "name": "reversal_of_transaction_id",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    },
    {
      "cid": 41,
      "name": "source_reference",
      "type": "TEXT",
      "notnull": 0,
      "dflt_value": null,
      "pk": 0
    }
  ],
  "finding_details": [
    {
      "fk": {
        "table": "broker_import_execution_plans",
        "rowid": 1,
        "parent": "transactions",
        "fkid": 0
      },
      "plan": {
        "execution_plan_id": "plan-9122f3c2-eb76-4f92-b95d-1f9c2a99f686",
        "dry_run_id": "2761d82c-b80f-44d2-8c5f-d969e01b9912",
        "review_item_id": "9122f3c2-eb76-4f92-b95d-1f9c2a99f686",
        "source_platform": "True Wealth",
        "target_account_id": "true-wealth-review-brokerage",
        "target_instrument_id": "instrument-US9229087690",
        "transaction_type": "initial_position_snapshot",
        "snapshot_date": "2026-05-14",
        "payload_status": "ready",
        "payload_quality_flags_json": "[\"cost_basis_uncertain\", \"fx_missing\"]",
        "source_row_hash": "d91dcdb723e0725fc4d721d2c3083d3609a33c1bd04c191d3d548fbfaa55d38a",
        "planned_write_summary_json": "{\"account_id\": \"true-wealth-review-brokerage\", \"cost_basis_quality\": \"uncertain\", \"currency_original\": \"USD\", \"fx_rate_to_chf\": null, \"fx_status\": \"missing\", \"gross_amount_chf\": \"36482.67\", \"instrument_id\": \"instrument-US9229087690\", \"price_original\": \"364.71\", \"quantity\": \"128\", \"snapshot_date\": \"2026-05-14\", \"source_id\": \"9122f3c2-eb76-4f92-b95d-1f9c2a99f686\", \"source_row_ref\": \"table1:row14\", \"source_type\": \"broker_import_reviewed_snapshot\", \"trade_date\": \"2026-05-14\", \"transaction_type\": \"initial_position_snapshot\"}",
        "execution_status": "imported",
        "transaction_id": "tx-0870b5b9-0c4e-4ffb-94b5-4eef18009b99",
        "created_at": "2026-05-15T10:20:15.960216+00:00",
        "updated_at": "2026-05-15T10:21:23.938094+00:00",
        "executed_at": "2026-05-15T10:21:23.938094+00:00",
        "notes": "B6b mini-import executed for exactly one reviewed payload."
      },
      "parent_count": 0
    },
    {
      "fk": {
        "table": "broker_import_execution_plans",
        "rowid": 2,
        "parent": "transactions",
        "fkid": 0
      },
      "plan": {
        "execution_plan_id": "plan-1c6136ca-852d-4467-ae87-4924ea2bd305",
        "dry_run_id": "2761d82c-b80f-44d2-8c5f-d969e01b9912",
        "review_item_id": "1c6136ca-852d-4467-ae87-4924ea2bd305",
        "source_platform": "True Wealth",
        "target_account_id": "true-wealth-review-brokerage",
        "target_instrument_id": "instrument-US9220428588",
        "transaction_type": "initial_position_snapshot",
        "snapshot_date": "2026-05-14",
        "payload_status": "ready",
        "payload_quality_flags_json": "[\"cost_basis_uncertain\", \"fx_missing\"]",
        "source_row_hash": "69b0d49e21558dff03555e0dd70509e800f81507a014215c18722548f809b63b",
        "planned_write_summary_json": "{\"account_id\": \"true-wealth-review-brokerage\", \"cost_basis_quality\": \"uncertain\", \"currency_original\": \"USD\", \"fx_rate_to_chf\": null, \"fx_status\": \"missing\", \"gross_amount_chf\": \"11476.56\", \"instrument_id\": \"instrument-US9220428588\", \"price_original\": \"59.94\", \"quantity\": \"245\", \"snapshot_date\": \"2026-05-14\", \"source_id\": \"1c6136ca-852d-4467-ae87-4924ea2bd305\", \"source_row_ref\": \"table1:row15\", \"source_type\": \"broker_import_reviewed_snapshot\", \"trade_date\": \"2026-05-14\", \"transaction_type\": \"initial_position_snapshot\"}",
        "execution_status": "imported",
        "transaction_id": "tx-e13645cf-1681-4ac8-b57d-981aad88098c",
        "created_at": "2026-05-15T10:20:15.960591+00:00",
        "updated_at": "2026-05-15T10:48:28.447099+00:00",
        "executed_at": "2026-05-15T10:48:28.447099+00:00",
        "notes": "B6c second controlled mini-import from reviewed True Wealth execution plan; no mass import."
      },
      "parent_count": 0
    },
    {
      "fk": {
        "table": "broker_import_execution_plans",
        "rowid": 3,
        "parent": "transactions",
        "fkid": 0
      },
      "plan": {
        "execution_plan_id": "plan-8cc9a511-e679-47ee-a57a-30fe53ea72a6",
        "dry_run_id": "2761d82c-b80f-44d2-8c5f-d969e01b9912",
        "review_item_id": "8cc9a511-e679-47ee-a57a-30fe53ea72a6",
        "source_platform": "True Wealth",
        "target_account_id": "true-wealth-review-brokerage",
        "target_instrument_id": "instrument-US92204A7028",
        "transaction_type": "initial_position_snapshot",
        "snapshot_date": "2026-05-14",
        "payload_status": "ready",
        "payload_quality_flags_json": "[\"cost_basis_uncertain\", \"fx_missing\"]",
        "source_row_hash": "4af3459e24c3edf73a406bad31c4ebe4ece6ca7dcefa8acb175c3d1798e49ca1",
        "planned_write_summary_json": "{\"account_id\": \"true-wealth-review-brokerage\", \"cost_basis_quality\": \"uncertain\", \"currency_original\": \"USD\", \"fx_rate_to_chf\": null, \"fx_status\": \"missing\", \"gross_amount_chf\": \"32095.35\", \"instrument_id\": \"instrument-US92204A7028\", \"price_original\": \"113.45\", \"quantity\": \"362\", \"snapshot_date\": \"2026-05-14\", \"source_id\": \"8cc9a511-e679-47ee-a57a-30fe53ea72a6\", \"source_row_ref\": \"table1:row17\", \"source_type\": \"broker_import_reviewed_snapshot\", \"trade_date\": \"2026-05-14\", \"transaction_type\": \"initial_position_snapshot\"}",
        "execution_status": "imported",
        "transaction_id": "tx-aecd65d3-148f-4e45-9e19-d5c2d85e8133",
        "created_at": "2026-05-15T10:20:15.960672+00:00",
        "updated_at": "2026-05-15T10:58:02.510937+00:00",
        "executed_at": "2026-05-15T10:58:02.510937+00:00",
        "notes": "B6d final controlled True Wealth mini-import from reviewed execution plan; no mass import."
      },
      "parent_count": 0
    }
  ],
  "exact_identity_match_counts": [
    {},
    {},
    {}
  ]
}