docs: record first research contract sync

This commit is contained in:
732642856
2026-07-16 12:38:09 +08:00
parent fd06bdc2ee
commit 37fea987f9
4 changed files with 94 additions and 15 deletions
+17 -4
View File
@@ -1,4 +1,4 @@
"""Public synthetic-fixture contract shared with the backup repository."""
"""Public synthetic-fixture contract shared with the commercial repository."""
from __future__ import annotations
@@ -20,15 +20,17 @@ LEDGER = ROOT / "references" / "cross_project_contract" / "sync_ledger.json"
def test_public_fixture_manifest_has_complete_effective_settings() -> None:
manifest = contract.load_manifest(MANIFEST)
fixture = manifest["fixtures"][0]
assert manifest["schema_version"] == 1
assert manifest["privacy_scope"] == "public_synthetic_only"
fixture = manifest["fixtures"][0]
assert fixture["birth"]["synthetic"] is True
assert fixture["effective"] == {"ayanamsa": "lahiri", "node_mode": "mean", "timezone_offset": 5.5}
def test_local_calculation_matches_public_compatibility_hash() -> None:
report = contract.evaluate_manifest(MANIFEST)
assert report["matches"] is True
assert report["fixtures"][0]["matches"] is True
@@ -38,7 +40,9 @@ def test_comparator_reports_tampered_expected_hash(tmp_path: Path) -> None:
manifest["fixtures"][0]["compatibility_hash"] = "0" * 64
changed = tmp_path / "fixture_manifest.v1.json"
changed.write_text(json.dumps(manifest), encoding="utf-8")
report = contract.evaluate_manifest(changed)
assert report["matches"] is False
assert report["fixtures"][0]["matches"] is False
@@ -47,16 +51,25 @@ def test_compatibility_payload_normalizes_engine_degree_field() -> None:
fixture = contract.load_manifest(MANIFEST)["fixtures"][0]
chart = {
"ascendant": {"sign": "Aries", "degree": 1.25},
"planets": {planet: {"sign": "Aries", "degree": float(index)} for index, planet in enumerate(contract.PLANETS)},
"planets": {
planet: {"sign": "Aries", "degree": float(index)}
for index, planet in enumerate(contract.PLANETS)
},
}
payload = contract.compatibility_payload(chart, fixture)
assert payload["ascendant"]["lon"] == 1.25
assert payload["planets"]["Sun"]["lon"] == 0.0
def test_sync_ledger_requires_provenance_privacy_tests_hash_and_rollback() -> None:
ledger = contract.load_ledger(LEDGER)
assert ledger == {"schema_version": 1, "entries": []}
assert ledger["schema_version"] == 1
assert len(ledger["entries"]) == 1
assert contract.validate_ledger_entry(ledger["entries"][0]) == []
assert ledger["entries"][0]["privacy_review"].startswith("pass:")
missing = contract.validate_ledger_entry({"source_repository": "x"})
assert "target_commit" in missing
assert "privacy_review" in missing