Files
Jyotisha/tests/test_upstream_git_import_a6f47abd.py
T
Jesse_Chen 45d132588f feat(upstream): snapshot a6f47abd, REST VedAstro path, and 116-technique truth layer
Advance the one-way import to git commit a6f47abd with consultation keypath golden, switch official VedAstro comparison to the REST Calculate bridge, and receive the 25 new registry entries behind research_only_blocked.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-03 17:35:26 +08:00

38 lines
1.8 KiB
Python

"""Git-mode import record for upstream a6f47abd. Does not replace the 5db72537 archive pin test."""
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-a6f47abd2c9b7c6baa911ea00c971e1ec902380c.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 = "a6f47abd2c9b7c6baa911ea00c971e1ec902380c"
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]{40}", record["source_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"] == "applied"
assert manifest["source_mode"] == "git"
assert manifest["source_commit"] == COMMIT
assert all(row["status"] == "review_required" for row in record["semantic_merge_files"])