Files
Jyotisha/tests/test_upstream_git_import_d09feab7.py
T
ClaudeandClaude Opus 5.5 919c61814a docs(upstream): mirror record for astrologer branch d09feab7 (sync 12)
Import record from scripts/import_yinduzhanxing.py --apply on a clean d09feab7
clone (root SKILL.md unchanged since ea2a9d65); source-manifest and import plan
point at d09feab7; the ea2a9d65 record test becomes history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-07 20:05:45 +08:00

41 lines
1.9 KiB
Python

"""Git-mode import record for the astrologer's working branch d09feab7 (twelfth sync, 2026-11-07).
Branch codex/public-sync-20261107, 10 commits after main ea2a9d65. Root SKILL.md
is byte-identical to ea2a9d65, so the importer reports the mirror as unchanged.
"""
from __future__ import annotations
import hashlib
import json
import re
from pathlib import Path
from jsonschema import Draft202012Validator, FormatChecker
ROOT = Path(__file__).resolve().parents[1]
RECORD = ROOT / "references/cross_project_contract/imports/commit-d09feab738fd7676865686b6dbb459a940d7793e.json"
SOURCE_MANIFEST = ROOT / "references/upstream/yinduzhanxing/source-manifest.json"
SKILL_SNAPSHOT = ROOT / "references/upstream/yinduzhanxing/SKILL.md"
SCHEMA = ROOT / "references/cross_project_contract/import_manifest.schema.json"
COMMIT = "d09feab738fd7676865686b6dbb459a940d7793e"
def test_git_import_record_matches_mirrored_skill_and_manifest() -> None:
record = json.loads(RECORD.read_text(encoding="utf-8"))
manifest = json.loads(SOURCE_MANIFEST.read_text(encoding="utf-8"))
schema = json.loads(SCHEMA.read_text(encoding="utf-8"))
Draft202012Validator(schema, format_checker=FormatChecker()).validate(record)
assert record["source_mode"] == "git"
assert record["source_commit"] == COMMIT
assert re.fullmatch(r"[0-9a-f]{64}", record["source_tree_hash"])
assert record["source_tree_hash"] == manifest["source_tree_sha256"]
assert record["source_skill_sha256"] == manifest["source_skill_sha256"]
snapshot_hash = hashlib.sha256(SKILL_SNAPSHOT.read_bytes()).hexdigest()
assert snapshot_hash == record["source_skill_sha256"] == record["mirror_files"][0]["target_sha256_after"]
assert record["mirror_files"][0]["status"] == "unchanged"
assert manifest["source_mode"] == "git"
assert manifest["source_commit"] == COMMIT
assert all(row["status"] in {"review_required", "unchanged"} for row in record["semantic_merge_files"])