chore(repo): make the release gate reproducible and clean product URLs

PyJHora absence is now partial, tests write research manifests to tmp, the registry allows experimental_variant, and product links point at the Gitea repo. Early logs move to docs/history.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-03 16:55:26 +08:00
parent b6a70aa7df
commit 2415e751fe
32 changed files with 320 additions and 115 deletions
+13 -3
View File
@@ -25,24 +25,32 @@ def test_registry_is_backend_evidence_pool_not_flat_user_skill_list() -> None:
"composite_adjudicator",
"workflow_or_engineering",
"alias_entry",
"experimental_variant",
}
allowed_roles = {"primary", "secondary", "context", "audit_only", "alias"}
allowed_roles = {"primary", "secondary", "context", "audit_only", "alias", "comparison_only"}
allowed_visibility = {"ordinary_topic_router", "expert_audit", "hidden"}
allowed_prediction = {
"case_validated_partial",
"support_only",
"not_claimed",
"not_applicable",
"blocked",
}
allowed_rule = {"verified", "partial", "not_applicable", "blocked"}
allowed_calculation = {"verified", "partial", "not_applicable", "experimental"}
for tech_id, tech in techniques.items():
assert tech["entry_type"] in allowed_entry_types, tech_id
assert tech["evidence_role"] in allowed_roles, tech_id
assert tech["user_visibility"] in allowed_visibility, tech_id
assert tech["verification_level"]["calculation"] in {"verified", "partial", "not_applicable"}, tech_id
assert tech["verification_level"]["rule"] in {"verified", "partial", "not_applicable"}, tech_id
assert tech["verification_level"]["calculation"] in allowed_calculation, tech_id
assert tech["verification_level"]["rule"] in allowed_rule, tech_id
assert tech["verification_level"]["prediction"] in allowed_prediction, tech_id
assert tech["conclusion_policy"], tech_id
if tech["entry_type"] == "experimental_variant":
assert tech["verification_level"]["prediction"] == "blocked", tech_id
assert tech["verification_level"]["rule"] == "blocked", tech_id
assert tech["user_visibility"] == "expert_audit", tech_id
assert techniques["case_validator"]["evidence_role"] == "audit_only"
assert techniques["thematic_report_orchestrator"]["entry_type"] == "workflow_or_engineering"
@@ -59,6 +67,8 @@ def test_evidence_pool_summary_routes_few_primary_items_and_many_support_items()
assert summary["evidence_role_counts"]["primary"] >= 8
assert summary["evidence_role_counts"]["secondary"] > summary["evidence_role_counts"]["primary"]
assert summary["evidence_role_counts"]["audit_only"] >= 3
assert summary["comparison_only_entries"] == ["rangacharya_jaimini_variant"]
assert summary["conclusion_policy"]["comparison_only_entries_cannot_affect_astrological_conclusions"] is True
assert summary["prediction_verification_counts"]["not_claimed"] > 0
assert summary["conclusion_policy"]["primary_chain_required"] is True
assert summary["conclusion_policy"]["all_89_entries_must_not_be_flattened_into_conclusions"] is True
@@ -25,6 +25,11 @@ def _run_manifest(*args: str) -> dict:
return json.loads(completed.stdout)
def _saved(report: dict, key: str) -> Path:
raw = Path(report["artifacts"][key])
return raw if raw.is_absolute() else ROOT / raw
def test_manifest_indexes_project_source_layers_without_heavy_ocr() -> None:
report = _run_manifest("--scope", "project", "--no-write")
@@ -64,13 +69,14 @@ def test_manifest_indexes_project_source_layers_without_heavy_ocr() -> None:
}
def test_manifest_writes_json_and_markdown_reports() -> None:
report = _run_manifest("--scope", "project")
def test_manifest_writes_json_and_markdown_reports(tmp_path: Path) -> None:
report = _run_manifest("--scope", "project", "--output-dir", str(tmp_path))
json_path = ROOT / report["artifacts"]["json_report"]
md_path = ROOT / report["artifacts"]["markdown_report"]
json_path = _saved(report, "json_report")
md_path = _saved(report, "markdown_report")
assert json_path.exists()
assert md_path.exists()
assert json_path.parent == tmp_path
saved = json.loads(json_path.read_text(encoding="utf-8"))
assert saved["summary"] == report["summary"]
@@ -136,22 +142,23 @@ def test_external_manifest_indexes_high_relevance_machine_fragments_without_copy
assert "text_preview" not in item
def test_external_manifest_writes_separate_reports() -> None:
report = _run_manifest("--scope", "external", "--summary-only")
def test_external_manifest_writes_separate_reports(tmp_path: Path) -> None:
report = _run_manifest("--scope", "external", "--summary-only", "--output-dir", str(tmp_path))
assert "by_path" not in report
assert report["artifacts"]["json_report"] == "docs/research/character_level_external_manifest_latest.json"
assert report["artifacts"]["markdown_report"] == "docs/research/character_level_external_manifest_latest.md"
assert Path(report["artifacts"]["json_report"]).name == "character_level_external_manifest_latest.json"
assert Path(report["artifacts"]["markdown_report"]).name == "character_level_external_manifest_latest.md"
json_path = ROOT / report["artifacts"]["json_report"]
md_path = ROOT / report["artifacts"]["markdown_report"]
json_path = _saved(report, "json_report")
md_path = _saved(report, "markdown_report")
assert json_path.exists()
assert md_path.exists()
assert json_path.parent == tmp_path
assert "External High-Relevance Inventory Manifest" in md_path.read_text(encoding="utf-8")
def test_extraction_queue_report_combines_project_and_external_binary_work() -> None:
report = _run_manifest("--scope", "extraction-queue")
def test_extraction_queue_report_combines_project_and_external_binary_work(tmp_path: Path) -> None:
report = _run_manifest("--scope", "extraction-queue", "--output-dir", str(tmp_path))
assert report["scope"] == "extraction-queue"
assert report["status"] == "pass"
@@ -171,15 +178,16 @@ def test_extraction_queue_report_combines_project_and_external_binary_work() ->
}
assert "text_preview" not in item
json_path = ROOT / report["artifacts"]["json_report"]
md_path = ROOT / report["artifacts"]["markdown_report"]
json_path = _saved(report, "json_report")
md_path = _saved(report, "markdown_report")
assert json_path.exists()
assert md_path.exists()
assert json_path.parent == tmp_path
assert "Extraction Queue Manifest" in md_path.read_text(encoding="utf-8")
def test_extraction_results_extract_pdf_and_docx_without_storing_text() -> None:
report = _run_manifest("--scope", "extraction-results")
def test_extraction_results_extract_pdf_and_docx_without_storing_text(tmp_path: Path) -> None:
report = _run_manifest("--scope", "extraction-results", "--output-dir", str(tmp_path))
assert report["scope"] == "extraction-results"
assert report["status"] == "pass"
@@ -218,15 +226,16 @@ def test_extraction_results_extract_pdf_and_docx_without_storing_text() -> None:
assert item["extraction_result"] == "ocr_blocked_missing_engine"
assert item["ocr_engine_available"] is False
json_path = ROOT / report["artifacts"]["json_report"]
md_path = ROOT / report["artifacts"]["markdown_report"]
json_path = _saved(report, "json_report")
md_path = _saved(report, "markdown_report")
assert json_path.exists()
assert md_path.exists()
assert json_path.parent == tmp_path
assert "Extraction Results Manifest" in md_path.read_text(encoding="utf-8")
def test_extraction_review_grades_extracted_sources_without_promoting_runtime_truth() -> None:
report = _run_manifest("--scope", "extraction-review")
def test_extraction_review_grades_extracted_sources_without_promoting_runtime_truth(tmp_path: Path) -> None:
report = _run_manifest("--scope", "extraction-review", "--output-dir", str(tmp_path))
assert report["scope"] == "extraction-review"
assert report["status"] == "pass"
@@ -250,15 +259,16 @@ def test_extraction_review_grades_extracted_sources_without_promoting_runtime_tr
assert "text" not in item
assert "text_preview" not in item
json_path = ROOT / report["artifacts"]["json_report"]
md_path = ROOT / report["artifacts"]["markdown_report"]
json_path = _saved(report, "json_report")
md_path = _saved(report, "markdown_report")
assert json_path.exists()
assert md_path.exists()
assert json_path.parent == tmp_path
assert "Extraction Review Manifest" in md_path.read_text(encoding="utf-8")
def test_source_grading_batch1_classifies_promote_review_candidates_without_runtime_promotion() -> None:
report = _run_manifest("--scope", "source-grading-batch1")
def test_source_grading_batch1_classifies_promote_review_candidates_without_runtime_promotion(tmp_path: Path) -> None:
report = _run_manifest("--scope", "source-grading-batch1", "--output-dir", str(tmp_path))
assert report["scope"] == "source-grading-batch1"
assert report["status"] == "pass"
@@ -299,8 +309,9 @@ def test_source_grading_batch1_classifies_promote_review_candidates_without_runt
assert "text" not in item
assert "text_preview" not in item
json_path = ROOT / report["artifacts"]["json_report"]
md_path = ROOT / report["artifacts"]["markdown_report"]
json_path = _saved(report, "json_report")
md_path = _saved(report, "markdown_report")
assert json_path.exists()
assert md_path.exists()
assert json_path.parent == tmp_path
assert "Source Grading Batch 1 Manifest" in md_path.read_text(encoding="utf-8")
@@ -3,7 +3,7 @@ from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
PACKET=ROOT/'references/oracle/hard_gap_source_hunt_2026_07_23.json'
def test_hard_gap_source_hunt_does_not_upgrade_oracles():
data=json.loads(subprocess.check_output(['python3','scripts/hard_gap_source_hunt_2026_07_23.py'],cwd=ROOT,text=True))
data=json.loads(subprocess.check_output(['python3','scripts/hard_gap_source_hunt_2026_07_23.py','--no-write'],cwd=ROOT,text=True))
assert data['claim_status']=='source_hunt_only'
assert data['truth_matrix_allowed'] is False
assert data['summary']['ready_numeric_oracle_count']==0
+1 -1
View File
@@ -3,7 +3,7 @@ from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
PACKET=ROOT/'references/oracle/numeric_oracle_gap_queue_v3_2026_07_23.json'
def test_numeric_oracle_gap_queue_v3_blocks_truth_upgrade():
data=json.loads(subprocess.check_output(['python3','scripts/numeric_oracle_gap_queue_v3.py'],cwd=ROOT,text=True))
data=json.loads(subprocess.check_output(['python3','scripts/numeric_oracle_gap_queue_v3.py','--no-write'],cwd=ROOT,text=True))
assert data['claim_status']=='candidate_queue'
assert data['truth_matrix_allowed'] is False
assert data['summary']['numeric_packet_ready_count']==0
+44 -1
View File
@@ -1,6 +1,12 @@
from __future__ import annotations
from scripts.remote_repo_visibility_check import github_slug_from_remote_url, parse_ls_remote
import json
from scripts.remote_repo_visibility_check import (
build_report,
github_slug_from_remote_url,
parse_ls_remote,
)
def test_github_slug_from_remote_url_accepts_ssh_and_https() -> None:
@@ -23,3 +29,40 @@ def test_parse_ls_remote_separates_heads_and_tags() -> None:
assert parsed["heads"]["codex/release-hygiene-ci"] == "def456"
assert parsed["tags"]["v1.0.0"] == "aaa111"
assert parsed["ref_count"] == 3
def test_gitea_remote_reports_provider_and_does_not_fall_back_to_legacy_slug(monkeypatch) -> None:
from scripts import remote_repo_visibility_check as mod
def fake_run_command(args: list[str], timeout: int) -> dict:
joined = " ".join(args)
if args[:3] == ["git", "rev-parse", "--abbrev-ref"]:
return {"ok": True, "returncode": 0, "stdout": "staging\n", "stderr": "", "error": ""}
if args[:2] == ["git", "rev-parse"]:
return {"ok": True, "returncode": 0, "stdout": "abc123\n", "stderr": "", "error": ""}
if args[:3] == ["git", "remote", "get-url"]:
return {
"ok": True,
"returncode": 0,
"stdout": "https://git.copse.top/root/Jyotisha.git\n",
"stderr": "",
"error": "",
}
if args[:2] == ["git", "ls-remote"]:
return {
"ok": True,
"returncode": 0,
"stdout": "abc123 refs/heads/main\ndef456 refs/heads/staging\n",
"stderr": "",
"error": "",
}
raise AssertionError(f"unexpected command: {joined}")
monkeypatch.setattr(mod, "run_command", fake_run_command)
report = build_report(8)
dumped = json.dumps(report)
assert report["provider"] == "gitea"
assert report["github_slug"] is None
assert report["status"] == "verified"
assert "732642856/yinduzhanxing" not in dumped
assert report["github_api"]["error"] == "not_github_remote"
+2 -1
View File
@@ -68,5 +68,6 @@ def test_premium_skill_zip_runs_from_clean_directory(tmp_path: Path) -> None:
)
assert user_acceptance.returncode == 0, user_acceptance.stderr or user_acceptance.stdout
report = json.loads(user_acceptance.stdout)
assert report["status"] == "pass"
# 原值=status 必须 pass;新值=pass 或 partial;原因=打包目录里缺 PyJHora 时应降级而不是 fail
assert report["status"] in {"pass", "partial"}
assert report["checks"]["guided_topics_entrypoint"] is True
+2 -1
View File
@@ -13,7 +13,8 @@ def test_skill_release_manifest_defines_basic_and_premium_boundaries() -> None:
assert set(editions) == {"basic_git", "premium_cloud_drive"}
assert editions["basic_git"]["distribution"] == "public_git_repository"
assert editions["premium_cloud_drive"]["distribution"] == "cloud_drive_zip"
assert "https://github.com/732642856/yinduzhanxing" in editions["basic_git"]["source"]
# 原值=上游研究仓 GitHub 地址;新值=本产品 Gitea 仓;原因=发行清单 source 必须指向产品仓
assert "https://git.copse.top/root/Jyotisha" in editions["basic_git"]["source"]
assert any("scripts/user_invocation_acceptance_check.py" in command for command in report["acceptance_commands"])
assert any("scripts/public_release_privacy_scan.py" in command for command in report["acceptance_commands"])
assert report["privacy_boundary"]["private_birth_data_allowed"] is False
+2 -1
View File
@@ -56,7 +56,8 @@ def test_skill_release_package_can_write_zip(tmp_path) -> None:
guided = archive.read("GUIDED_ENTRYPOINT.md").decode("utf-8")
acceptance = json.loads(archive.read("PACKAGE_ACCEPTANCE.json").decode("utf-8"))
assert "python3 scripts/user_invocation_acceptance_check.py" in install
assert "https://github.com/732642856/yinduzhanxing" in install
# 原值=上游研究仓 GitHub 地址;新值=本产品 Gitea 仓;原因=安装说明必须指向可克隆的产品仓
assert "https://git.copse.top/root/Jyotisha" in install
assert "guided_topics" in prompts
assert "official_blocked" in prompts
assert "western_oracle_payload" in prompts
@@ -148,8 +148,23 @@ def test_one_command_user_invocation_acceptance_check() -> None:
assert completed.returncode == 0, completed.stderr or completed.stdout
report = json.loads(completed.stdout)
assert report["status"] == "pass"
# 原值=status 必须 pass;新值=pass 或 partial;原因=PyJHora 缺席是外部参照降级,不应把验收检查打成 fail
assert report["status"] in {"pass", "partial"}
assert report["checks"]["user_invocation_tests"] is True
assert report["checks"]["guided_topics_entrypoint"] is True
assert report["checks"]["external_adapter_diagnostics"] is True
assert report["external_adapter_status"] in {"pass", "partial", "complete"}
def test_missing_reference_engine_is_partial_not_fail() -> None:
from scripts.user_invocation_acceptance_check import resolve_acceptance_status
assert resolve_acceptance_status([], {"engines": {"PyJHora/JHora": {"status": "available"}}}) == "pass"
assert (
resolve_acceptance_status(
[],
{"engines": {"PyJHora/JHora": {"missing_dependency": "pyjhora"}}},
)
== "partial"
)
assert resolve_acceptance_status(["user_invocation_pytest_failed"], {"engines": {}}) == "fail"