"""Single released task-stream entry point.""" from copy import deepcopy from rescopebench.case_validation import ReleasedCase from .spec import DATA, DATA_TOOLS, DATA_TASKS, DATA_PROMPT, DATA_SCHEDULE from .runtime import World class Driver(ReleasedCase): case_id = 'event_ticketing' case_version = 'event-catalog-migration-evolution-v4' def __init__(self): self.tools = deepcopy(DATA_TOOLS) self.tasks = deepcopy(DATA_TASKS) self.directory = deepcopy(DATA) self.prompt = deepcopy(DATA_PROMPT) self.lifecycle_schedule = deepcopy(DATA_SCHEDULE) def create_world(self): return World() def begin(self, world, task): receipt = world.activate_task(task['private_task_id']) if receipt.get('task_id') != task['private_task_id']: raise ValueError('boundary receipt belongs to a different task') if receipt.get('after_sha256') != world.business_hash(): raise ValueError('boundary receipt differs from current business state') return {'status': 'success', 'boundary': receipt} def call(self, world, name, arguments): return world.dispatch(name, arguments) def grade(self, world, task): return world.grade(task['private_task_id']) def public_grade(self, grade): return {'score': grade['score'], 'public_components': {f'artifact_{index}': {'correct': int(bool(row['complete'])), 'total': 1} for (index, row) in enumerate(grade['deliverables'], 1)}} def close(self, _world): return None