gate.py python
40 lines 1.2 KB
Raw
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83 chore(governance): sync handover+roadmap to 84db8c8 (drift:… 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 1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199 fix(ISR): default require_independent_second_reviewer to require Human minor 10 hours ago