Files
handbook/tasks/finance_sunshine_set_6b9398f4/tests/rubrics.json
T
2026-06-29 10:08:59 -07:00

52 lines
32 KiB
JSON

[
{
"id": "5dc90497-0f2e-473c-937a-650876b57667",
"sort_order": 0,
"rubric_text": "In `DealLog_April2026.xlsx`, Deal #4821 row must contain: Sell Price=34500, Doc Fee=899, Tax=2301, F&I Products=2590, Reserve=1050, Down Pmt=8625, Amt Financed=31665, Front Gross=2000, Back Gross=3640, Total Gross=5640, Desk Recap=5640, Variance=0, Lender contains 'Ally', APR≈0.0699 (or 6.99%), Term=72",
"verifier_code": "from pathlib import Path\nimport openpyxl\n\ndef verify(workspace_path, external_services_path=None):\n try:\n xlsx_files = (list(Path(workspace_path).glob('*[Dd]eal*[Ll]og*.xlsx')) +\n list(Path(workspace_path).glob('*Deal*Log*.xlsx')))\n if not xlsx_files:\n xlsx_files = list(Path(workspace_path).glob('*.xlsx'))\n if not xlsx_files:\n return {'pass': False, 'score': 0.0, 'feedback': 'No xlsx files found in workspace'}\n\n for xl_path in xlsx_files:\n try:\n wb = openpyxl.load_workbook(xl_path, data_only=True)\n except Exception:\n continue\n for sheet_name in wb.sheetnames:\n ws = wb[sheet_name]\n all_rows = list(ws.iter_rows(values_only=True))\n\n header_row_idx = 0\n for i, row in enumerate(all_rows):\n if row and row[0] is not None:\n s = str(row[0]).strip()\n if len(s) < 60 and '\\u2014' not in s and '\\u2013' not in s:\n header_row_idx = i\n break\n\n headers = [str(c).strip().lower().replace(' ', '_').replace('/', '_') if c else ''\n for c in all_rows[header_row_idx]]\n\n deal_row = None\n for row in all_rows[header_row_idx + 1:]:\n if row and any(str(c) == '4821' for c in row if c is not None):\n deal_row = row\n break\n if deal_row is None:\n continue\n\n row_dict = {headers[j]: deal_row[j] for j in range(min(len(headers), len(deal_row)))}\n\n def find_val(keys):\n for k in headers:\n for key in keys:\n if key in k:\n v = row_dict.get(k)\n if v is not None:\n try:\n return float(v)\n except (ValueError, TypeError):\n return str(v)\n return None\n\n def check_num(keys, expected, tol_pct=0.01):\n val = find_val(keys)\n if val is None:\n return False, f'Field {keys[0]} not found'\n try:\n fval = float(val)\n except (ValueError, TypeError):\n return False, f'Field {keys[0]} not numeric: {val}'\n tol = abs(expected) * tol_pct if expected != 0 else 0.01\n if abs(fval - expected) > tol:\n return False, f'Field {keys[0]}: expected {expected}, got {fval}'\n return True, ''\n\n checks = [\n (['sell_price', 'sellprice', 'sale_price', 'sell'], 34500),\n (['doc_fee', 'docfee', 'doc'], 899),\n (['tax'], 2301),\n (['f&i_prod', 'fi_product', 'f_i_prod'], 2590),\n (['reserve'], 1050),\n (['down_pmt', 'down_pay', 'downpay', 'down'], 8625),\n (['front_gross', 'frontgross', 'front'], 2000),\n (['back_gross', 'backgross', 'back'], 3640),\n (['total_gross', 'totalgross', 'total_g'], 5640),\n (['desk_recap', 'deskrecap', 'desk'], 5640),\n (['term'], 72),\n ]\n\n failures = []\n for keys, expected in checks:\n ok, msg = check_num(keys, expected)\n if not ok:\n failures.append(msg)\n\n amt_val = find_val(['amt_fin', 'amount_fin', 'amtfin', 'financed'])\n if amt_val is None:\n sp = find_val(['sell_price', 'sellprice', 'sale_price', 'sell'])\n df = find_val(['doc_fee', 'docfee', 'doc'])\n tx = find_val(['tax'])\n fi = find_val(['f&i_prod', 'fi_product', 'f_i_prod'])\n dn = find_val(['down_pmt', 'down_pay', 'downpay', 'down'])\n if all(v is not None for v in [sp, df, tx, fi, dn]):\n try:\n amt_val = float(sp) + float(df) + float(tx) + float(fi) - float(dn)\n except Exception:\n pass\n if amt_val is None:\n failures.append('Field amt_financed not found or not computable')\n else:\n try:\n if abs(float(amt_val) - 31665) > 316.65:\n failures.append(f'Field amt_financed: expected 31665, got {amt_val}')\n except (ValueError, TypeError):\n failures.append(f'Field amt_financed not numeric: {amt_val}')\n\n var_val = find_val(['variance'])\n if var_val is None:\n tg = find_val(['total_gross', 'totalgross', 'total_g'])\n dr = find_val(['desk_recap', 'deskrecap', 'desk'])\n if tg is not None and dr is not None:\n try:\n var_val = float(tg) - float(dr)\n except Exception:\n pass\n if var_val is None:\n failures.append('Field variance not found or not computable')\n else:\n try:\n if abs(float(var_val) - 0) > 0.01:\n failures.append(f'Field variance: expected 0, got {var_val}')\n except (ValueError, TypeError):\n failures.append(f'Field variance not numeric: {var_val}')\n\n apr_val = find_val(['apr', 'rate', 'int_rate'])\n if apr_val is not None:\n try:\n apr_f = float(apr_val)\n if not (abs(apr_f - 0.0699) <= 0.001 or abs(apr_f - 6.99) <= 0.1):\n failures.append(f'APR expected ~0.0699 or 6.99, got {apr_f}')\n except (ValueError, TypeError):\n failures.append(f'APR not numeric: {apr_val}')\n else:\n failures.append('APR field not found')\n\n lender_val = find_val(['lender', 'bank', 'finance_co'])\n if lender_val is None:\n failures.append('Lender field not found')\n elif 'ally' not in str(lender_val).lower():\n failures.append(f'Lender expected to contain Ally, got {lender_val}')\n\n if failures:\n return {'pass': False, 'score': 0.3,\n 'feedback': 'Deal #4821 found but failures: ' + '; '.join(failures)}\n return {'pass': True, 'score': 1.0,\n 'feedback': 'Deal #4821 row verified with all required fields in ' + str(xl_path.name)}\n\n return {'pass': False, 'score': 0.0, 'feedback': 'Deal #4821 row not found in any xlsx file'}\n except Exception as e:\n return {'pass': False, 'score': 0.0, 'feedback': f'Error: {e}'}",
"criterion_type": "expected_output"
},
{
"id": "2c9d99a3-cfba-4b27-a712-6b0a4434ee43",
"sort_order": 1,
"rubric_text": "In `DealLog_April2026.xlsx`, Deal #4821 row must have Post Date containing '2026-04-14' or 'April 14' or '4/14/2026', Posted By containing 'Patel', Funding Status = 'Contract in Transit', and Title Status = 'In Process' (case-insensitive)",
"verifier_code": "from pathlib import Path\nimport openpyxl\nimport re\nimport datetime\n\ndef verify(workspace_path, external_services_path=None):\n try:\n xlsx_files = (list(Path(workspace_path).glob('*[Dd]eal*[Ll]og*.xlsx')) +\n list(Path(workspace_path).glob('*Deal*Log*.xlsx')))\n if not xlsx_files:\n xlsx_files = list(Path(workspace_path).glob('*.xlsx'))\n if not xlsx_files:\n return {'pass': False, 'score': 0.0, 'feedback': 'No xlsx files found in workspace'}\n\n for xl_path in xlsx_files:\n try:\n wb = openpyxl.load_workbook(xl_path, data_only=True)\n except Exception:\n continue\n for sheet_name in wb.sheetnames:\n ws = wb[sheet_name]\n all_rows = list(ws.iter_rows(values_only=True))\n\n header_row_idx = 0\n for i, row in enumerate(all_rows):\n if row and row[0] is not None:\n s = str(row[0]).strip()\n if len(s) < 60 and '\\u2014' not in s and '\\u2013' not in s:\n header_row_idx = i\n break\n\n headers = [str(c).strip().lower().replace(' ', '_').replace('/', '_') if c else ''\n for c in all_rows[header_row_idx]]\n\n deal_row = None\n for row in all_rows[header_row_idx + 1:]:\n if row and any(str(c) == '4821' for c in row if c is not None):\n deal_row = row\n break\n if deal_row is None:\n continue\n\n row_dict = {headers[j]: deal_row[j] for j in range(min(len(headers), len(deal_row)))}\n\n def find_cell(keys):\n for k in headers:\n for key in keys:\n if key in k:\n return row_dict.get(k)\n return None\n\n failures = []\n\n post_date = find_cell(['post_date', 'postdate', 'post'])\n if post_date is None:\n failures.append('Post Date field not found')\n else:\n pds = str(post_date)\n date_ok = False\n if isinstance(post_date, (datetime.date, datetime.datetime)):\n if post_date.month == 4 and post_date.day == 14 and post_date.year == 2026:\n date_ok = True\n if not date_ok:\n if re.search(r'(2026.04.14|april.?14.?2026|4.14.2026|14.apr.2026)', pds, re.IGNORECASE):\n date_ok = True\n if not date_ok:\n failures.append(f'Post Date expected April 14 2026, got {pds}')\n\n posted_by = find_cell(['posted_by', 'postedby', 'posted'])\n if posted_by is None:\n failures.append('Posted By field not found')\n elif 'patel' not in str(posted_by).lower():\n failures.append(f'Posted By expected to contain Patel, got {posted_by}')\n\n funding_status = find_cell(['funding_status', 'fundingstatus', 'funding_stat', 'fund_status'])\n if funding_status is None:\n failures.append('Funding Status field not found')\n elif 'contract in transit' not in str(funding_status).lower() and 'cit' not in str(funding_status).lower():\n failures.append(f'Funding Status expected Contract in Transit, got {funding_status}')\n\n title_status = find_cell(['title_status', 'titlestatus', 'title_stat'])\n if title_status is None:\n failures.append('Title Status field not found')\n else:\n ts = str(title_status).lower().strip()\n if 'in process' not in ts and 'inprocess' not in ts and 'processing' not in ts:\n failures.append(f'Title Status expected In Process/Processing, got {title_status}')\n\n if failures:\n return {'pass': False, 'score': 0.3,\n 'feedback': 'Deal #4821 found but status/date failures: ' + '; '.join(failures)}\n return {'pass': True, 'score': 1.0,\n 'feedback': f'Deal #4821 verified: Post Date=April 14 2026, Posted By=Patel, '\n f'Funding Status=Contract in Transit, Title Status=In Process in {xl_path.name}'}\n\n return {'pass': False, 'score': 0.0, 'feedback': 'Deal #4821 row not found in any xlsx file'}\n except Exception as e:\n return {'pass': False, 'score': 0.0, 'feedback': f'Error: {e}'}",
"criterion_type": "expected_output"
},
{
"id": "37d3cc0f-21c2-49f0-97dd-5d7bf2acb61d",
"sort_order": 2,
"rubric_text": "In `FundingTracker_April2026.xlsx` (or similar funding tracker xlsx), a row for Deal #4821 must exist with Contract Value=31665, Reserve Est.=1050, Pkg Sent Date=April 14 2026, and Exp. Funding Date=April 16 2026",
"verifier_code": "from pathlib import Path\nimport openpyxl\nimport re\nimport datetime\n\ndef verify(workspace_path, external_services_path=None):\n try:\n xlsx_files = (list(Path(workspace_path).glob('*[Ff]unding*[Tt]racker*.xlsx')) +\n list(Path(workspace_path).glob('*[Ff]unding*[Ll]og*.xlsx')))\n if not xlsx_files:\n xlsx_files = list(Path(workspace_path).glob('*.xlsx'))\n if not xlsx_files:\n return {'pass': False, 'score': 0.0, 'feedback': 'No xlsx files found in workspace'}\n\n for xl_path in xlsx_files:\n try:\n wb = openpyxl.load_workbook(xl_path, data_only=True)\n except Exception:\n continue\n for sheet_name in wb.sheetnames:\n ws = wb[sheet_name]\n all_rows = list(ws.iter_rows(values_only=True))\n\n header_row_idx = 0\n for i, row in enumerate(all_rows):\n if row and row[0] is not None:\n s = str(row[0]).strip()\n if len(s) < 60 and '\\u2014' not in s and '\\u2013' not in s:\n header_row_idx = i\n break\n\n headers = [str(c).strip().lower().replace(' ', '_').replace('/', '_') if c else ''\n for c in all_rows[header_row_idx]]\n\n deal_row = None\n for row in all_rows[header_row_idx + 1:]:\n if row and any(str(c) == '4821' for c in row if c is not None):\n deal_row = row\n break\n if deal_row is None:\n continue\n\n row_dict = {headers[j]: deal_row[j] for j in range(min(len(headers), len(deal_row)))}\n\n def find_cell(keys):\n for k in headers:\n for key in keys:\n if key in k:\n return row_dict.get(k)\n return None\n\n failures = []\n\n cv = find_cell(['contract_val', 'contractval', 'contract_v', 'amt_fin', 'financed', 'contract'])\n if cv is None:\n failures.append('Contract Value field not found')\n else:\n try:\n if abs(float(cv) - 31665) > 316.65:\n failures.append(f'Contract Value expected 31665, got {cv}')\n except (ValueError, TypeError):\n failures.append(f'Contract Value not numeric: {cv}')\n\n res = find_cell(['reserve_est', 'reserveest', 'reserve'])\n if res is None:\n failures.append('Reserve Est field not found')\n else:\n try:\n if abs(float(res) - 1050) > 10.5:\n failures.append(f'Reserve Est expected 1050, got {res}')\n except (ValueError, TypeError):\n failures.append(f'Reserve Est not numeric: {res}')\n\n pkg_sent = find_cell(['pkg_sent', 'pkgsent', 'sent_date', 'sentdate', 'pkg_date'])\n if pkg_sent is None:\n failures.append('Pkg Sent Date field not found')\n else:\n pds = str(pkg_sent)\n date_ok = False\n if isinstance(pkg_sent, (datetime.date, datetime.datetime)):\n if pkg_sent.month == 4 and pkg_sent.day == 14 and pkg_sent.year == 2026:\n date_ok = True\n if not date_ok:\n if re.search(r'(2026.04.14|april.?14.?2026|4.14.2026)', pds, re.IGNORECASE):\n date_ok = True\n if not date_ok:\n failures.append(f'Pkg Sent Date expected April 14 2026, got {pds}')\n\n exp_fund = find_cell(['exp_fund', 'expfund', 'exp_date', 'funding_date', 'fundingdate', 'expected_fund'])\n if exp_fund is None:\n failures.append('Exp. Funding Date field not found')\n else:\n eds = str(exp_fund)\n date_ok = False\n if isinstance(exp_fund, (datetime.date, datetime.datetime)):\n if exp_fund.month == 4 and exp_fund.day == 16 and exp_fund.year == 2026:\n date_ok = True\n if not date_ok:\n if re.search(r'(2026.04.16|april.?16.?2026|4.16.2026)', eds, re.IGNORECASE):\n date_ok = True\n if not date_ok:\n failures.append(f'Exp. Funding Date expected April 16 2026, got {eds}')\n\n if failures:\n return {'pass': False, 'score': 0.3,\n 'feedback': 'FundingTracker row for 4821 found but failures: ' + '; '.join(failures)}\n return {'pass': True, 'score': 1.0,\n 'feedback': f'FundingTracker row for Deal #4821 verified in {xl_path.name}'}\n\n return {'pass': False, 'score': 0.0, 'feedback': 'No FundingTracker row for Deal #4821 found in any xlsx file'}\n except Exception as e:\n return {'pass': False, 'score': 0.0, 'feedback': f'Error: {e}'}",
"criterion_type": "expected_output"
},
{
"id": "bd9dbfee-768f-4661-bc7e-392df47b15da",
"sort_order": 3,
"rubric_text": "In `slack_data.json` (external services), at least one Slack message on or after April 14 2026 in channel 'acct-contracts-funding' must reference '4821' and mention 'noah' or '@noah.alvarez' (case-insensitive)",
"verifier_code": "from pathlib import Path\nimport json\nimport re\nfrom datetime import datetime\n\ndef verify(workspace_path, external_services_path=None):\n try:\n slack_path = None\n if external_services_path is not None:\n candidate = Path(external_services_path) / 'slack_data.json'\n if candidate.exists():\n slack_path = candidate\n if slack_path is None:\n candidates = list(Path(workspace_path).glob('*slack*.json'))\n if candidates:\n slack_path = candidates[0]\n if slack_path is None:\n return {'pass': False, 'score': 0.0, 'feedback': 'No slack_data.json found'}\n\n with open(slack_path, 'r') as f:\n data = json.load(f)\n\n cutoff_ts = datetime(2026, 4, 14).timestamp()\n channels = data.get('channels', {})\n messages_dict = data.get('messages', {})\n\n # Find the target channel ID and name for acct-contracts-funding\n target_channel_id = None\n target_channel_name = None\n for cid, cinfo in channels.items():\n cname = cinfo.get('name', '').lower()\n if 'acct' in cname and ('contract' in cname or 'fund' in cname):\n target_channel_id = cid\n target_channel_name = cname\n break\n\n # Collect all message keys that belong to the target channel\n target_keys = set()\n if target_channel_id:\n target_keys.add(target_channel_id)\n if target_channel_name:\n target_keys.add(target_channel_name)\n # Also check common name variants\n for key in messages_dict:\n key_lower = key.lower()\n if 'acct' in key_lower and ('contract' in key_lower or 'fund' in key_lower):\n target_keys.add(key)\n\n if not target_keys:\n return {'pass': False, 'score': 0.0, 'feedback': 'Cannot identify acct-contracts-funding channel'}\n\n for channel_key in target_keys:\n msgs = messages_dict.get(channel_key, [])\n for msg in msgs:\n if not isinstance(msg, dict):\n continue\n ts = float(msg.get('ts', 0))\n if ts < cutoff_ts:\n continue\n text = str(msg.get('text', '')).lower()\n if '4821' in text and ('noah' in text or 'alvarez' in text):\n return {'pass': True, 'score': 1.0,\n 'feedback': f'Found Slack message referencing 4821 and Noah in acct-contracts-funding (key={channel_key})'}\n\n return {'pass': False, 'score': 0.0,\n 'feedback': 'No Slack message found referencing 4821 and Noah on/after April 14 2026 in acct-contracts-funding channel'}\n except Exception as e:\n return {'pass': False, 'score': 0.0, 'feedback': f'Error: {e}'}",
"criterion_type": "expected_output"
},
{
"id": "7228f798-9013-4051-aa4f-448b7aaac722",
"sort_order": 4,
"rubric_text": "In `slack_data.json` (external services), at least one Slack message on or after April 14 2026 must reference '4821' and contain 'title work', 'title packet', or 'priya' (case-insensitive)",
"verifier_code": "from pathlib import Path\nimport json\nfrom datetime import datetime\n\ndef verify(workspace_path, external_services_path=None):\n try:\n slack_path = None\n if external_services_path is not None:\n candidate = Path(external_services_path) / 'slack_data.json'\n if candidate.exists():\n slack_path = candidate\n \n if slack_path is None:\n candidates = list(Path(workspace_path).glob('*slack*.json'))\n if candidates:\n slack_path = candidates[0]\n \n if slack_path is None:\n return {'pass': False, 'score': 0.0, 'feedback': 'No slack_data.json found'}\n \n with open(slack_path, 'r') as f:\n data = json.load(f)\n \n cutoff_ts = datetime(2026, 4, 14).timestamp()\n messages_dict = data.get('messages', {})\n \n for channel_id, msgs in messages_dict.items():\n for msg in msgs:\n if not isinstance(msg, dict):\n continue\n ts = float(msg.get('ts', 0))\n if ts < cutoff_ts:\n continue\n text = str(msg.get('text', '')).lower()\n if '4821' in text:\n if 'title work' in text or 'title packet' in text or 'priya' in text:\n return {'pass': True, 'score': 1.0, 'feedback': f'Found Slack message referencing 4821 and title work/packet/priya in channel {channel_id}'}\n \n return {'pass': False, 'score': 0.0, 'feedback': 'No Slack message found referencing 4821 with title work/title packet/priya on/after April 14 2026'}\n except Exception as e:\n return {'pass': False, 'score': 0.0, 'feedback': f'Error: {e}'}",
"criterion_type": "expected_output"
},
{
"id": "R2_handoff_new",
"sort_order": 5,
"rubric_text": "In `FundingTracker_April2026.xlsx` (or similar funding tracker xlsx), Deal #4821 row must have Expected Funding Date = April 16 2026",
"verifier_code": "from pathlib import Path\nimport openpyxl\nimport re\nimport datetime\n\ndef verify(workspace_path, external_services_path=None):\n try:\n xlsx_files = (list(Path(workspace_path).glob('*[Ff]unding*[Tt]racker*.xlsx')) +\n list(Path(workspace_path).glob('*[Ff]unding*[Ll]og*.xlsx')))\n if not xlsx_files:\n xlsx_files = list(Path(workspace_path).glob('*.xlsx'))\n if not xlsx_files:\n return {'pass': False, 'score': 0.0, 'feedback': 'No xlsx files found in workspace'}\n\n for xl_path in xlsx_files:\n try:\n wb = openpyxl.load_workbook(xl_path, data_only=True)\n except Exception:\n continue\n for sheet_name in wb.sheetnames:\n ws = wb[sheet_name]\n all_rows = list(ws.iter_rows(values_only=True))\n\n header_row_idx = 0\n for i, row in enumerate(all_rows):\n if row and row[0] is not None:\n s = str(row[0]).strip()\n if len(s) < 60 and '\\u2014' not in s and '\\u2013' not in s:\n header_row_idx = i\n break\n\n headers = [str(c).strip().lower().replace(' ', '_').replace('/', '_') if c else ''\n for c in all_rows[header_row_idx]]\n\n deal_row = None\n for row in all_rows[header_row_idx + 1:]:\n if row and any(str(c) == '4821' for c in row if c is not None):\n deal_row = row\n break\n if deal_row is None:\n continue\n\n row_dict = {headers[j]: deal_row[j] for j in range(min(len(headers), len(deal_row)))}\n\n def find_cell(keys):\n for k in headers:\n for key in keys:\n if key in k:\n return row_dict.get(k)\n return None\n\n exp_fund = find_cell(['exp_fund', 'expfund', 'exp_date', 'funding_date', 'fundingdate', 'expected_fund'])\n pkg_sent = find_cell(['pkg_sent', 'pkgsent', 'sent_date', 'sentdate', 'pkg_date'])\n\n if exp_fund is None:\n continue\n\n # Check that exp_fund is April 16 (2 BD from April 14)\n date_ok = False\n if isinstance(exp_fund, (datetime.date, datetime.datetime)):\n if exp_fund.month == 4 and exp_fund.day == 16 and exp_fund.year == 2026:\n date_ok = True\n if not date_ok:\n eds = str(exp_fund)\n if re.search(r'(2026.04.16|april.?16.?2026|4.16.2026)', eds, re.IGNORECASE):\n date_ok = True\n\n if date_ok:\n return {'pass': True, 'score': 1.0,\n 'feedback': 'Agent correctly applied 2-business-day priority funding window for high-gross deal (Total Gross $5,640 > $5,000 threshold). Expected Funding Date = April 16 2026.'}\n else:\n eds = str(exp_fund)\n # Check if they used the standard 3-BD window (April 17)\n used_standard = False\n if isinstance(exp_fund, (datetime.date, datetime.datetime)):\n if exp_fund.day == 17:\n used_standard = True\n if re.search(r'(2026.04.17|april.?17|4.17)', eds, re.IGNORECASE):\n used_standard = True\n if used_standard:\n return {'pass': False, 'score': 0.2,\n 'feedback': 'Agent used standard 3-business-day window (April 17) instead of the 2-business-day priority window (April 16). Total Gross $5,640 exceeds the $5,000 threshold in §2.2.'}\n return {'pass': False, 'score': 0.0,\n 'feedback': f'Expected Funding Date should be April 16 2026 (2-BD priority window), got {eds}'}\n\n return {'pass': False, 'score': 0.0, 'feedback': 'No FundingTracker row for Deal #4821 found in any xlsx file'}\n except Exception as e:\n return {'pass': False, 'score': 0.0, 'feedback': f'Error: {e}'}",
"criterion_type": "expected_output"
},
{
"id": "R5",
"sort_order": 6,
"rubric_text": "In `slack_data.json` (external services), at least one Slack message on or after April 14 2026 in channel 'acct-deal-posting' must reference '4821' and mention 'marcus' or '@marcus.hale' and contain '5640' or '5,640'.",
"verifier_code": "from pathlib import Path\nimport json\nfrom datetime import datetime\n\ndef verify(workspace_path, external_services_path=None):\n try:\n slack_path = None\n if external_services_path is not None:\n candidate = Path(external_services_path) / 'slack_data.json'\n if candidate.exists():\n slack_path = candidate\n if slack_path is None:\n candidates = list(Path(workspace_path).glob('*slack*.json'))\n if candidates:\n slack_path = candidates[0]\n if slack_path is None:\n return {'pass': False, 'score': 0.0, 'feedback': 'No slack_data.json found'}\n\n with open(slack_path, 'r') as f:\n data = json.load(f)\n\n cutoff_ts = datetime(2026, 4, 14).timestamp()\n messages_dict = data.get('messages', {})\n channels = data.get('channels', {})\n\n target_keys = set()\n for cid, cinfo in channels.items():\n cname = cinfo.get('name', '').lower()\n if 'acct' in cname and 'deal' in cname and 'post' in cname:\n target_keys.add(cid)\n target_keys.add(cname)\n for key in messages_dict:\n key_lower = key.lower()\n if 'acct' in key_lower and 'deal' in key_lower and 'post' in key_lower:\n target_keys.add(key)\n\n if not target_keys:\n return {'pass': False, 'score': 0.0, 'feedback': 'Cannot identify acct-deal-posting channel'}\n\n for channel_key in target_keys:\n msgs = messages_dict.get(channel_key, [])\n for msg in msgs:\n if not isinstance(msg, dict):\n continue\n ts = float(msg.get('ts', 0))\n if ts < cutoff_ts:\n continue\n text = str(msg.get('text', '')).lower()\n has_deal = '4821' in text\n has_marcus = 'marcus' in text or 'marcus.hale' in text\n has_gross = '5640' in text.replace(',', '').replace(' ', '') or '5,640' in text\n if has_deal and has_marcus and has_gross:\n return {'pass': True, 'score': 1.0,\n 'feedback': f'Found high-gross confirmation notice referencing 4821, Marcus, and gross $5,640 in acct-deal-posting (key={channel_key})'}\n\n return {'pass': False, 'score': 0.0,\n 'feedback': 'No high-gross confirmation notice found referencing 4821, Marcus Hale, and total gross 5640 in acct-deal-posting channel on/after April 14 2026'}\n except Exception as e:\n return {'pass': False, 'score': 0.0, 'feedback': f'Error: {e}'}",
"criterion_type": "expected_output"
}
]