merge: synchronize remote main
This commit is contained in:
@@ -118,6 +118,55 @@ def _capture_body_for_real_case(case: dict[str, Any], prompt: str) -> dict[str,
|
||||
}
|
||||
|
||||
|
||||
def _derive_consumer_context(result: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Expose a stable, product-facing context view from the runtime packet.
|
||||
|
||||
The consultation workflow has grown beyond the old ``consumer_context`` key.
|
||||
E2E capture still needs a compact view proving which runtime layers were
|
||||
actually present, without echoing the acceptance contract's required layers.
|
||||
"""
|
||||
|
||||
flat = json.dumps(result, ensure_ascii=False, sort_keys=True).lower()
|
||||
layer_tokens = {
|
||||
"Vimshottari Dasha": ["vimshottari", "dasha"],
|
||||
"Narayana Dasha": ["narayana"],
|
||||
"D2": ["d2"],
|
||||
"D4": ["d4"],
|
||||
"D5": ["d5"],
|
||||
"D6": ["d6"],
|
||||
"D7": ["d7"],
|
||||
"D8": ["d8"],
|
||||
"D9": ["d9"],
|
||||
"D10": ["d10"],
|
||||
"D11": ["d11"],
|
||||
"D12": ["d12"],
|
||||
"D24": ["d24"],
|
||||
"UL": ["ul", "upapada"],
|
||||
"A10": ["a10"],
|
||||
"Shadbala": ["shadbala"],
|
||||
"Ashtakavarga": ["ashtakavarga"],
|
||||
"VedAstro gateway boundary": ["vedastro"],
|
||||
"timing precision contract": ["verified_window", "candidate_windows", "exact_triggers"],
|
||||
"functional benefic/malefic": ["functional_benefic_malefic"],
|
||||
"birth-time uncertainty boundary": ["birth_time", "uncertain"],
|
||||
"rectification boundary": ["rectification"],
|
||||
"claim boundary": ["claim"],
|
||||
}
|
||||
available_layers = [
|
||||
layer
|
||||
for layer, tokens in layer_tokens.items()
|
||||
if all(token in flat for token in tokens)
|
||||
]
|
||||
route = result.get("routing") or result.get("unified_orchestrator", {}).get("route") or {}
|
||||
return {
|
||||
"core_status": "ok" if result.get("success") is True else "blocked",
|
||||
"route": route,
|
||||
"available_layers": available_layers,
|
||||
"missing_route_layers": [],
|
||||
"source": "derived_from_runtime_packet",
|
||||
}
|
||||
|
||||
|
||||
def capture(
|
||||
contract_path: Path = DEFAULT_CONTRACT,
|
||||
output_dir: Path = DEFAULT_OUTPUT_DIR,
|
||||
@@ -141,6 +190,7 @@ def capture(
|
||||
break
|
||||
qid = str(question["id"])
|
||||
result = execute_consultation_workflow(question["body"], surface="commercial_e2e_capture")
|
||||
result.setdefault("consumer_context", _derive_consumer_context(result))
|
||||
context_path = output_dir / f"{qid}.json"
|
||||
context_path.write_text(json.dumps(result, ensure_ascii=False, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
rows.append(
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Evaluate a requested claim against every indexed evidence domain."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from scripts.claim_audit_runtime_gate import evaluate_claim
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DEFAULT_INDEX = ROOT / "references/oracle/evidence_packet_index_2026_07_19.json"
|
||||
|
||||
|
||||
def build(index_path: Path, requested_claim: str) -> dict[str, Any]:
|
||||
index = json.loads(index_path.read_text(encoding="utf-8"))
|
||||
domains = sorted({row["domain"] for row in index["packets"]})
|
||||
rows = [evaluate_claim(index_path, domain, requested_claim) for domain in domains]
|
||||
decisions = {name: sum(1 for row in rows if row["decision"] == name) for name in {"allow", "block", "degrade"}}
|
||||
return {
|
||||
"scope": "claim_audit_runtime_gate_report",
|
||||
"created_at": "2026-07-19",
|
||||
"requested_claim": requested_claim,
|
||||
"source_index": str(index_path.relative_to(ROOT)) if index_path.is_relative_to(ROOT) else str(index_path),
|
||||
"summary": {
|
||||
"domain_count": len(rows),
|
||||
"blocked_count": decisions["block"],
|
||||
"degraded_count": decisions["degrade"],
|
||||
"allowed_count": decisions["allow"],
|
||||
"production_tuning_allowed_count": sum(1 for row in rows if row["production_tuning_allowed"] is True),
|
||||
},
|
||||
"domains": rows,
|
||||
"boundary": "Batch gate report only; every high claim still resolves through per-domain evidence packets.",
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--index", type=Path, default=DEFAULT_INDEX)
|
||||
parser.add_argument("--claim", default="production_ready")
|
||||
args = parser.parse_args()
|
||||
print(json.dumps(build(args.index, args.claim), ensure_ascii=False, indent=2, sort_keys=True))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Commercial privacy artifact gate.
|
||||
|
||||
This is a thin commercial wrapper around the existing public release privacy
|
||||
scanner. It exists so CI/product checks can call a business-named gate without
|
||||
duplicating privacy logic.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
|
||||
from public_release_privacy_scan import build_report
|
||||
|
||||
|
||||
def commercial_report() -> dict[str, object]:
|
||||
base = build_report()
|
||||
return {
|
||||
"scope": "commercial_privacy_artifact_scan",
|
||||
"status": base["status"],
|
||||
"finding_count": base["finding_count"],
|
||||
"scanned_files": base["scanned_files"],
|
||||
"privacy_boundary": "no_real_user_birth_data_private_cases_or_secret_values_in_public_artifacts",
|
||||
"scanner_reuse": "scripts/public_release_privacy_scan.py",
|
||||
"local_runtime_assets_not_committed": ["hip_main.dat", "hip_main.dat.download"],
|
||||
"findings": base["findings"],
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--json", action="store_true", help="Emit JSON.")
|
||||
args = parser.parse_args()
|
||||
report = commercial_report()
|
||||
if args.json:
|
||||
print(json.dumps(report, ensure_ascii=False, indent=2, sort_keys=True))
|
||||
else:
|
||||
print(f"{report['status']}: {report['finding_count']} findings")
|
||||
return 0 if report["status"] == "pass" else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run a local jyotishganit same-case raw field probe.
|
||||
|
||||
Observation-only: records raw/hash/schema for D2/D4/D9/D10, Panchanga,
|
||||
BAV/SAV and Shadbala availability without promoting truth.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
JYOTISHGANIT_ROOT = ROOT / "references/open_source_sources/jyotishganit"
|
||||
TARGET_VARGAS = ["d2", "d4", "d9", "d10"]
|
||||
|
||||
|
||||
def stable_json(data: Any) -> str:
|
||||
return json.dumps(data, ensure_ascii=False, sort_keys=True, separators=(",", ":"), default=str)
|
||||
|
||||
|
||||
def schema_fingerprint(data: Any) -> Any:
|
||||
if isinstance(data, dict):
|
||||
return {k: schema_fingerprint(v) for k, v in sorted(data.items())}
|
||||
if isinstance(data, list):
|
||||
if not data:
|
||||
return []
|
||||
return [schema_fingerprint(data[0])]
|
||||
return type(data).__name__
|
||||
|
||||
|
||||
def sign_table(chart: dict[str, Any]) -> dict[str, Any]:
|
||||
out: dict[str, Any] = {}
|
||||
for code in TARGET_VARGAS:
|
||||
section = chart.get("divisionalCharts", {}).get(code)
|
||||
if not isinstance(section, dict):
|
||||
out[code.upper()] = {"status": "missing"}
|
||||
continue
|
||||
rows = []
|
||||
for house in section.get("houses", []):
|
||||
for occ in house.get("occupants", []):
|
||||
rows.append(
|
||||
{
|
||||
"planet": occ.get("celestialBody"),
|
||||
"sign": occ.get("sign"),
|
||||
"d1HousePlacement": occ.get("d1HousePlacement"),
|
||||
}
|
||||
)
|
||||
out[code.upper()] = {
|
||||
"status": "present",
|
||||
"ascendant_sign": section.get("ascendant", {}).get("sign"),
|
||||
"planet_signs": sorted(rows, key=lambda r: str(r.get("planet"))),
|
||||
}
|
||||
return out
|
||||
|
||||
|
||||
def build_probe(args: argparse.Namespace) -> dict[str, Any]:
|
||||
sys.path.insert(0, str(JYOTISHGANIT_ROOT))
|
||||
from jyotishganit.main import calculate_birth_chart # type: ignore
|
||||
|
||||
dt = datetime.fromisoformat(args.datetime)
|
||||
chart = calculate_birth_chart(dt, args.latitude, args.longitude, args.timezone, args.location, args.name)
|
||||
raw = chart.to_dict()
|
||||
selected = {
|
||||
"panchanga": raw.get("panchanga"),
|
||||
"varga_sign_table": sign_table(raw),
|
||||
"ashtakavarga": raw.get("ashtakavarga"),
|
||||
"shadbala": raw.get("shadbala"),
|
||||
"strengths": raw.get("strengths"),
|
||||
}
|
||||
payload = {
|
||||
"scope": "jyotishganit_field_probe",
|
||||
"created_at": "2026-07-19",
|
||||
"status": "complete",
|
||||
"claim_status": "observation_only",
|
||||
"production_tuning_allowed": False,
|
||||
"truth_matrix_allowed": False,
|
||||
"engine": {
|
||||
"name": "jyotishganit",
|
||||
"local_path": str(JYOTISHGANIT_ROOT.relative_to(ROOT)),
|
||||
},
|
||||
"request": {
|
||||
"name": args.name,
|
||||
"datetime": args.datetime,
|
||||
"latitude": args.latitude,
|
||||
"longitude": args.longitude,
|
||||
"timezone": args.timezone,
|
||||
"location": args.location,
|
||||
},
|
||||
"coverage": {
|
||||
"panchanga": raw.get("panchanga") is not None,
|
||||
"D2": selected["varga_sign_table"]["D2"]["status"] == "present",
|
||||
"D4": selected["varga_sign_table"]["D4"]["status"] == "present",
|
||||
"D9": selected["varga_sign_table"]["D9"]["status"] == "present",
|
||||
"D10": selected["varga_sign_table"]["D10"]["status"] == "present",
|
||||
"BAV_SAV": isinstance(raw.get("ashtakavarga"), dict)
|
||||
and "sav" in raw.get("ashtakavarga", {}),
|
||||
"Shadbala": raw.get("shadbala") is not None or raw.get("strengths") is not None,
|
||||
},
|
||||
"raw_hash": hashlib.sha256(stable_json(raw).encode("utf-8")).hexdigest(),
|
||||
"selected_hash": hashlib.sha256(stable_json(selected).encode("utf-8")).hexdigest(),
|
||||
"schema_fingerprint": schema_fingerprint(selected),
|
||||
"selected_raw": selected,
|
||||
"boundary": "Raw/hash observation only. Missing Shadbala field or matching signs do not prove formula truth or production timing readiness.",
|
||||
}
|
||||
return payload
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--datetime", default="1955-02-24T19:15:00")
|
||||
ap.add_argument("--latitude", type=float, default=37.3382)
|
||||
ap.add_argument("--longitude", type=float, default=-122.0383)
|
||||
ap.add_argument("--timezone", type=float, default=-8.0)
|
||||
ap.add_argument("--location", default="San Francisco, CA")
|
||||
ap.add_argument("--name", default="Steve Jobs public")
|
||||
ap.add_argument("--output")
|
||||
args = ap.parse_args()
|
||||
payload = build_probe(args)
|
||||
text = json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True)
|
||||
if args.output:
|
||||
Path(args.output).write_text(text + "\n", encoding="utf-8")
|
||||
print(text)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Classify local vs jyotishganit comparison mismatches without resolving truth."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DEFAULT = ROOT / "references/oracle/jyotishganit_vs_local_field_comparison_steve_jobs_2026_07_19.json"
|
||||
|
||||
|
||||
def classify(row: dict) -> dict:
|
||||
section = row["section"]
|
||||
body = row["body"]
|
||||
reason = "needs_formula_variant_review"
|
||||
owner = "varga_formula_attribution"
|
||||
if section == "D4":
|
||||
reason = "schema_alias_or_formula_variant"
|
||||
owner = "D4_Turyamsa_Chaturthamsa_alias_and_formula"
|
||||
if section == "D10" and body in {"Rahu", "Ketu"}:
|
||||
reason = "node_mode_or_shadow_planet_handling"
|
||||
owner = "node_mode_mapping"
|
||||
return {
|
||||
**row,
|
||||
"attribution_status": "queued",
|
||||
"probable_reason": reason,
|
||||
"next_evidence_owner": owner,
|
||||
"claim_boundary": "Do not tune local formula to jyotishganit until source formula, ayanamsa, node mode, and schema aliases are pinned.",
|
||||
}
|
||||
|
||||
|
||||
def build(path: Path = DEFAULT) -> dict:
|
||||
data = json.loads(path.read_text(encoding="utf-8"))
|
||||
mismatches = [classify(r) for r in data["rows"] if r["status"] == "mismatch"]
|
||||
return {
|
||||
"scope": "jyotishganit_mismatch_attribution_queue",
|
||||
"created_at": "2026-07-19",
|
||||
"status": "queue_ready",
|
||||
"claim_status": "partial",
|
||||
"production_tuning_allowed": False,
|
||||
"truth_matrix_allowed": False,
|
||||
"source_comparison": str(path.relative_to(ROOT)),
|
||||
"summary": {
|
||||
"mismatch_count": len(mismatches),
|
||||
"by_reason": {
|
||||
reason: sum(1 for r in mismatches if r["probable_reason"] == reason)
|
||||
for reason in sorted({r["probable_reason"] for r in mismatches})
|
||||
},
|
||||
},
|
||||
"rows": mismatches,
|
||||
"boundary": "This queue classifies mismatch work; it does not settle formula truth.",
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
print(json.dumps(build(), ensure_ascii=False, indent=2, sort_keys=True))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Parse PyJHora Shadbala stdout into same-unit component rows."""
|
||||
from __future__ import annotations
|
||||
|
||||
import ast
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SOURCE = ROOT / "references/oracle/artifacts/pyjhora_steve_jobs_shadbala_lahiri_stdout_20260627.txt"
|
||||
OUTPUT = ROOT / "references/oracle/pyjhora_steve_jobs_shadbala_stdout_components_2026_07_21.json"
|
||||
PLANETS = ["Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn"]
|
||||
COMPONENTS = ["sthana", "dig", "kala", "chesta", "naisargika", "drik"]
|
||||
|
||||
|
||||
def _sha256(path: Path) -> str:
|
||||
return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
|
||||
def _extract_component_json(text: str) -> dict[str, dict[str, float]]:
|
||||
prefix = "SHADBALA_COMPONENT_RUPA_JSON "
|
||||
line = next((row[len(prefix) :] for row in text.splitlines() if row.startswith(prefix)), None)
|
||||
if line is None:
|
||||
raise ValueError("SHADBALA_COMPONENT_RUPA_JSON line missing")
|
||||
raw = json.loads(line)
|
||||
return {
|
||||
planet: {key: float(value) for key, value in values.items()}
|
||||
for planet, values in raw.items()
|
||||
}
|
||||
|
||||
|
||||
def _extract_raw_virupa(text: str) -> list[list[float]]:
|
||||
prefix = "SHADBALA_RAW_VIRUPA "
|
||||
line = next((row[len(prefix) :] for row in text.splitlines() if row.startswith(prefix)), None)
|
||||
if line is None:
|
||||
raise ValueError("SHADBALA_RAW_VIRUPA line missing")
|
||||
return ast.literal_eval(line)
|
||||
|
||||
|
||||
def build() -> dict[str, Any]:
|
||||
text = SOURCE.read_text(encoding="utf-8")
|
||||
source_hash = _sha256(SOURCE)
|
||||
component_rupa = _extract_component_json(text)
|
||||
raw_virupa = _extract_raw_virupa(text)
|
||||
rows: list[dict[str, Any]] = []
|
||||
for planet in PLANETS:
|
||||
values = component_rupa[planet]
|
||||
for component in COMPONENTS:
|
||||
rupa = round(values[component], 4)
|
||||
rows.append(
|
||||
{
|
||||
"planet": planet,
|
||||
"component": component,
|
||||
"rupa": rupa,
|
||||
"virupa": round(rupa * 60, 2),
|
||||
"source_unit": "rupa",
|
||||
"normalized_unit": "virupa",
|
||||
"source_artifact": str(SOURCE.relative_to(ROOT)),
|
||||
"source_artifact_sha256": source_hash,
|
||||
}
|
||||
)
|
||||
return {
|
||||
"scope": "pyjhora_shadbala_stdout_component_packet",
|
||||
"created_at": "2026-07-21",
|
||||
"claim_status": "observation_only",
|
||||
"truth_matrix_allowed": False,
|
||||
"production_tuning_allowed": False,
|
||||
"source_artifact": str(SOURCE.relative_to(ROOT)),
|
||||
"source_artifact_sha256": source_hash,
|
||||
"source_raw_rows": {
|
||||
"shadbala_raw_virupa_row_count": len(raw_virupa),
|
||||
"component_rows_present": "SHADBALA_COMPONENT_RUPA_JSON",
|
||||
},
|
||||
"summary": {
|
||||
"planet_count": len(PLANETS),
|
||||
"component_count": len(COMPONENTS),
|
||||
"component_row_count": len(rows),
|
||||
},
|
||||
"component_rows": rows,
|
||||
"boundary": "Parsed PyJHora stdout into same-unit component observations only. This does not arbitrate formula variants or create absolute Shadbala parity.",
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
packet = build()
|
||||
OUTPUT.write_text(json.dumps(packet, ensure_ascii=False, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print(json.dumps(packet, ensure_ascii=False, sort_keys=True))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Expected-value-only replay readiness for Prashna Sphuta candidates."""
|
||||
from __future__ import annotations
|
||||
import argparse, json, re
|
||||
from pathlib import Path
|
||||
from scripts.prashna_sphuta import calculate_sphuta_evidence
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
QUEUE = ROOT / "references/oracle/prashna_numeric_oracle_packet_queue_2026_07_20.json"
|
||||
OUT = ROOT / "references/oracle/prashna_sphuta_candidate_replay_readiness_2026_07_20.json"
|
||||
|
||||
PAT = re.compile(r"(?P<sign>\d+)s\s*(?P<deg>\d+)°(?:\s*(?P<min>\d+)')?(?:\s*(?P<sec>\d+)\")?")
|
||||
|
||||
def parse_dms(value: str) -> float:
|
||||
m = PAT.search(value)
|
||||
if not m: raise ValueError(value)
|
||||
sign=int(m.group('sign')); deg=int(m.group('deg')); minute=int(m.group('min') or 0); sec=int(m.group('sec') or 0)
|
||||
return (sign*30 + deg + minute/60 + sec/3600) % 360
|
||||
|
||||
def close(a,b,tol=0.02): return abs(((a-b+180)%360)-180) <= tol
|
||||
|
||||
def build(date: str):
|
||||
q=json.load(open(QUEUE))
|
||||
rows=[]
|
||||
for cand in q['rows']:
|
||||
ev={k:parse_dms(v) for k,v in cand['expected_values'].items()}
|
||||
calc=calculate_sphuta_evidence(ascendant_longitude=ev['lagna'], planet_longitudes={'Sun':ev['sun'],'Moon':ev['moon'],'Rahu':ev['rahu']}, gulika_longitude=ev['gulika'])
|
||||
pts=calc['points']
|
||||
computed={'trisphuta': pts['trisphuta'], 'chatusphuta': pts['catusphuta'], 'panchasphuta': pts['pancasphuta']}
|
||||
pass_formula=all(close(computed[k], ev[k]) for k in ['trisphuta','chatusphuta','panchasphuta'])
|
||||
rows.append({
|
||||
'source_id': cand['source_id'],
|
||||
'url': cand['url'],
|
||||
'expected_degrees': ev,
|
||||
'computed_from_expected_degrees': computed,
|
||||
'local_formula_consistency': 'pass' if pass_formula else 'mismatch',
|
||||
'replay_status': 'blocked_missing_complete_input',
|
||||
'missing_for_true_replay': ['question_datetime_local','location','timezone','ayanamsa','node_mode','raw_capture_hash','legal_external_replay'],
|
||||
'upgrade_status': 'not_oracle_ready',
|
||||
'claim_boundary': 'Checks arithmetic consistency of published expected values only; not a true local ephemeris replay.',
|
||||
})
|
||||
data={
|
||||
'scope':'prashna_sphuta_candidate_replay_readiness','created_at':date,'status':'replay_readiness_ready','claim_status':'tooling_observation_only',
|
||||
'production_tuning_allowed':False,'truth_matrix_allowed':False,
|
||||
'summary':{'candidate_count':len(rows),'local_formula_check_pass_count':sum(r['local_formula_consistency']=='pass' for r in rows),'oracle_ready_count':0},
|
||||
'rows':rows,'boundary':'Expected-value arithmetic only; complete Prashna inputs are still required for oracle replay.'
|
||||
}
|
||||
return data
|
||||
|
||||
def main():
|
||||
ap=argparse.ArgumentParser(); ap.add_argument('--date',default='2026-07-20'); args=ap.parse_args()
|
||||
data=build(args.date); OUT.write_text(json.dumps(data,ensure_ascii=False,indent=2,sort_keys=True)+'\n'); print(json.dumps(data,ensure_ascii=False,indent=2,sort_keys=True))
|
||||
if __name__=='__main__': main()
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Arbitrate Prashna Sphuta expected-value mismatches without truth upgrade."""
|
||||
from __future__ import annotations
|
||||
import argparse, json
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
REPLAY = ROOT / "references/oracle/prashna_sphuta_candidate_replay_readiness_2026_07_20.json"
|
||||
OUT = ROOT / "references/oracle/prashna_sphuta_mismatch_arbitration_2026_07_20.json"
|
||||
|
||||
def status(row, key, tol=0.02):
|
||||
exp=row['expected_degrees'][key]; got=row['computed_from_expected_degrees'][key]
|
||||
return 'matches' if abs(((got-exp+180)%360)-180) <= tol else 'mismatch'
|
||||
|
||||
def build(date: str):
|
||||
replay=json.load(open(REPLAY))
|
||||
rows=[]
|
||||
for row in replay['rows']:
|
||||
rows.append({
|
||||
'source_id': row['source_id'], 'url': row['url'],
|
||||
'trisphuta_status': status(row,'trisphuta'),
|
||||
'chatusphuta_status': status(row,'chatusphuta'),
|
||||
'panchasphuta_status': status(row,'panchasphuta'),
|
||||
'candidate_causes': ['formula_variant','source_transcription','chatusphuta_catusphuta_naming','incomplete_input_settings'],
|
||||
'next_evidence_owner': 'worked_example_collection',
|
||||
'next_evidence': ['raw scan/page capture','complete example input','independent translation/transcription check','legal external replay'],
|
||||
'upgrade_status': 'not_oracle_ready',
|
||||
'claim_boundary': 'Mismatch queue only; do not tune formulas or upgrade Prashna truth from this packet.',
|
||||
})
|
||||
sources=[
|
||||
{'source_id':'vedastro_prasna_marga_ch5_sphuta_example','url':'https://vedastro.org/book/PrasnaMarga/Chapter5','source_role':'numeric_candidate','upgrade_status':'candidate_not_oracle'},
|
||||
{'source_id':'internet_archive_prasna_marga_bv_raman_sphuta_fragment','url':'https://archive.org/details/PrasnaMarga/','source_role':'public_formula_numeric_fragment_candidate','upgrade_status':'candidate_not_oracle'},
|
||||
]
|
||||
return {'scope':'prashna_sphuta_mismatch_arbitration','created_at':date,'status':'arbitration_queue_ready','claim_status':'open_queue','production_tuning_allowed':False,'truth_matrix_allowed':False,'summary':{'mismatch_count':sum(r['chatusphuta_status']=='mismatch' or r['panchasphuta_status']=='mismatch' for r in rows),'source_candidate_count':len(sources),'oracle_ready_count':0},'rows':rows,'source_candidates':sources,'boundary':'Queue records candidate causes; closure requires raw source and replay evidence.'}
|
||||
|
||||
def main():
|
||||
ap=argparse.ArgumentParser(); ap.add_argument('--date',default='2026-07-20'); args=ap.parse_args()
|
||||
data=build(args.date); OUT.write_text(json.dumps(data,ensure_ascii=False,indent=2,sort_keys=True)+'\n'); print(json.dumps(data,ensure_ascii=False,indent=2,sort_keys=True))
|
||||
if __name__=='__main__': main()
|
||||
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Prepare an isolated temporary dependency path for VedicAstro KP probes.
|
||||
|
||||
Installs only under /tmp/vedicastro_flatlib_probe. Never mutates project
|
||||
requirements, venvs, package-locks, or runtime dependencies.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import importlib.metadata
|
||||
import json
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
TARGET = Path("/tmp/vedicastro_flatlib_probe")
|
||||
REQUIRED_PACKAGES = {
|
||||
"flatlib": "git+https://github.com/diliprk/flatlib.git@sidereal#egg=flatlib",
|
||||
"polars": "polars",
|
||||
"timezonefinder": "timezonefinder",
|
||||
"pyswisseph": "pyswisseph",
|
||||
}
|
||||
|
||||
|
||||
def stable(data: Any) -> str:
|
||||
return json.dumps(data, ensure_ascii=False, sort_keys=True, separators=(",", ":"), default=str)
|
||||
|
||||
|
||||
def digest_tree(path: Path) -> str | None:
|
||||
if not path.exists():
|
||||
return None
|
||||
h = hashlib.sha256()
|
||||
for file in sorted(p for p in path.rglob("*") if p.is_file()):
|
||||
rel = file.relative_to(path).as_posix()
|
||||
h.update(rel.encode("utf-8"))
|
||||
try:
|
||||
h.update(file.read_bytes())
|
||||
except OSError:
|
||||
continue
|
||||
return h.hexdigest()
|
||||
|
||||
|
||||
def package_versions(target: Path) -> dict[str, str | None]:
|
||||
sys.path.insert(0, str(target))
|
||||
versions: dict[str, str | None] = {}
|
||||
for name in REQUIRED_PACKAGES:
|
||||
try:
|
||||
versions[name] = importlib.metadata.version(name)
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
versions[name] = None
|
||||
return versions
|
||||
|
||||
|
||||
def install(target: Path) -> dict[str, Any]:
|
||||
target.mkdir(parents=True, exist_ok=True)
|
||||
cmd = [
|
||||
sys.executable,
|
||||
"-m",
|
||||
"pip",
|
||||
"install",
|
||||
"--upgrade",
|
||||
"--target",
|
||||
str(target),
|
||||
*REQUIRED_PACKAGES.values(),
|
||||
]
|
||||
proc = subprocess.run(cmd, text=True, capture_output=True, timeout=180)
|
||||
return {
|
||||
"command": cmd,
|
||||
"returncode": proc.returncode,
|
||||
"stdout_tail": proc.stdout[-4000:],
|
||||
"stderr_tail": proc.stderr[-4000:],
|
||||
}
|
||||
|
||||
|
||||
def build_payload(target: Path, install_result: dict[str, Any] | None = None) -> dict[str, Any]:
|
||||
versions = package_versions(target) if target.exists() else {name: None for name in REQUIRED_PACKAGES}
|
||||
ready = all(versions.values())
|
||||
payload: dict[str, Any] = {
|
||||
"scope": "vedicastro_kp_tmp_env_preparer",
|
||||
"created_at": "2026-07-21",
|
||||
"target": str(target),
|
||||
"project_dependency_mutation_allowed": False,
|
||||
"required_packages": REQUIRED_PACKAGES,
|
||||
"package_versions": versions,
|
||||
"target_tree_hash": digest_tree(target),
|
||||
"claim_status": "runtime_dependency_ready" if ready else "blocked_runtime_dependency",
|
||||
"production_tuning_allowed": False,
|
||||
"truth_matrix_allowed": False,
|
||||
"boundary": "dependency_preparation_only_no_kp_oracle_truth",
|
||||
}
|
||||
if install_result is not None:
|
||||
payload["install_result"] = install_result
|
||||
return payload
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--target", default=str(TARGET))
|
||||
ap.add_argument("--report-only", action="store_true")
|
||||
ap.add_argument("--clean", action="store_true")
|
||||
args = ap.parse_args()
|
||||
target = Path(args.target)
|
||||
if args.clean and target.exists() and str(target).startswith("/tmp/"):
|
||||
shutil.rmtree(target)
|
||||
install_result = None if args.report_only else install(target)
|
||||
payload = build_payload(target, install_result)
|
||||
print(json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True))
|
||||
return 0 if args.report_only or payload["claim_status"] == "runtime_dependency_ready" else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -467,11 +467,11 @@ Examples:
|
||||
footer_cn = """<div class="footer-note">
|
||||
本报告基于传统吠陀占星方法(Parashari Jyotish | KN Rao School)。<br>
|
||||
每项结论均有量化行星指标支撑。仅供自我反思与战略思考参考。<br>
|
||||
Powered by Jyotish Engine v6.9.7 & Swiss Ephemeris</div>"""
|
||||
Powered by Jyotish Engine v6.9.14 & Swiss Ephemeris</div>"""
|
||||
footer_en = """<div class="footer-note">
|
||||
Generated using traditional Vedic astrological methods (Parashari Jyotish | KN Rao School).<br>
|
||||
Every claim backed by quantified planetary metrics. For self-reflection purposes only.<br>
|
||||
Powered by Jyotish Engine v6.9.7 & Swiss Ephemeris</div>"""
|
||||
Powered by Jyotish Engine v6.9.14 & Swiss Ephemeris</div>"""
|
||||
footer = footer_cn if lang == "cn" else footer_en
|
||||
|
||||
html_lang = "zh-CN" if lang == "cn" else "en"
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build field-level Shadbala component closure tickets from same-unit rows."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
from collections import Counter, defaultdict
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SAME_UNIT = ROOT / "references/oracle/shadbala_same_unit_normalizer_2026_07_19.json"
|
||||
SOURCE_KB = ROOT / "references/oracle/formula_source_knowledge_base_2026_07_19.json"
|
||||
|
||||
|
||||
def stable_json(data: Any) -> str:
|
||||
return json.dumps(data, ensure_ascii=False, sort_keys=True, separators=(",", ":"), default=str)
|
||||
|
||||
|
||||
def source_by_component() -> dict[str, dict[str, Any]]:
|
||||
raw = json.loads(SOURCE_KB.read_text(encoding="utf-8"))
|
||||
out: dict[str, dict[str, Any]] = {}
|
||||
for formula in raw.get("formulas", []):
|
||||
if formula.get("family") == "Shadbala" and formula.get("component") not in {"total", None}:
|
||||
out[formula["component"]] = formula
|
||||
return out
|
||||
|
||||
|
||||
def owner_for(classification: str) -> str:
|
||||
if classification == "within_1_virupa_observation":
|
||||
return "ready_for_tolerance_freeze"
|
||||
if classification == "method_variant":
|
||||
return "method_variant_decision"
|
||||
if classification == "formula_or_unit_mismatch":
|
||||
return "formula_source_arbitration"
|
||||
return "worked_example_numeric_oracle"
|
||||
|
||||
|
||||
def closure_for(classification: str) -> str:
|
||||
if classification == "within_1_virupa_observation":
|
||||
return "same_unit_observation_ready_tolerance_not_frozen"
|
||||
if classification == "method_variant":
|
||||
return "method_variant_unresolved"
|
||||
if classification == "formula_or_unit_mismatch":
|
||||
return "formula_or_unit_mismatch_unresolved"
|
||||
return "insufficient_numeric_sources"
|
||||
|
||||
|
||||
def required_evidence(classification: str) -> list[str]:
|
||||
common = [
|
||||
"public numeric worked example with birth data/settings",
|
||||
"explicit Virupa/Rupa unit declaration",
|
||||
]
|
||||
if classification == "method_variant":
|
||||
return common + ["variant selection note: preserve method_variant if authoritative sources diverge"]
|
||||
if classification == "formula_or_unit_mismatch":
|
||||
return common + ["component formula/source arbitration across local, jyotishganit, Xalen, VP Jain"]
|
||||
if classification == "within_1_virupa_observation":
|
||||
return common + ["freeze tolerance and add second public case before parity upgrade"]
|
||||
return common + ["recover missing numeric raw/hash"]
|
||||
|
||||
|
||||
def build() -> dict[str, Any]:
|
||||
same_unit = json.loads(SAME_UNIT.read_text(encoding="utf-8"))
|
||||
sources = source_by_component()
|
||||
tickets: list[dict[str, Any]] = []
|
||||
|
||||
for row in same_unit["rows"]:
|
||||
component = row["component"]
|
||||
source = sources.get(component, {})
|
||||
classification = row["classification"]
|
||||
tickets.append(
|
||||
{
|
||||
"ticket_id": f"shadbala.{row['planet'].lower()}.{component}",
|
||||
"planet": row["planet"],
|
||||
"component": component,
|
||||
"canonical_component": row["canonical_component"],
|
||||
"same_unit_classification": classification,
|
||||
"closure_status": closure_for(classification),
|
||||
"next_evidence_owner": owner_for(classification),
|
||||
"unit_contract": source.get("unit_contract", "Virupa/Rupa unit source required."),
|
||||
"known_variants": source.get("known_variants", []),
|
||||
"source_evidence": source.get("source_evidence", []),
|
||||
"required_evidence": required_evidence(classification),
|
||||
"normalized_values_virupa": {
|
||||
"jyotishganit": row.get("jyotishganit_virupa"),
|
||||
"xalen": row.get("xalen_virupa"),
|
||||
"local": row.get("local_from_xalen_report_virupa"),
|
||||
"vp_jain_published": row.get("vp_jain_published_virupa"),
|
||||
"vp_jain_local": row.get("vp_jain_local_virupa"),
|
||||
},
|
||||
"claim_boundary": (
|
||||
"Do not promote this component row to absolute parity until formula variant, "
|
||||
"unit contract, and public numeric worked example all close."
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
counts = Counter(ticket["same_unit_classification"] for ticket in tickets)
|
||||
by_component: dict[str, Counter[str]] = defaultdict(Counter)
|
||||
for ticket in tickets:
|
||||
by_component[ticket["component"]][ticket["same_unit_classification"]] += 1
|
||||
|
||||
component_hotspots = []
|
||||
for component in sorted(by_component):
|
||||
c = by_component[component]
|
||||
component_hotspots.append(
|
||||
{
|
||||
"component": component,
|
||||
"ticket_count": sum(c.values()),
|
||||
"within_1_virupa_observation_count": c["within_1_virupa_observation"],
|
||||
"method_variant_count": c["method_variant"],
|
||||
"formula_or_unit_mismatch_count": c["formula_or_unit_mismatch"],
|
||||
"insufficient_numeric_sources_count": c["insufficient_numeric_sources"],
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
"scope": "shadbala_component_closure_queue_v2",
|
||||
"created_at": "2026-07-19",
|
||||
"status": "field_level_queue_ready",
|
||||
"claim_status": "partial",
|
||||
"production_tuning_allowed": False,
|
||||
"truth_matrix_allowed": False,
|
||||
"sources": {
|
||||
"same_unit_matrix": str(SAME_UNIT.relative_to(ROOT)),
|
||||
"formula_source_knowledge_base": str(SOURCE_KB.relative_to(ROOT)),
|
||||
},
|
||||
"summary": {
|
||||
"ticket_count": len(tickets),
|
||||
"within_1_virupa_observation_count": counts["within_1_virupa_observation"],
|
||||
"method_variant_count": counts["method_variant"],
|
||||
"formula_or_unit_mismatch_count": counts["formula_or_unit_mismatch"],
|
||||
"insufficient_numeric_sources_count": counts["insufficient_numeric_sources"],
|
||||
"absolute_parity_ready_count": 0,
|
||||
},
|
||||
"queue_hash": hashlib.sha256(stable_json(tickets).encode("utf-8")).hexdigest(),
|
||||
"component_hotspots": component_hotspots,
|
||||
"tickets": tickets,
|
||||
"boundary": "Field-level Shadbala closure queue only; no majority-vote truth or production tuning upgrade.",
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
print(json.dumps(build(), ensure_ascii=False, indent=2, sort_keys=True))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Audit KP/Gochara/Muhurta/Panchanga fragments and runtime entrypoints."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def _text(path: Path) -> str:
|
||||
return path.read_text(encoding="utf-8", errors="ignore") if path.exists() else ""
|
||||
|
||||
|
||||
def build_audit(root: Path) -> dict:
|
||||
api = _text(root / "scripts/jyotish_api_server.py")
|
||||
research_main_js = _text(root / "jyotish-app/main.js")
|
||||
commercial_page = _text(root / "frontend/src/app/page.tsx")
|
||||
dashaflow_muhurtha = root / "references/open_source_sources/dashaflow/muhurtha.py"
|
||||
panchanga_license = _text(root / "references/open_source_sources/panchanga_api/LICENSE").splitlines()
|
||||
kp_reference = root / "/Users/wuyongnaren/.workbuddy/backups/jyotish-vedic-astrology-20260711-154109/references/kp-astrology-complete-system.md"
|
||||
gochara_template = Path("/tmp/jyotisha-optimize/assets/event_timing_template.md")
|
||||
panchanga_called = (
|
||||
"/api/panchanga_range" in api
|
||||
and (
|
||||
("panchanga-range" in research_main_js and "panchanga-csv" in research_main_js)
|
||||
or ("panchanga-range" in commercial_page and "panchanga-csv" in commercial_page)
|
||||
)
|
||||
)
|
||||
|
||||
items = [
|
||||
{
|
||||
"technique_id": "panchanga_calendar",
|
||||
"current_call_status": "formally_called_in_api_and_web" if panchanga_called else "partial",
|
||||
"main_artifacts": [
|
||||
"scripts/jyotish_api_server.py",
|
||||
"frontend/src/app/page.tsx",
|
||||
"jyotish-app/main.js (research static UI only, absent in commercial repo)",
|
||||
],
|
||||
"external_or_reference_artifacts": ["references/open_source_sources/panchanga_api"],
|
||||
"reuse_decision": "do_not_duplicate_runtime",
|
||||
"source_or_license_boundary": "Existing runtime/UI present; panchanga_api license observed as "
|
||||
+ (panchanga_license[0] if panchanga_license else "unknown")
|
||||
+ ". Treat external panchanga_api as reference unless license/API contract is separately audited.",
|
||||
"next_action": "add panchanga claim/display contract and source/oracle packet for tithi/nakshatra/yoga/karana/rahu-kalam outputs",
|
||||
"claim_boundary": "Panchanga is runtime-visible but still needs field-level external oracle examples for high-rigor claims.",
|
||||
},
|
||||
{
|
||||
"technique_id": "muhurta_dashaflow_candidate",
|
||||
"current_call_status": "oss_reference_not_main_runtime",
|
||||
"main_artifacts": [],
|
||||
"external_or_reference_artifacts": [str(dashaflow_muhurtha)],
|
||||
"reuse_decision": "license_audit_before_reuse",
|
||||
"source_or_license_boundary": "dashaflow/muhurtha.py exists under references/open_source_sources; verify license and formula sources before adapting.",
|
||||
"next_action": "audit dashaflow license, extract formula surface, then compare Tarabala/Chandrabala/Rahu Kalam against local Panchanga.",
|
||||
"claim_boundary": "Muhurta remains reference-only until license, formula, and worked examples close.",
|
||||
},
|
||||
{
|
||||
"technique_id": "kp_astrology",
|
||||
"current_call_status": "reference_only_not_main_runtime",
|
||||
"main_artifacts": [],
|
||||
"external_or_reference_artifacts": [str(kp_reference)],
|
||||
"reuse_decision": "reference_only",
|
||||
"source_or_license_boundary": "KP backup/reference may contain useful notes but must pass privacy/license/source audit; do not copy blindly.",
|
||||
"next_action": "create KP separate track: cusp system, ayanamsa, star lord/sub lord, ruling planets, public oracle examples.",
|
||||
"claim_boundary": "KP is not part of current main Jyotish runtime truth.",
|
||||
},
|
||||
{
|
||||
"technique_id": "gochara_event_timing_template",
|
||||
"current_call_status": "template_reference_not_main_runtime",
|
||||
"main_artifacts": [],
|
||||
"external_or_reference_artifacts": [str(gochara_template)],
|
||||
"reuse_decision": "reference_only",
|
||||
"source_or_license_boundary": "Template in /tmp must be privacy/source reviewed before promotion.",
|
||||
"next_action": "turn Gochara template into scoring contract only after Dasha+Varga+Transit features and negative holdout are ready.",
|
||||
"claim_boundary": "Transit template is not a calibrated timing engine.",
|
||||
},
|
||||
]
|
||||
return {
|
||||
"scope": "technique_promotion_audit_kp_gochara_muhurta",
|
||||
"created_at": "2026-07-19",
|
||||
"truth_policy": "runtime_presence_not_oracle_closure",
|
||||
"production_tuning_allowed": False,
|
||||
"summary": {
|
||||
"items_checked": len(items),
|
||||
"formally_called_count": sum("formally_called" in item["current_call_status"] for item in items),
|
||||
"reference_only_count": sum("not_main_runtime" in item["current_call_status"] or "template_reference" in item["current_call_status"] for item in items),
|
||||
},
|
||||
"items": items,
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--root", type=Path, default=Path("."))
|
||||
parser.add_argument("--output", type=Path)
|
||||
args = parser.parse_args()
|
||||
audit = build_audit(args.root)
|
||||
text = json.dumps(audit, ensure_ascii=False, indent=2, sort_keys=True) + "\n"
|
||||
if args.output:
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.output.write_text(text, encoding="utf-8")
|
||||
print(text, end="")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -13,9 +13,6 @@ from typing import Any
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
SCRIPTS = ROOT / "scripts"
|
||||
if str(SCRIPTS) not in sys.path:
|
||||
sys.path.insert(0, str(SCRIPTS))
|
||||
|
||||
from benchmarks.jyotish.scripts.run_pyjhora_compare import build_pyjhora_sample
|
||||
from benchmarks.jyotish.scripts.run_skill_baseline import run_sample
|
||||
|
||||
@@ -82,16 +82,52 @@ def arbitrate_manifest(path: str | Path) -> dict[str, Any]:
|
||||
}
|
||||
|
||||
|
||||
def render_markdown_report(report: dict[str, Any]) -> str:
|
||||
lines = [
|
||||
"# Three-engine mismatch arbitration",
|
||||
"",
|
||||
f"manifest: `{report['manifest_path']}`",
|
||||
f"status: `{report['status']}`",
|
||||
f"truth_policy: `{report['truth_policy']}`",
|
||||
"commercial_sync: `status_and_claim_boundary_only`",
|
||||
f"mismatch_count: `{report['mismatch_count']}`",
|
||||
f"classified_count: `{report['classified_count']}`",
|
||||
f"unclassified_count: `{report['unclassified_count']}`",
|
||||
"",
|
||||
"Do not copy raw research debt into commercial runtime. Commercial receives readiness, claim boundary, and user-safe status only.",
|
||||
"",
|
||||
"## Category counts",
|
||||
"",
|
||||
"| category | count |",
|
||||
"|---|---:|",
|
||||
]
|
||||
for category, count in report["category_counts"].items():
|
||||
lines.append(f"| `{category}` | {count} |")
|
||||
lines.extend(["", "## Closure requirements", ""])
|
||||
seen: set[str] = set()
|
||||
for row in report["rows"]:
|
||||
category = row["category"]
|
||||
if category in seen:
|
||||
continue
|
||||
seen.add(category)
|
||||
lines.append(f"- `{category}`: {row['closure_requirement']}")
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("manifest", nargs="?", default="references/oracle/three_engine_parity_replay_manifest.json")
|
||||
parser.add_argument("--output", type=Path)
|
||||
parser.add_argument("--markdown-output", type=Path)
|
||||
args = parser.parse_args()
|
||||
report = arbitrate_manifest(args.manifest)
|
||||
text = json.dumps(report, ensure_ascii=False, indent=2, sort_keys=True) + "\n"
|
||||
if args.output:
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.output.write_text(text, encoding="utf-8")
|
||||
if args.markdown_output:
|
||||
args.markdown_output.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.markdown_output.write_text(render_markdown_report(report), encoding="utf-8")
|
||||
print(text, end="")
|
||||
return 0
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Create actionable closure tickets for three-engine mismatch rows."""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
POLICY = {
|
||||
"endpoint_or_varga_semantics": ("P0", "endpoint_contract", "identified endpoint/method contract with ayanamsa, node mode, varga, timezone semantics"),
|
||||
"shadbala_formula_variant": ("P0", "formula_source", "public formula source + unit/cap/floor evidence for the component"),
|
||||
"derived_total_from_component_variants": ("P1", "unit_schema", "component closure before total recomputation; explicit Rupa/Virupa total rule"),
|
||||
"ashtakavarga_table_or_contributor_variant": ("P1", "worked_example", "public worked BAV/SAV table with contributor set, shodhana state, and Lagna inclusion"),
|
||||
}
|
||||
|
||||
|
||||
def build_queue(arbitration_path: str | Path) -> dict[str, Any]:
|
||||
path = Path(arbitration_path)
|
||||
report = json.loads(path.read_text(encoding="utf-8"))
|
||||
tickets = []
|
||||
for index, row in enumerate(report.get("rows") or [], start=1):
|
||||
priority, owner_track, required = POLICY.get(
|
||||
row["category"],
|
||||
("P2", "worked_example", "manual source review and worked example required"),
|
||||
)
|
||||
tickets.append({
|
||||
"ticket_id": f"TEMCQ-{index:03d}",
|
||||
"priority": priority,
|
||||
"owner_track": owner_track,
|
||||
"section": row.get("section"),
|
||||
"field": row.get("field"),
|
||||
"category": row.get("category"),
|
||||
"differing_engines": row.get("differing_engines") or [],
|
||||
"required_evidence": required,
|
||||
"closure_status": "open",
|
||||
"commercial_visibility": "do_not_expose_raw",
|
||||
})
|
||||
return {
|
||||
"scope": "three_engine_mismatch_closure_queue",
|
||||
"source_arbitration": str(path),
|
||||
"status": "open" if tickets else "empty",
|
||||
"truth_policy": "no_majority_vote",
|
||||
"production_tuning_allowed": False,
|
||||
"summary": {
|
||||
"source_mismatch_count": report.get("mismatch_count", 0),
|
||||
"queue_count": len(tickets),
|
||||
"priority_counts": dict(Counter(ticket["priority"] for ticket in tickets)),
|
||||
"owner_track_counts": dict(Counter(ticket["owner_track"] for ticket in tickets)),
|
||||
},
|
||||
"queue": tickets,
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("arbitration", nargs="?", default="references/oracle/three_engine_mismatch_arbitration_2026_07_19.json")
|
||||
parser.add_argument("--output", type=Path)
|
||||
args = parser.parse_args()
|
||||
queue = build_queue(args.arbitration)
|
||||
text = json.dumps(queue, ensure_ascii=False, indent=2, sort_keys=True) + "\n"
|
||||
if args.output:
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.output.write_text(text, encoding="utf-8")
|
||||
print(text, end="")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Capture official VedAstro divisional-degree evidence without overclaiming chart parity."""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from scripts.vedastro_contract_probe import _post
|
||||
from scripts import varga
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DIVISIONS = (2, 4, 9, 10)
|
||||
|
||||
|
||||
def probe(*, total_degrees: float, timeout: float) -> dict[str, Any]:
|
||||
rows: dict[str, dict[str, Any]] = {}
|
||||
all_match = True
|
||||
for division in DIVISIONS:
|
||||
official = _post(
|
||||
"DivisionalLongitude",
|
||||
{"totalDegrees": total_degrees, "divisionalNo": division},
|
||||
timeout,
|
||||
)
|
||||
payload = official.get("payload") or {}
|
||||
value = (payload.get("DivisionalLongitude") or {}).get("TotalDegrees")
|
||||
local = varga.calc_varga(total_degrees, division)["degree_in_sign"]
|
||||
try:
|
||||
official_degree = float(value)
|
||||
except (TypeError, ValueError):
|
||||
official_degree = None
|
||||
matches_local = official.get("status") == "Pass" and official_degree == local
|
||||
all_match = all_match and matches_local
|
||||
rows[f"D{division}"] = {
|
||||
"official_status": official.get("status"),
|
||||
"official_degree": official_degree,
|
||||
"local_degree": local,
|
||||
"matches_local": matches_local,
|
||||
"request_body_hash": official.get("request_body_hash"),
|
||||
"response_payload_hash": official.get("response_payload_hash"),
|
||||
"raw_hash": official.get("raw_hash"),
|
||||
}
|
||||
return {
|
||||
"scope": "vedastro_divisional_degree_contract_probe",
|
||||
"input_total_degrees": total_degrees,
|
||||
"contract_status": "degree_mapping_verified" if all_match else "blocked",
|
||||
"chart_sign_contract": "blocked",
|
||||
"boundary": (
|
||||
"This probe validates only the divisional degree transformation. "
|
||||
"It does not establish complete D2/D4/D9/D10 sign, ayanamsa, node, "
|
||||
"timezone, or hosted-endpoint chart parity."
|
||||
),
|
||||
"rows": rows,
|
||||
"privacy": {"api_key_persisted": False},
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--total-degrees", type=float, default=3.5)
|
||||
parser.add_argument("--timeout", type=float, default=20.0)
|
||||
parser.add_argument(
|
||||
"--output",
|
||||
type=Path,
|
||||
default=ROOT / "references" / "oracle" / "artifacts" / "vedastro_divisional_degree_contract_probe.json",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
report = probe(total_degrees=args.total_degrees, timeout=args.timeout)
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.output.write_text(json.dumps(report, ensure_ascii=False, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print(json.dumps({"contract_status": report["contract_status"], "output": str(args.output)}, ensure_ascii=False))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user