gate.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
10 hours ago
| 1 | """Module and hook gates for L2 commands (§K9.2 / §K9.8).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from pathlib import Path |
| 6 | |
| 7 | from adapters.config import HonestyConfig, OverseerConfig |
| 8 | from cli.paths import confine_path |
| 9 | |
| 10 | |
| 11 | ROLES_FILE_V1_WARNING = ( |
| 12 | "honesty.roles_file is set but v1 does not load roster content for enforcement " |
| 13 | "(role gates remain enum-only)" |
| 14 | ) |
| 15 | |
| 16 | |
| 17 | def honesty_module_disabled(config: OverseerConfig) -> bool: |
| 18 | """Return True when the L2 operational gate is off.""" |
| 19 | return not config.honesty.enabled |
| 20 | |
| 21 | |
| 22 | def check_roles_file( |
| 23 | honesty: HonestyConfig, |
| 24 | repo_root: Path, |
| 25 | ) -> tuple[int | None, str | None]: |
| 26 | """Apply roles_file v1 path rule; return (exit_code, warning).""" |
| 27 | if honesty.roles_file is None: |
| 28 | return None, None |
| 29 | try: |
| 30 | roles_path = confine_path(repo_root, honesty.roles_file) |
| 31 | except Exception: |
| 32 | return 4, None |
| 33 | if not roles_path.is_file(): |
| 34 | return 4, None |
| 35 | return None, ROLES_FILE_V1_WARNING |
| 36 | |
| 37 | |
| 38 | def hook_enabled(config: OverseerConfig, hook: str) -> bool: |
| 39 | """Return True when ``hook`` is in the effective require_verdict_on set.""" |
| 40 | return hook in config.honesty.require_verdict_on |
File History
2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
10 hours ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439
feat: K1-P1 complete — agent provenance, build-verification…
Sonnet 4.6
patch
52 days ago