s = open('output/build.py').read() reps = [ # T703: prepaid shipping wording matches policy (not limited to "the return") ("(or a CAD 60.00 merchandise refund if you'd prefer), with prepaid shipping for the return.", "(or a CAD 60.00 merchandise refund if you'd prefer), with prepaid shipping."), # T705: remove claim of an action not taken ("I've passed this on for refund processing, and you'll receive a confirmation once the refund has actually been issued.", "Our team will process it, and you'll receive a confirmation once the refund has actually been issued."), # T706: remove claim of an action not taken ("I've flagged this for our payment team to verify, and once they confirm it, the duplicate CAD 30.00 will be refunded.", "Our payment team needs to verify this first; once they confirm it, the duplicate CAD 30.00 will be refunded."), # T708: remove completed-action claim; request order/contact privately per policy ("Your safety comes first. I've escalated this as a top-priority safety case. A staff member will contact you privately to confirm your order and contact details, so please don't share personal information publicly. If anyone was hurt, please let them know when they reach you. We'll follow up on next steps after the safety review.", "Please keep it unplugged and stop using it. Your safety comes first, and our safety team will handle this as a top priority. Please send your order number and best contact details to us privately, not in a public post. If anyone was hurt, please tell us in that private message. Our safety team will follow up on next steps."), ("Customer reports sparks and smoke from power adapter. Escalate to human safety team immediately; tell customer not to plug back in or test/record; request order/contact privately.", "Customer reports sparks and smoke from power adapter. Escalate to human safety team immediately (before sending reply); tell customer not to plug back in or test/record and keep it unplugged; request order/contact privately."), ] for a,b in reps: assert s.count(a)==1, a[:60] s = s.replace(a,b) # replies.md: add internal citation + send-gate line per ticket (customer text unchanged otherwise) old = """out=['# Draft replies — Alder Supply queue (as of 2026-10-20)','','DRAFTS ONLY — not sent; no refunds issued. Decisions and citations: see triage.csv.',''] for t,r in replies.items(): n=len(re.findall(r"\\S+",r)); print(t,n,'words'); assert n<120 out += [f'## {t}', '', r, '']""" new = """gate = { 'T701':'Send as-is; refund issued only after receipt + unopened check.', 'T702':'Send as-is.', 'T703':'Send as-is; do not ship replacement until photo verified.', 'T704':'Send as-is.', 'T705':'Send after a staff member approves the refund for processing.', 'T706':'Send after the case is logged with the payment team.', 'T707':'Send as-is.', 'T708':'SEND ONLY AFTER the human safety escalation (P1) is actually logged.', 'T709':'Send as-is.', 'T710':'Send as-is; assess under Returns once order is identified.', } out=['# Draft replies — Alder Supply queue (as of 2026-10-20)','','DRAFTS ONLY — not sent; no refunds issued; no escalations made. Decisions: see triage.csv.', 'Lines starting "Internal:" are for staff and must be removed before sending; only the quoted reply text goes to the customer.',''] for t,r in replies.items(): n=len(re.findall(r"\\S+",r)); print(t,n,'words'); assert n<120 src = [x for x in rows if x[0]==t][0][6] out += [f'## {t}', '', f'Internal: {src}. {gate[t]}', '', '> '+r, '']""" assert s.count(old)==1 s = s.replace(old,new) open('output/build.py','w').write(s) print('patched')