feat(skill): validate first shadbala oracle packet

This commit is contained in:
732642856
2026-06-27 01:27:56 +08:00
parent a369c99a7d
commit fec9f23702
13 changed files with 207 additions and 60 deletions
+5 -1
View File
@@ -27,6 +27,7 @@ LOCAL_ENGINE_MARKERS = [
SHADBALA_REQUIRED_PLANETS = ["Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn"]
SHADBALA_REQUIRED_COMPONENTS = ["sthana", "dig", "kala", "chesta", "naisargika", "drik"]
SHADBALA_COMPONENT_MAX_RUPA = 20.0
SHADBALA_DRIK_MIN_RUPA = -20.0
SHADBALA_TOTAL_TOLERANCE_RUPA = 0.05
ASHTAKOOT_SCORE_RANGES = {
"target.total_score": (0.0, 36.0),
@@ -153,7 +154,10 @@ def _validate_shadbala_components(value: Any) -> list[str]:
if not isinstance(component_value, (int, float)) or isinstance(component_value, bool):
problems.append(f"invalid_shadbala_component_type:{planet}.{component}")
continue
if component_value < 0:
if component == "drik" and component_value < SHADBALA_DRIK_MIN_RUPA:
problems.append(f"invalid_shadbala_component_range:{planet}.{component}")
continue
if component != "drik" and component_value < 0:
problems.append(f"invalid_shadbala_component_negative:{planet}.{component}")
continue
if component_value > SHADBALA_COMPONENT_MAX_RUPA:
+20 -2
View File
@@ -58,6 +58,18 @@ def _dasha_readiness(oracle_file: str) -> dict[str, Any]:
return validation["summary"]
def _shadbala_readiness(oracle_file: str) -> dict[str, Any]:
report = _run_json([
PYTHON,
"scripts/shadbala_oracle_closure_status.py",
"--oracle-file",
oracle_file,
"--format",
"json",
])
return report["summary"]
def _boundary_audit(oracle_file: str) -> dict[str, Any]:
report = _run_json([PYTHON, "scripts/oracle_boundary_audit.py", "--oracle-file", oracle_file])
summary = report["summary"]
@@ -78,10 +90,12 @@ def build_dashboard(oracle_file: str) -> dict[str, Any]:
oracle = _oracle_readiness(oracle_file)
boundary = _boundary_audit(oracle_file)
dasha = _dasha_readiness(oracle_file)
shadbala = _shadbala_readiness(oracle_file)
global_first_gap = (
f"Dasha-only external oracle readiness is {dasha['valid_dasha_packets']}/"
f"{dasha['total_dasha_packets']}; Shadbala absolute values still need component-level "
"external evidence, and public long-term benchmark history is not yet comparable to the strongest "
f"{dasha['total_dasha_packets']}; Shadbala external absolute-value readiness is "
f"{shadbala['external_verified_shadbala_tasks']}/{shadbala['shadbala_task_count']}; "
"public long-term benchmark history is not yet comparable to the strongest "
"global open-source projects."
)
can_claim_global_first = bool(
@@ -101,6 +115,7 @@ def build_dashboard(oracle_file: str) -> dict[str, Any]:
},
"oracle_readiness": oracle,
"dasha_oracle_readiness": dasha,
"shadbala_oracle_readiness": shadbala,
"boundary_audit": boundary,
"public_claim": {
"can_claim_global_first": can_claim_global_first,
@@ -122,6 +137,7 @@ def build_dashboard(oracle_file: str) -> dict[str, Any]:
def render_markdown(report: dict[str, Any]) -> str:
oracle = report["oracle_readiness"]
dasha = report["dasha_oracle_readiness"]
shadbala = report["shadbala_oracle_readiness"]
boundary = report["boundary_audit"]
claim = report["public_claim"]
lines = [
@@ -143,6 +159,8 @@ def render_markdown(report: dict[str, Any]) -> str:
f"- production_tuning_allowed: `{str(oracle['production_tuning_allowed']).lower()}`",
f"- valid_dasha_packets: `{dasha['valid_dasha_packets']}`",
f"- total_dasha_packets: `{dasha['total_dasha_packets']}`",
f"- external_verified_shadbala_tasks: `{shadbala['external_verified_shadbala_tasks']}`",
f"- shadbala_task_count: `{shadbala['shadbala_task_count']}`",
"",
"## Boundary Audit",
"",
+18 -8
View File
@@ -83,6 +83,15 @@ def _supporting_missing(packet: dict[str, Any], target_fields: list[str]) -> lis
return missing
def _shadbala_target_filled(task: dict[str, Any]) -> bool:
packet = task.get("evidence_packet", {})
return (
task.get("status") == "external_verified"
and not _supporting_missing(packet, task.get("target_fields", []))
and not _shadbala_missing(packet)
)
def _group_missing_fields(missing_fields: list[str]) -> dict[str, Any]:
metadata_fields = [field for field in missing_fields if field.startswith("metadata.")]
target_fields = [field for field in missing_fields if field.startswith("target.")]
@@ -167,9 +176,14 @@ def build_status(oracle_file: str) -> dict[str, Any]:
task for task in queue.get("tasks", [])
if SHADBALA_TARGET_FIELD in task.get("target_fields", [])
]
priority = next((task for task in shadbala_tasks if task.get("case_id") == FIRST_PRIORITY_CASE_ID), None)
if priority is None and shadbala_tasks:
priority = shadbala_tasks[0]
unverified_shadbala_tasks = [
task for task in shadbala_tasks
if not _shadbala_target_filled(task)
]
priority_pool = unverified_shadbala_tasks or shadbala_tasks
priority = next((task for task in priority_pool if task.get("case_id") == FIRST_PRIORITY_CASE_ID), None)
if priority is None and priority_pool:
priority = priority_pool[0]
if priority is None:
raise RuntimeError("No Shadbala target task found")
@@ -184,11 +198,7 @@ def build_status(oracle_file: str) -> dict[str, Any]:
missing_groups = _group_missing_fields(missing_fields)
external_verified = [
task for task in shadbala_tasks
if (
task.get("status") == "external_verified"
and not _supporting_missing(task.get("evidence_packet", {}), task.get("target_fields", []))
and not _shadbala_missing(task.get("evidence_packet", {}))
)
if _shadbala_target_filled(task)
]
return {