- BUG-1725: evidence card Arudha rows carry pada_house_from_lagna and lord_natal_house plus arudha_columns; her phrasing rule 「A2 位于水瓶;其主星土星位于本命第 2 宫」 is in the runtime contract. - BUG-1726: methodology delivers her files in her three layers (ruling 2026-11-07 Q3): router, status contract, output contract (skeleton §5/§6) and §0.4 every turn; §2.3, the matching event-judgment branch, the transit guide and route-needed sub-skills per question; maintenance files never. methodology.delivery records layer and reason. Removes the dead sharedConsultationMethodMarkdown. - BUG-1727: sub-skills follow route techniques through her skill_family_router.json triggers (ruling Q4); question words are auxiliary; product domain table kept as labelled floor; specialized-jyotish reachable as technique paragraphs plus its boundaries; skill_read reads allowlisted skills/<family>/ files. - BUG-1728: CHAT_METHOD_BOUNDARIES, natal instructions, MEVG policy and the shared reading move to references/product_runtime_contract.md (loaded by block name, each rule annotated as a product rule); her Q5 rulings added; current order and a list of rules that may cross her writing floor recorded for her. - Offline model-input manifest mode in consult-model-input-manifest.mts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
116 lines
5.9 KiB
Python
116 lines
5.9 KiB
Python
"""BUG-1698 (2026-11-07, owner): the product runs the astrologer's skill in full.
|
|
|
|
Guards against the drift that happened before: the live SKILL.md is her upstream
|
|
file verbatim, every sub-skill her family router names is present, and every
|
|
file her SKILL.md, router and sub-skills point to exists here. The only
|
|
exceptions are paths her own repository (732642856/yinduzhanxing @ the pinned
|
|
mirror commit) does not carry either.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import re
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
PATH_RE = re.compile(r"(?:references|docs|skills|scripts)/[A-Za-z0-9_./-]+\.(?:md|json|py|yaml|yml|txt)")
|
|
|
|
# Named by her files but absent from her repository too (checked 2026-11-07 at 5fb8379c).
|
|
UPSTREAM_ALSO_LACKS = {
|
|
("SKILL.md", "docs/research/current_skill_core_gap_rerank_2026_06_26.md"),
|
|
("SKILL.md", "docs/research/global_open_source_positioning_of_skill_2026_06_26.md"),
|
|
("SKILL.md", "docs/research/reuse_license_whitelist_for_skill_2026_06_26.md"),
|
|
("SKILL.md", "docs/research/vedastro_rest_bridge_default_decision_2026_09_01.md"),
|
|
("skills/jyotish-vedic-astrology/SKILL.md", "docs/research/current_skill_core_gap_rerank_2026_06_26.md"),
|
|
("skills/jyotish-vedic-astrology/SKILL.md", "docs/research/global_open_source_positioning_of_skill_2026_06_26.md"),
|
|
("skills/jyotish-vedic-astrology/SKILL.md", "docs/research/reuse_license_whitelist_for_skill_2026_06_26.md"),
|
|
("skills/jyotish-vedic-astrology/SKILL.md", "docs/research/vedastro_rest_bridge_default_decision_2026_09_01.md"),
|
|
}
|
|
|
|
# Named by her method but kept outside scripts/ on purpose (path -> where it lives and why).
|
|
RELOCATED = {
|
|
# jyotish_engine.py imports this module optionally; at the scripts/ root it replaced
|
|
# our dasha tables and undid BUG-1674 (balance row from birth) and dropped the
|
|
# Jaimini / Narayana section. Her text is kept verbatim here until its dasha pack is
|
|
# ported onto our dasha path.
|
|
"scripts/professional_parity_closure.py": "scripts/research/professional_parity_closure.py",
|
|
}
|
|
|
|
UPSTREAM_SUB_SKILLS = (
|
|
"financial-astrology", "jaimini-timing", "jhora-pdf-ai-interpreter", "jyotish-birth-time-rectification",
|
|
"jyotish-codex-dialogue", "jyotish-engine-modules", "jyotish-full-reading-integration",
|
|
"jyotish-full-synastry-reading", "kp-event", "parashari-core", "prashna-muhurta",
|
|
"specialized-jyotish", "startrack-log-generator", "tajika-annual",
|
|
)
|
|
|
|
|
|
def _split_skill(raw: str) -> tuple[dict[str, str], str]:
|
|
"""Frontmatter fields and body. Her file's description is an unquoted YAML
|
|
scalar containing ': ', which YAML rejects (Mastra then cannot find the
|
|
skill); ours quotes it, so the fields are compared as values, the body byte
|
|
for byte."""
|
|
import json as _json
|
|
|
|
_, head, body = raw.split("---\n", 2)
|
|
fields: dict[str, str] = {}
|
|
for line in head.strip().splitlines():
|
|
key, _, value = line.partition(": ")
|
|
value = value.strip()
|
|
if value.startswith('"'):
|
|
value = _json.loads(value)
|
|
fields[key] = value
|
|
return fields, body
|
|
|
|
|
|
def test_live_skill_is_her_skill_md_verbatim() -> None:
|
|
live = _split_skill((ROOT / "SKILL.md").read_text(encoding="utf-8"))
|
|
mirror = _split_skill((ROOT / "references/upstream/yinduzhanxing/SKILL.md").read_text(encoding="utf-8"))
|
|
assert live == mirror
|
|
|
|
|
|
def test_every_upstream_sub_skill_is_present() -> None:
|
|
for name in UPSTREAM_SUB_SKILLS:
|
|
assert (ROOT / "skills" / name / "SKILL.md").is_file(), name
|
|
router = json.loads((ROOT / "references/skill_family_router.json").read_text(encoding="utf-8"))
|
|
for family, row in router["families"].items():
|
|
assert (ROOT / row["skill_path"]).is_file(), family
|
|
|
|
|
|
def test_every_file_her_method_points_to_exists() -> None:
|
|
sources = [ROOT / "SKILL.md", ROOT / "references/strict-workflow-router.md", *sorted((ROOT / "skills").glob("*/SKILL.md"))]
|
|
missing = []
|
|
for source in sources:
|
|
rel = source.relative_to(ROOT).as_posix()
|
|
for path in sorted(set(PATH_RE.findall(source.read_text(encoding="utf-8")))):
|
|
if (ROOT / path).exists() or (source.parent / path).exists():
|
|
continue
|
|
if (rel, path) in UPSTREAM_ALSO_LACKS:
|
|
continue
|
|
if path in RELOCATED and (ROOT / RELOCATED[path]).exists():
|
|
continue
|
|
missing.append(f"{rel} -> {path}")
|
|
assert missing == []
|
|
|
|
|
|
def test_chat_contract_files_exist() -> None:
|
|
for path in ("references/interpretation_status_contract.md", "references/product_runtime_contract.md"):
|
|
assert (ROOT / path).is_file(), path
|
|
|
|
|
|
def test_product_rules_live_in_the_announced_contract_file() -> None:
|
|
"""BUG-1728: product rules are named blocks in references/product_runtime_contract.md,
|
|
each rule announced as a product rule (or as her 2026-11-07 ruling), never her method."""
|
|
text = (ROOT / "references/product_runtime_contract.md").read_text(encoding="utf-8")
|
|
for block in ("runtime-contract", "chat-method-boundaries", "natal-instructions", "mevg-blocked-policy", "shared-reading"):
|
|
start = text.index(f"<!-- product-block:{block} -->\n")
|
|
end = text.index(f"\n<!-- /product-block:{block} -->", start)
|
|
lines = text[start:end].split("\n")[1:]
|
|
for index, line in enumerate(lines):
|
|
if re.match(r"^(- |\d+\. )", line):
|
|
assert re.match(r"^<!-- (产品规则,不是占星师的方法|占星师 2026-11-07 裁定)", lines[index - 1]), (block, line[:40])
|
|
# The current order is written down for her ruling, and no product rule text is left in TypeScript.
|
|
assert "## 当前顺序(尚待占星师裁定,本阶段不调整)" in text
|
|
index_ts = (ROOT / "frontend/src/mastra/index.ts").read_text(encoding="utf-8")
|
|
assert 'productContractBlock("natal-instructions"' in index_ts
|
|
assert "Call run-jyotish-consultation before answering every turn" not in index_ts
|