test_gfg_d2_bridge_roundtrip.py python
32 lines 1.2 KB
Raw
sha256:106ef9e12cca7f3be3ffb2a6bd3abfa76f032dce453c9e5010d732a8d86f2e14 Reconcile reviewed credential compatibility 32254cd939885d9… Human patch 8 days ago
1 """Data-integrity: muse_commit_id preserved including sha256: prefix (§D2F.9)."""
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 from tests.support import adapter_for, make_runner
9
10
11 def test_muse_commit_id_roundtrip_preserves_prefix(
12 muse_git_mirror_config, repo_root: Path
13 ) -> None:
14 tip = "sha256:67001f71f4481906b1bad7a9f46ccf61f9113c44a6cf64473416c4c77a8b6116"
15 git_sha = "1e734a922a8de5dcac248007b8dfb706c4a0f84e"
16 muse = repo_root / ".muse"
17 muse.mkdir(parents=True)
18 original = (
19 f'[last_export]\n'
20 f'muse_commit_id = "{tip}"\n'
21 f'git_sha = "{git_sha}"\n'
22 )
23 path = muse / "git-bridge.toml"
24 path.write_text(original, encoding="utf-8")
25
26 assert read_bridge_muse_commit_id(repo_root, "last_export") == tip
27 assert read_bridge_git_sha(repo_root, "last_export") == git_sha
28 adapter = adapter_for(muse_git_mirror_config, repo_root, make_runner({}))
29 anchor = adapter.read_canonical_anchor()
30 assert anchor.anchor_sha == tip
31 # Reading must not mutate bridge bytes
32 assert path.read_text(encoding="utf-8") == original
File History 2 commits
sha256:106ef9e12cca7f3be3ffb2a6bd3abfa76f032dce453c9e5010d732a8d86f2e14 Reconcile reviewed credential compatibility 32254cd939885d9… Human patch 8 days ago
sha256:c87cf2c2f03da507f66f93922cb339a2cbebb33ad6372a6039032fb09a20da12 Reconcile reviewed Overseer recovery d47291d5d9030de5ebef71… Human minor ⚠ 9 days ago