Spaces:
Sleeping
Sleeping
Download src/modules/governance/local_validation.py from dellweb3/VibeCoding: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/main/src/modules/governance/local_validation.py
- Command line
-
hf download hf://spaces/dellweb3/VibeCoding/src/modules/governance/local_validation.py
-
curl -L -o local_validation.py https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/main/src/modules/governance/local_validation.py
1.32 kB
| """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 | |