{
 "use_case": "filing-tieout",
 "title": "Filing tie-out: a synthetic company's draft against its tables and trial balance, and a real 10-K with planted errors",
 "about": "Two runs, for a self-hosted install (DECOSA_TIEOUT_PUBLIC_ONLY=0; on a public-only instance the pasted tables need \"public\": true, which the first step sends). First, a made-up company (Example Instruments Co.): its income statement and balance sheet as CSV in millions, a trial balance mapped to three balance-sheet lines, and a short MD&A draft in which 2024 net income is written as $64.2 million instead of $62.4 million. Second, AMD's filed FY2025 10-K (bundled with the API, public domain) with six errors planted in its MD&A text and one note table changed. Figures are tied in code with no model call (judge_claims false), so the rehearsal needs no GPU. Every planted error must come back as a mismatch naming the right cell, the rest must tie or compute, and the signed record must verify and catch a changed status.",
 "licence": "The synthetic company, its tables, trial balance and draft are made up (part of decosa-api, AGPL-3.0-or-later). The AMD 10-K is an SEC EDGAR filing, a US government work in the public domain (17 U.S.C. 105).",
 "inputs": [
  {
   "file": "inputs/income-statement.csv",
   "what": "Consolidated statements of income: a label column, then 2025 and 2024, in millions."
  },
  {
   "file": "inputs/balance-sheet.csv",
   "what": "Consolidated balance sheets: a label column, then 2025-12-31 and 2024-12-31, in millions."
  },
  {
   "file": "inputs/trial-balance.csv",
   "what": "account, name, balance (millions), line: the statement line each account rolls up to."
  },
  {
   "file": "inputs/draft.txt",
   "what": "The MD&A draft to tie; one planted error (2024 net income)."
  }
 ],
 "steps": [
  {
   "id": "tables",
   "method": "POST",
   "path": "/tieout/check",
   "body": {
    "tables": [
     {
      "title": "Consolidated Statements of Income",
      "scale": "millions",
      "csv": {
       "$file": "inputs/income-statement.csv"
      }
     },
     {
      "title": "Consolidated Balance Sheets",
      "scale": "millions",
      "csv": {
       "$file": "inputs/balance-sheet.csv"
      }
     }
    ],
    "draft": {
     "$file": "inputs/draft.txt"
    },
    "trial_balance": {
     "$file": "inputs/trial-balance.csv"
    },
    "trial_balance_scale": "millions",
    "public": true,
    "judge_claims": false,
    "company": "Example Instruments Co. (fictional)"
   }
  },
  {
   "id": "planted",
   "method": "POST",
   "path": "/tieout/check",
   "body": {
    "sample": "amd-fy2025-planted",
    "judge_claims": false
   }
  },
  {
   "id": "verify",
   "method": "POST",
   "path": "/tieout/verify",
   "auth": false,
   "body": {
    "report": {
     "$ref": "planted.report"
    },
    "workpaper_md": {
     "$ref": "planted.workpaper_md"
    },
    "workpaper_csv": {
     "$ref": "planted.workpaper_csv"
    }
   }
  },
  {
   "id": "tampered",
   "method": "POST",
   "path": "/tieout/verify",
   "auth": false,
   "body": {
    "report": {
     "$ref": "planted.report"
    }
   },
   "tamper": {
    "at": "report.status",
    "set": "tied"
   }
  }
 ],
 "checks": [
  {
   "says": "the synthetic draft does not tie",
   "path": "tables.status",
   "equals": "mismatches"
  },
  {
   "says": "the transposed 2024 net income is a value mismatch naming the table's figure",
   "path": "tables.sentences[text~64.2 million][0].figures[status=mismatch][0].detail",
   "contains": "$62,400,000"
  },
  {
   "says": "the inventories accounts do not roll up to the balance sheet",
   "path": "tables.trial_balance[line=Inventories][0].status",
   "equals": "mismatch"
  },
  {
   "says": "the cash accounts roll up exactly",
   "path": "tables.trial_balance[line=Cash and cash equivalents][0].status",
   "equals": "tied"
  },
  {
   "says": "the planted AMD draft does not tie",
   "path": "planted.status",
   "equals": "mismatches"
  },
  {
   "says": "four planted figures are mismatches (value, value, period, scale)",
   "path": "planted.counts.mismatch",
   "min": 4
  },
  {
   "says": "the scale error names the $577 million cell",
   "path": "planted.sentences[text~577 billion][0].figures[reason=scale][0].detail",
   "contains": "$577,000,000"
  },
  {
   "says": "the swapped period is recognised as another year's figure",
   "path": "planted.sentences[text~Interest expense of $92 million][0].figures[reason=period][0].detail",
   "contains": "FY2024"
  },
  {
   "says": "the flipped direction is caught",
   "path": "planted.sentences[text~Embedded net revenue of $3.5 billion in 2025 increased][0].direction",
   "count": 1
  },
  {
   "says": "the wrong note number is caught",
   "path": "planted.sentences[text~Note 6][0].notes[status=mismatch]",
   "count": 1
  },
  {
   "says": "the note table that disagrees with the income statement is caught",
   "path": "planted.cross_refs[kind=same_fact_two_values]",
   "count": 1
  },
  {
   "says": "most figures still tie or compute",
   "path": "planted.coverage.traced",
   "min": 40
  },
  {
   "says": "no model call was made (figures only)",
   "path": "planted.receipts",
   "count": 0
  },
  {
   "says": "the signed record verifies with both workpapers",
   "path": "verify.valid_signature",
   "equals": true
  },
  {
   "says": "the Markdown workpaper matches its hash",
   "path": "verify.workpaper_md_matches",
   "equals": true
  },
  {
   "says": "a changed status breaks the signature",
   "path": "tampered.valid_signature",
   "equals": false
  }
 ]
}