test_gfg_d2_bridge_sections.py file-level

at main · View file ↗ · Intel ↗

History
1 files
1 commits
0 hotspots
0 🧊 dead
0 💥 blast risk
sha256:6 fix(ISR): default require_independent_second_reviewer to require Opera… · aaronrene · Sep 2, 2026
1 """Stress: bridge TOML with large unrelated sections (§D2F.9 stress)."""
2
3 from __future__ import annotations
4
5 from pathlib import Path
6
7 from adapters.base import read_bridge_git_sha, read_bridge_muse_commit_id
8
9
10 def test_bridge_parsers_isolate_last_export_amid_noise(tmp_path: Path) -> None:
11 tip = "sha256:" + ("a" * 64)
12 git_sha = "b" * 40
13 noise = "\n".join(f'noise_key_{i} = "x{i}"' for i in range(200))
14 body = f"""[meta]
15 {noise}
16
17 [last_import]
18 git_sha = "{"c" * 40}"
19 muse_commit_id = "sha256:{"d" * 64}"
20 {noise}
21
22 [last_export]
23 muse_branch = "main"
24 muse_commit_id = "{tip}"
25 git_remote = "origin"
26 git_ref = "muse-mirror"
27 git_sha = "{git_sha}"
28 {noise}
29
30 [other]
31 {noise}
32 """
33 muse = tmp_path / ".muse"
34 muse.mkdir()
35 (muse / "git-bridge.toml").write_text(body, encoding="utf-8")
36 assert read_bridge_muse_commit_id(tmp_path, "last_export") == tip
37 assert read_bridge_git_sha(tmp_path, "last_export") == git_sha
38 assert read_bridge_muse_commit_id(tmp_path, "last_import") == "sha256:" + ("d" * 64)