feat: sync closure planning queues

This commit is contained in:
732642856
2026-07-20 00:41:29 +08:00
parent 0f3c916e96
commit d61d75deef
10 changed files with 649 additions and 21 deletions
@@ -0,0 +1,79 @@
#!/usr/bin/env python3
"""Build an actionable queue for domains blocked by production-ready claim gate."""
from __future__ import annotations
import argparse
import json
from pathlib import Path
from typing import Any
from scripts.claim_audit_runtime_gate_report import build as build_gate_report
ROOT = Path(__file__).resolve().parents[1]
INDEX = ROOT / "references/oracle/evidence_packet_index_2026_07_19.json"
RESOLUTION = {
"closure_governance": ("gate_snapshot_refresh", "blocked_subgates", False),
"high_rigor_governance": ("refresh_snapshot_after_subgate_changes", "blocked_subgates", False),
"external_oracle_identity": ("archive_self_host_or_upstream_identity_metadata", "upstream_build_identity", False),
"timing_holdout": ("prepare_blind_eval_after_labels", "independent_human_labels", False),
"three_engine_parity": ("continue_field_level_attribution", "field_source_oracle_arbitration", True),
"kp_precision_timing": ("collect_exact_cusp_numeric_packet", "public_kp_worked_example", True),
"worked_example_collection": ("promote_field_complete_candidates_to_numeric_packets", "public_numeric_worked_examples", True),
"horary_annual_sensitive_points": ("collect_prashna_tajika_saham_gulika_sphuta_packets", "public_numeric_worked_examples", True),
"varga_mapping": ("promote_d1_d60_sources_to_verified_packets", "public_varga_formula_sources", True),
"conception_chart": ("keep_research_registry_until_source_oracle", "classical_source_and_oracle", False),
}
CODE_ONLY_CLOSABLE_DEPENDENCIES = {"blocked_subgates"}
def build(date: str) -> dict[str, Any]:
gate = build_gate_report(INDEX, "production_ready")
blocked = [row for row in gate["domains"] if row["decision"] == "block"]
domains = []
for row in blocked:
local_next_action, hard_dependency, code_can_progress = RESOLUTION.get(
row["domain"], ("triage_blocked_domain", "unknown_dependency", True)
)
domains.append(
{
"domain": row["domain"],
"blocking_packets": row["blocking_packets"],
"local_next_action": local_next_action,
"hard_dependency": hard_dependency,
"code_can_progress_without_truth_upgrade": code_can_progress,
"claim_boundary": "Do not change claim status until blocking packets close with reproducible evidence.",
}
)
return {
"scope": "blocked_domain_resolution_queue",
"created_at": date,
"status": "open_queue",
"claim_status": "open_queue",
"production_tuning_allowed": False,
"source_gate_report_summary": gate["summary"],
"summary": {
"blocked_domain_count": len(domains),
"code_can_progress_count": sum(1 for row in domains if row["code_can_progress_without_truth_upgrade"]),
"cannot_be_closed_by_code_only_count": sum(
1 for row in domains if row["hard_dependency"] not in CODE_ONLY_CLOSABLE_DEPENDENCIES
),
},
"domains": domains,
"boundary": "Resolution queue prioritizes work; it does not unblock production-ready claims.",
}
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--date", default="2026-07-20")
args = parser.parse_args()
print(json.dumps(build(args.date), ensure_ascii=False, indent=2, sort_keys=True))
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,77 @@
#!/usr/bin/env python3
"""Group three-engine mismatch tickets by owner track for closure planning."""
from __future__ import annotations
import argparse
import json
from collections import defaultdict
from pathlib import Path
from typing import Any
ROOT = Path(__file__).resolve().parents[1]
QUEUE = ROOT / "references/oracle/three_engine_mismatch_closure_queue_2026_07_19.json"
PROGRESS = ROOT / "references/oracle/three_engine_mismatch_progress_ledger_2026_07_19.json"
def build(date: str) -> dict[str, Any]:
queue = json.loads(QUEUE.read_text(encoding="utf-8"))
progress = json.loads(PROGRESS.read_text(encoding="utf-8"))
already = {
(row["section"], row["field"])
for row in progress.get("attributed_rows", [])
if row.get("closure_state") == "attributed_no_tuning"
}
groups: dict[str, list[dict[str, Any]]] = defaultdict(list)
for row in queue["queue"]:
if (row["section"], row["field"].split(".")[0]) in already:
continue
groups[row["owner_track"]].append(row)
batches = []
for owner_track in sorted(groups):
rows = groups[owner_track]
batches.append(
{
"owner_track": owner_track,
"ticket_count": len(rows),
"priorities": sorted({row["priority"] for row in rows}),
"categories": sorted({row["category"] for row in rows}),
"sample_ticket_ids": [row["ticket_id"] for row in rows[:5]],
"next_evidence": sorted({row["required_evidence"] for row in rows}),
"claim_boundary": "Batch planning only; does not close mismatches, tune production, or majority-vote truth.",
}
)
return {
"scope": "three_engine_owner_track_batch_plan",
"created_at": date,
"status": "open_queue",
"claim_status": "open_queue",
"production_tuning_allowed": False,
"truth_matrix_allowed": False,
"source_queue": str(QUEUE.relative_to(ROOT)),
"source_progress": str(PROGRESS.relative_to(ROOT)),
"summary": {
"source_queue_count": len(queue["queue"]),
"already_attributed_count": len(already),
"remaining_ticket_count": max(len(queue["queue"]) - len(already), 0),
"batched_source_row_count": sum(batch["ticket_count"] for batch in batches),
"owner_track_count": len(batches),
},
"batches": batches,
"boundary": "Prioritized owner-track batch plan for remaining three-engine mismatches; no claim is upgraded.",
}
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--date", default="2026-07-20")
args = parser.parse_args()
print(json.dumps(build(args.date), ensure_ascii=False, indent=2, sort_keys=True))
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,82 @@
#!/usr/bin/env python3
"""Normalize public worked-example candidates into numeric-packet eligibility rows."""
from __future__ import annotations
import argparse
import json
from pathlib import Path
from typing import Any
ROOT = Path(__file__).resolve().parents[1]
AUDIT = ROOT / "references/oracle/public_worked_example_candidate_numeric_audit_2026_07_19.json"
QUEUE = ROOT / "references/oracle/kp_muhurta_shadbala_numeric_packet_queue_2026_07_19.json"
def classify(status: str) -> str:
if status == "runtime_raw_available_public_oracle_missing":
return "runtime_only_public_oracle_missing"
if status == "table_hash_candidate_pending_capture":
return "reference_table_hash_needed"
if status == "worked_example_candidate_pending_raw_capture":
return "raw_capture_needed"
if status == "calculation_reference_pending_fixture":
return "fixture_and_raw_capture_needed"
return "formula_reference_only"
def build(date: str) -> dict[str, Any]:
audit = json.loads(AUDIT.read_text(encoding="utf-8"))
queue = json.loads(QUEUE.read_text(encoding="utf-8"))
required_by_topic = {row["topic"]: row.get("required_fields", []) for row in queue.get("packet_rows", [])}
rows = []
for candidate in audit["candidates"]:
topic = candidate["topic"].replace("KP cusp star/sub/sub-sub", "KP cusp")
missing = list(candidate.get("missing_for_oracle", []))
for field in required_by_topic.get(topic, []):
if field not in missing:
missing.append(field)
rows.append(
{
"topic": topic,
"url": candidate["url"],
"candidate_type": candidate["candidate_type"],
"eligibility_status": classify(candidate["numeric_packet_status"]),
"runtime_observation_available": bool(candidate.get("runtime_observation_available")),
"missing_for_oracle": missing,
"claim_boundary": "Not oracle-ready until exact public input, settings, expected values, raw/hash and replay comparison are archived.",
}
)
return {
"scope": "worked_example_numeric_packet_eligibility",
"created_at": date,
"status": "eligibility_queue_ready",
"claim_status": "open_queue",
"production_tuning_allowed": False,
"truth_matrix_allowed": False,
"sources": {
"candidate_numeric_audit": str(AUDIT.relative_to(ROOT)),
"numeric_packet_queue": str(QUEUE.relative_to(ROOT)),
},
"summary": {
"candidate_count": len(rows),
"oracle_ready_count": 0,
"runtime_only_count": sum(1 for row in rows if row["eligibility_status"] == "runtime_only_public_oracle_missing"),
"raw_capture_needed_count": sum(1 for row in rows if "raw_capture" in row["eligibility_status"]),
},
"rows": rows,
"boundary": "Eligibility queue only; no public numeric candidate is promoted to oracle_ready.",
}
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--date", default="2026-07-20")
args = parser.parse_args()
print(json.dumps(build(args.date), ensure_ascii=False, indent=2, sort_keys=True))
return 0
if __name__ == "__main__":
raise SystemExit(main())