"""Explicit local-validation scope. This does not authorize human acceptance or deployment.""" from src.modules.skill.domain.models import SkillError, digest class LocalValidation: def __init__(self, runtime, actor, authorization_ref): if not authorization_ref or len(authorization_ref) > 300: raise ValueError('AUTHORIZATION_REFERENCE_REQUIRED') self.runtime, self.actor, self.authorization_ref = runtime, actor, authorization_ref def step(self, run_id): run = self.runtime.get(self.actor, run_id) if (run['release'].get('publication_scope') != 'local-validation-only' or run['release'].get('authorization_ref') != self.authorization_ref): raise SkillError('VALIDATION_SCOPE_REQUIRED', '自动验证只接受本地验证版本。', 403) if run['status'] == 'queued': return self.runtime.advance(self.actor, run_id) if run['status'] == 'repair_required': return self.runtime.repair(self.actor, run_id) if run['status'] == 'waiting_approval' and run['pending_approval']['scope'] in {'design', 'execution'}: pending = run['pending_approval'] return self.runtime.approve(self.actor, run_id, pending['digest'], delegation=self.authorization_ref) return run