{
  "schemaVersion": 1,
  "fixtureId": "daily-order-check-v1",
  "status": "prepared_untested",
  "preparedOn": "2026-09-17",
  "syntheticDataOnly": true,
  "purpose": "Check unfinished existing order rows against a second reference Sheet, update exact matches and hold uncertain rows for review.",
  "outcomeScope": "These are test inputs and expected outcomes. They are not Zapier, Make or Lovable run results.",
  "fieldContract": {
    "rowKey": "Unique stable input identity, not the current spreadsheet position. Keep it unchanged when a Sheet is sorted.",
    "orderId": "Fictional order identity. Trim surrounding whitespace for matching; compare case-sensitively. Never guess a blank or ambiguous identity.",
    "savedStatus": "The order status currently stored on the input row.",
    "referenceStatus": "The status from the one accepted reference match; null until a successful update.",
    "processingState": "Ready, Processed or Held. Only Ready rows enter a batch. A failed write stays eligible until its actual outcome is checked.",
    "lastBatchId": "The actual batch that last updated or held the row, or null for an untouched input.",
    "exceptionCode": "blank_order_id, duplicate_input_order_id, reference_not_found or reference_ambiguous; null for a row without a held exception."
  },
  "inputColumns": ["rowKey", "orderId", "savedStatus", "referenceStatus", "processingState", "lastBatchId", "exceptionCode"],
  "referenceColumns": ["referenceRowKey", "orderId", "status"],
  "inputRows": [
    {"rowKey":"ROW-001","orderId":"ORDER-001","savedStatus":"Pending","referenceStatus":null,"processingState":"Ready","lastBatchId":null,"exceptionCode":null},
    {"rowKey":"ROW-002","orderId":"ORDER-002","savedStatus":"Pending","referenceStatus":null,"processingState":"Ready","lastBatchId":null,"exceptionCode":null},
    {"rowKey":"ROW-003","orderId":"ORDER-003","savedStatus":"Pending","referenceStatus":null,"processingState":"Ready","lastBatchId":null,"exceptionCode":null},
    {"rowKey":"ROW-004","orderId":"ORDER-004","savedStatus":"Processing","referenceStatus":null,"processingState":"Ready","lastBatchId":null,"exceptionCode":null},
    {"rowKey":"ROW-005","orderId":"ORDER-005","savedStatus":"Paid","referenceStatus":null,"processingState":"Ready","lastBatchId":null,"exceptionCode":null},
    {"rowKey":"ROW-006","orderId":"ORDER-006","savedStatus":"Processing","referenceStatus":null,"processingState":"Ready","lastBatchId":null,"exceptionCode":null},
    {"rowKey":"ROW-007","orderId":"ORDER-007","savedStatus":"Pending","referenceStatus":null,"processingState":"Ready","lastBatchId":null,"exceptionCode":null},
    {"rowKey":"ROW-008","orderId":"ORDER-008","savedStatus":"Pending","referenceStatus":null,"processingState":"Ready","lastBatchId":null,"exceptionCode":null},
    {"rowKey":"ROW-009","orderId":"ORDER-009","savedStatus":"Delivered","referenceStatus":"Delivered","processingState":"Processed","lastBatchId":"PREVIOUS-009","exceptionCode":null},
    {"rowKey":"ROW-010","orderId":"ORDER-010","savedStatus":"Cancelled","referenceStatus":"Cancelled","processingState":"Processed","lastBatchId":"PREVIOUS-010","exceptionCode":null},
    {"rowKey":"ROW-011","orderId":"ORDER-003","savedStatus":"Pending","referenceStatus":null,"processingState":"Ready","lastBatchId":null,"exceptionCode":null},
    {"rowKey":"ROW-012","orderId":"","savedStatus":"Pending","referenceStatus":null,"processingState":"Ready","lastBatchId":null,"exceptionCode":null}
  ],
  "referenceRows": [
    {"referenceRowKey":"REF-001","orderId":"ORDER-001","status":"Shipped"},
    {"referenceRowKey":"REF-002","orderId":"ORDER-002","status":"Packed"},
    {"referenceRowKey":"REF-003","orderId":"ORDER-003","status":"Cancelled"},
    {"referenceRowKey":"REF-004","orderId":"ORDER-004","status":"Shipped"},
    {"referenceRowKey":"REF-005","orderId":"ORDER-005","status":"Packed"},
    {"referenceRowKey":"REF-006","orderId":"ORDER-006","status":"Delivered"},
    {"referenceRowKey":"REF-008-A","orderId":"ORDER-008","status":"Packed"},
    {"referenceRowKey":"REF-008-B","orderId":"ORDER-008","status":"Cancelled"},
    {"referenceRowKey":"REF-009","orderId":"ORDER-009","status":"Packed"},
    {"referenceRowKey":"REF-010","orderId":"ORDER-010","status":"Shipped"}
  ],
  "fallbackReferenceRows": [
    {"referenceRowKey":"FALLBACK-007","orderId":"ORDER-007","status":"Packed"}
  ],
  "rules": {
    "eligibleState": "Ready",
    "completedState": "Processed",
    "heldState": "Held",
    "inputDuplicateRule": "For each trimmed, nonblank order ID, the smallest stable row key across the complete input list is canonical. Hold any additional Ready row for the same ID, even if the canonical row is already Processed.",
    "referenceRule": "Exactly one match is required. Zero matches are held; multiple matches are held even if their status values agree.",
    "fallbackRule": "Initially disabled. After the rule-change test, consult the fixed fallback only when the primary reference has zero matches. A duplicate primary reference cannot be overridden by fallback.",
    "updateRule": "Update the original row selected by stable row key. Copy the one reference status, set Processed, clear its exception and retain the actual batch identity.",
    "holdRule": "Set Held and the exact exception reason, retaining the existing savedStatus. Holding a row is a persisted metadata write and must be counted separately from a successful status update.",
    "skipRule": "Processed and Held rows remain unchanged until a deliberate recorded release.",
    "summaryRule": "One final summary only after every item belonging to the batch is accounted for. A loop's final-numbered child is not evidence of completion of parallel children."
  },
  "cases": {
    "A": {
      "name": "Morning batch",
      "expected": {"inspectedRows":12,"readyRows":10,"distinctReadyNonblankOrderIds":8,"statusUpdates":6,"exceptionHolds":4,"skippedRows":2,"persistedInputRowWrites":10,"finalSummaries":1},
      "updatedRowKeys": ["ROW-001","ROW-002","ROW-003","ROW-004","ROW-005","ROW-006"],
      "untouchedRowKeys": ["ROW-009","ROW-010"],
      "exceptionRows": {"ROW-007":"reference_not_found","ROW-008":"reference_ambiguous","ROW-011":"duplicate_input_order_id","ROW-012":"blank_order_id"}
    },
    "B": {
      "name": "Next scheduled run after A",
      "expected": {"inspectedRows":12,"readyRows":0,"statusUpdates":0,"exceptionHolds":0,"skippedRows":12,"persistedInputRowWrites":0,"finalSummaries":1},
      "usageNote": "An empty-update batch can still read rows, coordinate and save a summary. Observe each product's actual usage; do not claim the batch is free."
    },
    "C": {
      "name": "Repeated input identity",
      "canonicalRowKey": "ROW-003",
      "heldRowKey": "ROW-011",
      "expected": "Sorting input rows does not change the canonical identity. Only ROW-003 receives the successful status update for ORDER-003."
    },
    "D": {
      "name": "Change the missing-match rule",
      "startingState": "After A",
      "enableFallbackLookup": true,
      "releaseRowKey": "ROW-007",
      "releaseAction": "Record a deliberate Held-to-Ready release before the next scheduled run. Do not release any other held row.",
      "expected": {"releaseWritesBeforeBatch":1,"statusUpdates":1,"exceptionHolds":0,"skippedRows":11,"persistedInputRowWritesInBatch":1,"remainingHeldRows":3,"finalSummaries":1},
      "newSavedStatus": "Packed"
    },
    "E": {
      "name": "Partial batch failure and recovery",
      "startingState": "Reset to A's original isolated inputs",
      "failureOrderId": "ORDER-004",
      "failureRowKey": "ROW-004",
      "failurePoint": "The dedicated test endpoint fails before this row's status write. Count the endpoint separately from normal production-path usage.",
      "expectedBeforeRecovery": "Record the actual successful, failed, held and pending row keys. Do not assume that exactly three updates occurred before the failure.",
      "expectedAfterRecovery": "Six correct status updates in total, the same four explained exceptions and two original processed rows untouched. Audit every write; report repeated writes and duplicate summaries instead of concealing them.",
      "claimedExactlyOnceSupport": false,
      "claimedConcurrencySupport": false
    },
    "F": {
      "name": "Independent handover",
      "expected": "A second reviewer uses the setup note to locate eligibility, duplicate handling and one failure. Record assistance. No completed handover is claimed."
    }
  },
  "runtimeEvidenceContract": {
    "provider": "zapier or make; never mix provider partitions",
    "batchId": "Actual identity shared by the scheduled start, child runs, row changes and summary",
    "childRunIds": "All native child run identities associated with the batch",
    "writeAudit": "Append each actual input-row write with provider, batchId, nativeRunId, stable rowKey, write kind, old/new state and observed timestamp. Distinguish status updates, exception holds, releases and repeats.",
    "usage": "Record before/after counters and native action/credit history separately for normal, empty, rule-change and failed/recovered batches.",
    "summary": "Counts reconcile to the actual input rows and each item outcome. Never infer completion from the final-numbered loop iteration."
  },
  "isolation": {
    "providers": ["zapier","make"],
    "inputTabs": {"zapier":"Zapier Orders","make":"Make Orders"},
    "referenceTabs": {"zapier":"Zapier Reference","make":"Make Reference"},
    "fallbackTabs": {"zapier":"Zapier Fallback","make":"Make Fallback"},
    "sheetId": null,
    "appProjectId": null,
    "rules": ["Create new fictional resources; keep earlier demonstrations intact.","Reset each case to equivalent provider-specific state and retain previous evidence.","Use the same reference values and business rules. Record differences in native implementation.","Lovable displays supplied results; matching, selection, exception routing and recovery belong to the automation products.","Keep credentials, connection IDs and private endpoint URLs outside this fixture and public footage."]
  },
  "observedRuns": []
}
