Skip to content

Commit 676fd93

Browse files
johnteeecursoragent
andcommitted
refactor: fold horizon-4/5 root modules into governance packages (WDF-002)
Move policy, RBAC, routing, scope, release gate, and consensus validation into canonical packages with deprecated import aliases; root count 177. Roadmap-Status: unchanged Constraint: deprecated teaagent.* root imports via MetaPathFinder only Tested: smoke tier 196 passed; test_import_compat_wdf002 Confidence: high Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent cdc2331 commit 676fd93

19 files changed

Lines changed: 144 additions & 29 deletions

docs/adr/0030-root-module-freeze.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ consolidation into `teaagent/governance/`, `teaagent/consensus/`, and
2323
- `scripts/check_root_module_count.py` fails CI when count exceeds baseline.
2424
- New root modules require an ADR exception with explicit justification.
2525

26-
3. **WDF-002 deferred**
27-
- Deprecation re-exports for remaining H4 root modules are a follow-up; this
28-
ADR establishes the freeze without a mass move.
26+
3. **WDF-002 complete (2026-06-10)**
27+
- Folded seven H4/H5 root modules into `teaagent/governance/` and
28+
`teaagent/consensus/`; deprecated import aliases via `_compat_modules.py`.
29+
- Root count at HEAD: **177** (down from 184 baseline).
2930

3031
## Consequences
3132

docs/generated/docs-inventory.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Do not edit this file manually — regenerate instead.
4040
| `adr/0027-context-bus-architecture.md` | 543 | `6fa1d2ced665` |
4141
| `adr/0028-tournament-swarm-architecture.md` | 594 | `ee8dec0fdb60` |
4242
| `adr/0029-consensus-validation-deferred.md` | 1587 | `8a2da40abc07` |
43-
| `adr/0030-root-module-freeze.md` | 1209 | `709d2d3cb33b` |
43+
| `adr/0030-root-module-freeze.md` | 1297 | `bee25422e85f` |
4444
| `adr/README.md` | 6668 | `7b2bbdfbda07` |
4545
| `agent-mode-operator-guide.md` | 2778 | `25b258ab7bfe` |
4646
| `analysis/active-findings-status-ledger-2026-06-06.md` | 4724 | `34c514f544b8` |
@@ -455,7 +455,7 @@ Do not edit this file manually — regenerate instead.
455455
| `plans/ticket-plans/WDG-002-plan.md` | 1712 | `16cb2bb47cbc` |
456456
| `plans/ux-improvement-roadmap-2026-05-31.md` | 15201 | `368416e593d4` |
457457
| `plans/work-direction-decomposition-2026-06-10.md` | 10371 | `cba4dd33a15d` |
458-
| `plans/work-direction-execution-index-2026-06-10.md` | 5539 | `e1849019fc92` |
458+
| `plans/work-direction-execution-index-2026-06-10.md` | 5577 | `7a9c52868019` |
459459
| `plugin-skill-catalog.md` | 4118 | `8d42b8f0c492` |
460460
| `processes/breaking-changes.md` | 820 | `2a43f4d37b6c` |
461461
| `processes/community-presence.md` | 5009 | `f33f69b2e8ff` |

docs/generated/suite-summary.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"tier": "smoke",
3-
"generated_at": "2026-06-10T02:52:26.056736+00:00",
4-
"commit": "ef2560592beb070430389dea8b0bfc53501a7d4a",
3+
"generated_at": "2026-06-10T03:00:06.462543+00:00",
4+
"commit": "cdc23316def191ffe30c42d40a920ddd77fa18c0",
55
"exit_code": 0,
6-
"duration_seconds": 9.66,
7-
"passed": 180,
6+
"duration_seconds": 11.0,
7+
"passed": 196,
88
"failed": 0,
9-
"total": 180
9+
"total": 196
1010
}

docs/plans/work-direction-execution-index-2026-06-10.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ any time after S1 WDA-001 lands (needs honest module labels for concept audit).
7474
| S3b | WDA-005 | **Closed**`governance/update_platform.py` + `prove_update_platform.py` |
7575
| S4 | WDC-001, WDC-002, WDC-003, WDC-004 | **Closed** — stranger baseline, 3-concept path, plain receipts, terminology freeze |
7676
| S5 | WDE-001, WDE-002, WDE-003, WDF-001 | **Closed**`file://` remote backend, Ed25519 signed queue, WS2 gap tests, ADR 0030 |
77-
| S5 defer | WDF-002 | Root-module fold/re-exports (deferred post-freeze) |
77+
| S5 | WDF-002 | **Closed** — H4/H5 folded to `governance/` + `consensus/`; compat aliases (177 root modules) |
7878
| S6 | WDH-001, WDH-003 | **Closed** — survey moratorium; when-not-to-use refresh |
7979
| S6 open | WDH-002 | Protocol ready; external sessions not yet recorded |
8080
| S3 note | WDD-003 | **Closed**[competitor absence note](../analysis/eval-gate-competitor-absence-2026-06-10.md) |

scripts/run_test_tier.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
str(_TESTS / 'test_conversation_ux.py'),
4444
str(_TESTS / 'test_ws2_verification_gaps.py'),
4545
str(_TESTS / 'test_root_module_count.py'),
46+
str(_TESTS / 'test_import_compat_wdf002.py'),
4647
str(_TESTS / 'test_terminology_lint.py'),
4748
str(_TESTS / 'test_suite_summary_freshness.py'),
4849
str(_TESTS / 'regression'),

scripts/validate_wiring.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828

2929
# H4/H5/H6 clusters from ENG-R1 — must be production-wired or explicitly labeled.
3030
WATCH_MODULES: tuple[str, ...] = (
31-
'teaagent.policy_routing',
32-
'teaagent.consensus_validation',
33-
'teaagent.scope_creep',
34-
'teaagent.repo_map_benchmark',
31+
'teaagent.governance.policy_routing',
32+
'teaagent.consensus.consensus_validation',
33+
'teaagent.governance.scope_creep',
34+
'teaagent.governance.repo_map_benchmark',
3535
'teaagent.update',
3636
'teaagent.update.changelog',
3737
'teaagent.update.delta',

teaagent/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
except PackageNotFoundError:
1111
__version__ = '0+local'
1212

13+
from teaagent._compat_modules import install_deprecated_module_aliases
1314
from teaagent._lazy_exports import _EXPORTS, lazy_dir, lazy_getattr
1415

16+
install_deprecated_module_aliases()
17+
1518

1619
def __getattr__(name: str) -> object:
1720
return lazy_getattr(name)

teaagent/_compat_modules.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"""Deprecated root-module import aliases (WDF-002)."""
2+
3+
from __future__ import annotations
4+
5+
import importlib
6+
import importlib.abc
7+
import importlib.util
8+
import sys
9+
from types import ModuleType
10+
11+
_DEPRECATED_ALIASES: dict[str, str] = {
12+
'teaagent.policy_engine': 'teaagent.governance.policy_engine',
13+
'teaagent.rbac': 'teaagent.governance.rbac',
14+
'teaagent.policy_routing': 'teaagent.governance.policy_routing',
15+
'teaagent.scope_creep': 'teaagent.governance.scope_creep',
16+
'teaagent.release_gate': 'teaagent.governance.release_gate',
17+
'teaagent.repo_map_benchmark': 'teaagent.governance.repo_map_benchmark',
18+
'teaagent.consensus_validation': 'teaagent.consensus.consensus_validation',
19+
}
20+
21+
22+
class _DeprecatedModuleLoader(importlib.abc.Loader):
23+
def __init__(self, target: str) -> None:
24+
self._target = target
25+
26+
def create_module(self, spec: importlib.machinery.ModuleSpec) -> ModuleType | None:
27+
del spec
28+
return importlib.import_module(self._target)
29+
30+
def exec_module(self, module: ModuleType) -> None:
31+
del module
32+
33+
34+
class _DeprecatedAliasFinder(importlib.abc.MetaPathFinder):
35+
def find_spec(
36+
self,
37+
fullname: str,
38+
path: object | None,
39+
target: ModuleType | None = None,
40+
) -> importlib.machinery.ModuleSpec | None:
41+
del path, target
42+
target_name = _DEPRECATED_ALIASES.get(fullname)
43+
if target_name is None:
44+
return None
45+
return importlib.util.spec_from_loader(
46+
fullname,
47+
_DeprecatedModuleLoader(target_name),
48+
)
49+
50+
51+
def install_deprecated_module_aliases() -> None:
52+
if any(isinstance(finder, _DeprecatedAliasFinder) for finder in sys.meta_path):
53+
return
54+
sys.meta_path.insert(0, _DeprecatedAliasFinder())

teaagent/consensus_validation.py renamed to teaagent/consensus/consensus_validation.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
from typing import Any, Optional
1616
from uuid import uuid4
1717

18-
from .policy_engine import PolicyEffect, PolicyEngine, PolicyStore, PolicyType
18+
from teaagent.governance.policy_engine import (
19+
PolicyEffect,
20+
PolicyEngine,
21+
PolicyStore,
22+
PolicyType,
23+
)
1924

2025

2126
class ConsensusStatus(str, Enum):

teaagent/governance/h4_integration.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
from pathlib import Path
1313
from typing import Any, Optional
1414

15-
from teaagent.policy_engine import PolicyEffect, PolicyEngine, PolicyStore, PolicyType
15+
from teaagent.governance.policy_engine import (
16+
PolicyEffect,
17+
PolicyEngine,
18+
PolicyStore,
19+
PolicyType,
20+
)
1621

1722

1823
class H4GovernanceMode(str, Enum):
@@ -125,7 +130,7 @@ def check_subagent_launch_rbac(
125130
depth: int,
126131
) -> tuple[bool, str]:
127132
"""RBAC gate for subagent launch. Shadow by default; enforce when configured."""
128-
from teaagent.rbac import Permission, RBACSystem
133+
from teaagent.governance.rbac import Permission, RBACSystem
129134

130135
mode = rbac_governance_mode()
131136
context = {

0 commit comments

Comments
 (0)