freedom-intelligence/scripts/test_declaration.py
tegwick 5c5c298643 FI-WP-0005 T01-T03: owner declaration, publication decision, egress hosts.
- Owner declaration for the profiled fi-daily-research-brief (proposed):
  inputs, single-commit briefs/** grant, fast-forward-only publication,
  quality rules, model requirements without env selection, completion
  evidence and rollback pins.
- Decision: origin publication is a typed grant on the run, not an
  executor default.
- docs/sources-egress.yaml: 17 exact host:443 entries for the sandbox,
  tested for sand-boxer format and drift against the prose allowlist.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 51320@bnt-lap001
Assistant-Session: 9d40b4c7-8e3c-42ee-b755-d658d4640d6c
2026-09-22 12:00:59 +02:00

42 lines
1.6 KiB
Python

"""The fi-daily-research-brief owner declaration parses and its references resolve."""
from pathlib import Path
import unittest
import yaml
ROOT = Path(__file__).resolve().parent.parent
DECLARATION = ROOT / 'activity-definitions' / 'fi-daily-research-brief.declaration.yaml'
class DeclarationTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.doc = yaml.safe_load(DECLARATION.read_text(encoding='utf-8'))
def test_referenced_files_exist(self):
inputs = self.doc['inputs']
paths = list(inputs['repository_files'])
paths.append(inputs['network']['egress_hosts'])
paths.append(self.doc['repository_grant']['publication']['decision'])
for rel in paths:
self.assertTrue((ROOT / rel).is_file(), rel)
def test_grant_is_single_commit_within_briefs(self):
grant = self.doc['repository_grant']
self.assertEqual(grant['allowed_paths'], ['briefs/**'])
self.assertEqual(grant['commit_count'], {'min': 1, 'max': 1})
self.assertEqual(grant['publication'],
{'remote': 'origin', 'ref': 'main', 'mode': 'fast-forward-only',
'decision': grant['publication']['decision']})
def test_completion_requires_published_evidence(self):
detail = self.doc['completion']['required_detail']
self.assertIs(detail['pushed'], True)
self.assertIn('origin_sha', detail)
def test_no_environment_model_selection(self):
self.assertNotIn('env', self.doc['model'])
if __name__ == '__main__':
unittest.main()