Harbor format: 210 business_automation tasks (part 6)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- tasks/autom-supplier-invoice-match-007/tests/test.shAdded+4
- tasks/autom-supplier-invoice-match-007/tests/world.jsonAdded+446
- tasks/autom-supplier-invoice-match-007/tests/world_check.pyAdded+26
- tasks/autom-supplier-invoice-match-007/validation/openenv.jsonAdded+28
- tasks/autom-supplier-invoice-match-008/environment/inputs/apps.pyAdded+68
- tasks/autom-supplier-invoice-match-008/environment/inputs/world.jsonAdded+430
- tasks/autom-supplier-invoice-match-008/instruction.mdAdded+17
- tasks/autom-supplier-invoice-match-008/solution/files/actions.jsonlAdded+28
- tasks/autom-supplier-invoice-match-008/solution/solve.shAdded+4
- tasks/autom-supplier-invoice-match-008/task.tomlAdded+46
- tasks/autom-supplier-invoice-match-008/tests/expected.jsonAdded+9
- tasks/autom-supplier-invoice-match-008/tests/grade.pyAdded+330
- tasks/autom-supplier-invoice-match-008/tests/replay.pyAdded+68
- tasks/autom-supplier-invoice-match-008/tests/target.jsonAdded+538
- tasks/autom-supplier-invoice-match-008/tests/test.shAdded+4
- tasks/autom-supplier-invoice-match-008/tests/world.jsonAdded+430
- tasks/autom-supplier-invoice-match-008/tests/world_check.pyAdded+26
- tasks/autom-supplier-invoice-match-008/validation/openenv.jsonAdded+28
- tasks/autom-supplier-invoice-match-009/environment/inputs/apps.pyAdded+68
- tasks/autom-supplier-invoice-match-009/environment/inputs/world.jsonAdded+422
- tasks/autom-supplier-invoice-match-009/instruction.mdAdded+17
- tasks/autom-supplier-invoice-match-009/solution/files/actions.jsonlAdded+26
- tasks/autom-supplier-invoice-match-009/solution/solve.shAdded+4
- tasks/autom-supplier-invoice-match-009/task.tomlAdded+46
- tasks/autom-supplier-invoice-match-009/tests/expected.jsonAdded+9
- tasks/autom-supplier-invoice-match-009/tests/grade.pyAdded+330
- tasks/autom-supplier-invoice-match-009/tests/replay.pyAdded+68
- tasks/autom-supplier-invoice-match-009/tests/target.jsonAdded+526
- tasks/autom-supplier-invoice-match-009/tests/test.shAdded+4
- tasks/autom-supplier-invoice-match-009/tests/world.jsonAdded+422
- tasks/autom-supplier-invoice-match-009/tests/world_check.pyAdded+26
- tasks/autom-supplier-invoice-match-009/validation/openenv.jsonAdded+28
- tasks/autom-supplier-invoice-match-010/environment/inputs/apps.pyAdded+68
- tasks/autom-supplier-invoice-match-010/environment/inputs/world.jsonAdded+446
- tasks/autom-supplier-invoice-match-010/instruction.mdAdded+17
- tasks/autom-supplier-invoice-match-010/solution/files/actions.jsonlAdded+20
- tasks/autom-supplier-invoice-match-010/solution/solve.shAdded+4
- tasks/autom-supplier-invoice-match-010/task.tomlAdded+46
- tasks/autom-supplier-invoice-match-010/tests/expected.jsonAdded+9
- tasks/autom-supplier-invoice-match-010/tests/grade.pyAdded+330
- tasks/autom-supplier-invoice-match-010/tests/replay.pyAdded+68
- tasks/autom-supplier-invoice-match-010/tests/target.jsonAdded+525
- tasks/autom-supplier-invoice-match-010/tests/test.shAdded+4
- tasks/autom-supplier-invoice-match-010/tests/world.jsonAdded+446
- tasks/autom-supplier-invoice-match-010/tests/world_check.pyAdded+26
- tasks/autom-supplier-invoice-match-010/validation/openenv.jsonAdded+28
- tasks/autom-supplier-invoice-match-011/environment/inputs/apps.pyAdded+68
- tasks/autom-supplier-invoice-match-011/environment/inputs/world.jsonAdded+398
- tasks/autom-supplier-invoice-match-011/instruction.mdAdded+17
- tasks/autom-supplier-invoice-match-011/solution/files/actions.jsonlAdded+18
1234#!/bin/shset -eumkdir -p /logs/verifier /workspace/outputsexec python3 -B -I /tests/grade.py123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446{ "ap_postings": { "booked-PO0": { "po": "PO0", "status": "posted", "units": 3 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 1 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 1 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 6 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 7 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 5 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 8 } }, "goods_receipts": { "GI-0-0": { "date": "2025-07-07", "po": "PO0", "state": "accepted", "units": 20 }, "GI-0-1": { "date": "2025-07-05", "po": "PO0", "state": "accepted", "units": 28 }, "GI-0-2": { "date": "2025-07-12", "po": "PO0", "state": "quarantine", "units": 28 }, "GI-0-3": { "date": "2025-06-26", "po": "PO0", "state": "accepted", "units": 25 }, "GI-1-0": { "date": "2025-07-07", "po": "PO1", "state": "accepted", "units": 18 }, "GI-1-1": { "date": "2025-07-09", "po": "PO1", "state": "accepted", "units": 14 }, "GI-1-2": { "date": "2025-06-28", "po": "PO1", "state": "accepted", "units": 22 }, "GI-1-3": { "date": "2025-07-10", "po": "PO1", "state": "accepted", "units": 14 }, "GI-2-0": { "date": "2025-07-07", "po": "PO2", "state": "accepted", "units": 13 }, "GI-2-1": { "date": "2025-07-13", "po": "PO2", "state": "quarantine", "units": 22 }, "GI-2-2": { "date": "2025-07-10", "po": "PO2", "state": "quarantine", "units": 19 }, "GI-2-3": { "date": "2025-06-19", "po": "PO2", "state": "accepted", "units": 16 }, "GI-3-0": { "date": "2025-07-07", "po": "PO3", "state": "accepted", "units": 20 }, "GI-3-1": { "date": "2025-07-02", "po": "PO3", "state": "accepted", "units": 27 }, "GI-3-2": { "date": "2025-06-14", "po": "PO3", "state": "accepted", "units": 14 }, "GI-3-3": { "date": "2025-06-17", "po": "PO3", "state": "accepted", "units": 12 }, "GI-4-0": { "date": "2025-07-07", "po": "PO4", "state": "accepted", "units": 21 }, "GI-4-1": { "date": "2025-06-16", "po": "PO4", "state": "accepted", "units": 14 }, "GI-4-2": { "date": "2025-06-24", "po": "PO4", "state": "quarantine", "units": 13 }, "GI-4-3": { "date": "2025-07-09", "po": "PO4", "state": "accepted", "units": 25 }, "GI-5-0": { "date": "2025-07-07", "po": "PO5", "state": "accepted", "units": 15 }, "GI-5-1": { "date": "2025-07-06", "po": "PO5", "state": "quarantine", "units": 15 }, "GI-5-2": { "date": "2025-07-12", "po": "PO5", "state": "quarantine", "units": 24 }, "GI-5-3": { "date": "2025-07-13", "po": "PO5", "state": "quarantine", "units": 23 }, "GI-6-0": { "date": "2025-07-07", "po": "PO6", "state": "accepted", "units": 21 }, "GI-6-1": { "date": "2025-07-07", "po": "PO6", "state": "accepted", "units": 26 }, "GI-6-2": { "date": "2025-06-21", "po": "PO6", "state": "accepted", "units": 22 }, "GI-6-3": { "date": "2025-06-16", "po": "PO6", "state": "quarantine", "units": 26 } }, "invoice_inbox": { "IV-2655-0-1": { "date": "2025-06-20", "po": "PO0", "state": "review", "unit_price_cents": 20529, "units": 10, "vendor": "V3" }, "IV-2809-6-2": { "date": "2025-06-23", "po": "PO6", "state": "review", "unit_price_cents": 4548, "units": 7, "vendor": "V2" }, "IV-3227-2-0": { "date": "2025-06-24", "po": "PO2", "state": "review", "unit_price_cents": 18498, "units": 5, "vendor": "V4" }, "IV-3392-5-0": { "date": "2025-06-24", "po": "PO5", "state": "review", "unit_price_cents": 15272, "units": 13, "vendor": "V3" }, "IV-3483-2-1": { "date": "2025-06-18", "po": "PO2", "state": "void", "unit_price_cents": 18955, "units": 9, "vendor": "V4" }, "IV-3518-4-1": { "date": "2025-07-02", "po": "PO4", "state": "review", "unit_price_cents": 4246, "units": 13, "vendor": "V1" }, "IV-3522-4-2": { "date": "2025-07-02", "po": "PO4", "state": "void", "unit_price_cents": 2844, "units": 13, "vendor": "V1" }, "IV-3568-3-1": { "date": "2025-07-04", "po": "PO3", "state": "review", "unit_price_cents": 11063, "units": 9, "vendor": "Unknown" }, "IV-3822-3-0": { "date": "2025-06-24", "po": "PO3", "state": "review", "unit_price_cents": 10013, "units": 24, "vendor": "V1" }, "IV-3847-3-2": { "date": "2025-06-23", "po": "PO3", "state": "review", "unit_price_cents": 11651, "units": 22, "vendor": "V1" }, "IV-4156-2-2": { "date": "2025-06-27", "po": "PO2", "state": "review", "unit_price_cents": 19365, "units": 4, "vendor": "V4" }, "IV-4193-1-3": { "date": "2025-07-06", "po": "PO1", "state": "review", "unit_price_cents": 18727, "units": 21, "vendor": "Unknown" }, "IV-5034-1-0": { "date": "2025-06-24", "po": "PO1", "state": "review", "unit_price_cents": 17713, "units": 21, "vendor": "V3" }, "IV-5385-5-1": { "date": "2025-06-26", "po": "PO5", "state": "review", "unit_price_cents": 15209, "units": 10, "vendor": "V3" }, "IV-5419-6-1": { "date": "2025-06-25", "po": "PO6", "state": "review", "unit_price_cents": 4843, "units": 13, "vendor": "V2" }, "IV-5742-3-3": { "date": "2025-06-25", "po": "PO3", "state": "review", "unit_price_cents": 10967, "units": 5, "vendor": "V1" }, "IV-7082-4-0": { "date": "2025-06-24", "po": "PO4", "state": "review", "unit_price_cents": 2670, "units": 17, "vendor": "V1" }, "IV-8006-6-0": { "date": "2025-06-24", "po": "PO6", "state": "review", "unit_price_cents": 3349, "units": 6, "vendor": "V2" }, "IV-8060-6-3": { "date": "2025-06-22", "po": "PO6", "state": "review", "unit_price_cents": 3811, "units": 8, "vendor": "V2" }, "IV-8204-1-2": { "date": "2025-07-06", "po": "PO1", "state": "review", "unit_price_cents": 19493, "units": 8, "vendor": "V3" }, "IV-8321-0-0": { "date": "2025-06-24", "po": "PO0", "state": "review", "unit_price_cents": 18473, "units": 1, "vendor": "V3" }, "IV-8848-1-1": { "date": "2025-06-25", "po": "PO1", "state": "review", "unit_price_cents": 19793, "units": 20, "vendor": "V3" } }, "purchase_orders": { "PO0": { "unit": "South", "unit_price_cents": 18473, "vendor": "V3" }, "PO1": { "unit": "South", "unit_price_cents": 17713, "vendor": "V3" }, "PO2": { "unit": "South", "unit_price_cents": 18498, "vendor": "V4" }, "PO3": { "unit": "South", "unit_price_cents": 10013, "vendor": "V1" }, "PO4": { "unit": "South", "unit_price_cents": 2670, "vendor": "V1" }, "PO5": { "unit": "South", "unit_price_cents": 15272, "vendor": "V3" }, "PO6": { "unit": "Other", "unit_price_cents": 3349, "vendor": "V2" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" } }, "vendors": { "V0": { "net_days": 21 }, "V1": { "net_days": 45 }, "V2": { "net_days": 45 }, "V3": { "net_days": 45 }, "V4": { "net_days": 45 } }}1234567891011121314151617181920212223242526"""Replay submitted mutations from the private verifier's initial state."""from types import ModuleTypeimport json
def check(spec, outputs, tests): replay = ModuleType('workflow_replay') exec(compile((tests/'replay.py').read_bytes(), 'replay.py', 'exec'), replay.__dict__) world = json.loads((tests/'world.json').read_text()) target = json.loads((tests/'target.json').read_text()) # Only fields whose starting and expected values differ may be changed. Attempts # to temporarily alter a protected field fail even when a later write restores it. allowed = { (app,key): {field for field,value in doc.items() if field not in world[app].get(key,{}) or not replay.same(world[app][key][field],value)} for app,records in target.items() for key,doc in records.items() } actions = replay.load_actions(outputs/'actions.jsonl') for event in actions: replay.apply(world,event) touched = set(event['fields']) if not touched <= allowed.get((event['app'],event['id']),set()): return False,'protected field or record write' if not replay.same(world,target): return False,'required business outcomes incomplete' return True,''12345678910111213141516171819202122232425262728{ "profile": "harbor-semantic-v1", "reward_key": "reward", "reward": { "range": [ 0, 1 ], "oracle_tolerance": 0, "floor_margin": 0.1 }, "resources": { "cpu": 1, "memory_mb": 4096, "disk_mb": 10240, "episode_timeout_s": 1800 }, "types": { "tags": [ "knowledge-work", "cross-app-workflows", "conditional-execution", "protected-state", "finance" ] }, "requires_credentials": false}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768"""Offline business-app client. Print usage with --help."""import argparseimport copyimport fcntlimport jsonimport osfrom pathlib import Path
def same(left, right): return json.dumps(left, sort_keys=True, allow_nan=False) == json.dumps(right, sort_keys=True, allow_nan=False)
def apply(world, action): if not isinstance(action, dict) or action.keys() != {'op', 'app', 'id', 'fields'}: raise ValueError('expected op, app, id, fields') op, app, key, fields = (action[k] for k in ('op', 'app', 'id', 'fields')) if app not in world or not isinstance(key, str) or not key or not isinstance(fields, dict) or not fields: raise ValueError('unknown app, invalid id or empty fields') collection = world[app] if op == 'update' and key in collection: collection[key].update(copy.deepcopy(fields)) elif op == 'create' and key not in collection: collection[key] = copy.deepcopy(fields) else: raise ValueError(f'invalid {op} for {app}/{key}')
def load_actions(path): if path.is_symlink() or (path.is_file() and path.stat().st_size > 2_000_000): raise ValueError('invalid action log') if not path.exists(): return [] return [json.loads(s) for s in path.read_text().splitlines() if s.strip()]
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('op', choices=('apps','list','get','update','create')) parser.add_argument('app', nargs='?') parser.add_argument('id', nargs='?') parser.add_argument('fields', nargs='?', type=json.loads) args = parser.parse_args() world = json.loads(Path(__file__).with_name('world.json').read_text()) out = Path(os.environ.get('WORKFLOW_OUTPUT_DIR', '/workspace/outputs')) out.mkdir(parents=True, exist_ok=True) log = out/'actions.jsonl' with (out/'.actions.lock').open('a') as lock: fcntl.flock(lock.fileno(), fcntl.LOCK_EX) for event in load_actions(log): apply(world,event) if args.op=='apps': value=sorted(world) elif args.op=='list': value=world[args.app] elif args.op=='get': value=world[args.app][args.id] else: event={'op':args.op, 'app':args.app, 'id':args.id, 'fields':args.fields} apply(world,event) with log.open('a') as handle: handle.write(json.dumps(event,allow_nan=False)+'\n') value=world[args.app][args.id] print(json.dumps(value,sort_keys=True,allow_nan=False))
if __name__=='__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430{ "ap_postings": { "booked-PO0": { "po": "PO0", "status": "posted", "units": 3 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 2 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 2 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 2 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 7 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 5 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 6 } }, "goods_receipts": { "GI-0-0": { "date": "2025-07-30", "po": "PO0", "state": "accepted", "units": 20 }, "GI-0-1": { "date": "2025-07-14", "po": "PO0", "state": "quarantine", "units": 27 }, "GI-0-2": { "date": "2025-07-27", "po": "PO0", "state": "quarantine", "units": 22 }, "GI-0-3": { "date": "2025-08-01", "po": "PO0", "state": "accepted", "units": 15 }, "GI-1-0": { "date": "2025-07-30", "po": "PO1", "state": "accepted", "units": 15 }, "GI-1-1": { "date": "2025-08-01", "po": "PO1", "state": "accepted", "units": 14 }, "GI-1-2": { "date": "2025-07-30", "po": "PO1", "state": "accepted", "units": 23 }, "GI-1-3": { "date": "2025-07-31", "po": "PO1", "state": "accepted", "units": 27 }, "GI-2-0": { "date": "2025-07-30", "po": "PO2", "state": "accepted", "units": 22 }, "GI-2-1": { "date": "2025-07-19", "po": "PO2", "state": "accepted", "units": 17 }, "GI-2-2": { "date": "2025-07-18", "po": "PO2", "state": "quarantine", "units": 16 }, "GI-2-3": { "date": "2025-08-03", "po": "PO2", "state": "accepted", "units": 19 }, "GI-3-0": { "date": "2025-07-30", "po": "PO3", "state": "accepted", "units": 18 }, "GI-3-1": { "date": "2025-07-20", "po": "PO3", "state": "quarantine", "units": 22 }, "GI-3-2": { "date": "2025-07-31", "po": "PO3", "state": "quarantine", "units": 21 }, "GI-3-3": { "date": "2025-07-19", "po": "PO3", "state": "accepted", "units": 23 }, "GI-4-0": { "date": "2025-07-30", "po": "PO4", "state": "accepted", "units": 25 }, "GI-4-1": { "date": "2025-07-14", "po": "PO4", "state": "quarantine", "units": 14 }, "GI-4-2": { "date": "2025-07-23", "po": "PO4", "state": "quarantine", "units": 14 }, "GI-4-3": { "date": "2025-07-26", "po": "PO4", "state": "accepted", "units": 21 }, "GI-5-0": { "date": "2025-07-30", "po": "PO5", "state": "accepted", "units": 13 }, "GI-5-1": { "date": "2025-07-07", "po": "PO5", "state": "quarantine", "units": 20 }, "GI-5-2": { "date": "2025-07-21", "po": "PO5", "state": "quarantine", "units": 18 }, "GI-5-3": { "date": "2025-07-08", "po": "PO5", "state": "accepted", "units": 25 }, "GI-6-0": { "date": "2025-07-30", "po": "PO6", "state": "accepted", "units": 28 }, "GI-6-1": { "date": "2025-08-02", "po": "PO6", "state": "accepted", "units": 28 }, "GI-6-2": { "date": "2025-07-13", "po": "PO6", "state": "accepted", "units": 27 }, "GI-6-3": { "date": "2025-08-04", "po": "PO6", "state": "quarantine", "units": 23 } }, "invoice_inbox": { "IV-1042-6-1": { "date": "2025-07-12", "po": "PO6", "state": "review", "unit_price_cents": 23221, "units": 24, "vendor": "V2" }, "IV-2441-2-0": { "date": "2025-07-10", "po": "PO2", "state": "review", "unit_price_cents": 3352, "units": 24, "vendor": "V0" }, "IV-2499-2-2": { "date": "2025-07-14", "po": "PO2", "state": "review", "unit_price_cents": 3672, "units": 24, "vendor": "V0" }, "IV-2842-1-3": { "date": "2025-07-29", "po": "PO1", "state": "review", "unit_price_cents": 14234, "units": 15, "vendor": "V2" }, "IV-3512-2-1": { "date": "2025-07-12", "po": "PO2", "state": "void", "unit_price_cents": 5366, "units": 7, "vendor": "V0" }, "IV-3645-2-3": { "date": "2025-07-06", "po": "PO2", "state": "review", "unit_price_cents": 4141, "units": 14, "vendor": "V0" }, "IV-4781-1-1": { "date": "2025-07-10", "po": "PO1", "state": "void", "unit_price_cents": 14048, "units": 12, "vendor": "V2" }, "IV-5355-0-3": { "date": "2025-07-27", "po": "PO0", "state": "review", "unit_price_cents": 22436, "units": 9, "vendor": "V1" }, "IV-5362-5-1": { "date": "2025-07-23", "po": "PO5", "state": "review", "unit_price_cents": 19908, "units": 6, "vendor": "Unknown" }, "IV-5898-1-2": { "date": "2025-07-17", "po": "PO1", "state": "review", "unit_price_cents": 12052, "units": 11, "vendor": "V2" }, "IV-6039-3-0": { "date": "2025-07-10", "po": "PO3", "state": "review", "unit_price_cents": 11188, "units": 24, "vendor": "V4" }, "IV-6192-4-1": { "date": "2025-07-29", "po": "PO4", "state": "review", "unit_price_cents": 12050, "units": 9, "vendor": "V0" }, "IV-6195-1-0": { "date": "2025-07-10", "po": "PO1", "state": "review", "unit_price_cents": 12069, "units": 4, "vendor": "V2" }, "IV-6673-0-0": { "date": "2025-07-10", "po": "PO0", "state": "review", "unit_price_cents": 20814, "units": 1, "vendor": "V1" }, "IV-7091-3-1": { "date": "2025-07-21", "po": "PO3", "state": "review", "unit_price_cents": 11644, "units": 13, "vendor": "V4" }, "IV-7714-4-0": { "date": "2025-07-10", "po": "PO4", "state": "review", "unit_price_cents": 10466, "units": 8, "vendor": "V0" }, "IV-8313-6-0": { "date": "2025-07-10", "po": "PO6", "state": "review", "unit_price_cents": 21349, "units": 9, "vendor": "V2" }, "IV-8475-0-1": { "date": "2025-07-11", "po": "PO0", "state": "void", "unit_price_cents": 22241, "units": 3, "vendor": "Unknown" }, "IV-8625-5-0": { "date": "2025-07-10", "po": "PO5", "state": "review", "unit_price_cents": 18133, "units": 9, "vendor": "V4" }, "IV-8964-0-2": { "date": "2025-07-14", "po": "PO0", "state": "review", "unit_price_cents": 22581, "units": 21, "vendor": "V1" } }, "purchase_orders": { "PO0": { "unit": "South", "unit_price_cents": 20814, "vendor": "V1" }, "PO1": { "unit": "South", "unit_price_cents": 12069, "vendor": "V2" }, "PO2": { "unit": "South", "unit_price_cents": 3352, "vendor": "V0" }, "PO3": { "unit": "South", "unit_price_cents": 11188, "vendor": "V4" }, "PO4": { "unit": "South", "unit_price_cents": 10466, "vendor": "V0" }, "PO5": { "unit": "South", "unit_price_cents": 18133, "vendor": "V4" }, "PO6": { "unit": "Other", "unit_price_cents": 21349, "vendor": "V2" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" } }, "vendors": { "V0": { "net_days": 21 }, "V1": { "net_days": 30 }, "V2": { "net_days": 15 }, "V3": { "net_days": 45 }, "V4": { "net_days": 15 } }}1234567891011121314151617Close the invoice matching queue for purchasing unit South at 2025-07-31. Handle invoices in review attached to that unit's purchase orders, invoice dates 2025-07-10 through 2025-07-31 inclusive. Process by invoice date ascending, then invoice ID ascending. Available units per PO equal units on accepted goods receipts dated on or before cutoff, minus previously posted units and any units successfully matched earlier in this run.
Match the invoice vendor exactly against the purchase order. A unit price above PO price is acceptable only up to 100 basis points above PO price (10,000 basis points = 100%; compare exactly, before rounding). Lower prices are acceptable. The invoice quantity must fit the available units in full. If any tests fail, update the invoice state to `disputed`, consume zero units, and create supplier_cases record `case-<invoice ID>` with `invoice`, `po` and the list `issues` containing every failing check in vendor, price, units order; use those lowercase strings.
For a match update invoice state to `posted` and create ap_postings record `book-<invoice ID>` with `invoice`, `po`, `units`, `status=posted`, integer `amount_cents` equal to invoiced quantity times invoiced unit price, and ISO date `due`. Count the vendor's net_days calendar days from the invoice date, then roll Saturday or Sunday forward to Monday. Preserve all other fields and records.
Use the offline app client at `/workspace/inputs/apps.py`. Call it with python3. Run`apps` to discover apps, `list APP` to see its records, or `get APP ID` for one record.Write with `update APP ID '{"field":"value"}'` or `create APP ID '{"field":"value"}'`.The client records successful writes in `/workspace/outputs/actions.jsonl`.Apply exactly the required changes. Other records and fields must remain untouched,including temporary changes. Actions take effect in the local simulation only.
## Deliverable
Work in `/workspace`. Input files are under `/workspace/inputs/`. Put every deliverable in`/workspace/outputs/`; only that directory is graded. Leave the app action log in the outputs directory.12345678910111213141516171819202122232425262728{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-6673-0-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-8964-0-2", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-5355-0-3", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-6195-1-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-5898-1-2", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-2842-1-3", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-2441-2-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-2499-2-2", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-6039-3-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-7091-3-1", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-7714-4-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-6192-4-1", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-8625-5-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-5362-5-1", "op": "update"}{"app": "ap_postings", "fields": {"amount_cents": 80448, "due": "2025-07-31", "invoice": "IV-2441-2-0", "po": "PO2", "status": "posted", "units": 24}, "id": "book-IV-2441-2-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 268512, "due": "2025-07-25", "invoice": "IV-6039-3-0", "po": "PO3", "status": "posted", "units": 24}, "id": "book-IV-6039-3-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 48276, "due": "2025-07-25", "invoice": "IV-6195-1-0", "po": "PO1", "status": "posted", "units": 4}, "id": "book-IV-6195-1-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 20814, "due": "2025-08-11", "invoice": "IV-6673-0-0", "po": "PO0", "status": "posted", "units": 1}, "id": "book-IV-6673-0-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 83728, "due": "2025-07-31", "invoice": "IV-7714-4-0", "po": "PO4", "status": "posted", "units": 8}, "id": "book-IV-7714-4-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 163197, "due": "2025-07-25", "invoice": "IV-8625-5-0", "po": "PO5", "status": "posted", "units": 9}, "id": "book-IV-8625-5-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 132572, "due": "2025-08-01", "invoice": "IV-5898-1-2", "po": "PO1", "status": "posted", "units": 11}, "id": "book-IV-5898-1-2", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-2499-2-2", "issues": ["price", "units"], "po": "PO2"}, "id": "case-IV-2499-2-2", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-8964-0-2", "issues": ["price", "units"], "po": "PO0"}, "id": "case-IV-8964-0-2", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-7091-3-1", "issues": ["price"], "po": "PO3"}, "id": "case-IV-7091-3-1", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-5362-5-1", "issues": ["vendor", "price"], "po": "PO5"}, "id": "case-IV-5362-5-1", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-5355-0-3", "issues": ["price"], "po": "PO0"}, "id": "case-IV-5355-0-3", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-2842-1-3", "issues": ["price"], "po": "PO1"}, "id": "case-IV-2842-1-3", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-6192-4-1", "issues": ["price"], "po": "PO4"}, "id": "case-IV-6192-4-1", "op": "create"}1234#!/bin/shset -eumkdir -p /workspace/outputscp -R /solution/files/. /workspace/outputs/12345678910111213141516171819202122232425262728293031323334353637383940414243444546schema_version = "1.3"
[task]name = "apex-gap/autom-supplier-invoice-match-008"
[metadata.apex_gap]capability_tags = ["cross-app-workflows", "conditional-execution", "protected-state", "finance"]dataset = "Original simulated workflows"job = "finance"seed = 8source = "local/original-automation-workflows"source_revision = "1"source_split = "synthetic"source_task_id = "autom-supplier-invoice-match-008"template_family = "automation:supplier-invoice-match"workflow_template = "supplier-invoice-match"
[metadata.openenv_hf_sandbox]variant = "apex-gap-hfsandbox-v1"task_modified_for_hf_sandbox = truenetwork_enabled = true
[environment]docker_image = "ghcr.io/younesbelkada/apex@sha256:24969c952247033023872f87161a16e067003469506be63783bbaa5d96926bdf"workdir = "/workspace"cpus = 1memory_mb = 4096build_timeout_sec = 600network_mode = "public"
[agent]timeout_sec = 1800network_mode = "public"
[verifier]timeout_sec = 600network_mode = "public"environment_mode = "separate"
[verifier.environment]network_mode = "public"cpus = 1memory_mb = 4096
[[artifacts]]source = "/workspace/outputs"123456789{ "checks": [ { "id": "business-outcomes", "type": "custom", "module": "world_check" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330"""Deterministic grader shared by converted knowledge-work tasks.
Runs inside the separate verifier sandbox. Reads /tests/expected.json, inspects thesubmitted /workspace/outputs tree and writes a binary reward plus per-check details.No model calls and no network.
expected.json: {"checks": [{"id": ..., "type": ..., ...}, ...]}Check types: answer field of outputs/answer.json; kind = number|text|choice|date|bool|list xlsx_range recalculated outputs/<file> vs tests/<target> over sheet!range (SpreadsheetBench rules) xlsx_cell recalculated outputs/<file> sheet!cell vs value with tolerance (optional alt_values) file_contains outputs/<file> text (docx/pdf/ics/eml/txt) must contain every needle custom tests/<module>.py defines check(spec, outputs_dir, tests_dir) -> (bool, str)"""
import datetime as dtimport jsonimport reimport shutilimport subprocessimport sysimport tempfileimport unicodedatafrom pathlib import Path
OUT = Path("/workspace/outputs")TESTS = Path("/tests")LOGS = Path("/logs/verifier")
def norm_text(v): v = unicodedata.normalize("NFKC", str(v)).casefold() v = re.sub(r"[‘’“”]", "'", v) v = re.sub(r"[^\w%.$/-]+", " ", v) return " ".join(v.split()).strip(" .")
def to_number(v): if isinstance(v, bool): raise ValueError("bool") if isinstance(v, (int, float)): return float(v) s = str(v).strip().replace(",", "").replace("$", "").replace("−", "-") neg = s.startswith("(") and s.endswith(")") s = s.strip("()").strip() pct = s.endswith("%") s = s.rstrip("%").strip() s = re.sub(r"\s*(usd|dollars|million|billion|thousand|m|bn|k)$", "", s, flags=re.I) x = float(s) x = -x if neg else x return x / 100 if pct else x
def number_ok(got, want, rel, abs_): try: g = to_number(got) except (TypeError, ValueError): return False w = float(want) tol = max(abs_, rel * abs(w)) # "12.5%" may mean the ratio 0.125 or the percent number 12.5; the gold fixes which. candidates = [g, g * 100] if isinstance(got, str) and got.strip().endswith("%") else [g] return any(abs(c - w) <= tol for c in candidates)
def parse_date(v): if isinstance(v, (dt.date, dt.datetime)): return v if isinstance(v, dt.date) else v.date() s = str(v).strip() for fmt in ("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y", "%d %B %Y", "%B %d, %Y", "%b %d, %Y", "%Y/%m/%d"): try: return dt.datetime.strptime(s, fmt).date() except ValueError: continue raise ValueError(s)
def check_answer(check, answers): key = check["field"] if key not in answers: return False, f"missing field {key!r}" got, want, kind = answers[key], check["value"], check.get("kind", "text") if kind == "number": ok = number_ok(got, want, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01)) if not ok and check.get("percent_either"): ok = number_ok(got, want * 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) * 100) or ( number_ok(got, want / 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) / 100) ) elif kind == "date": try: ok = parse_date(got) == parse_date(want) except ValueError: ok = False elif kind == "bool": g = norm_text(got) ok = g in {"yes", "true"} if want else g in {"no", "false"} elif kind == "choice": ok = norm_text(got) == norm_text(want) elif kind == "list": if not isinstance(got, list): return False, f"{key}: expected a JSON list" # Filenames may be given with a directory prefix; compare base names. base = lambda x: norm_text(str(x).replace("\\", "/").rsplit("/", 1)[-1]) ok = sorted(base(x) for x in got) == sorted(base(x) for x in want) else: accepted = check.get("accept", [want]) ok = norm_text(got) in {norm_text(a) for a in accepted} return ok, "" if ok else f"{key}: got {got!r}"
# LibreOffice keeps cached formula values on load unless told otherwise; force a full recalculation.RECALC_PROFILE = """<?xml version="1.0" encoding="UTF-8"?><oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"><item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="OOXMLRecalcMode" oor:op="fuse"><value>0</value></prop></item><item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="ODFRecalcMode" oor:op="fuse"><value>0</value></prop></item></oor:items>"""
def recalc(path, tmp): dest = Path(tmp) / f"recalc-{len(list(Path(tmp).glob('recalc-*')))}" dest.mkdir() profile = Path(tmp) / "lo-profile" if not profile.exists(): (profile / "user").mkdir(parents=True) (profile / "user" / "registrymodifications.xcu").write_text(RECALC_PROFILE) subprocess.run( ["soffice", f"-env:UserInstallation=file://{profile}", "--headless", "--calc", "--convert-to", "xlsx:Calc MS Excel 2007 XML", "--outdir", str(dest), str(path)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=180, check=False, ) out = dest / (Path(path).stem + ".xlsx") return out if out.exists() else Path(path)
def cell_value(v): if isinstance(v, (int, float)) and not isinstance(v, bool): return round(float(v), 2) if isinstance(v, dt.datetime): return round((v - dt.datetime(1899, 12, 30)).total_seconds() / 86400.0, 0) if isinstance(v, dt.time): return v.strftime("%H:%M") if isinstance(v, str): try: return round(float(v), 2) except ValueError: return v.strip() return v
def time_of(v): """A time or a day fraction in [0, 1) as HH:MM, rounded to the nearest second first. Calc and Excel store a time as that fraction; openpyxl returns a time only for time-formatted cells.""" if isinstance(v, dt.time): v = (v.hour * 3600 + v.minute * 60 + v.second + v.microsecond / 1e6) / 86400 if isinstance(v, (int, float)) and not isinstance(v, bool) and 0 <= v < 1: return (dt.datetime(1899, 12, 30) + dt.timedelta(seconds=round(v * 86400))).strftime("%H:%M") return None
def same_cell(a, b): if isinstance(a, dt.time) is not isinstance(b, dt.time): n = b if isinstance(a, dt.time) else a if time_of(n) is not None: # a time against a plain day fraction return time_of(a) == time_of(b) a, b = cell_value(a), cell_value(b) if a in (None, "") and b in (None, ""): return True return type(a) is type(b) and a == b
ERRORS = {"#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"}
def is_error(v): return isinstance(v, str) and (v in ERRORS or v.startswith("Err:"))
def cells(rng): if ":" not in rng: return [rng] from openpyxl.utils import range_boundaries, get_column_letter
c1, r1, c2, r2 = range_boundaries(rng) return [f"{get_column_letter(c)}{r}" for r in range(r1, r2 + 1) for c in range(c1, c2 + 1)]
def load(path, tmp): import openpyxl
return openpyxl.load_workbook(recalc(path, tmp), data_only=True)
def check_xlsx_range(check, tmp, cache): sub = OUT / check["file"] if not sub.is_file(): return False, f"missing output {check['file']}" if sub not in cache: cache[sub] = load(sub, tmp) tgt = TESTS / check["target"] if tgt not in cache: cache[tgt] = load(tgt, tmp) got, want = cache[sub], cache[tgt] cached = None # the target's stored (Excel-computed) values, read only when Calc errs for sheet, rng in check["ranges"]: sheet = sheet or want.sheetnames[0] if sheet not in got.sheetnames: return False, f"sheet {sheet!r} missing" for name in cells(rng): w = want[sheet][name].value if is_error(w): # LibreOffice could not evaluate the gold formula (e.g. XLOOKUP, FILTER in Calc 7.4). # The value Excel stored is the intended answer. if cached is None: import openpyxl
cached = openpyxl.load_workbook(tgt, data_only=True) c = cached[sheet][name].value if sheet in cached.sheetnames else None if c is not None and not is_error(c): w = c if not same_cell(w, got[sheet][name].value): return False, f"{sheet}!{name}: want {w!r} got {got[sheet][name].value!r}" return True, ""
def check_xlsx_cell(check, tmp, cache): sub = OUT / check["file"] if not sub.is_file(): return False, f"missing output {check['file']}" if sub not in cache: cache[sub] = load(sub, tmp) wb = cache[sub] if check["sheet"] not in wb.sheetnames: return False, f"sheet {check['sheet']!r} missing" got = wb[check["sheet"]][check["cell"]].value want = check["value"] if isinstance(want, (int, float)): # alt_values: other accepted golds where the source admits more than one reading. ok = got is not None and any(number_ok(got, w, check.get("rel_tol", 0.0), check.get("abs_tol", 0.01)) for w in [want, *check.get("alt_values", [])]) else: ok = norm_text(got) == norm_text(want) return ok, "" if ok else f"{check['sheet']}!{check['cell']}: want {want!r} got {got!r}"
def text_of(path): suffix = path.suffix.lower() if suffix == ".docx": import docx
d = docx.Document(path) parts = [p.text for p in d.paragraphs] for t in d.tables: parts += [c.text for row in t.rows for c in row.cells] return "\n".join(parts) if suffix == ".pdf": import pdfplumber
with pdfplumber.open(path) as pdf: return "\n".join(page.extract_text() or "" for page in pdf.pages) return path.read_text(errors="replace")
def check_file_contains(check, tmp, cache): sub = OUT / check["file"] if not sub.is_file(): return False, f"missing output {check['file']}" text = text_of(sub) hay = text if check.get("case_sensitive") else text.casefold() for needle in check["needles"]: n = needle if check.get("case_sensitive") else needle.casefold() if n not in hay: return False, f"{check['file']} lacks {needle!r}" return True, ""
def main(): LOGS.mkdir(parents=True, exist_ok=True) reward_path = LOGS / "reward.txt" reward_path.write_text("0\n") spec = json.loads((TESTS / "expected.json").read_text()) answers, details = {}, [] answer_file = OUT / "answer.json" if answer_file.is_file(): try: answers = json.loads(answer_file.read_text()) if not isinstance(answers, dict): answers = {} except json.JSONDecodeError: answers = {} tmp = tempfile.mkdtemp() cache = {} try: for check in spec["checks"]: try: if check["type"] == "answer": ok, why = check_answer(check, answers) elif check["type"] == "xlsx_range": ok, why = check_xlsx_range(check, tmp, cache) elif check["type"] == "xlsx_cell": ok, why = check_xlsx_cell(check, tmp, cache) elif check["type"] == "file_contains": ok, why = check_file_contains(check, tmp, cache) elif check["type"] == "custom": import importlib.util
spec_ = importlib.util.spec_from_file_location("custom_check", TESTS / f"{check['module']}.py") mod = importlib.util.module_from_spec(spec_) spec_.loader.exec_module(mod) ok, why = mod.check(check, OUT, TESTS) else: ok, why = False, f"unknown check type {check['type']}" except Exception as exc: # a malformed submission fails the check, not the grader ok, why = False, f"{type(exc).__name__}: {exc}" details.append({"id": check["id"], "passed": ok, "detail": why}) finally: shutil.rmtree(tmp, ignore_errors=True) passed = sum(d["passed"] for d in details) total = len(details) reward = 1 if total and passed == total else 0 (LOGS / "details.json").write_text(json.dumps({"passed": passed, "total": total, "checks": details}, indent=1)) reward_path.write_text(f"{reward}\n") print(f"{passed}/{total} checks passed; reward {reward}")
if __name__ == "__main__": sys.exit(main())1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768"""Offline business-app client. Print usage with --help."""import argparseimport copyimport fcntlimport jsonimport osfrom pathlib import Path
def same(left, right): return json.dumps(left, sort_keys=True, allow_nan=False) == json.dumps(right, sort_keys=True, allow_nan=False)
def apply(world, action): if not isinstance(action, dict) or action.keys() != {'op', 'app', 'id', 'fields'}: raise ValueError('expected op, app, id, fields') op, app, key, fields = (action[k] for k in ('op', 'app', 'id', 'fields')) if app not in world or not isinstance(key, str) or not key or not isinstance(fields, dict) or not fields: raise ValueError('unknown app, invalid id or empty fields') collection = world[app] if op == 'update' and key in collection: collection[key].update(copy.deepcopy(fields)) elif op == 'create' and key not in collection: collection[key] = copy.deepcopy(fields) else: raise ValueError(f'invalid {op} for {app}/{key}')
def load_actions(path): if path.is_symlink() or (path.is_file() and path.stat().st_size > 2_000_000): raise ValueError('invalid action log') if not path.exists(): return [] return [json.loads(s) for s in path.read_text().splitlines() if s.strip()]
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('op', choices=('apps','list','get','update','create')) parser.add_argument('app', nargs='?') parser.add_argument('id', nargs='?') parser.add_argument('fields', nargs='?', type=json.loads) args = parser.parse_args() world = json.loads(Path(__file__).with_name('world.json').read_text()) out = Path(os.environ.get('WORKFLOW_OUTPUT_DIR', '/workspace/outputs')) out.mkdir(parents=True, exist_ok=True) log = out/'actions.jsonl' with (out/'.actions.lock').open('a') as lock: fcntl.flock(lock.fileno(), fcntl.LOCK_EX) for event in load_actions(log): apply(world,event) if args.op=='apps': value=sorted(world) elif args.op=='list': value=world[args.app] elif args.op=='get': value=world[args.app][args.id] else: event={'op':args.op, 'app':args.app, 'id':args.id, 'fields':args.fields} apply(world,event) with log.open('a') as handle: handle.write(json.dumps(event,allow_nan=False)+'\n') value=world[args.app][args.id] print(json.dumps(value,sort_keys=True,allow_nan=False))
if __name__=='__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538{ "ap_postings": { "book-IV-2441-2-0": { "amount_cents": 80448, "due": "2025-07-31", "invoice": "IV-2441-2-0", "po": "PO2", "status": "posted", "units": 24 }, "book-IV-5898-1-2": { "amount_cents": 132572, "due": "2025-08-01", "invoice": "IV-5898-1-2", "po": "PO1", "status": "posted", "units": 11 }, "book-IV-6039-3-0": { "amount_cents": 268512, "due": "2025-07-25", "invoice": "IV-6039-3-0", "po": "PO3", "status": "posted", "units": 24 }, "book-IV-6195-1-0": { "amount_cents": 48276, "due": "2025-07-25", "invoice": "IV-6195-1-0", "po": "PO1", "status": "posted", "units": 4 }, "book-IV-6673-0-0": { "amount_cents": 20814, "due": "2025-08-11", "invoice": "IV-6673-0-0", "po": "PO0", "status": "posted", "units": 1 }, "book-IV-7714-4-0": { "amount_cents": 83728, "due": "2025-07-31", "invoice": "IV-7714-4-0", "po": "PO4", "status": "posted", "units": 8 }, "book-IV-8625-5-0": { "amount_cents": 163197, "due": "2025-07-25", "invoice": "IV-8625-5-0", "po": "PO5", "status": "posted", "units": 9 }, "booked-PO0": { "po": "PO0", "status": "posted", "units": 3 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 2 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 2 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 2 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 7 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 5 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 6 } }, "goods_receipts": { "GI-0-0": { "date": "2025-07-30", "po": "PO0", "state": "accepted", "units": 20 }, "GI-0-1": { "date": "2025-07-14", "po": "PO0", "state": "quarantine", "units": 27 }, "GI-0-2": { "date": "2025-07-27", "po": "PO0", "state": "quarantine", "units": 22 }, "GI-0-3": { "date": "2025-08-01", "po": "PO0", "state": "accepted", "units": 15 }, "GI-1-0": { "date": "2025-07-30", "po": "PO1", "state": "accepted", "units": 15 }, "GI-1-1": { "date": "2025-08-01", "po": "PO1", "state": "accepted", "units": 14 }, "GI-1-2": { "date": "2025-07-30", "po": "PO1", "state": "accepted", "units": 23 }, "GI-1-3": { "date": "2025-07-31", "po": "PO1", "state": "accepted", "units": 27 }, "GI-2-0": { "date": "2025-07-30", "po": "PO2", "state": "accepted", "units": 22 }, "GI-2-1": { "date": "2025-07-19", "po": "PO2", "state": "accepted", "units": 17 }, "GI-2-2": { "date": "2025-07-18", "po": "PO2", "state": "quarantine", "units": 16 }, "GI-2-3": { "date": "2025-08-03", "po": "PO2", "state": "accepted", "units": 19 }, "GI-3-0": { "date": "2025-07-30", "po": "PO3", "state": "accepted", "units": 18 }, "GI-3-1": { "date": "2025-07-20", "po": "PO3", "state": "quarantine", "units": 22 }, "GI-3-2": { "date": "2025-07-31", "po": "PO3", "state": "quarantine", "units": 21 }, "GI-3-3": { "date": "2025-07-19", "po": "PO3", "state": "accepted", "units": 23 }, "GI-4-0": { "date": "2025-07-30", "po": "PO4", "state": "accepted", "units": 25 }, "GI-4-1": { "date": "2025-07-14", "po": "PO4", "state": "quarantine", "units": 14 }, "GI-4-2": { "date": "2025-07-23", "po": "PO4", "state": "quarantine", "units": 14 }, "GI-4-3": { "date": "2025-07-26", "po": "PO4", "state": "accepted", "units": 21 }, "GI-5-0": { "date": "2025-07-30", "po": "PO5", "state": "accepted", "units": 13 }, "GI-5-1": { "date": "2025-07-07", "po": "PO5", "state": "quarantine", "units": 20 }, "GI-5-2": { "date": "2025-07-21", "po": "PO5", "state": "quarantine", "units": 18 }, "GI-5-3": { "date": "2025-07-08", "po": "PO5", "state": "accepted", "units": 25 }, "GI-6-0": { "date": "2025-07-30", "po": "PO6", "state": "accepted", "units": 28 }, "GI-6-1": { "date": "2025-08-02", "po": "PO6", "state": "accepted", "units": 28 }, "GI-6-2": { "date": "2025-07-13", "po": "PO6", "state": "accepted", "units": 27 }, "GI-6-3": { "date": "2025-08-04", "po": "PO6", "state": "quarantine", "units": 23 } }, "invoice_inbox": { "IV-1042-6-1": { "date": "2025-07-12", "po": "PO6", "state": "review", "unit_price_cents": 23221, "units": 24, "vendor": "V2" }, "IV-2441-2-0": { "date": "2025-07-10", "po": "PO2", "state": "posted", "unit_price_cents": 3352, "units": 24, "vendor": "V0" }, "IV-2499-2-2": { "date": "2025-07-14", "po": "PO2", "state": "disputed", "unit_price_cents": 3672, "units": 24, "vendor": "V0" }, "IV-2842-1-3": { "date": "2025-07-29", "po": "PO1", "state": "disputed", "unit_price_cents": 14234, "units": 15, "vendor": "V2" }, "IV-3512-2-1": { "date": "2025-07-12", "po": "PO2", "state": "void", "unit_price_cents": 5366, "units": 7, "vendor": "V0" }, "IV-3645-2-3": { "date": "2025-07-06", "po": "PO2", "state": "review", "unit_price_cents": 4141, "units": 14, "vendor": "V0" }, "IV-4781-1-1": { "date": "2025-07-10", "po": "PO1", "state": "void", "unit_price_cents": 14048, "units": 12, "vendor": "V2" }, "IV-5355-0-3": { "date": "2025-07-27", "po": "PO0", "state": "disputed", "unit_price_cents": 22436, "units": 9, "vendor": "V1" }, "IV-5362-5-1": { "date": "2025-07-23", "po": "PO5", "state": "disputed", "unit_price_cents": 19908, "units": 6, "vendor": "Unknown" }, "IV-5898-1-2": { "date": "2025-07-17", "po": "PO1", "state": "posted", "unit_price_cents": 12052, "units": 11, "vendor": "V2" }, "IV-6039-3-0": { "date": "2025-07-10", "po": "PO3", "state": "posted", "unit_price_cents": 11188, "units": 24, "vendor": "V4" }, "IV-6192-4-1": { "date": "2025-07-29", "po": "PO4", "state": "disputed", "unit_price_cents": 12050, "units": 9, "vendor": "V0" }, "IV-6195-1-0": { "date": "2025-07-10", "po": "PO1", "state": "posted", "unit_price_cents": 12069, "units": 4, "vendor": "V2" }, "IV-6673-0-0": { "date": "2025-07-10", "po": "PO0", "state": "posted", "unit_price_cents": 20814, "units": 1, "vendor": "V1" }, "IV-7091-3-1": { "date": "2025-07-21", "po": "PO3", "state": "disputed", "unit_price_cents": 11644, "units": 13, "vendor": "V4" }, "IV-7714-4-0": { "date": "2025-07-10", "po": "PO4", "state": "posted", "unit_price_cents": 10466, "units": 8, "vendor": "V0" }, "IV-8313-6-0": { "date": "2025-07-10", "po": "PO6", "state": "review", "unit_price_cents": 21349, "units": 9, "vendor": "V2" }, "IV-8475-0-1": { "date": "2025-07-11", "po": "PO0", "state": "void", "unit_price_cents": 22241, "units": 3, "vendor": "Unknown" }, "IV-8625-5-0": { "date": "2025-07-10", "po": "PO5", "state": "posted", "unit_price_cents": 18133, "units": 9, "vendor": "V4" }, "IV-8964-0-2": { "date": "2025-07-14", "po": "PO0", "state": "disputed", "unit_price_cents": 22581, "units": 21, "vendor": "V1" } }, "purchase_orders": { "PO0": { "unit": "South", "unit_price_cents": 20814, "vendor": "V1" }, "PO1": { "unit": "South", "unit_price_cents": 12069, "vendor": "V2" }, "PO2": { "unit": "South", "unit_price_cents": 3352, "vendor": "V0" }, "PO3": { "unit": "South", "unit_price_cents": 11188, "vendor": "V4" }, "PO4": { "unit": "South", "unit_price_cents": 10466, "vendor": "V0" }, "PO5": { "unit": "South", "unit_price_cents": 18133, "vendor": "V4" }, "PO6": { "unit": "Other", "unit_price_cents": 21349, "vendor": "V2" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" }, "case-IV-2499-2-2": { "invoice": "IV-2499-2-2", "issues": [ "price", "units" ], "po": "PO2" }, "case-IV-2842-1-3": { "invoice": "IV-2842-1-3", "issues": [ "price" ], "po": "PO1" }, "case-IV-5355-0-3": { "invoice": "IV-5355-0-3", "issues": [ "price" ], "po": "PO0" }, "case-IV-5362-5-1": { "invoice": "IV-5362-5-1", "issues": [ "vendor", "price" ], "po": "PO5" }, "case-IV-6192-4-1": { "invoice": "IV-6192-4-1", "issues": [ "price" ], "po": "PO4" }, "case-IV-7091-3-1": { "invoice": "IV-7091-3-1", "issues": [ "price" ], "po": "PO3" }, "case-IV-8964-0-2": { "invoice": "IV-8964-0-2", "issues": [ "price", "units" ], "po": "PO0" } }, "vendors": { "V0": { "net_days": 21 }, "V1": { "net_days": 30 }, "V2": { "net_days": 15 }, "V3": { "net_days": 45 }, "V4": { "net_days": 15 } }}1234#!/bin/shset -eumkdir -p /logs/verifier /workspace/outputsexec python3 -B -I /tests/grade.py123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430{ "ap_postings": { "booked-PO0": { "po": "PO0", "status": "posted", "units": 3 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 2 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 2 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 2 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 7 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 5 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 6 } }, "goods_receipts": { "GI-0-0": { "date": "2025-07-30", "po": "PO0", "state": "accepted", "units": 20 }, "GI-0-1": { "date": "2025-07-14", "po": "PO0", "state": "quarantine", "units": 27 }, "GI-0-2": { "date": "2025-07-27", "po": "PO0", "state": "quarantine", "units": 22 }, "GI-0-3": { "date": "2025-08-01", "po": "PO0", "state": "accepted", "units": 15 }, "GI-1-0": { "date": "2025-07-30", "po": "PO1", "state": "accepted", "units": 15 }, "GI-1-1": { "date": "2025-08-01", "po": "PO1", "state": "accepted", "units": 14 }, "GI-1-2": { "date": "2025-07-30", "po": "PO1", "state": "accepted", "units": 23 }, "GI-1-3": { "date": "2025-07-31", "po": "PO1", "state": "accepted", "units": 27 }, "GI-2-0": { "date": "2025-07-30", "po": "PO2", "state": "accepted", "units": 22 }, "GI-2-1": { "date": "2025-07-19", "po": "PO2", "state": "accepted", "units": 17 }, "GI-2-2": { "date": "2025-07-18", "po": "PO2", "state": "quarantine", "units": 16 }, "GI-2-3": { "date": "2025-08-03", "po": "PO2", "state": "accepted", "units": 19 }, "GI-3-0": { "date": "2025-07-30", "po": "PO3", "state": "accepted", "units": 18 }, "GI-3-1": { "date": "2025-07-20", "po": "PO3", "state": "quarantine", "units": 22 }, "GI-3-2": { "date": "2025-07-31", "po": "PO3", "state": "quarantine", "units": 21 }, "GI-3-3": { "date": "2025-07-19", "po": "PO3", "state": "accepted", "units": 23 }, "GI-4-0": { "date": "2025-07-30", "po": "PO4", "state": "accepted", "units": 25 }, "GI-4-1": { "date": "2025-07-14", "po": "PO4", "state": "quarantine", "units": 14 }, "GI-4-2": { "date": "2025-07-23", "po": "PO4", "state": "quarantine", "units": 14 }, "GI-4-3": { "date": "2025-07-26", "po": "PO4", "state": "accepted", "units": 21 }, "GI-5-0": { "date": "2025-07-30", "po": "PO5", "state": "accepted", "units": 13 }, "GI-5-1": { "date": "2025-07-07", "po": "PO5", "state": "quarantine", "units": 20 }, "GI-5-2": { "date": "2025-07-21", "po": "PO5", "state": "quarantine", "units": 18 }, "GI-5-3": { "date": "2025-07-08", "po": "PO5", "state": "accepted", "units": 25 }, "GI-6-0": { "date": "2025-07-30", "po": "PO6", "state": "accepted", "units": 28 }, "GI-6-1": { "date": "2025-08-02", "po": "PO6", "state": "accepted", "units": 28 }, "GI-6-2": { "date": "2025-07-13", "po": "PO6", "state": "accepted", "units": 27 }, "GI-6-3": { "date": "2025-08-04", "po": "PO6", "state": "quarantine", "units": 23 } }, "invoice_inbox": { "IV-1042-6-1": { "date": "2025-07-12", "po": "PO6", "state": "review", "unit_price_cents": 23221, "units": 24, "vendor": "V2" }, "IV-2441-2-0": { "date": "2025-07-10", "po": "PO2", "state": "review", "unit_price_cents": 3352, "units": 24, "vendor": "V0" }, "IV-2499-2-2": { "date": "2025-07-14", "po": "PO2", "state": "review", "unit_price_cents": 3672, "units": 24, "vendor": "V0" }, "IV-2842-1-3": { "date": "2025-07-29", "po": "PO1", "state": "review", "unit_price_cents": 14234, "units": 15, "vendor": "V2" }, "IV-3512-2-1": { "date": "2025-07-12", "po": "PO2", "state": "void", "unit_price_cents": 5366, "units": 7, "vendor": "V0" }, "IV-3645-2-3": { "date": "2025-07-06", "po": "PO2", "state": "review", "unit_price_cents": 4141, "units": 14, "vendor": "V0" }, "IV-4781-1-1": { "date": "2025-07-10", "po": "PO1", "state": "void", "unit_price_cents": 14048, "units": 12, "vendor": "V2" }, "IV-5355-0-3": { "date": "2025-07-27", "po": "PO0", "state": "review", "unit_price_cents": 22436, "units": 9, "vendor": "V1" }, "IV-5362-5-1": { "date": "2025-07-23", "po": "PO5", "state": "review", "unit_price_cents": 19908, "units": 6, "vendor": "Unknown" }, "IV-5898-1-2": { "date": "2025-07-17", "po": "PO1", "state": "review", "unit_price_cents": 12052, "units": 11, "vendor": "V2" }, "IV-6039-3-0": { "date": "2025-07-10", "po": "PO3", "state": "review", "unit_price_cents": 11188, "units": 24, "vendor": "V4" }, "IV-6192-4-1": { "date": "2025-07-29", "po": "PO4", "state": "review", "unit_price_cents": 12050, "units": 9, "vendor": "V0" }, "IV-6195-1-0": { "date": "2025-07-10", "po": "PO1", "state": "review", "unit_price_cents": 12069, "units": 4, "vendor": "V2" }, "IV-6673-0-0": { "date": "2025-07-10", "po": "PO0", "state": "review", "unit_price_cents": 20814, "units": 1, "vendor": "V1" }, "IV-7091-3-1": { "date": "2025-07-21", "po": "PO3", "state": "review", "unit_price_cents": 11644, "units": 13, "vendor": "V4" }, "IV-7714-4-0": { "date": "2025-07-10", "po": "PO4", "state": "review", "unit_price_cents": 10466, "units": 8, "vendor": "V0" }, "IV-8313-6-0": { "date": "2025-07-10", "po": "PO6", "state": "review", "unit_price_cents": 21349, "units": 9, "vendor": "V2" }, "IV-8475-0-1": { "date": "2025-07-11", "po": "PO0", "state": "void", "unit_price_cents": 22241, "units": 3, "vendor": "Unknown" }, "IV-8625-5-0": { "date": "2025-07-10", "po": "PO5", "state": "review", "unit_price_cents": 18133, "units": 9, "vendor": "V4" }, "IV-8964-0-2": { "date": "2025-07-14", "po": "PO0", "state": "review", "unit_price_cents": 22581, "units": 21, "vendor": "V1" } }, "purchase_orders": { "PO0": { "unit": "South", "unit_price_cents": 20814, "vendor": "V1" }, "PO1": { "unit": "South", "unit_price_cents": 12069, "vendor": "V2" }, "PO2": { "unit": "South", "unit_price_cents": 3352, "vendor": "V0" }, "PO3": { "unit": "South", "unit_price_cents": 11188, "vendor": "V4" }, "PO4": { "unit": "South", "unit_price_cents": 10466, "vendor": "V0" }, "PO5": { "unit": "South", "unit_price_cents": 18133, "vendor": "V4" }, "PO6": { "unit": "Other", "unit_price_cents": 21349, "vendor": "V2" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" } }, "vendors": { "V0": { "net_days": 21 }, "V1": { "net_days": 30 }, "V2": { "net_days": 15 }, "V3": { "net_days": 45 }, "V4": { "net_days": 15 } }}1234567891011121314151617181920212223242526"""Replay submitted mutations from the private verifier's initial state."""from types import ModuleTypeimport json
def check(spec, outputs, tests): replay = ModuleType('workflow_replay') exec(compile((tests/'replay.py').read_bytes(), 'replay.py', 'exec'), replay.__dict__) world = json.loads((tests/'world.json').read_text()) target = json.loads((tests/'target.json').read_text()) # Only fields whose starting and expected values differ may be changed. Attempts # to temporarily alter a protected field fail even when a later write restores it. allowed = { (app,key): {field for field,value in doc.items() if field not in world[app].get(key,{}) or not replay.same(world[app][key][field],value)} for app,records in target.items() for key,doc in records.items() } actions = replay.load_actions(outputs/'actions.jsonl') for event in actions: replay.apply(world,event) touched = set(event['fields']) if not touched <= allowed.get((event['app'],event['id']),set()): return False,'protected field or record write' if not replay.same(world,target): return False,'required business outcomes incomplete' return True,''12345678910111213141516171819202122232425262728{ "profile": "harbor-semantic-v1", "reward_key": "reward", "reward": { "range": [ 0, 1 ], "oracle_tolerance": 0, "floor_margin": 0.1 }, "resources": { "cpu": 1, "memory_mb": 4096, "disk_mb": 10240, "episode_timeout_s": 1800 }, "types": { "tags": [ "knowledge-work", "cross-app-workflows", "conditional-execution", "protected-state", "finance" ] }, "requires_credentials": false}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768"""Offline business-app client. Print usage with --help."""import argparseimport copyimport fcntlimport jsonimport osfrom pathlib import Path
def same(left, right): return json.dumps(left, sort_keys=True, allow_nan=False) == json.dumps(right, sort_keys=True, allow_nan=False)
def apply(world, action): if not isinstance(action, dict) or action.keys() != {'op', 'app', 'id', 'fields'}: raise ValueError('expected op, app, id, fields') op, app, key, fields = (action[k] for k in ('op', 'app', 'id', 'fields')) if app not in world or not isinstance(key, str) or not key or not isinstance(fields, dict) or not fields: raise ValueError('unknown app, invalid id or empty fields') collection = world[app] if op == 'update' and key in collection: collection[key].update(copy.deepcopy(fields)) elif op == 'create' and key not in collection: collection[key] = copy.deepcopy(fields) else: raise ValueError(f'invalid {op} for {app}/{key}')
def load_actions(path): if path.is_symlink() or (path.is_file() and path.stat().st_size > 2_000_000): raise ValueError('invalid action log') if not path.exists(): return [] return [json.loads(s) for s in path.read_text().splitlines() if s.strip()]
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('op', choices=('apps','list','get','update','create')) parser.add_argument('app', nargs='?') parser.add_argument('id', nargs='?') parser.add_argument('fields', nargs='?', type=json.loads) args = parser.parse_args() world = json.loads(Path(__file__).with_name('world.json').read_text()) out = Path(os.environ.get('WORKFLOW_OUTPUT_DIR', '/workspace/outputs')) out.mkdir(parents=True, exist_ok=True) log = out/'actions.jsonl' with (out/'.actions.lock').open('a') as lock: fcntl.flock(lock.fileno(), fcntl.LOCK_EX) for event in load_actions(log): apply(world,event) if args.op=='apps': value=sorted(world) elif args.op=='list': value=world[args.app] elif args.op=='get': value=world[args.app][args.id] else: event={'op':args.op, 'app':args.app, 'id':args.id, 'fields':args.fields} apply(world,event) with log.open('a') as handle: handle.write(json.dumps(event,allow_nan=False)+'\n') value=world[args.app][args.id] print(json.dumps(value,sort_keys=True,allow_nan=False))
if __name__=='__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422{ "ap_postings": { "booked-PO0": { "po": "PO0", "status": "posted", "units": 1 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 0 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 5 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 1 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 0 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 2 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 6 } }, "goods_receipts": { "GI-0-0": { "date": "2025-08-22", "po": "PO0", "state": "accepted", "units": 20 }, "GI-0-1": { "date": "2025-08-26", "po": "PO0", "state": "quarantine", "units": 28 }, "GI-0-2": { "date": "2025-08-04", "po": "PO0", "state": "accepted", "units": 22 }, "GI-0-3": { "date": "2025-08-19", "po": "PO0", "state": "accepted", "units": 12 }, "GI-1-0": { "date": "2025-08-22", "po": "PO1", "state": "accepted", "units": 16 }, "GI-1-1": { "date": "2025-08-07", "po": "PO1", "state": "quarantine", "units": 12 }, "GI-1-2": { "date": "2025-08-20", "po": "PO1", "state": "quarantine", "units": 26 }, "GI-1-3": { "date": "2025-08-25", "po": "PO1", "state": "accepted", "units": 26 }, "GI-2-0": { "date": "2025-08-22", "po": "PO2", "state": "accepted", "units": 17 }, "GI-2-1": { "date": "2025-07-31", "po": "PO2", "state": "accepted", "units": 13 }, "GI-2-2": { "date": "2025-08-27", "po": "PO2", "state": "accepted", "units": 22 }, "GI-2-3": { "date": "2025-08-19", "po": "PO2", "state": "quarantine", "units": 26 }, "GI-3-0": { "date": "2025-08-22", "po": "PO3", "state": "accepted", "units": 21 }, "GI-3-1": { "date": "2025-08-19", "po": "PO3", "state": "accepted", "units": 22 }, "GI-3-2": { "date": "2025-08-27", "po": "PO3", "state": "accepted", "units": 16 }, "GI-3-3": { "date": "2025-08-14", "po": "PO3", "state": "accepted", "units": 13 }, "GI-4-0": { "date": "2025-08-22", "po": "PO4", "state": "accepted", "units": 22 }, "GI-4-1": { "date": "2025-08-15", "po": "PO4", "state": "quarantine", "units": 15 }, "GI-4-2": { "date": "2025-07-31", "po": "PO4", "state": "accepted", "units": 28 }, "GI-4-3": { "date": "2025-08-09", "po": "PO4", "state": "quarantine", "units": 18 }, "GI-5-0": { "date": "2025-08-22", "po": "PO5", "state": "accepted", "units": 13 }, "GI-5-1": { "date": "2025-08-21", "po": "PO5", "state": "accepted", "units": 25 }, "GI-5-2": { "date": "2025-08-07", "po": "PO5", "state": "quarantine", "units": 13 }, "GI-5-3": { "date": "2025-08-18", "po": "PO5", "state": "accepted", "units": 22 }, "GI-6-0": { "date": "2025-08-22", "po": "PO6", "state": "accepted", "units": 16 }, "GI-6-1": { "date": "2025-08-17", "po": "PO6", "state": "accepted", "units": 14 }, "GI-6-2": { "date": "2025-08-17", "po": "PO6", "state": "accepted", "units": 15 }, "GI-6-3": { "date": "2025-08-19", "po": "PO6", "state": "quarantine", "units": 20 } }, "invoice_inbox": { "IV-2613-5-2": { "date": "2025-08-22", "po": "PO5", "state": "review", "unit_price_cents": 12821, "units": 18, "vendor": "V4" }, "IV-3037-6-1": { "date": "2025-08-15", "po": "PO6", "state": "void", "unit_price_cents": 22140, "units": 25, "vendor": "V0" }, "IV-3482-1-1": { "date": "2025-08-23", "po": "PO1", "state": "review", "unit_price_cents": 19000, "units": 13, "vendor": "Unknown" }, "IV-4155-4-1": { "date": "2025-08-03", "po": "PO4", "state": "void", "unit_price_cents": 8752, "units": 13, "vendor": "V2" }, "IV-4801-3-1": { "date": "2025-08-04", "po": "PO3", "state": "review", "unit_price_cents": 14648, "units": 10, "vendor": "V3" }, "IV-4811-2-1": { "date": "2025-08-16", "po": "PO2", "state": "review", "unit_price_cents": 4453, "units": 25, "vendor": "Unknown" }, "IV-5537-5-0": { "date": "2025-08-09", "po": "PO5", "state": "review", "unit_price_cents": 13177, "units": 19, "vendor": "V4" }, "IV-6510-3-2": { "date": "2025-08-09", "po": "PO3", "state": "review", "unit_price_cents": 13059, "units": 3, "vendor": "V3" }, "IV-6764-0-1": { "date": "2025-08-15", "po": "PO0", "state": "review", "unit_price_cents": 4492, "units": 9, "vendor": "V0" }, "IV-6912-6-2": { "date": "2025-08-12", "po": "PO6", "state": "review", "unit_price_cents": 23343, "units": 19, "vendor": "V0" }, "IV-7893-4-2": { "date": "2025-08-20", "po": "PO4", "state": "review", "unit_price_cents": 9742, "units": 11, "vendor": "V2" }, "IV-7924-5-1": { "date": "2025-08-09", "po": "PO5", "state": "review", "unit_price_cents": 15219, "units": 13, "vendor": "V4" }, "IV-8036-3-0": { "date": "2025-08-09", "po": "PO3", "state": "review", "unit_price_cents": 13187, "units": 5, "vendor": "V3" }, "IV-8332-6-3": { "date": "2025-08-22", "po": "PO6", "state": "review", "unit_price_cents": 23448, "units": 5, "vendor": "V0" }, "IV-8473-0-0": { "date": "2025-08-09", "po": "PO0", "state": "review", "unit_price_cents": 4672, "units": 1, "vendor": "V0" }, "IV-8711-4-0": { "date": "2025-08-09", "po": "PO4", "state": "review", "unit_price_cents": 8944, "units": 17, "vendor": "V2" }, "IV-9039-1-0": { "date": "2025-08-09", "po": "PO1", "state": "review", "unit_price_cents": 18388, "units": 16, "vendor": "V0" }, "IV-9189-6-0": { "date": "2025-08-09", "po": "PO6", "state": "review", "unit_price_cents": 21322, "units": 17, "vendor": "V0" }, "IV-9422-2-0": { "date": "2025-08-09", "po": "PO2", "state": "review", "unit_price_cents": 3223, "units": 3, "vendor": "V1" } }, "purchase_orders": { "PO0": { "unit": "North", "unit_price_cents": 4672, "vendor": "V0" }, "PO1": { "unit": "North", "unit_price_cents": 18388, "vendor": "V0" }, "PO2": { "unit": "North", "unit_price_cents": 3223, "vendor": "V1" }, "PO3": { "unit": "North", "unit_price_cents": 13187, "vendor": "V3" }, "PO4": { "unit": "North", "unit_price_cents": 8944, "vendor": "V2" }, "PO5": { "unit": "North", "unit_price_cents": 13177, "vendor": "V4" }, "PO6": { "unit": "Other", "unit_price_cents": 21322, "vendor": "V0" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" } }, "vendors": { "V0": { "net_days": 30 }, "V1": { "net_days": 15 }, "V2": { "net_days": 21 }, "V3": { "net_days": 45 }, "V4": { "net_days": 15 } }}1234567891011121314151617Close the invoice matching queue for purchasing unit North at 2025-08-23. Handle invoices in review attached to that unit's purchase orders, invoice dates 2025-08-09 through 2025-08-23 inclusive. Process by invoice date ascending, then invoice ID ascending. Available units per PO equal units on accepted goods receipts dated on or before cutoff, minus previously posted units and any units successfully matched earlier in this run.
Match the invoice vendor exactly against the purchase order. A unit price above PO price is acceptable only up to 200 basis points above PO price (10,000 basis points = 100%; compare exactly, before rounding). Lower prices are acceptable. The invoice quantity must fit the available units in full. If any tests fail, update the invoice state to `disputed`, consume zero units, and create supplier_cases record `case-<invoice ID>` with `invoice`, `po` and the list `issues` containing every failing check in vendor, price, units order; use those lowercase strings.
For a match update invoice state to `posted` and create ap_postings record `book-<invoice ID>` with `invoice`, `po`, `units`, `status=posted`, integer `amount_cents` equal to invoiced quantity times invoiced unit price, and ISO date `due`. Count the vendor's net_days calendar days from the invoice date, then roll Saturday or Sunday forward to Monday. Preserve all other fields and records.
Use the offline app client at `/workspace/inputs/apps.py`. Call it with python3. Run`apps` to discover apps, `list APP` to see its records, or `get APP ID` for one record.Write with `update APP ID '{"field":"value"}'` or `create APP ID '{"field":"value"}'`.The client records successful writes in `/workspace/outputs/actions.jsonl`.Apply exactly the required changes. Other records and fields must remain untouched,including temporary changes. Actions take effect in the local simulation only.
## Deliverable
Work in `/workspace`. Input files are under `/workspace/inputs/`. Put every deliverable in`/workspace/outputs/`; only that directory is graded. Leave the app action log in the outputs directory.1234567891011121314151617181920212223242526{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-8473-0-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-6764-0-1", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-9039-1-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-3482-1-1", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-9422-2-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-4811-2-1", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-8036-3-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-6510-3-2", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-8711-4-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-7893-4-2", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-5537-5-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-7924-5-1", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-2613-5-2", "op": "update"}{"app": "ap_postings", "fields": {"amount_cents": 250363, "due": "2025-08-25", "invoice": "IV-5537-5-0", "po": "PO5", "status": "posted", "units": 19}, "id": "book-IV-5537-5-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 39177, "due": "2025-09-23", "invoice": "IV-6510-3-2", "po": "PO3", "status": "posted", "units": 3}, "id": "book-IV-6510-3-2", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 65935, "due": "2025-09-23", "invoice": "IV-8036-3-0", "po": "PO3", "status": "posted", "units": 5}, "id": "book-IV-8036-3-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 4672, "due": "2025-09-08", "invoice": "IV-8473-0-0", "po": "PO0", "status": "posted", "units": 1}, "id": "book-IV-8473-0-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 152048, "due": "2025-09-01", "invoice": "IV-8711-4-0", "po": "PO4", "status": "posted", "units": 17}, "id": "book-IV-8711-4-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 294208, "due": "2025-09-08", "invoice": "IV-9039-1-0", "po": "PO1", "status": "posted", "units": 16}, "id": "book-IV-9039-1-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 9669, "due": "2025-08-25", "invoice": "IV-9422-2-0", "po": "PO2", "status": "posted", "units": 3}, "id": "book-IV-9422-2-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 40428, "due": "2025-09-15", "invoice": "IV-6764-0-1", "po": "PO0", "status": "posted", "units": 9}, "id": "book-IV-6764-0-1", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 230778, "due": "2025-09-08", "invoice": "IV-2613-5-2", "po": "PO5", "status": "posted", "units": 18}, "id": "book-IV-2613-5-2", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-7924-5-1", "issues": ["price"], "po": "PO5"}, "id": "case-IV-7924-5-1", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-4811-2-1", "issues": ["vendor", "price", "units"], "po": "PO2"}, "id": "case-IV-4811-2-1", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-7893-4-2", "issues": ["price"], "po": "PO4"}, "id": "case-IV-7893-4-2", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-3482-1-1", "issues": ["vendor", "price", "units"], "po": "PO1"}, "id": "case-IV-3482-1-1", "op": "create"}1234#!/bin/shset -eumkdir -p /workspace/outputscp -R /solution/files/. /workspace/outputs/12345678910111213141516171819202122232425262728293031323334353637383940414243444546schema_version = "1.3"
[task]name = "apex-gap/autom-supplier-invoice-match-009"
[metadata.apex_gap]capability_tags = ["cross-app-workflows", "conditional-execution", "protected-state", "finance"]dataset = "Original simulated workflows"job = "finance"seed = 9source = "local/original-automation-workflows"source_revision = "1"source_split = "synthetic"source_task_id = "autom-supplier-invoice-match-009"template_family = "automation:supplier-invoice-match"workflow_template = "supplier-invoice-match"
[metadata.openenv_hf_sandbox]variant = "apex-gap-hfsandbox-v1"task_modified_for_hf_sandbox = truenetwork_enabled = true
[environment]docker_image = "ghcr.io/younesbelkada/apex@sha256:24969c952247033023872f87161a16e067003469506be63783bbaa5d96926bdf"workdir = "/workspace"cpus = 1memory_mb = 4096build_timeout_sec = 600network_mode = "public"
[agent]timeout_sec = 1800network_mode = "public"
[verifier]timeout_sec = 600network_mode = "public"environment_mode = "separate"
[verifier.environment]network_mode = "public"cpus = 1memory_mb = 4096
[[artifacts]]source = "/workspace/outputs"123456789{ "checks": [ { "id": "business-outcomes", "type": "custom", "module": "world_check" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330"""Deterministic grader shared by converted knowledge-work tasks.
Runs inside the separate verifier sandbox. Reads /tests/expected.json, inspects thesubmitted /workspace/outputs tree and writes a binary reward plus per-check details.No model calls and no network.
expected.json: {"checks": [{"id": ..., "type": ..., ...}, ...]}Check types: answer field of outputs/answer.json; kind = number|text|choice|date|bool|list xlsx_range recalculated outputs/<file> vs tests/<target> over sheet!range (SpreadsheetBench rules) xlsx_cell recalculated outputs/<file> sheet!cell vs value with tolerance (optional alt_values) file_contains outputs/<file> text (docx/pdf/ics/eml/txt) must contain every needle custom tests/<module>.py defines check(spec, outputs_dir, tests_dir) -> (bool, str)"""
import datetime as dtimport jsonimport reimport shutilimport subprocessimport sysimport tempfileimport unicodedatafrom pathlib import Path
OUT = Path("/workspace/outputs")TESTS = Path("/tests")LOGS = Path("/logs/verifier")
def norm_text(v): v = unicodedata.normalize("NFKC", str(v)).casefold() v = re.sub(r"[‘’“”]", "'", v) v = re.sub(r"[^\w%.$/-]+", " ", v) return " ".join(v.split()).strip(" .")
def to_number(v): if isinstance(v, bool): raise ValueError("bool") if isinstance(v, (int, float)): return float(v) s = str(v).strip().replace(",", "").replace("$", "").replace("−", "-") neg = s.startswith("(") and s.endswith(")") s = s.strip("()").strip() pct = s.endswith("%") s = s.rstrip("%").strip() s = re.sub(r"\s*(usd|dollars|million|billion|thousand|m|bn|k)$", "", s, flags=re.I) x = float(s) x = -x if neg else x return x / 100 if pct else x
def number_ok(got, want, rel, abs_): try: g = to_number(got) except (TypeError, ValueError): return False w = float(want) tol = max(abs_, rel * abs(w)) # "12.5%" may mean the ratio 0.125 or the percent number 12.5; the gold fixes which. candidates = [g, g * 100] if isinstance(got, str) and got.strip().endswith("%") else [g] return any(abs(c - w) <= tol for c in candidates)
def parse_date(v): if isinstance(v, (dt.date, dt.datetime)): return v if isinstance(v, dt.date) else v.date() s = str(v).strip() for fmt in ("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y", "%d %B %Y", "%B %d, %Y", "%b %d, %Y", "%Y/%m/%d"): try: return dt.datetime.strptime(s, fmt).date() except ValueError: continue raise ValueError(s)
def check_answer(check, answers): key = check["field"] if key not in answers: return False, f"missing field {key!r}" got, want, kind = answers[key], check["value"], check.get("kind", "text") if kind == "number": ok = number_ok(got, want, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01)) if not ok and check.get("percent_either"): ok = number_ok(got, want * 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) * 100) or ( number_ok(got, want / 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) / 100) ) elif kind == "date": try: ok = parse_date(got) == parse_date(want) except ValueError: ok = False elif kind == "bool": g = norm_text(got) ok = g in {"yes", "true"} if want else g in {"no", "false"} elif kind == "choice": ok = norm_text(got) == norm_text(want) elif kind == "list": if not isinstance(got, list): return False, f"{key}: expected a JSON list" # Filenames may be given with a directory prefix; compare base names. base = lambda x: norm_text(str(x).replace("\\", "/").rsplit("/", 1)[-1]) ok = sorted(base(x) for x in got) == sorted(base(x) for x in want) else: accepted = check.get("accept", [want]) ok = norm_text(got) in {norm_text(a) for a in accepted} return ok, "" if ok else f"{key}: got {got!r}"
# LibreOffice keeps cached formula values on load unless told otherwise; force a full recalculation.RECALC_PROFILE = """<?xml version="1.0" encoding="UTF-8"?><oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"><item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="OOXMLRecalcMode" oor:op="fuse"><value>0</value></prop></item><item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="ODFRecalcMode" oor:op="fuse"><value>0</value></prop></item></oor:items>"""
def recalc(path, tmp): dest = Path(tmp) / f"recalc-{len(list(Path(tmp).glob('recalc-*')))}" dest.mkdir() profile = Path(tmp) / "lo-profile" if not profile.exists(): (profile / "user").mkdir(parents=True) (profile / "user" / "registrymodifications.xcu").write_text(RECALC_PROFILE) subprocess.run( ["soffice", f"-env:UserInstallation=file://{profile}", "--headless", "--calc", "--convert-to", "xlsx:Calc MS Excel 2007 XML", "--outdir", str(dest), str(path)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=180, check=False, ) out = dest / (Path(path).stem + ".xlsx") return out if out.exists() else Path(path)
def cell_value(v): if isinstance(v, (int, float)) and not isinstance(v, bool): return round(float(v), 2) if isinstance(v, dt.datetime): return round((v - dt.datetime(1899, 12, 30)).total_seconds() / 86400.0, 0) if isinstance(v, dt.time): return v.strftime("%H:%M") if isinstance(v, str): try: return round(float(v), 2) except ValueError: return v.strip() return v
def time_of(v): """A time or a day fraction in [0, 1) as HH:MM, rounded to the nearest second first. Calc and Excel store a time as that fraction; openpyxl returns a time only for time-formatted cells.""" if isinstance(v, dt.time): v = (v.hour * 3600 + v.minute * 60 + v.second + v.microsecond / 1e6) / 86400 if isinstance(v, (int, float)) and not isinstance(v, bool) and 0 <= v < 1: return (dt.datetime(1899, 12, 30) + dt.timedelta(seconds=round(v * 86400))).strftime("%H:%M") return None
def same_cell(a, b): if isinstance(a, dt.time) is not isinstance(b, dt.time): n = b if isinstance(a, dt.time) else a if time_of(n) is not None: # a time against a plain day fraction return time_of(a) == time_of(b) a, b = cell_value(a), cell_value(b) if a in (None, "") and b in (None, ""): return True return type(a) is type(b) and a == b
ERRORS = {"#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"}
def is_error(v): return isinstance(v, str) and (v in ERRORS or v.startswith("Err:"))
def cells(rng): if ":" not in rng: return [rng] from openpyxl.utils import range_boundaries, get_column_letter
c1, r1, c2, r2 = range_boundaries(rng) return [f"{get_column_letter(c)}{r}" for r in range(r1, r2 + 1) for c in range(c1, c2 + 1)]
def load(path, tmp): import openpyxl
return openpyxl.load_workbook(recalc(path, tmp), data_only=True)
def check_xlsx_range(check, tmp, cache): sub = OUT / check["file"] if not sub.is_file(): return False, f"missing output {check['file']}" if sub not in cache: cache[sub] = load(sub, tmp) tgt = TESTS / check["target"] if tgt not in cache: cache[tgt] = load(tgt, tmp) got, want = cache[sub], cache[tgt] cached = None # the target's stored (Excel-computed) values, read only when Calc errs for sheet, rng in check["ranges"]: sheet = sheet or want.sheetnames[0] if sheet not in got.sheetnames: return False, f"sheet {sheet!r} missing" for name in cells(rng): w = want[sheet][name].value if is_error(w): # LibreOffice could not evaluate the gold formula (e.g. XLOOKUP, FILTER in Calc 7.4). # The value Excel stored is the intended answer. if cached is None: import openpyxl
cached = openpyxl.load_workbook(tgt, data_only=True) c = cached[sheet][name].value if sheet in cached.sheetnames else None if c is not None and not is_error(c): w = c if not same_cell(w, got[sheet][name].value): return False, f"{sheet}!{name}: want {w!r} got {got[sheet][name].value!r}" return True, ""
def check_xlsx_cell(check, tmp, cache): sub = OUT / check["file"] if not sub.is_file(): return False, f"missing output {check['file']}" if sub not in cache: cache[sub] = load(sub, tmp) wb = cache[sub] if check["sheet"] not in wb.sheetnames: return False, f"sheet {check['sheet']!r} missing" got = wb[check["sheet"]][check["cell"]].value want = check["value"] if isinstance(want, (int, float)): # alt_values: other accepted golds where the source admits more than one reading. ok = got is not None and any(number_ok(got, w, check.get("rel_tol", 0.0), check.get("abs_tol", 0.01)) for w in [want, *check.get("alt_values", [])]) else: ok = norm_text(got) == norm_text(want) return ok, "" if ok else f"{check['sheet']}!{check['cell']}: want {want!r} got {got!r}"
def text_of(path): suffix = path.suffix.lower() if suffix == ".docx": import docx
d = docx.Document(path) parts = [p.text for p in d.paragraphs] for t in d.tables: parts += [c.text for row in t.rows for c in row.cells] return "\n".join(parts) if suffix == ".pdf": import pdfplumber
with pdfplumber.open(path) as pdf: return "\n".join(page.extract_text() or "" for page in pdf.pages) return path.read_text(errors="replace")
def check_file_contains(check, tmp, cache): sub = OUT / check["file"] if not sub.is_file(): return False, f"missing output {check['file']}" text = text_of(sub) hay = text if check.get("case_sensitive") else text.casefold() for needle in check["needles"]: n = needle if check.get("case_sensitive") else needle.casefold() if n not in hay: return False, f"{check['file']} lacks {needle!r}" return True, ""
def main(): LOGS.mkdir(parents=True, exist_ok=True) reward_path = LOGS / "reward.txt" reward_path.write_text("0\n") spec = json.loads((TESTS / "expected.json").read_text()) answers, details = {}, [] answer_file = OUT / "answer.json" if answer_file.is_file(): try: answers = json.loads(answer_file.read_text()) if not isinstance(answers, dict): answers = {} except json.JSONDecodeError: answers = {} tmp = tempfile.mkdtemp() cache = {} try: for check in spec["checks"]: try: if check["type"] == "answer": ok, why = check_answer(check, answers) elif check["type"] == "xlsx_range": ok, why = check_xlsx_range(check, tmp, cache) elif check["type"] == "xlsx_cell": ok, why = check_xlsx_cell(check, tmp, cache) elif check["type"] == "file_contains": ok, why = check_file_contains(check, tmp, cache) elif check["type"] == "custom": import importlib.util
spec_ = importlib.util.spec_from_file_location("custom_check", TESTS / f"{check['module']}.py") mod = importlib.util.module_from_spec(spec_) spec_.loader.exec_module(mod) ok, why = mod.check(check, OUT, TESTS) else: ok, why = False, f"unknown check type {check['type']}" except Exception as exc: # a malformed submission fails the check, not the grader ok, why = False, f"{type(exc).__name__}: {exc}" details.append({"id": check["id"], "passed": ok, "detail": why}) finally: shutil.rmtree(tmp, ignore_errors=True) passed = sum(d["passed"] for d in details) total = len(details) reward = 1 if total and passed == total else 0 (LOGS / "details.json").write_text(json.dumps({"passed": passed, "total": total, "checks": details}, indent=1)) reward_path.write_text(f"{reward}\n") print(f"{passed}/{total} checks passed; reward {reward}")
if __name__ == "__main__": sys.exit(main())1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768"""Offline business-app client. Print usage with --help."""import argparseimport copyimport fcntlimport jsonimport osfrom pathlib import Path
def same(left, right): return json.dumps(left, sort_keys=True, allow_nan=False) == json.dumps(right, sort_keys=True, allow_nan=False)
def apply(world, action): if not isinstance(action, dict) or action.keys() != {'op', 'app', 'id', 'fields'}: raise ValueError('expected op, app, id, fields') op, app, key, fields = (action[k] for k in ('op', 'app', 'id', 'fields')) if app not in world or not isinstance(key, str) or not key or not isinstance(fields, dict) or not fields: raise ValueError('unknown app, invalid id or empty fields') collection = world[app] if op == 'update' and key in collection: collection[key].update(copy.deepcopy(fields)) elif op == 'create' and key not in collection: collection[key] = copy.deepcopy(fields) else: raise ValueError(f'invalid {op} for {app}/{key}')
def load_actions(path): if path.is_symlink() or (path.is_file() and path.stat().st_size > 2_000_000): raise ValueError('invalid action log') if not path.exists(): return [] return [json.loads(s) for s in path.read_text().splitlines() if s.strip()]
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('op', choices=('apps','list','get','update','create')) parser.add_argument('app', nargs='?') parser.add_argument('id', nargs='?') parser.add_argument('fields', nargs='?', type=json.loads) args = parser.parse_args() world = json.loads(Path(__file__).with_name('world.json').read_text()) out = Path(os.environ.get('WORKFLOW_OUTPUT_DIR', '/workspace/outputs')) out.mkdir(parents=True, exist_ok=True) log = out/'actions.jsonl' with (out/'.actions.lock').open('a') as lock: fcntl.flock(lock.fileno(), fcntl.LOCK_EX) for event in load_actions(log): apply(world,event) if args.op=='apps': value=sorted(world) elif args.op=='list': value=world[args.app] elif args.op=='get': value=world[args.app][args.id] else: event={'op':args.op, 'app':args.app, 'id':args.id, 'fields':args.fields} apply(world,event) with log.open('a') as handle: handle.write(json.dumps(event,allow_nan=False)+'\n') value=world[args.app][args.id] print(json.dumps(value,sort_keys=True,allow_nan=False))
if __name__=='__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526{ "ap_postings": { "book-IV-2613-5-2": { "amount_cents": 230778, "due": "2025-09-08", "invoice": "IV-2613-5-2", "po": "PO5", "status": "posted", "units": 18 }, "book-IV-5537-5-0": { "amount_cents": 250363, "due": "2025-08-25", "invoice": "IV-5537-5-0", "po": "PO5", "status": "posted", "units": 19 }, "book-IV-6510-3-2": { "amount_cents": 39177, "due": "2025-09-23", "invoice": "IV-6510-3-2", "po": "PO3", "status": "posted", "units": 3 }, "book-IV-6764-0-1": { "amount_cents": 40428, "due": "2025-09-15", "invoice": "IV-6764-0-1", "po": "PO0", "status": "posted", "units": 9 }, "book-IV-8036-3-0": { "amount_cents": 65935, "due": "2025-09-23", "invoice": "IV-8036-3-0", "po": "PO3", "status": "posted", "units": 5 }, "book-IV-8473-0-0": { "amount_cents": 4672, "due": "2025-09-08", "invoice": "IV-8473-0-0", "po": "PO0", "status": "posted", "units": 1 }, "book-IV-8711-4-0": { "amount_cents": 152048, "due": "2025-09-01", "invoice": "IV-8711-4-0", "po": "PO4", "status": "posted", "units": 17 }, "book-IV-9039-1-0": { "amount_cents": 294208, "due": "2025-09-08", "invoice": "IV-9039-1-0", "po": "PO1", "status": "posted", "units": 16 }, "book-IV-9422-2-0": { "amount_cents": 9669, "due": "2025-08-25", "invoice": "IV-9422-2-0", "po": "PO2", "status": "posted", "units": 3 }, "booked-PO0": { "po": "PO0", "status": "posted", "units": 1 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 0 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 5 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 1 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 0 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 2 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 6 } }, "goods_receipts": { "GI-0-0": { "date": "2025-08-22", "po": "PO0", "state": "accepted", "units": 20 }, "GI-0-1": { "date": "2025-08-26", "po": "PO0", "state": "quarantine", "units": 28 }, "GI-0-2": { "date": "2025-08-04", "po": "PO0", "state": "accepted", "units": 22 }, "GI-0-3": { "date": "2025-08-19", "po": "PO0", "state": "accepted", "units": 12 }, "GI-1-0": { "date": "2025-08-22", "po": "PO1", "state": "accepted", "units": 16 }, "GI-1-1": { "date": "2025-08-07", "po": "PO1", "state": "quarantine", "units": 12 }, "GI-1-2": { "date": "2025-08-20", "po": "PO1", "state": "quarantine", "units": 26 }, "GI-1-3": { "date": "2025-08-25", "po": "PO1", "state": "accepted", "units": 26 }, "GI-2-0": { "date": "2025-08-22", "po": "PO2", "state": "accepted", "units": 17 }, "GI-2-1": { "date": "2025-07-31", "po": "PO2", "state": "accepted", "units": 13 }, "GI-2-2": { "date": "2025-08-27", "po": "PO2", "state": "accepted", "units": 22 }, "GI-2-3": { "date": "2025-08-19", "po": "PO2", "state": "quarantine", "units": 26 }, "GI-3-0": { "date": "2025-08-22", "po": "PO3", "state": "accepted", "units": 21 }, "GI-3-1": { "date": "2025-08-19", "po": "PO3", "state": "accepted", "units": 22 }, "GI-3-2": { "date": "2025-08-27", "po": "PO3", "state": "accepted", "units": 16 }, "GI-3-3": { "date": "2025-08-14", "po": "PO3", "state": "accepted", "units": 13 }, "GI-4-0": { "date": "2025-08-22", "po": "PO4", "state": "accepted", "units": 22 }, "GI-4-1": { "date": "2025-08-15", "po": "PO4", "state": "quarantine", "units": 15 }, "GI-4-2": { "date": "2025-07-31", "po": "PO4", "state": "accepted", "units": 28 }, "GI-4-3": { "date": "2025-08-09", "po": "PO4", "state": "quarantine", "units": 18 }, "GI-5-0": { "date": "2025-08-22", "po": "PO5", "state": "accepted", "units": 13 }, "GI-5-1": { "date": "2025-08-21", "po": "PO5", "state": "accepted", "units": 25 }, "GI-5-2": { "date": "2025-08-07", "po": "PO5", "state": "quarantine", "units": 13 }, "GI-5-3": { "date": "2025-08-18", "po": "PO5", "state": "accepted", "units": 22 }, "GI-6-0": { "date": "2025-08-22", "po": "PO6", "state": "accepted", "units": 16 }, "GI-6-1": { "date": "2025-08-17", "po": "PO6", "state": "accepted", "units": 14 }, "GI-6-2": { "date": "2025-08-17", "po": "PO6", "state": "accepted", "units": 15 }, "GI-6-3": { "date": "2025-08-19", "po": "PO6", "state": "quarantine", "units": 20 } }, "invoice_inbox": { "IV-2613-5-2": { "date": "2025-08-22", "po": "PO5", "state": "posted", "unit_price_cents": 12821, "units": 18, "vendor": "V4" }, "IV-3037-6-1": { "date": "2025-08-15", "po": "PO6", "state": "void", "unit_price_cents": 22140, "units": 25, "vendor": "V0" }, "IV-3482-1-1": { "date": "2025-08-23", "po": "PO1", "state": "disputed", "unit_price_cents": 19000, "units": 13, "vendor": "Unknown" }, "IV-4155-4-1": { "date": "2025-08-03", "po": "PO4", "state": "void", "unit_price_cents": 8752, "units": 13, "vendor": "V2" }, "IV-4801-3-1": { "date": "2025-08-04", "po": "PO3", "state": "review", "unit_price_cents": 14648, "units": 10, "vendor": "V3" }, "IV-4811-2-1": { "date": "2025-08-16", "po": "PO2", "state": "disputed", "unit_price_cents": 4453, "units": 25, "vendor": "Unknown" }, "IV-5537-5-0": { "date": "2025-08-09", "po": "PO5", "state": "posted", "unit_price_cents": 13177, "units": 19, "vendor": "V4" }, "IV-6510-3-2": { "date": "2025-08-09", "po": "PO3", "state": "posted", "unit_price_cents": 13059, "units": 3, "vendor": "V3" }, "IV-6764-0-1": { "date": "2025-08-15", "po": "PO0", "state": "posted", "unit_price_cents": 4492, "units": 9, "vendor": "V0" }, "IV-6912-6-2": { "date": "2025-08-12", "po": "PO6", "state": "review", "unit_price_cents": 23343, "units": 19, "vendor": "V0" }, "IV-7893-4-2": { "date": "2025-08-20", "po": "PO4", "state": "disputed", "unit_price_cents": 9742, "units": 11, "vendor": "V2" }, "IV-7924-5-1": { "date": "2025-08-09", "po": "PO5", "state": "disputed", "unit_price_cents": 15219, "units": 13, "vendor": "V4" }, "IV-8036-3-0": { "date": "2025-08-09", "po": "PO3", "state": "posted", "unit_price_cents": 13187, "units": 5, "vendor": "V3" }, "IV-8332-6-3": { "date": "2025-08-22", "po": "PO6", "state": "review", "unit_price_cents": 23448, "units": 5, "vendor": "V0" }, "IV-8473-0-0": { "date": "2025-08-09", "po": "PO0", "state": "posted", "unit_price_cents": 4672, "units": 1, "vendor": "V0" }, "IV-8711-4-0": { "date": "2025-08-09", "po": "PO4", "state": "posted", "unit_price_cents": 8944, "units": 17, "vendor": "V2" }, "IV-9039-1-0": { "date": "2025-08-09", "po": "PO1", "state": "posted", "unit_price_cents": 18388, "units": 16, "vendor": "V0" }, "IV-9189-6-0": { "date": "2025-08-09", "po": "PO6", "state": "review", "unit_price_cents": 21322, "units": 17, "vendor": "V0" }, "IV-9422-2-0": { "date": "2025-08-09", "po": "PO2", "state": "posted", "unit_price_cents": 3223, "units": 3, "vendor": "V1" } }, "purchase_orders": { "PO0": { "unit": "North", "unit_price_cents": 4672, "vendor": "V0" }, "PO1": { "unit": "North", "unit_price_cents": 18388, "vendor": "V0" }, "PO2": { "unit": "North", "unit_price_cents": 3223, "vendor": "V1" }, "PO3": { "unit": "North", "unit_price_cents": 13187, "vendor": "V3" }, "PO4": { "unit": "North", "unit_price_cents": 8944, "vendor": "V2" }, "PO5": { "unit": "North", "unit_price_cents": 13177, "vendor": "V4" }, "PO6": { "unit": "Other", "unit_price_cents": 21322, "vendor": "V0" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" }, "case-IV-3482-1-1": { "invoice": "IV-3482-1-1", "issues": [ "vendor", "price", "units" ], "po": "PO1" }, "case-IV-4811-2-1": { "invoice": "IV-4811-2-1", "issues": [ "vendor", "price", "units" ], "po": "PO2" }, "case-IV-7893-4-2": { "invoice": "IV-7893-4-2", "issues": [ "price" ], "po": "PO4" }, "case-IV-7924-5-1": { "invoice": "IV-7924-5-1", "issues": [ "price" ], "po": "PO5" } }, "vendors": { "V0": { "net_days": 30 }, "V1": { "net_days": 15 }, "V2": { "net_days": 21 }, "V3": { "net_days": 45 }, "V4": { "net_days": 15 } }}1234#!/bin/shset -eumkdir -p /logs/verifier /workspace/outputsexec python3 -B -I /tests/grade.py123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422{ "ap_postings": { "booked-PO0": { "po": "PO0", "status": "posted", "units": 1 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 0 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 5 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 1 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 0 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 2 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 6 } }, "goods_receipts": { "GI-0-0": { "date": "2025-08-22", "po": "PO0", "state": "accepted", "units": 20 }, "GI-0-1": { "date": "2025-08-26", "po": "PO0", "state": "quarantine", "units": 28 }, "GI-0-2": { "date": "2025-08-04", "po": "PO0", "state": "accepted", "units": 22 }, "GI-0-3": { "date": "2025-08-19", "po": "PO0", "state": "accepted", "units": 12 }, "GI-1-0": { "date": "2025-08-22", "po": "PO1", "state": "accepted", "units": 16 }, "GI-1-1": { "date": "2025-08-07", "po": "PO1", "state": "quarantine", "units": 12 }, "GI-1-2": { "date": "2025-08-20", "po": "PO1", "state": "quarantine", "units": 26 }, "GI-1-3": { "date": "2025-08-25", "po": "PO1", "state": "accepted", "units": 26 }, "GI-2-0": { "date": "2025-08-22", "po": "PO2", "state": "accepted", "units": 17 }, "GI-2-1": { "date": "2025-07-31", "po": "PO2", "state": "accepted", "units": 13 }, "GI-2-2": { "date": "2025-08-27", "po": "PO2", "state": "accepted", "units": 22 }, "GI-2-3": { "date": "2025-08-19", "po": "PO2", "state": "quarantine", "units": 26 }, "GI-3-0": { "date": "2025-08-22", "po": "PO3", "state": "accepted", "units": 21 }, "GI-3-1": { "date": "2025-08-19", "po": "PO3", "state": "accepted", "units": 22 }, "GI-3-2": { "date": "2025-08-27", "po": "PO3", "state": "accepted", "units": 16 }, "GI-3-3": { "date": "2025-08-14", "po": "PO3", "state": "accepted", "units": 13 }, "GI-4-0": { "date": "2025-08-22", "po": "PO4", "state": "accepted", "units": 22 }, "GI-4-1": { "date": "2025-08-15", "po": "PO4", "state": "quarantine", "units": 15 }, "GI-4-2": { "date": "2025-07-31", "po": "PO4", "state": "accepted", "units": 28 }, "GI-4-3": { "date": "2025-08-09", "po": "PO4", "state": "quarantine", "units": 18 }, "GI-5-0": { "date": "2025-08-22", "po": "PO5", "state": "accepted", "units": 13 }, "GI-5-1": { "date": "2025-08-21", "po": "PO5", "state": "accepted", "units": 25 }, "GI-5-2": { "date": "2025-08-07", "po": "PO5", "state": "quarantine", "units": 13 }, "GI-5-3": { "date": "2025-08-18", "po": "PO5", "state": "accepted", "units": 22 }, "GI-6-0": { "date": "2025-08-22", "po": "PO6", "state": "accepted", "units": 16 }, "GI-6-1": { "date": "2025-08-17", "po": "PO6", "state": "accepted", "units": 14 }, "GI-6-2": { "date": "2025-08-17", "po": "PO6", "state": "accepted", "units": 15 }, "GI-6-3": { "date": "2025-08-19", "po": "PO6", "state": "quarantine", "units": 20 } }, "invoice_inbox": { "IV-2613-5-2": { "date": "2025-08-22", "po": "PO5", "state": "review", "unit_price_cents": 12821, "units": 18, "vendor": "V4" }, "IV-3037-6-1": { "date": "2025-08-15", "po": "PO6", "state": "void", "unit_price_cents": 22140, "units": 25, "vendor": "V0" }, "IV-3482-1-1": { "date": "2025-08-23", "po": "PO1", "state": "review", "unit_price_cents": 19000, "units": 13, "vendor": "Unknown" }, "IV-4155-4-1": { "date": "2025-08-03", "po": "PO4", "state": "void", "unit_price_cents": 8752, "units": 13, "vendor": "V2" }, "IV-4801-3-1": { "date": "2025-08-04", "po": "PO3", "state": "review", "unit_price_cents": 14648, "units": 10, "vendor": "V3" }, "IV-4811-2-1": { "date": "2025-08-16", "po": "PO2", "state": "review", "unit_price_cents": 4453, "units": 25, "vendor": "Unknown" }, "IV-5537-5-0": { "date": "2025-08-09", "po": "PO5", "state": "review", "unit_price_cents": 13177, "units": 19, "vendor": "V4" }, "IV-6510-3-2": { "date": "2025-08-09", "po": "PO3", "state": "review", "unit_price_cents": 13059, "units": 3, "vendor": "V3" }, "IV-6764-0-1": { "date": "2025-08-15", "po": "PO0", "state": "review", "unit_price_cents": 4492, "units": 9, "vendor": "V0" }, "IV-6912-6-2": { "date": "2025-08-12", "po": "PO6", "state": "review", "unit_price_cents": 23343, "units": 19, "vendor": "V0" }, "IV-7893-4-2": { "date": "2025-08-20", "po": "PO4", "state": "review", "unit_price_cents": 9742, "units": 11, "vendor": "V2" }, "IV-7924-5-1": { "date": "2025-08-09", "po": "PO5", "state": "review", "unit_price_cents": 15219, "units": 13, "vendor": "V4" }, "IV-8036-3-0": { "date": "2025-08-09", "po": "PO3", "state": "review", "unit_price_cents": 13187, "units": 5, "vendor": "V3" }, "IV-8332-6-3": { "date": "2025-08-22", "po": "PO6", "state": "review", "unit_price_cents": 23448, "units": 5, "vendor": "V0" }, "IV-8473-0-0": { "date": "2025-08-09", "po": "PO0", "state": "review", "unit_price_cents": 4672, "units": 1, "vendor": "V0" }, "IV-8711-4-0": { "date": "2025-08-09", "po": "PO4", "state": "review", "unit_price_cents": 8944, "units": 17, "vendor": "V2" }, "IV-9039-1-0": { "date": "2025-08-09", "po": "PO1", "state": "review", "unit_price_cents": 18388, "units": 16, "vendor": "V0" }, "IV-9189-6-0": { "date": "2025-08-09", "po": "PO6", "state": "review", "unit_price_cents": 21322, "units": 17, "vendor": "V0" }, "IV-9422-2-0": { "date": "2025-08-09", "po": "PO2", "state": "review", "unit_price_cents": 3223, "units": 3, "vendor": "V1" } }, "purchase_orders": { "PO0": { "unit": "North", "unit_price_cents": 4672, "vendor": "V0" }, "PO1": { "unit": "North", "unit_price_cents": 18388, "vendor": "V0" }, "PO2": { "unit": "North", "unit_price_cents": 3223, "vendor": "V1" }, "PO3": { "unit": "North", "unit_price_cents": 13187, "vendor": "V3" }, "PO4": { "unit": "North", "unit_price_cents": 8944, "vendor": "V2" }, "PO5": { "unit": "North", "unit_price_cents": 13177, "vendor": "V4" }, "PO6": { "unit": "Other", "unit_price_cents": 21322, "vendor": "V0" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" } }, "vendors": { "V0": { "net_days": 30 }, "V1": { "net_days": 15 }, "V2": { "net_days": 21 }, "V3": { "net_days": 45 }, "V4": { "net_days": 15 } }}1234567891011121314151617181920212223242526"""Replay submitted mutations from the private verifier's initial state."""from types import ModuleTypeimport json
def check(spec, outputs, tests): replay = ModuleType('workflow_replay') exec(compile((tests/'replay.py').read_bytes(), 'replay.py', 'exec'), replay.__dict__) world = json.loads((tests/'world.json').read_text()) target = json.loads((tests/'target.json').read_text()) # Only fields whose starting and expected values differ may be changed. Attempts # to temporarily alter a protected field fail even when a later write restores it. allowed = { (app,key): {field for field,value in doc.items() if field not in world[app].get(key,{}) or not replay.same(world[app][key][field],value)} for app,records in target.items() for key,doc in records.items() } actions = replay.load_actions(outputs/'actions.jsonl') for event in actions: replay.apply(world,event) touched = set(event['fields']) if not touched <= allowed.get((event['app'],event['id']),set()): return False,'protected field or record write' if not replay.same(world,target): return False,'required business outcomes incomplete' return True,''12345678910111213141516171819202122232425262728{ "profile": "harbor-semantic-v1", "reward_key": "reward", "reward": { "range": [ 0, 1 ], "oracle_tolerance": 0, "floor_margin": 0.1 }, "resources": { "cpu": 1, "memory_mb": 4096, "disk_mb": 10240, "episode_timeout_s": 1800 }, "types": { "tags": [ "knowledge-work", "cross-app-workflows", "conditional-execution", "protected-state", "finance" ] }, "requires_credentials": false}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768"""Offline business-app client. Print usage with --help."""import argparseimport copyimport fcntlimport jsonimport osfrom pathlib import Path
def same(left, right): return json.dumps(left, sort_keys=True, allow_nan=False) == json.dumps(right, sort_keys=True, allow_nan=False)
def apply(world, action): if not isinstance(action, dict) or action.keys() != {'op', 'app', 'id', 'fields'}: raise ValueError('expected op, app, id, fields') op, app, key, fields = (action[k] for k in ('op', 'app', 'id', 'fields')) if app not in world or not isinstance(key, str) or not key or not isinstance(fields, dict) or not fields: raise ValueError('unknown app, invalid id or empty fields') collection = world[app] if op == 'update' and key in collection: collection[key].update(copy.deepcopy(fields)) elif op == 'create' and key not in collection: collection[key] = copy.deepcopy(fields) else: raise ValueError(f'invalid {op} for {app}/{key}')
def load_actions(path): if path.is_symlink() or (path.is_file() and path.stat().st_size > 2_000_000): raise ValueError('invalid action log') if not path.exists(): return [] return [json.loads(s) for s in path.read_text().splitlines() if s.strip()]
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('op', choices=('apps','list','get','update','create')) parser.add_argument('app', nargs='?') parser.add_argument('id', nargs='?') parser.add_argument('fields', nargs='?', type=json.loads) args = parser.parse_args() world = json.loads(Path(__file__).with_name('world.json').read_text()) out = Path(os.environ.get('WORKFLOW_OUTPUT_DIR', '/workspace/outputs')) out.mkdir(parents=True, exist_ok=True) log = out/'actions.jsonl' with (out/'.actions.lock').open('a') as lock: fcntl.flock(lock.fileno(), fcntl.LOCK_EX) for event in load_actions(log): apply(world,event) if args.op=='apps': value=sorted(world) elif args.op=='list': value=world[args.app] elif args.op=='get': value=world[args.app][args.id] else: event={'op':args.op, 'app':args.app, 'id':args.id, 'fields':args.fields} apply(world,event) with log.open('a') as handle: handle.write(json.dumps(event,allow_nan=False)+'\n') value=world[args.app][args.id] print(json.dumps(value,sort_keys=True,allow_nan=False))
if __name__=='__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446{ "ap_postings": { "booked-PO0": { "po": "PO0", "status": "posted", "units": 2 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 6 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 4 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 1 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 7 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 2 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 4 } }, "goods_receipts": { "GI-0-0": { "date": "2025-09-14", "po": "PO0", "state": "accepted", "units": 26 }, "GI-0-1": { "date": "2025-09-12", "po": "PO0", "state": "quarantine", "units": 13 }, "GI-0-2": { "date": "2025-09-09", "po": "PO0", "state": "accepted", "units": 15 }, "GI-0-3": { "date": "2025-09-10", "po": "PO0", "state": "accepted", "units": 18 }, "GI-1-0": { "date": "2025-09-14", "po": "PO1", "state": "accepted", "units": 17 }, "GI-1-1": { "date": "2025-09-07", "po": "PO1", "state": "accepted", "units": 24 }, "GI-1-2": { "date": "2025-09-08", "po": "PO1", "state": "accepted", "units": 16 }, "GI-1-3": { "date": "2025-09-02", "po": "PO1", "state": "accepted", "units": 25 }, "GI-2-0": { "date": "2025-09-14", "po": "PO2", "state": "accepted", "units": 19 }, "GI-2-1": { "date": "2025-09-09", "po": "PO2", "state": "accepted", "units": 14 }, "GI-2-2": { "date": "2025-08-22", "po": "PO2", "state": "accepted", "units": 17 }, "GI-2-3": { "date": "2025-09-16", "po": "PO2", "state": "quarantine", "units": 25 }, "GI-3-0": { "date": "2025-09-14", "po": "PO3", "state": "accepted", "units": 28 }, "GI-3-1": { "date": "2025-09-16", "po": "PO3", "state": "accepted", "units": 20 }, "GI-3-2": { "date": "2025-09-10", "po": "PO3", "state": "quarantine", "units": 14 }, "GI-3-3": { "date": "2025-09-08", "po": "PO3", "state": "quarantine", "units": 12 }, "GI-4-0": { "date": "2025-09-14", "po": "PO4", "state": "accepted", "units": 22 }, "GI-4-1": { "date": "2025-09-09", "po": "PO4", "state": "accepted", "units": 13 }, "GI-4-2": { "date": "2025-09-20", "po": "PO4", "state": "accepted", "units": 22 }, "GI-4-3": { "date": "2025-08-27", "po": "PO4", "state": "quarantine", "units": 24 }, "GI-5-0": { "date": "2025-09-14", "po": "PO5", "state": "accepted", "units": 22 }, "GI-5-1": { "date": "2025-09-10", "po": "PO5", "state": "quarantine", "units": 15 }, "GI-5-2": { "date": "2025-08-26", "po": "PO5", "state": "accepted", "units": 27 }, "GI-5-3": { "date": "2025-09-13", "po": "PO5", "state": "quarantine", "units": 22 }, "GI-6-0": { "date": "2025-09-14", "po": "PO6", "state": "accepted", "units": 15 }, "GI-6-1": { "date": "2025-09-05", "po": "PO6", "state": "accepted", "units": 27 }, "GI-6-2": { "date": "2025-09-04", "po": "PO6", "state": "accepted", "units": 15 }, "GI-6-3": { "date": "2025-08-22", "po": "PO6", "state": "quarantine", "units": 26 } }, "invoice_inbox": { "IV-1121-4-0": { "date": "2025-09-01", "po": "PO4", "state": "review", "unit_price_cents": 17924, "units": 13, "vendor": "V1" }, "IV-1208-6-0": { "date": "2025-09-01", "po": "PO6", "state": "review", "unit_price_cents": 8042, "units": 3, "vendor": "V0" }, "IV-1673-5-0": { "date": "2025-09-01", "po": "PO5", "state": "review", "unit_price_cents": 1621, "units": 22, "vendor": "V2" }, "IV-1942-2-3": { "date": "2025-08-26", "po": "PO2", "state": "review", "unit_price_cents": 10900, "units": 25, "vendor": "V2" }, "IV-1960-5-1": { "date": "2025-09-10", "po": "PO5", "state": "void", "unit_price_cents": 1254, "units": 22, "vendor": "V2" }, "IV-2764-4-1": { "date": "2025-09-06", "po": "PO4", "state": "review", "unit_price_cents": 19899, "units": 12, "vendor": "Unknown" }, "IV-2815-2-1": { "date": "2025-08-27", "po": "PO2", "state": "review", "unit_price_cents": 11257, "units": 17, "vendor": "Unknown" }, "IV-3112-5-2": { "date": "2025-08-28", "po": "PO5", "state": "review", "unit_price_cents": 3159, "units": 9, "vendor": "V2" }, "IV-3145-6-3": { "date": "2025-08-30", "po": "PO6", "state": "void", "unit_price_cents": 8002, "units": 19, "vendor": "V0" }, "IV-3547-1-1": { "date": "2025-09-05", "po": "PO1", "state": "review", "unit_price_cents": 12078, "units": 17, "vendor": "V0" }, "IV-3914-6-2": { "date": "2025-09-07", "po": "PO6", "state": "void", "unit_price_cents": 8669, "units": 12, "vendor": "Unknown" }, "IV-4018-5-3": { "date": "2025-09-13", "po": "PO5", "state": "void", "unit_price_cents": 2185, "units": 18, "vendor": "V2" }, "IV-4805-2-0": { "date": "2025-09-01", "po": "PO2", "state": "review", "unit_price_cents": 9571, "units": 10, "vendor": "V2" }, "IV-5145-6-1": { "date": "2025-09-02", "po": "PO6", "state": "review", "unit_price_cents": 10087, "units": 12, "vendor": "V0" }, "IV-5313-3-0": { "date": "2025-09-01", "po": "PO3", "state": "review", "unit_price_cents": 9903, "units": 4, "vendor": "V4" }, "IV-5395-0-1": { "date": "2025-08-28", "po": "PO0", "state": "review", "unit_price_cents": 11242, "units": 18, "vendor": "V1" }, "IV-5915-0-2": { "date": "2025-08-29", "po": "PO0", "state": "void", "unit_price_cents": 10505, "units": 11, "vendor": "V1" }, "IV-6603-1-0": { "date": "2025-09-01", "po": "PO1", "state": "review", "unit_price_cents": 12252, "units": 5, "vendor": "V0" }, "IV-7380-2-2": { "date": "2025-08-29", "po": "PO2", "state": "review", "unit_price_cents": 9671, "units": 6, "vendor": "V2" }, "IV-7506-1-2": { "date": "2025-09-08", "po": "PO1", "state": "review", "unit_price_cents": 13175, "units": 14, "vendor": "V0" }, "IV-8304-3-1": { "date": "2025-09-06", "po": "PO3", "state": "review", "unit_price_cents": 9567, "units": 20, "vendor": "V4" }, "IV-9162-0-0": { "date": "2025-09-01", "po": "PO0", "state": "review", "unit_price_cents": 9684, "units": 1, "vendor": "V1" } }, "purchase_orders": { "PO0": { "unit": "South", "unit_price_cents": 9684, "vendor": "V1" }, "PO1": { "unit": "South", "unit_price_cents": 12252, "vendor": "V0" }, "PO2": { "unit": "South", "unit_price_cents": 9571, "vendor": "V2" }, "PO3": { "unit": "South", "unit_price_cents": 9903, "vendor": "V4" }, "PO4": { "unit": "South", "unit_price_cents": 17924, "vendor": "V1" }, "PO5": { "unit": "South", "unit_price_cents": 1621, "vendor": "V2" }, "PO6": { "unit": "Other", "unit_price_cents": 8042, "vendor": "V0" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" } }, "vendors": { "V0": { "net_days": 45 }, "V1": { "net_days": 15 }, "V2": { "net_days": 15 }, "V3": { "net_days": 30 }, "V4": { "net_days": 30 } }}1234567891011121314151617Close the invoice matching queue for purchasing unit South at 2025-09-15. Handle invoices in review attached to that unit's purchase orders, invoice dates 2025-09-01 through 2025-09-15 inclusive. Process by invoice date ascending, then invoice ID ascending. Available units per PO equal units on accepted goods receipts dated on or before cutoff, minus previously posted units and any units successfully matched earlier in this run.
Match the invoice vendor exactly against the purchase order. A unit price above PO price is acceptable only up to 500 basis points above PO price (10,000 basis points = 100%; compare exactly, before rounding). Lower prices are acceptable. The invoice quantity must fit the available units in full. If any tests fail, update the invoice state to `disputed`, consume zero units, and create supplier_cases record `case-<invoice ID>` with `invoice`, `po` and the list `issues` containing every failing check in vendor, price, units order; use those lowercase strings.
For a match update invoice state to `posted` and create ap_postings record `book-<invoice ID>` with `invoice`, `po`, `units`, `status=posted`, integer `amount_cents` equal to invoiced quantity times invoiced unit price, and ISO date `due`. Count the vendor's net_days calendar days from the invoice date, then roll Saturday or Sunday forward to Monday. Preserve all other fields and records.
Use the offline app client at `/workspace/inputs/apps.py`. Call it with python3. Run`apps` to discover apps, `list APP` to see its records, or `get APP ID` for one record.Write with `update APP ID '{"field":"value"}'` or `create APP ID '{"field":"value"}'`.The client records successful writes in `/workspace/outputs/actions.jsonl`.Apply exactly the required changes. Other records and fields must remain untouched,including temporary changes. Actions take effect in the local simulation only.
## Deliverable
Work in `/workspace`. Input files are under `/workspace/inputs/`. Put every deliverable in`/workspace/outputs/`; only that directory is graded. Leave the app action log in the outputs directory.1234567891011121314151617181920{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-9162-0-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-6603-1-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-3547-1-1", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-7506-1-2", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-4805-2-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-5313-3-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-8304-3-1", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-1121-4-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-2764-4-1", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-1673-5-0", "op": "update"}{"app": "ap_postings", "fields": {"amount_cents": 233012, "due": "2025-09-16", "invoice": "IV-1121-4-0", "po": "PO4", "status": "posted", "units": 13}, "id": "book-IV-1121-4-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 35662, "due": "2025-09-16", "invoice": "IV-1673-5-0", "po": "PO5", "status": "posted", "units": 22}, "id": "book-IV-1673-5-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 95710, "due": "2025-09-16", "invoice": "IV-4805-2-0", "po": "PO2", "status": "posted", "units": 10}, "id": "book-IV-4805-2-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 39612, "due": "2025-10-01", "invoice": "IV-5313-3-0", "po": "PO3", "status": "posted", "units": 4}, "id": "book-IV-5313-3-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 61260, "due": "2025-10-16", "invoice": "IV-6603-1-0", "po": "PO1", "status": "posted", "units": 5}, "id": "book-IV-6603-1-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 9684, "due": "2025-09-16", "invoice": "IV-9162-0-0", "po": "PO0", "status": "posted", "units": 1}, "id": "book-IV-9162-0-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 205326, "due": "2025-10-20", "invoice": "IV-3547-1-1", "po": "PO1", "status": "posted", "units": 17}, "id": "book-IV-3547-1-1", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 191340, "due": "2025-10-06", "invoice": "IV-8304-3-1", "po": "PO3", "status": "posted", "units": 20}, "id": "book-IV-8304-3-1", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-2764-4-1", "issues": ["vendor", "price"], "po": "PO4"}, "id": "case-IV-2764-4-1", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-7506-1-2", "issues": ["price"], "po": "PO1"}, "id": "case-IV-7506-1-2", "op": "create"}1234#!/bin/shset -eumkdir -p /workspace/outputscp -R /solution/files/. /workspace/outputs/12345678910111213141516171819202122232425262728293031323334353637383940414243444546schema_version = "1.3"
[task]name = "apex-gap/autom-supplier-invoice-match-010"
[metadata.apex_gap]capability_tags = ["cross-app-workflows", "conditional-execution", "protected-state", "finance"]dataset = "Original simulated workflows"job = "finance"seed = 10source = "local/original-automation-workflows"source_revision = "1"source_split = "synthetic"source_task_id = "autom-supplier-invoice-match-010"template_family = "automation:supplier-invoice-match"workflow_template = "supplier-invoice-match"
[metadata.openenv_hf_sandbox]variant = "apex-gap-hfsandbox-v1"task_modified_for_hf_sandbox = truenetwork_enabled = true
[environment]docker_image = "ghcr.io/younesbelkada/apex@sha256:24969c952247033023872f87161a16e067003469506be63783bbaa5d96926bdf"workdir = "/workspace"cpus = 1memory_mb = 4096build_timeout_sec = 600network_mode = "public"
[agent]timeout_sec = 1800network_mode = "public"
[verifier]timeout_sec = 600network_mode = "public"environment_mode = "separate"
[verifier.environment]network_mode = "public"cpus = 1memory_mb = 4096
[[artifacts]]source = "/workspace/outputs"123456789{ "checks": [ { "id": "business-outcomes", "type": "custom", "module": "world_check" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330"""Deterministic grader shared by converted knowledge-work tasks.
Runs inside the separate verifier sandbox. Reads /tests/expected.json, inspects thesubmitted /workspace/outputs tree and writes a binary reward plus per-check details.No model calls and no network.
expected.json: {"checks": [{"id": ..., "type": ..., ...}, ...]}Check types: answer field of outputs/answer.json; kind = number|text|choice|date|bool|list xlsx_range recalculated outputs/<file> vs tests/<target> over sheet!range (SpreadsheetBench rules) xlsx_cell recalculated outputs/<file> sheet!cell vs value with tolerance (optional alt_values) file_contains outputs/<file> text (docx/pdf/ics/eml/txt) must contain every needle custom tests/<module>.py defines check(spec, outputs_dir, tests_dir) -> (bool, str)"""
import datetime as dtimport jsonimport reimport shutilimport subprocessimport sysimport tempfileimport unicodedatafrom pathlib import Path
OUT = Path("/workspace/outputs")TESTS = Path("/tests")LOGS = Path("/logs/verifier")
def norm_text(v): v = unicodedata.normalize("NFKC", str(v)).casefold() v = re.sub(r"[‘’“”]", "'", v) v = re.sub(r"[^\w%.$/-]+", " ", v) return " ".join(v.split()).strip(" .")
def to_number(v): if isinstance(v, bool): raise ValueError("bool") if isinstance(v, (int, float)): return float(v) s = str(v).strip().replace(",", "").replace("$", "").replace("−", "-") neg = s.startswith("(") and s.endswith(")") s = s.strip("()").strip() pct = s.endswith("%") s = s.rstrip("%").strip() s = re.sub(r"\s*(usd|dollars|million|billion|thousand|m|bn|k)$", "", s, flags=re.I) x = float(s) x = -x if neg else x return x / 100 if pct else x
def number_ok(got, want, rel, abs_): try: g = to_number(got) except (TypeError, ValueError): return False w = float(want) tol = max(abs_, rel * abs(w)) # "12.5%" may mean the ratio 0.125 or the percent number 12.5; the gold fixes which. candidates = [g, g * 100] if isinstance(got, str) and got.strip().endswith("%") else [g] return any(abs(c - w) <= tol for c in candidates)
def parse_date(v): if isinstance(v, (dt.date, dt.datetime)): return v if isinstance(v, dt.date) else v.date() s = str(v).strip() for fmt in ("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y", "%d %B %Y", "%B %d, %Y", "%b %d, %Y", "%Y/%m/%d"): try: return dt.datetime.strptime(s, fmt).date() except ValueError: continue raise ValueError(s)
def check_answer(check, answers): key = check["field"] if key not in answers: return False, f"missing field {key!r}" got, want, kind = answers[key], check["value"], check.get("kind", "text") if kind == "number": ok = number_ok(got, want, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01)) if not ok and check.get("percent_either"): ok = number_ok(got, want * 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) * 100) or ( number_ok(got, want / 100, check.get("rel_tol", 0.005), check.get("abs_tol", 0.01) / 100) ) elif kind == "date": try: ok = parse_date(got) == parse_date(want) except ValueError: ok = False elif kind == "bool": g = norm_text(got) ok = g in {"yes", "true"} if want else g in {"no", "false"} elif kind == "choice": ok = norm_text(got) == norm_text(want) elif kind == "list": if not isinstance(got, list): return False, f"{key}: expected a JSON list" # Filenames may be given with a directory prefix; compare base names. base = lambda x: norm_text(str(x).replace("\\", "/").rsplit("/", 1)[-1]) ok = sorted(base(x) for x in got) == sorted(base(x) for x in want) else: accepted = check.get("accept", [want]) ok = norm_text(got) in {norm_text(a) for a in accepted} return ok, "" if ok else f"{key}: got {got!r}"
# LibreOffice keeps cached formula values on load unless told otherwise; force a full recalculation.RECALC_PROFILE = """<?xml version="1.0" encoding="UTF-8"?><oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"><item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="OOXMLRecalcMode" oor:op="fuse"><value>0</value></prop></item><item oor:path="/org.openoffice.Office.Calc/Formula/Load"><prop oor:name="ODFRecalcMode" oor:op="fuse"><value>0</value></prop></item></oor:items>"""
def recalc(path, tmp): dest = Path(tmp) / f"recalc-{len(list(Path(tmp).glob('recalc-*')))}" dest.mkdir() profile = Path(tmp) / "lo-profile" if not profile.exists(): (profile / "user").mkdir(parents=True) (profile / "user" / "registrymodifications.xcu").write_text(RECALC_PROFILE) subprocess.run( ["soffice", f"-env:UserInstallation=file://{profile}", "--headless", "--calc", "--convert-to", "xlsx:Calc MS Excel 2007 XML", "--outdir", str(dest), str(path)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=180, check=False, ) out = dest / (Path(path).stem + ".xlsx") return out if out.exists() else Path(path)
def cell_value(v): if isinstance(v, (int, float)) and not isinstance(v, bool): return round(float(v), 2) if isinstance(v, dt.datetime): return round((v - dt.datetime(1899, 12, 30)).total_seconds() / 86400.0, 0) if isinstance(v, dt.time): return v.strftime("%H:%M") if isinstance(v, str): try: return round(float(v), 2) except ValueError: return v.strip() return v
def time_of(v): """A time or a day fraction in [0, 1) as HH:MM, rounded to the nearest second first. Calc and Excel store a time as that fraction; openpyxl returns a time only for time-formatted cells.""" if isinstance(v, dt.time): v = (v.hour * 3600 + v.minute * 60 + v.second + v.microsecond / 1e6) / 86400 if isinstance(v, (int, float)) and not isinstance(v, bool) and 0 <= v < 1: return (dt.datetime(1899, 12, 30) + dt.timedelta(seconds=round(v * 86400))).strftime("%H:%M") return None
def same_cell(a, b): if isinstance(a, dt.time) is not isinstance(b, dt.time): n = b if isinstance(a, dt.time) else a if time_of(n) is not None: # a time against a plain day fraction return time_of(a) == time_of(b) a, b = cell_value(a), cell_value(b) if a in (None, "") and b in (None, ""): return True return type(a) is type(b) and a == b
ERRORS = {"#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"}
def is_error(v): return isinstance(v, str) and (v in ERRORS or v.startswith("Err:"))
def cells(rng): if ":" not in rng: return [rng] from openpyxl.utils import range_boundaries, get_column_letter
c1, r1, c2, r2 = range_boundaries(rng) return [f"{get_column_letter(c)}{r}" for r in range(r1, r2 + 1) for c in range(c1, c2 + 1)]
def load(path, tmp): import openpyxl
return openpyxl.load_workbook(recalc(path, tmp), data_only=True)
def check_xlsx_range(check, tmp, cache): sub = OUT / check["file"] if not sub.is_file(): return False, f"missing output {check['file']}" if sub not in cache: cache[sub] = load(sub, tmp) tgt = TESTS / check["target"] if tgt not in cache: cache[tgt] = load(tgt, tmp) got, want = cache[sub], cache[tgt] cached = None # the target's stored (Excel-computed) values, read only when Calc errs for sheet, rng in check["ranges"]: sheet = sheet or want.sheetnames[0] if sheet not in got.sheetnames: return False, f"sheet {sheet!r} missing" for name in cells(rng): w = want[sheet][name].value if is_error(w): # LibreOffice could not evaluate the gold formula (e.g. XLOOKUP, FILTER in Calc 7.4). # The value Excel stored is the intended answer. if cached is None: import openpyxl
cached = openpyxl.load_workbook(tgt, data_only=True) c = cached[sheet][name].value if sheet in cached.sheetnames else None if c is not None and not is_error(c): w = c if not same_cell(w, got[sheet][name].value): return False, f"{sheet}!{name}: want {w!r} got {got[sheet][name].value!r}" return True, ""
def check_xlsx_cell(check, tmp, cache): sub = OUT / check["file"] if not sub.is_file(): return False, f"missing output {check['file']}" if sub not in cache: cache[sub] = load(sub, tmp) wb = cache[sub] if check["sheet"] not in wb.sheetnames: return False, f"sheet {check['sheet']!r} missing" got = wb[check["sheet"]][check["cell"]].value want = check["value"] if isinstance(want, (int, float)): # alt_values: other accepted golds where the source admits more than one reading. ok = got is not None and any(number_ok(got, w, check.get("rel_tol", 0.0), check.get("abs_tol", 0.01)) for w in [want, *check.get("alt_values", [])]) else: ok = norm_text(got) == norm_text(want) return ok, "" if ok else f"{check['sheet']}!{check['cell']}: want {want!r} got {got!r}"
def text_of(path): suffix = path.suffix.lower() if suffix == ".docx": import docx
d = docx.Document(path) parts = [p.text for p in d.paragraphs] for t in d.tables: parts += [c.text for row in t.rows for c in row.cells] return "\n".join(parts) if suffix == ".pdf": import pdfplumber
with pdfplumber.open(path) as pdf: return "\n".join(page.extract_text() or "" for page in pdf.pages) return path.read_text(errors="replace")
def check_file_contains(check, tmp, cache): sub = OUT / check["file"] if not sub.is_file(): return False, f"missing output {check['file']}" text = text_of(sub) hay = text if check.get("case_sensitive") else text.casefold() for needle in check["needles"]: n = needle if check.get("case_sensitive") else needle.casefold() if n not in hay: return False, f"{check['file']} lacks {needle!r}" return True, ""
def main(): LOGS.mkdir(parents=True, exist_ok=True) reward_path = LOGS / "reward.txt" reward_path.write_text("0\n") spec = json.loads((TESTS / "expected.json").read_text()) answers, details = {}, [] answer_file = OUT / "answer.json" if answer_file.is_file(): try: answers = json.loads(answer_file.read_text()) if not isinstance(answers, dict): answers = {} except json.JSONDecodeError: answers = {} tmp = tempfile.mkdtemp() cache = {} try: for check in spec["checks"]: try: if check["type"] == "answer": ok, why = check_answer(check, answers) elif check["type"] == "xlsx_range": ok, why = check_xlsx_range(check, tmp, cache) elif check["type"] == "xlsx_cell": ok, why = check_xlsx_cell(check, tmp, cache) elif check["type"] == "file_contains": ok, why = check_file_contains(check, tmp, cache) elif check["type"] == "custom": import importlib.util
spec_ = importlib.util.spec_from_file_location("custom_check", TESTS / f"{check['module']}.py") mod = importlib.util.module_from_spec(spec_) spec_.loader.exec_module(mod) ok, why = mod.check(check, OUT, TESTS) else: ok, why = False, f"unknown check type {check['type']}" except Exception as exc: # a malformed submission fails the check, not the grader ok, why = False, f"{type(exc).__name__}: {exc}" details.append({"id": check["id"], "passed": ok, "detail": why}) finally: shutil.rmtree(tmp, ignore_errors=True) passed = sum(d["passed"] for d in details) total = len(details) reward = 1 if total and passed == total else 0 (LOGS / "details.json").write_text(json.dumps({"passed": passed, "total": total, "checks": details}, indent=1)) reward_path.write_text(f"{reward}\n") print(f"{passed}/{total} checks passed; reward {reward}")
if __name__ == "__main__": sys.exit(main())1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768"""Offline business-app client. Print usage with --help."""import argparseimport copyimport fcntlimport jsonimport osfrom pathlib import Path
def same(left, right): return json.dumps(left, sort_keys=True, allow_nan=False) == json.dumps(right, sort_keys=True, allow_nan=False)
def apply(world, action): if not isinstance(action, dict) or action.keys() != {'op', 'app', 'id', 'fields'}: raise ValueError('expected op, app, id, fields') op, app, key, fields = (action[k] for k in ('op', 'app', 'id', 'fields')) if app not in world or not isinstance(key, str) or not key or not isinstance(fields, dict) or not fields: raise ValueError('unknown app, invalid id or empty fields') collection = world[app] if op == 'update' and key in collection: collection[key].update(copy.deepcopy(fields)) elif op == 'create' and key not in collection: collection[key] = copy.deepcopy(fields) else: raise ValueError(f'invalid {op} for {app}/{key}')
def load_actions(path): if path.is_symlink() or (path.is_file() and path.stat().st_size > 2_000_000): raise ValueError('invalid action log') if not path.exists(): return [] return [json.loads(s) for s in path.read_text().splitlines() if s.strip()]
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('op', choices=('apps','list','get','update','create')) parser.add_argument('app', nargs='?') parser.add_argument('id', nargs='?') parser.add_argument('fields', nargs='?', type=json.loads) args = parser.parse_args() world = json.loads(Path(__file__).with_name('world.json').read_text()) out = Path(os.environ.get('WORKFLOW_OUTPUT_DIR', '/workspace/outputs')) out.mkdir(parents=True, exist_ok=True) log = out/'actions.jsonl' with (out/'.actions.lock').open('a') as lock: fcntl.flock(lock.fileno(), fcntl.LOCK_EX) for event in load_actions(log): apply(world,event) if args.op=='apps': value=sorted(world) elif args.op=='list': value=world[args.app] elif args.op=='get': value=world[args.app][args.id] else: event={'op':args.op, 'app':args.app, 'id':args.id, 'fields':args.fields} apply(world,event) with log.open('a') as handle: handle.write(json.dumps(event,allow_nan=False)+'\n') value=world[args.app][args.id] print(json.dumps(value,sort_keys=True,allow_nan=False))
if __name__=='__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525{ "ap_postings": { "book-IV-1121-4-0": { "amount_cents": 233012, "due": "2025-09-16", "invoice": "IV-1121-4-0", "po": "PO4", "status": "posted", "units": 13 }, "book-IV-1673-5-0": { "amount_cents": 35662, "due": "2025-09-16", "invoice": "IV-1673-5-0", "po": "PO5", "status": "posted", "units": 22 }, "book-IV-3547-1-1": { "amount_cents": 205326, "due": "2025-10-20", "invoice": "IV-3547-1-1", "po": "PO1", "status": "posted", "units": 17 }, "book-IV-4805-2-0": { "amount_cents": 95710, "due": "2025-09-16", "invoice": "IV-4805-2-0", "po": "PO2", "status": "posted", "units": 10 }, "book-IV-5313-3-0": { "amount_cents": 39612, "due": "2025-10-01", "invoice": "IV-5313-3-0", "po": "PO3", "status": "posted", "units": 4 }, "book-IV-6603-1-0": { "amount_cents": 61260, "due": "2025-10-16", "invoice": "IV-6603-1-0", "po": "PO1", "status": "posted", "units": 5 }, "book-IV-8304-3-1": { "amount_cents": 191340, "due": "2025-10-06", "invoice": "IV-8304-3-1", "po": "PO3", "status": "posted", "units": 20 }, "book-IV-9162-0-0": { "amount_cents": 9684, "due": "2025-09-16", "invoice": "IV-9162-0-0", "po": "PO0", "status": "posted", "units": 1 }, "booked-PO0": { "po": "PO0", "status": "posted", "units": 2 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 6 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 4 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 1 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 7 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 2 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 4 } }, "goods_receipts": { "GI-0-0": { "date": "2025-09-14", "po": "PO0", "state": "accepted", "units": 26 }, "GI-0-1": { "date": "2025-09-12", "po": "PO0", "state": "quarantine", "units": 13 }, "GI-0-2": { "date": "2025-09-09", "po": "PO0", "state": "accepted", "units": 15 }, "GI-0-3": { "date": "2025-09-10", "po": "PO0", "state": "accepted", "units": 18 }, "GI-1-0": { "date": "2025-09-14", "po": "PO1", "state": "accepted", "units": 17 }, "GI-1-1": { "date": "2025-09-07", "po": "PO1", "state": "accepted", "units": 24 }, "GI-1-2": { "date": "2025-09-08", "po": "PO1", "state": "accepted", "units": 16 }, "GI-1-3": { "date": "2025-09-02", "po": "PO1", "state": "accepted", "units": 25 }, "GI-2-0": { "date": "2025-09-14", "po": "PO2", "state": "accepted", "units": 19 }, "GI-2-1": { "date": "2025-09-09", "po": "PO2", "state": "accepted", "units": 14 }, "GI-2-2": { "date": "2025-08-22", "po": "PO2", "state": "accepted", "units": 17 }, "GI-2-3": { "date": "2025-09-16", "po": "PO2", "state": "quarantine", "units": 25 }, "GI-3-0": { "date": "2025-09-14", "po": "PO3", "state": "accepted", "units": 28 }, "GI-3-1": { "date": "2025-09-16", "po": "PO3", "state": "accepted", "units": 20 }, "GI-3-2": { "date": "2025-09-10", "po": "PO3", "state": "quarantine", "units": 14 }, "GI-3-3": { "date": "2025-09-08", "po": "PO3", "state": "quarantine", "units": 12 }, "GI-4-0": { "date": "2025-09-14", "po": "PO4", "state": "accepted", "units": 22 }, "GI-4-1": { "date": "2025-09-09", "po": "PO4", "state": "accepted", "units": 13 }, "GI-4-2": { "date": "2025-09-20", "po": "PO4", "state": "accepted", "units": 22 }, "GI-4-3": { "date": "2025-08-27", "po": "PO4", "state": "quarantine", "units": 24 }, "GI-5-0": { "date": "2025-09-14", "po": "PO5", "state": "accepted", "units": 22 }, "GI-5-1": { "date": "2025-09-10", "po": "PO5", "state": "quarantine", "units": 15 }, "GI-5-2": { "date": "2025-08-26", "po": "PO5", "state": "accepted", "units": 27 }, "GI-5-3": { "date": "2025-09-13", "po": "PO5", "state": "quarantine", "units": 22 }, "GI-6-0": { "date": "2025-09-14", "po": "PO6", "state": "accepted", "units": 15 }, "GI-6-1": { "date": "2025-09-05", "po": "PO6", "state": "accepted", "units": 27 }, "GI-6-2": { "date": "2025-09-04", "po": "PO6", "state": "accepted", "units": 15 }, "GI-6-3": { "date": "2025-08-22", "po": "PO6", "state": "quarantine", "units": 26 } }, "invoice_inbox": { "IV-1121-4-0": { "date": "2025-09-01", "po": "PO4", "state": "posted", "unit_price_cents": 17924, "units": 13, "vendor": "V1" }, "IV-1208-6-0": { "date": "2025-09-01", "po": "PO6", "state": "review", "unit_price_cents": 8042, "units": 3, "vendor": "V0" }, "IV-1673-5-0": { "date": "2025-09-01", "po": "PO5", "state": "posted", "unit_price_cents": 1621, "units": 22, "vendor": "V2" }, "IV-1942-2-3": { "date": "2025-08-26", "po": "PO2", "state": "review", "unit_price_cents": 10900, "units": 25, "vendor": "V2" }, "IV-1960-5-1": { "date": "2025-09-10", "po": "PO5", "state": "void", "unit_price_cents": 1254, "units": 22, "vendor": "V2" }, "IV-2764-4-1": { "date": "2025-09-06", "po": "PO4", "state": "disputed", "unit_price_cents": 19899, "units": 12, "vendor": "Unknown" }, "IV-2815-2-1": { "date": "2025-08-27", "po": "PO2", "state": "review", "unit_price_cents": 11257, "units": 17, "vendor": "Unknown" }, "IV-3112-5-2": { "date": "2025-08-28", "po": "PO5", "state": "review", "unit_price_cents": 3159, "units": 9, "vendor": "V2" }, "IV-3145-6-3": { "date": "2025-08-30", "po": "PO6", "state": "void", "unit_price_cents": 8002, "units": 19, "vendor": "V0" }, "IV-3547-1-1": { "date": "2025-09-05", "po": "PO1", "state": "posted", "unit_price_cents": 12078, "units": 17, "vendor": "V0" }, "IV-3914-6-2": { "date": "2025-09-07", "po": "PO6", "state": "void", "unit_price_cents": 8669, "units": 12, "vendor": "Unknown" }, "IV-4018-5-3": { "date": "2025-09-13", "po": "PO5", "state": "void", "unit_price_cents": 2185, "units": 18, "vendor": "V2" }, "IV-4805-2-0": { "date": "2025-09-01", "po": "PO2", "state": "posted", "unit_price_cents": 9571, "units": 10, "vendor": "V2" }, "IV-5145-6-1": { "date": "2025-09-02", "po": "PO6", "state": "review", "unit_price_cents": 10087, "units": 12, "vendor": "V0" }, "IV-5313-3-0": { "date": "2025-09-01", "po": "PO3", "state": "posted", "unit_price_cents": 9903, "units": 4, "vendor": "V4" }, "IV-5395-0-1": { "date": "2025-08-28", "po": "PO0", "state": "review", "unit_price_cents": 11242, "units": 18, "vendor": "V1" }, "IV-5915-0-2": { "date": "2025-08-29", "po": "PO0", "state": "void", "unit_price_cents": 10505, "units": 11, "vendor": "V1" }, "IV-6603-1-0": { "date": "2025-09-01", "po": "PO1", "state": "posted", "unit_price_cents": 12252, "units": 5, "vendor": "V0" }, "IV-7380-2-2": { "date": "2025-08-29", "po": "PO2", "state": "review", "unit_price_cents": 9671, "units": 6, "vendor": "V2" }, "IV-7506-1-2": { "date": "2025-09-08", "po": "PO1", "state": "disputed", "unit_price_cents": 13175, "units": 14, "vendor": "V0" }, "IV-8304-3-1": { "date": "2025-09-06", "po": "PO3", "state": "posted", "unit_price_cents": 9567, "units": 20, "vendor": "V4" }, "IV-9162-0-0": { "date": "2025-09-01", "po": "PO0", "state": "posted", "unit_price_cents": 9684, "units": 1, "vendor": "V1" } }, "purchase_orders": { "PO0": { "unit": "South", "unit_price_cents": 9684, "vendor": "V1" }, "PO1": { "unit": "South", "unit_price_cents": 12252, "vendor": "V0" }, "PO2": { "unit": "South", "unit_price_cents": 9571, "vendor": "V2" }, "PO3": { "unit": "South", "unit_price_cents": 9903, "vendor": "V4" }, "PO4": { "unit": "South", "unit_price_cents": 17924, "vendor": "V1" }, "PO5": { "unit": "South", "unit_price_cents": 1621, "vendor": "V2" }, "PO6": { "unit": "Other", "unit_price_cents": 8042, "vendor": "V0" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" }, "case-IV-2764-4-1": { "invoice": "IV-2764-4-1", "issues": [ "vendor", "price" ], "po": "PO4" }, "case-IV-7506-1-2": { "invoice": "IV-7506-1-2", "issues": [ "price" ], "po": "PO1" } }, "vendors": { "V0": { "net_days": 45 }, "V1": { "net_days": 15 }, "V2": { "net_days": 15 }, "V3": { "net_days": 30 }, "V4": { "net_days": 30 } }}1234#!/bin/shset -eumkdir -p /logs/verifier /workspace/outputsexec python3 -B -I /tests/grade.py123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446{ "ap_postings": { "booked-PO0": { "po": "PO0", "status": "posted", "units": 2 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 6 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 4 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 1 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 7 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 2 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 4 } }, "goods_receipts": { "GI-0-0": { "date": "2025-09-14", "po": "PO0", "state": "accepted", "units": 26 }, "GI-0-1": { "date": "2025-09-12", "po": "PO0", "state": "quarantine", "units": 13 }, "GI-0-2": { "date": "2025-09-09", "po": "PO0", "state": "accepted", "units": 15 }, "GI-0-3": { "date": "2025-09-10", "po": "PO0", "state": "accepted", "units": 18 }, "GI-1-0": { "date": "2025-09-14", "po": "PO1", "state": "accepted", "units": 17 }, "GI-1-1": { "date": "2025-09-07", "po": "PO1", "state": "accepted", "units": 24 }, "GI-1-2": { "date": "2025-09-08", "po": "PO1", "state": "accepted", "units": 16 }, "GI-1-3": { "date": "2025-09-02", "po": "PO1", "state": "accepted", "units": 25 }, "GI-2-0": { "date": "2025-09-14", "po": "PO2", "state": "accepted", "units": 19 }, "GI-2-1": { "date": "2025-09-09", "po": "PO2", "state": "accepted", "units": 14 }, "GI-2-2": { "date": "2025-08-22", "po": "PO2", "state": "accepted", "units": 17 }, "GI-2-3": { "date": "2025-09-16", "po": "PO2", "state": "quarantine", "units": 25 }, "GI-3-0": { "date": "2025-09-14", "po": "PO3", "state": "accepted", "units": 28 }, "GI-3-1": { "date": "2025-09-16", "po": "PO3", "state": "accepted", "units": 20 }, "GI-3-2": { "date": "2025-09-10", "po": "PO3", "state": "quarantine", "units": 14 }, "GI-3-3": { "date": "2025-09-08", "po": "PO3", "state": "quarantine", "units": 12 }, "GI-4-0": { "date": "2025-09-14", "po": "PO4", "state": "accepted", "units": 22 }, "GI-4-1": { "date": "2025-09-09", "po": "PO4", "state": "accepted", "units": 13 }, "GI-4-2": { "date": "2025-09-20", "po": "PO4", "state": "accepted", "units": 22 }, "GI-4-3": { "date": "2025-08-27", "po": "PO4", "state": "quarantine", "units": 24 }, "GI-5-0": { "date": "2025-09-14", "po": "PO5", "state": "accepted", "units": 22 }, "GI-5-1": { "date": "2025-09-10", "po": "PO5", "state": "quarantine", "units": 15 }, "GI-5-2": { "date": "2025-08-26", "po": "PO5", "state": "accepted", "units": 27 }, "GI-5-3": { "date": "2025-09-13", "po": "PO5", "state": "quarantine", "units": 22 }, "GI-6-0": { "date": "2025-09-14", "po": "PO6", "state": "accepted", "units": 15 }, "GI-6-1": { "date": "2025-09-05", "po": "PO6", "state": "accepted", "units": 27 }, "GI-6-2": { "date": "2025-09-04", "po": "PO6", "state": "accepted", "units": 15 }, "GI-6-3": { "date": "2025-08-22", "po": "PO6", "state": "quarantine", "units": 26 } }, "invoice_inbox": { "IV-1121-4-0": { "date": "2025-09-01", "po": "PO4", "state": "review", "unit_price_cents": 17924, "units": 13, "vendor": "V1" }, "IV-1208-6-0": { "date": "2025-09-01", "po": "PO6", "state": "review", "unit_price_cents": 8042, "units": 3, "vendor": "V0" }, "IV-1673-5-0": { "date": "2025-09-01", "po": "PO5", "state": "review", "unit_price_cents": 1621, "units": 22, "vendor": "V2" }, "IV-1942-2-3": { "date": "2025-08-26", "po": "PO2", "state": "review", "unit_price_cents": 10900, "units": 25, "vendor": "V2" }, "IV-1960-5-1": { "date": "2025-09-10", "po": "PO5", "state": "void", "unit_price_cents": 1254, "units": 22, "vendor": "V2" }, "IV-2764-4-1": { "date": "2025-09-06", "po": "PO4", "state": "review", "unit_price_cents": 19899, "units": 12, "vendor": "Unknown" }, "IV-2815-2-1": { "date": "2025-08-27", "po": "PO2", "state": "review", "unit_price_cents": 11257, "units": 17, "vendor": "Unknown" }, "IV-3112-5-2": { "date": "2025-08-28", "po": "PO5", "state": "review", "unit_price_cents": 3159, "units": 9, "vendor": "V2" }, "IV-3145-6-3": { "date": "2025-08-30", "po": "PO6", "state": "void", "unit_price_cents": 8002, "units": 19, "vendor": "V0" }, "IV-3547-1-1": { "date": "2025-09-05", "po": "PO1", "state": "review", "unit_price_cents": 12078, "units": 17, "vendor": "V0" }, "IV-3914-6-2": { "date": "2025-09-07", "po": "PO6", "state": "void", "unit_price_cents": 8669, "units": 12, "vendor": "Unknown" }, "IV-4018-5-3": { "date": "2025-09-13", "po": "PO5", "state": "void", "unit_price_cents": 2185, "units": 18, "vendor": "V2" }, "IV-4805-2-0": { "date": "2025-09-01", "po": "PO2", "state": "review", "unit_price_cents": 9571, "units": 10, "vendor": "V2" }, "IV-5145-6-1": { "date": "2025-09-02", "po": "PO6", "state": "review", "unit_price_cents": 10087, "units": 12, "vendor": "V0" }, "IV-5313-3-0": { "date": "2025-09-01", "po": "PO3", "state": "review", "unit_price_cents": 9903, "units": 4, "vendor": "V4" }, "IV-5395-0-1": { "date": "2025-08-28", "po": "PO0", "state": "review", "unit_price_cents": 11242, "units": 18, "vendor": "V1" }, "IV-5915-0-2": { "date": "2025-08-29", "po": "PO0", "state": "void", "unit_price_cents": 10505, "units": 11, "vendor": "V1" }, "IV-6603-1-0": { "date": "2025-09-01", "po": "PO1", "state": "review", "unit_price_cents": 12252, "units": 5, "vendor": "V0" }, "IV-7380-2-2": { "date": "2025-08-29", "po": "PO2", "state": "review", "unit_price_cents": 9671, "units": 6, "vendor": "V2" }, "IV-7506-1-2": { "date": "2025-09-08", "po": "PO1", "state": "review", "unit_price_cents": 13175, "units": 14, "vendor": "V0" }, "IV-8304-3-1": { "date": "2025-09-06", "po": "PO3", "state": "review", "unit_price_cents": 9567, "units": 20, "vendor": "V4" }, "IV-9162-0-0": { "date": "2025-09-01", "po": "PO0", "state": "review", "unit_price_cents": 9684, "units": 1, "vendor": "V1" } }, "purchase_orders": { "PO0": { "unit": "South", "unit_price_cents": 9684, "vendor": "V1" }, "PO1": { "unit": "South", "unit_price_cents": 12252, "vendor": "V0" }, "PO2": { "unit": "South", "unit_price_cents": 9571, "vendor": "V2" }, "PO3": { "unit": "South", "unit_price_cents": 9903, "vendor": "V4" }, "PO4": { "unit": "South", "unit_price_cents": 17924, "vendor": "V1" }, "PO5": { "unit": "South", "unit_price_cents": 1621, "vendor": "V2" }, "PO6": { "unit": "Other", "unit_price_cents": 8042, "vendor": "V0" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" } }, "vendors": { "V0": { "net_days": 45 }, "V1": { "net_days": 15 }, "V2": { "net_days": 15 }, "V3": { "net_days": 30 }, "V4": { "net_days": 30 } }}1234567891011121314151617181920212223242526"""Replay submitted mutations from the private verifier's initial state."""from types import ModuleTypeimport json
def check(spec, outputs, tests): replay = ModuleType('workflow_replay') exec(compile((tests/'replay.py').read_bytes(), 'replay.py', 'exec'), replay.__dict__) world = json.loads((tests/'world.json').read_text()) target = json.loads((tests/'target.json').read_text()) # Only fields whose starting and expected values differ may be changed. Attempts # to temporarily alter a protected field fail even when a later write restores it. allowed = { (app,key): {field for field,value in doc.items() if field not in world[app].get(key,{}) or not replay.same(world[app][key][field],value)} for app,records in target.items() for key,doc in records.items() } actions = replay.load_actions(outputs/'actions.jsonl') for event in actions: replay.apply(world,event) touched = set(event['fields']) if not touched <= allowed.get((event['app'],event['id']),set()): return False,'protected field or record write' if not replay.same(world,target): return False,'required business outcomes incomplete' return True,''12345678910111213141516171819202122232425262728{ "profile": "harbor-semantic-v1", "reward_key": "reward", "reward": { "range": [ 0, 1 ], "oracle_tolerance": 0, "floor_margin": 0.1 }, "resources": { "cpu": 1, "memory_mb": 4096, "disk_mb": 10240, "episode_timeout_s": 1800 }, "types": { "tags": [ "knowledge-work", "cross-app-workflows", "conditional-execution", "protected-state", "finance" ] }, "requires_credentials": false}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768"""Offline business-app client. Print usage with --help."""import argparseimport copyimport fcntlimport jsonimport osfrom pathlib import Path
def same(left, right): return json.dumps(left, sort_keys=True, allow_nan=False) == json.dumps(right, sort_keys=True, allow_nan=False)
def apply(world, action): if not isinstance(action, dict) or action.keys() != {'op', 'app', 'id', 'fields'}: raise ValueError('expected op, app, id, fields') op, app, key, fields = (action[k] for k in ('op', 'app', 'id', 'fields')) if app not in world or not isinstance(key, str) or not key or not isinstance(fields, dict) or not fields: raise ValueError('unknown app, invalid id or empty fields') collection = world[app] if op == 'update' and key in collection: collection[key].update(copy.deepcopy(fields)) elif op == 'create' and key not in collection: collection[key] = copy.deepcopy(fields) else: raise ValueError(f'invalid {op} for {app}/{key}')
def load_actions(path): if path.is_symlink() or (path.is_file() and path.stat().st_size > 2_000_000): raise ValueError('invalid action log') if not path.exists(): return [] return [json.loads(s) for s in path.read_text().splitlines() if s.strip()]
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('op', choices=('apps','list','get','update','create')) parser.add_argument('app', nargs='?') parser.add_argument('id', nargs='?') parser.add_argument('fields', nargs='?', type=json.loads) args = parser.parse_args() world = json.loads(Path(__file__).with_name('world.json').read_text()) out = Path(os.environ.get('WORKFLOW_OUTPUT_DIR', '/workspace/outputs')) out.mkdir(parents=True, exist_ok=True) log = out/'actions.jsonl' with (out/'.actions.lock').open('a') as lock: fcntl.flock(lock.fileno(), fcntl.LOCK_EX) for event in load_actions(log): apply(world,event) if args.op=='apps': value=sorted(world) elif args.op=='list': value=world[args.app] elif args.op=='get': value=world[args.app][args.id] else: event={'op':args.op, 'app':args.app, 'id':args.id, 'fields':args.fields} apply(world,event) with log.open('a') as handle: handle.write(json.dumps(event,allow_nan=False)+'\n') value=world[args.app][args.id] print(json.dumps(value,sort_keys=True,allow_nan=False))
if __name__=='__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398{ "ap_postings": { "booked-PO0": { "po": "PO0", "status": "posted", "units": 4 }, "booked-PO1": { "po": "PO1", "status": "posted", "units": 5 }, "booked-PO2": { "po": "PO2", "status": "posted", "units": 8 }, "booked-PO3": { "po": "PO3", "status": "posted", "units": 8 }, "booked-PO4": { "po": "PO4", "status": "posted", "units": 7 }, "booked-PO5": { "po": "PO5", "status": "posted", "units": 4 }, "booked-PO6": { "po": "PO6", "status": "posted", "units": 1 } }, "goods_receipts": { "GI-0-0": { "date": "2025-10-07", "po": "PO0", "state": "accepted", "units": 20 }, "GI-0-1": { "date": "2025-09-19", "po": "PO0", "state": "accepted", "units": 16 }, "GI-0-2": { "date": "2025-09-17", "po": "PO0", "state": "accepted", "units": 26 }, "GI-0-3": { "date": "2025-09-16", "po": "PO0", "state": "quarantine", "units": 13 }, "GI-1-0": { "date": "2025-10-07", "po": "PO1", "state": "accepted", "units": 14 }, "GI-1-1": { "date": "2025-10-03", "po": "PO1", "state": "quarantine", "units": 14 }, "GI-1-2": { "date": "2025-09-30", "po": "PO1", "state": "quarantine", "units": 17 }, "GI-1-3": { "date": "2025-10-03", "po": "PO1", "state": "quarantine", "units": 20 }, "GI-2-0": { "date": "2025-10-07", "po": "PO2", "state": "accepted", "units": 24 }, "GI-2-1": { "date": "2025-09-27", "po": "PO2", "state": "quarantine", "units": 21 }, "GI-2-2": { "date": "2025-10-12", "po": "PO2", "state": "quarantine", "units": 28 }, "GI-2-3": { "date": "2025-09-22", "po": "PO2", "state": "accepted", "units": 23 }, "GI-3-0": { "date": "2025-10-07", "po": "PO3", "state": "accepted", "units": 16 }, "GI-3-1": { "date": "2025-10-05", "po": "PO3", "state": "quarantine", "units": 21 }, "GI-3-2": { "date": "2025-10-06", "po": "PO3", "state": "accepted", "units": 19 }, "GI-3-3": { "date": "2025-09-28", "po": "PO3", "state": "quarantine", "units": 14 }, "GI-4-0": { "date": "2025-10-07", "po": "PO4", "state": "accepted", "units": 28 }, "GI-4-1": { "date": "2025-09-23", "po": "PO4", "state": "accepted", "units": 13 }, "GI-4-2": { "date": "2025-10-06", "po": "PO4", "state": "quarantine", "units": 23 }, "GI-4-3": { "date": "2025-10-12", "po": "PO4", "state": "accepted", "units": 13 }, "GI-5-0": { "date": "2025-10-07", "po": "PO5", "state": "accepted", "units": 22 }, "GI-5-1": { "date": "2025-10-05", "po": "PO5", "state": "quarantine", "units": 22 }, "GI-5-2": { "date": "2025-09-23", "po": "PO5", "state": "accepted", "units": 23 }, "GI-5-3": { "date": "2025-10-10", "po": "PO5", "state": "quarantine", "units": 17 }, "GI-6-0": { "date": "2025-10-07", "po": "PO6", "state": "accepted", "units": 14 }, "GI-6-1": { "date": "2025-10-01", "po": "PO6", "state": "accepted", "units": 13 }, "GI-6-2": { "date": "2025-10-08", "po": "PO6", "state": "accepted", "units": 12 }, "GI-6-3": { "date": "2025-09-14", "po": "PO6", "state": "quarantine", "units": 22 } }, "invoice_inbox": { "IV-1334-4-0": { "date": "2025-09-24", "po": "PO4", "state": "review", "unit_price_cents": 14638, "units": 9, "vendor": "V1" }, "IV-2153-1-0": { "date": "2025-09-24", "po": "PO1", "state": "review", "unit_price_cents": 20655, "units": 8, "vendor": "V4" }, "IV-2781-0-1": { "date": "2025-10-05", "po": "PO0", "state": "void", "unit_price_cents": 5848, "units": 18, "vendor": "V4" }, "IV-2933-0-2": { "date": "2025-09-25", "po": "PO0", "state": "review", "unit_price_cents": 7430, "units": 5, "vendor": "V4" }, "IV-3552-0-0": { "date": "2025-09-24", "po": "PO0", "state": "review", "unit_price_cents": 5813, "units": 1, "vendor": "V4" }, "IV-3593-6-2": { "date": "2025-09-18", "po": "PO6", "state": "review", "unit_price_cents": 11607, "units": 15, "vendor": "V1" }, "IV-3774-6-1": { "date": "2025-10-01", "po": "PO6", "state": "review", "unit_price_cents": 10525, "units": 7, "vendor": "V1" }, "IV-4767-2-0": { "date": "2025-09-24", "po": "PO2", "state": "review", "unit_price_cents": 17886, "units": 17, "vendor": "V2" }, "IV-5330-5-1": { "date": "2025-09-27", "po": "PO5", "state": "review", "unit_price_cents": 22682, "units": 4, "vendor": "V2" }, "IV-5377-4-1": { "date": "2025-10-04", "po": "PO4", "state": "review", "unit_price_cents": 16044, "units": 12, "vendor": "Unknown" }, "IV-5439-3-1": { "date": "2025-10-09", "po": "PO3", "state": "review", "unit_price_cents": 23248, "units": 19, "vendor": "V3" }, "IV-5831-3-0": { "date": "2025-09-24", "po": "PO3", "state": "review", "unit_price_cents": 22729, "units": 21, "vendor": "V3" }, "IV-7311-5-0": { "date": "2025-09-24", "po": "PO5", "state": "review", "unit_price_cents": 22413, "units": 10, "vendor": "V2" }, "IV-7466-2-1": { "date": "2025-09-28", "po": "PO2", "state": "void", "unit_price_cents": 17667, "units": 9, "vendor": "V2" }, "IV-7884-1-1": { "date": "2025-09-18", "po": "PO1", "state": "review", "unit_price_cents": 21929, "units": 6, "vendor": "V4" }, "IV-8927-6-0": { "date": "2025-09-24", "po": "PO6", "state": "review", "unit_price_cents": 10535, "units": 7, "vendor": "V1" } }, "purchase_orders": { "PO0": { "unit": "West", "unit_price_cents": 5813, "vendor": "V4" }, "PO1": { "unit": "West", "unit_price_cents": 20655, "vendor": "V4" }, "PO2": { "unit": "West", "unit_price_cents": 17886, "vendor": "V2" }, "PO3": { "unit": "West", "unit_price_cents": 22729, "vendor": "V3" }, "PO4": { "unit": "West", "unit_price_cents": 14638, "vendor": "V1" }, "PO5": { "unit": "West", "unit_price_cents": 22413, "vendor": "V2" }, "PO6": { "unit": "Other", "unit_price_cents": 10535, "vendor": "V1" } }, "supplier_cases": { "PREEXISTING": { "status": "investigating" } }, "vendors": { "V0": { "net_days": 15 }, "V1": { "net_days": 15 }, "V2": { "net_days": 30 }, "V3": { "net_days": 45 }, "V4": { "net_days": 30 } }}1234567891011121314151617Close the invoice matching queue for purchasing unit West at 2025-10-08. Handle invoices in review attached to that unit's purchase orders, invoice dates 2025-09-24 through 2025-10-08 inclusive. Process by invoice date ascending, then invoice ID ascending. Available units per PO equal units on accepted goods receipts dated on or before cutoff, minus previously posted units and any units successfully matched earlier in this run.
Match the invoice vendor exactly against the purchase order. A unit price above PO price is acceptable only up to 200 basis points above PO price (10,000 basis points = 100%; compare exactly, before rounding). Lower prices are acceptable. The invoice quantity must fit the available units in full. If any tests fail, update the invoice state to `disputed`, consume zero units, and create supplier_cases record `case-<invoice ID>` with `invoice`, `po` and the list `issues` containing every failing check in vendor, price, units order; use those lowercase strings.
For a match update invoice state to `posted` and create ap_postings record `book-<invoice ID>` with `invoice`, `po`, `units`, `status=posted`, integer `amount_cents` equal to invoiced quantity times invoiced unit price, and ISO date `due`. Count the vendor's net_days calendar days from the invoice date, then roll Saturday or Sunday forward to Monday. Preserve all other fields and records.
Use the offline app client at `/workspace/inputs/apps.py`. Call it with python3. Run`apps` to discover apps, `list APP` to see its records, or `get APP ID` for one record.Write with `update APP ID '{"field":"value"}'` or `create APP ID '{"field":"value"}'`.The client records successful writes in `/workspace/outputs/actions.jsonl`.Apply exactly the required changes. Other records and fields must remain untouched,including temporary changes. Actions take effect in the local simulation only.
## Deliverable
Work in `/workspace`. Input files are under `/workspace/inputs/`. Put every deliverable in`/workspace/outputs/`; only that directory is graded. Leave the app action log in the outputs directory.123456789101112131415161718{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-3552-0-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-2933-0-2", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-2153-1-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-4767-2-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-5831-3-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-1334-4-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "disputed"}, "id": "IV-5377-4-1", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-7311-5-0", "op": "update"}{"app": "invoice_inbox", "fields": {"state": "posted"}, "id": "IV-5330-5-1", "op": "update"}{"app": "ap_postings", "fields": {"amount_cents": 131742, "due": "2025-10-09", "invoice": "IV-1334-4-0", "po": "PO4", "status": "posted", "units": 9}, "id": "book-IV-1334-4-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 165240, "due": "2025-10-24", "invoice": "IV-2153-1-0", "po": "PO1", "status": "posted", "units": 8}, "id": "book-IV-2153-1-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 5813, "due": "2025-10-24", "invoice": "IV-3552-0-0", "po": "PO0", "status": "posted", "units": 1}, "id": "book-IV-3552-0-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 304062, "due": "2025-10-24", "invoice": "IV-4767-2-0", "po": "PO2", "status": "posted", "units": 17}, "id": "book-IV-4767-2-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 477309, "due": "2025-11-10", "invoice": "IV-5831-3-0", "po": "PO3", "status": "posted", "units": 21}, "id": "book-IV-5831-3-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 224130, "due": "2025-10-24", "invoice": "IV-7311-5-0", "po": "PO5", "status": "posted", "units": 10}, "id": "book-IV-7311-5-0", "op": "create"}{"app": "ap_postings", "fields": {"amount_cents": 90728, "due": "2025-10-27", "invoice": "IV-5330-5-1", "po": "PO5", "status": "posted", "units": 4}, "id": "book-IV-5330-5-1", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-2933-0-2", "issues": ["price"], "po": "PO0"}, "id": "case-IV-2933-0-2", "op": "create"}{"app": "supplier_cases", "fields": {"invoice": "IV-5377-4-1", "issues": ["vendor", "price"], "po": "PO4"}, "id": "case-IV-5377-4-1", "op": "create"}tasks/autom-supplier-invoice-match-007/tests/test.shAdded+4
tasks/autom-supplier-invoice-match-007/tests/world.jsonAdded+446
tasks/autom-supplier-invoice-match-007/tests/world_check.pyAdded+26
tasks/autom-supplier-invoice-match-007/validation/openenv.jsonAdded+28
tasks/autom-supplier-invoice-match-008/environment/inputs/apps.pyAdded+68
tasks/autom-supplier-invoice-match-008/environment/inputs/world.jsonAdded+430
tasks/autom-supplier-invoice-match-008/instruction.mdAdded+17
tasks/autom-supplier-invoice-match-008/solution/files/actions.jsonlAdded+28
tasks/autom-supplier-invoice-match-008/solution/solve.shAdded+4
tasks/autom-supplier-invoice-match-008/task.tomlAdded+46
tasks/autom-supplier-invoice-match-008/tests/expected.jsonAdded+9
tasks/autom-supplier-invoice-match-008/tests/grade.pyAdded+330
tasks/autom-supplier-invoice-match-008/tests/replay.pyAdded+68
tasks/autom-supplier-invoice-match-008/tests/target.jsonAdded+538
tasks/autom-supplier-invoice-match-008/tests/test.shAdded+4
tasks/autom-supplier-invoice-match-008/tests/world.jsonAdded+430
tasks/autom-supplier-invoice-match-008/tests/world_check.pyAdded+26
tasks/autom-supplier-invoice-match-008/validation/openenv.jsonAdded+28
tasks/autom-supplier-invoice-match-009/environment/inputs/apps.pyAdded+68
tasks/autom-supplier-invoice-match-009/environment/inputs/world.jsonAdded+422
tasks/autom-supplier-invoice-match-009/instruction.mdAdded+17
tasks/autom-supplier-invoice-match-009/solution/files/actions.jsonlAdded+26
tasks/autom-supplier-invoice-match-009/solution/solve.shAdded+4
tasks/autom-supplier-invoice-match-009/task.tomlAdded+46
tasks/autom-supplier-invoice-match-009/tests/expected.jsonAdded+9
tasks/autom-supplier-invoice-match-009/tests/grade.pyAdded+330
tasks/autom-supplier-invoice-match-009/tests/replay.pyAdded+68
tasks/autom-supplier-invoice-match-009/tests/target.jsonAdded+526
tasks/autom-supplier-invoice-match-009/tests/test.shAdded+4
tasks/autom-supplier-invoice-match-009/tests/world.jsonAdded+422
tasks/autom-supplier-invoice-match-009/tests/world_check.pyAdded+26
tasks/autom-supplier-invoice-match-009/validation/openenv.jsonAdded+28
tasks/autom-supplier-invoice-match-010/environment/inputs/apps.pyAdded+68
tasks/autom-supplier-invoice-match-010/environment/inputs/world.jsonAdded+446
tasks/autom-supplier-invoice-match-010/instruction.mdAdded+17
tasks/autom-supplier-invoice-match-010/solution/files/actions.jsonlAdded+20
tasks/autom-supplier-invoice-match-010/solution/solve.shAdded+4
tasks/autom-supplier-invoice-match-010/task.tomlAdded+46
tasks/autom-supplier-invoice-match-010/tests/expected.jsonAdded+9
tasks/autom-supplier-invoice-match-010/tests/grade.pyAdded+330
tasks/autom-supplier-invoice-match-010/tests/replay.pyAdded+68
tasks/autom-supplier-invoice-match-010/tests/target.jsonAdded+525
tasks/autom-supplier-invoice-match-010/tests/test.shAdded+4
tasks/autom-supplier-invoice-match-010/tests/world.jsonAdded+446
tasks/autom-supplier-invoice-match-010/tests/world_check.pyAdded+26
tasks/autom-supplier-invoice-match-010/validation/openenv.jsonAdded+28
tasks/autom-supplier-invoice-match-011/environment/inputs/apps.pyAdded+68
tasks/autom-supplier-invoice-match-011/environment/inputs/world.jsonAdded+398
tasks/autom-supplier-invoice-match-011/instruction.mdAdded+17
tasks/autom-supplier-invoice-match-011/solution/files/actions.jsonlAdded+18