35 lines
2.0 KiB
Python
35 lines
2.0 KiB
Python
"""Central executable policy follows the global exact-candidate gates."""
|
|
from pathlib import Path
|
|
import unittest
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
class GlobalGateAlignment(unittest.TestCase):
|
|
def test_review_before_substantive_push(self):
|
|
gates = (ROOT/'references/task-delivery-gates.md').read_text()
|
|
stage = gates.split('### Stage 3')[1].split('### Stage 4')[0]
|
|
self.assertLess(stage.index('5. Freeze'), stage.index('6. Obtain independent'))
|
|
self.assertLess(stage.index('6. Obtain independent'), stage.index('7. Push only'))
|
|
self.assertIn('before its next substantive push', stage)
|
|
self.assertIn('reviewer must not be the candidate implementer', stage)
|
|
self.assertIn('read-only reviewer', stage)
|
|
self.assertNotIn('push the new PR head, and review', gates)
|
|
self.assertNotIn('No implementation or review subagent', gates)
|
|
def test_any_base_change_invalidates_readiness(self):
|
|
gates = (ROOT/'references/task-delivery-gates.md').read_text()
|
|
self.assertIn('Any target-base SHA change invalidates merge readiness', gates)
|
|
self.assertIn('even when candidate head/tree is unchanged', gates)
|
|
self.assertNotIn('base drift is harmless', gates)
|
|
self.assertNotIn('push/readback, and review', gates)
|
|
def test_kickoff_and_cross_repository_scope(self):
|
|
entry = (ROOT/'references/repository-entry-and-visibility.md').read_text()
|
|
self.assertIn('no file/tree changes', entry)
|
|
self.assertIn('does not authorize a substantive push', entry)
|
|
gates = (ROOT/'references/task-delivery-gates.md').read_text()
|
|
self.assertIn('documentation claims/handoffs and GitOps candidates', gates)
|
|
def test_no_unresolved_policy_marker(self):
|
|
for path in [ROOT/'SKILL.md', *ROOT.glob('references/*.md')]:
|
|
text = path.read_text()
|
|
self.assertNotIn('Bounded unresolved A02/A04', text)
|
|
self.assertNotIn('A02/A04 review-order/base-drift remain bounded unresolved', text)
|
|
if __name__ == '__main__':
|
|
unittest.main()
|