__init__.py python
63 lines 2.3 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 2 days ago
1 """Shared fixtures for Track P / P-cost tests (§PC.9)."""
2
3 from __future__ import annotations
4
5 from pathlib import Path
6
7 import yaml
8
9 from tests.fixtures.model_routing import copy_default_routing_policy, seed_routing_repo
10 from tests.support import FIXTURES, write_config
11
12
13 def seed_cost_awareness_repo(
14 repo_root: Path,
15 *,
16 enabled: bool = True,
17 surfaces: list[str] | None = None,
18 config_name: str = "config-git-only.yaml",
19 ) -> None:
20 """Seed a repo with routing policy and optional cost-awareness config."""
21 seed_routing_repo(repo_root, config_name=config_name)
22 copy_default_routing_policy(repo_root)
23 cfg_path = repo_root / ".overseer" / "config.yaml"
24 data = yaml.safe_load(cfg_path.read_text(encoding="utf-8"))
25 block: dict[str, object] = {"enabled": enabled}
26 if surfaces is not None:
27 block["surfaces"] = surfaces
28 data["cost_awareness"] = block
29 cfg_path.write_text(yaml.safe_dump(data, sort_keys=False), encoding="utf-8")
30
31
32 def seed_cost_e2e_repo(tmp_path: Path) -> None:
33 """Fixture repo with handover/roadmap for active-slice spend-awareness e2e."""
34 write_config(tmp_path, "config-governance-gates.yaml")
35 copy_default_routing_policy(tmp_path)
36 overseer = tmp_path / ".overseer"
37 cfg_path = overseer / "config.yaml"
38 data = yaml.safe_load(cfg_path.read_text(encoding="utf-8"))
39 data["cost_awareness"] = {"enabled": True, "surfaces": ["status", "governance-sync"]}
40 cfg_path.write_text(yaml.safe_dump(data, sort_keys=False), encoding="utf-8")
41 (overseer / "version.lock").write_text(
42 "lock_version: 1\nkit_version: 0.1.0\nconfig_version: 1\n"
43 "footprint_digest: sha256:0\ninstalled_at: '2026-01-01'\n"
44 "synced_at: '2026-01-01'\nfootprint: []\n",
45 encoding="utf-8",
46 )
47 docs = tmp_path / "docs"
48 docs.mkdir(parents=True)
49 (docs / "ROADMAP.md").write_text(
50 (FIXTURES / "cost-awareness-roadmap.md").read_text(encoding="utf-8"),
51 encoding="utf-8",
52 )
53 (docs / "OVERSEER-HANDOVER.md").write_text(
54 (FIXTURES / "cost-awareness-handover.md").read_text(encoding="utf-8"),
55 encoding="utf-8",
56 )
57 (docs / "PHASE-DEMO-THINKING.md").write_text(
58 (FIXTURES / "governance-gates-phase-thinking.md").read_text(encoding="utf-8"),
59 encoding="utf-8",
60 )
61
62
63 COST_FIXTURES = FIXTURES / "cost_awareness"
File History 1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 2 days ago