"""Executable consumer declaration contract wiring.""" from harness.tests._support.paths import ROOT as SOURCE_ROOT from pathlib import Path from harness.tests._support.contracts import read_contract import unittest ROOT = SOURCE_ROOT class DelegationAdoptionContractTests(unittest.TestCase): def test_common_runtime_contract_is_explicit(self): text = (ROOT / 'harness/operations/repository-cache.md').read_text() for token in ('require_adoption', 'expected_source', 'expected_stage', '--no-delegated-evidence', '--delegation-adoption', 'spec-review', 'code-review', 'implementation-delivery'): with self.subTest(token=token): self.assertIn(token, text) def test_each_consumer_skill_requires_runtime_declaration(self): paths = ( 'spec/skills/gitea-implementation-spec-review', 'impl/skills/gitea-issue-implementation', 'impl/skills/gitea-issue-rework', 'review/skills/gitea-code-review', ) for path in paths: text = read_contract(ROOT / 'harness/agents' / path / 'SKILL.md') with self.subTest(path=path): self.assertIn('require_adoption', text) self.assertIn('mode', text) self.assertIn('none', text) self.assertIn('delegated', text) self.assertIn('delegation-adoption-runtime-consumption', text) if __name__ == '__main__': unittest.main()