{
  "round": "lakehouse recovery",
  "question": "On a real lakehouse platform, after late data, a schema change and a bad backfill, can control totals prove that a repair worked, and which totals can?",
  "platform": {"name": "Databricks Free Edition", "compute": "one 2X-Small serverless SQL warehouse", "tables": "Delta tables in Unity Catalog", "access": "SQL Statement Execution API and Files API"},
  "data": {"source": "the study's sealed sample: 10,000 City of Chicago trips of January 2024, vendor/portfolio-eval-contract-0.1.0.zip, data/trips.csv", "days": 31},
  "business_columns": ["trip_id", "trip_date", "trip_seconds", "trip_miles", "pickup_community_area", "dropoff_community_area", "fare", "tip", "additional_charges", "trip_total", "shared_trip_authorized", "shared_trip_match"],
  "metrics_exact": ["trips", "fares_present", "shared_matched"],
  "metrics_sum": ["fare_sum", "miles_sum", "seconds_sum"],
  "sum_tolerance": 0.01,
  "schedule": {"bulk_days": "January 1 to 20, one load", "daily_days": "January 21 to 31, one file each, one job each", "job": ["COPY INTO bronze, naming that morning's file", "MERGE into silver on trip_id, the file's rows only", "INSERT INTO gold REPLACE WHERE trip_date is that day"]},
  "faults": {
    "late_file": {"what": "The last 60 January 24 rows by trip_id are withheld from that day's file and delivered as a separate file that no morning job names.", "planted_days": ["2024-01-24"], "late_rows": 60},
    "renamed_column": {"what": "From January 26 the fare column arrives as fare_amount. COPY INTO with schema merge adds the column; the job still reads fare.", "planted_days": ["2024-01-26", "2024-01-27", "2024-01-28", "2024-01-29", "2024-01-30", "2024-01-31"]},
    "bad_backfill": {"what": "After the January 27 job, a backfill sets silver fare to trip_total for January 15 to 22 (the declared window was January 15 to 21) and restates those gold days. January 28 to 31 then load normally.", "planted_days": ["2024-01-15", "2024-01-16", "2024-01-17", "2024-01-18", "2024-01-19", "2024-01-20", "2024-01-21", "2024-01-22"]}
  },
  "truth": "A repair restored the data when silver equals the clean reference run on all 12 business columns, row for row in both directions (EXCEPT ALL), and gold equals it on trip_date and all 6 metrics, row for row in both directions. A team does not have this reference.",
  "levels": {
    "layer_totals": "Per day: bronze (latest row per trip_id, reading fare or fare_amount) against silver, and silver against gold; 6 metrics; one gold row per day. All inside the platform.",
    "outside_gold": "Per day: gold against the sender's totals, held outside the platform; 6 metrics; one gold row per day.",
    "outside_both": "outside_gold, and the same comparison for silver, with one silver row per trip_id.",
    "fingerprint": "Per day: silver's sum of row hashes over all 12 business columns against the sender's, held outside the platform. Silver only.",
    "bundle": "outside_both and fingerprint together."
  },
  "scores": {"false_proof": "a level passes and the repair did not restore the data", "false_alarm": "a level fails and the repair did restore the data"},
  "repairs": {
    "own": {"late_file": ["L_right_load_merge_restate", "L_wrong_gold_added_twice", "L_wrong_gold_only"], "renamed_column": ["R_right_map_merge_restate", "R_wrong_total_as_fare", "R_wrong_join_by_position"], "bad_backfill": ["B_right_merge_from_bronze", "B_wrong_restore_only", "B_wrong_gold_from_bronze", "B_right_restore_and_replay"]},
    "blind": {"count": 12, "per_fault": 4, "first_of_each": "the repair the author would run", "other_three": "repairs an able engineer in a hurry might run, right or wrong"}
  },
  "attempt_order": "Per fault: no-op, own repairs in the order above, blind repairs in file order, then the fault's first own right repair again as the repeat.",
  "reset": "Before each attempt bronze, silver and gold are restored to the fault state's versions, tmp_ tables dropped, and row counts compared with the fault state; a mismatch is a method failure.",
  "method_failures": "A statement refused by the allowlist or failing on the platform ends that attempt. It is reported as did-not-finish, measured, and left out of the proof scores. A quota stop ends the run and is reported.",
  "statement_allowlist": ["COPY INTO", "MERGE INTO", "INSERT", "UPDATE", "DELETE", "RESTORE TABLE", "CREATE OR REPLACE TABLE tmp_", "CREATE TABLE tmp_", "DROP TABLE tmp_", "DROP TABLE IF EXISTS tmp_", "ALTER TABLE", "SELECT", "WITH"],
  "predictions": [
    {"id": 1, "text": "Clean reference: every level passes on every day.", "band": "0 failures"},
    {"id": 2, "text": "No-op controls: late_file passes layer_totals and fails outside_gold, outside_both and fingerprint; renamed_column and bad_backfill fail all four.", "band": "exact"},
    {"id": 3, "text": "The 4 own right repairs restore the data and pass every level.", "band": "4 of 4"},
    {"id": 4, "text": "L_wrong_gold_added_twice: fingerprint passes (false proof), layer_totals and outside_gold fail.", "band": "exact"},
    {"id": 5, "text": "L_wrong_gold_only and B_wrong_gold_from_bronze: outside_gold passes (false proof), layer_totals, outside_both and fingerprint fail.", "band": "exact"},
    {"id": 6, "text": "R_wrong_join_by_position: layer_totals, outside_gold and outside_both pass (false proofs), fingerprint fails.", "band": "exact"},
    {"id": 7, "text": "R_wrong_total_as_fare and B_wrong_restore_only: all four levels fail.", "band": "exact"},
    {"id": 8, "text": "Blind: the repair the author would run restores the data on at least 2 of the 3 faults.", "band": "2 to 3"},
    {"id": 9, "text": "Blind: of the 9 hurried repairs, at least 5 do not restore the data.", "band": "5 to 9"},
    {"id": 10, "text": "Blind: layer_totals passes at least 1 repair that did not restore the data.", "band": "1 to 5"},
    {"id": 11, "text": "Blind: outside_gold passes more unrestored repairs than outside_both.", "band": "strictly more"},
    {"id": 12, "text": "Blind: the bundle has 0 false proofs and 0 false alarms; this follows from its definition unless a sum differs by under 0.01.", "band": "0 and 0"}
  ],
  "headline_rule": "The h1 leads with the blind repairs: how many of those that ran restored the data, and how many of the ones that did not each level passed. It says the sender's totals are assumed right. Every prediction is reported as held, missed or untestable."
}
