Prioritize VedAstro timing requests

This commit is contained in:
732642856
2026-06-29 15:58:06 +08:00
parent e2595bec13
commit a8f6698463
2 changed files with 42 additions and 14 deletions
+14 -14
View File
@@ -90,6 +90,20 @@ OFFICIAL_SEARCH_EVENTS_PROFILE_VERSION = "official_builder_search_events_v1"
OFFICIAL_FULL_SNAPSHOT_PROFILE_VERSION = "official_full_snapshot_v1"
OFFICIAL_METHOD_CATALOG_URL = "https://vedastro.org/Complete-List-VedAstro-API-Methods-Calculators.html"
OFFICIAL_FULL_SNAPSHOT_METHODS = [
{
"section": "events_overview",
"endpoint_path": OFFICIAL_SEARCH_EVENTS_ENDPOINT_PATH,
"calculator_name": "SearchEvents",
"role": "life_event_raw_evidence",
"description": "Official event radar using SearchEvents for career, marriage and wealth tags.",
},
{
"section": "dasha_all",
"endpoint_path": "/Calculate/DasaAtRange",
"calculator_name": "DasaAtRange",
"role": "all_dasha_raw_evidence",
"description": "Official dasha timeline snapshot where available.",
},
{
"section": "chart_core",
"endpoint_path": "/Calculate/AllPlanetData",
@@ -106,20 +120,6 @@ OFFICIAL_FULL_SNAPSHOT_METHODS = [
"description": "Official house data snapshot when supported by the official service.",
"fanout": "houseName",
},
{
"section": "dasha_all",
"endpoint_path": "/Calculate/DasaAtRange",
"calculator_name": "DasaAtRange",
"role": "all_dasha_raw_evidence",
"description": "Official dasha timeline snapshot where available.",
},
{
"section": "events_overview",
"endpoint_path": OFFICIAL_SEARCH_EVENTS_ENDPOINT_PATH,
"calculator_name": "SearchEvents",
"role": "life_event_raw_evidence",
"description": "Official event radar using SearchEvents for career, marriage and wealth tags.",
},
]
OFFICIAL_FULL_SNAPSHOT_BACKLOG_SECTIONS = [
{
@@ -116,6 +116,34 @@ def test_official_full_snapshot_dasha_request_uses_official_range_contract(monke
assert "time" not in body
def test_official_full_snapshot_prioritizes_timing_sections_before_heavy_fanout(monkeypatch) -> None:
from scripts import vedastro_service_adapter as adapter
monkeypatch.delenv("VEDASTRO_API_ENDPOINT", raising=False)
monkeypatch.delenv("VEDASTRO_ENABLE_NETWORK", raising=False)
report = adapter.run_official_full_snapshot_for_case(
{
"year": REDACTED_YEAR,
"month": 4,
"day": 17,
"hour": 14,
"minute": 49,
"lat": 36.42,
"lon": 114.2,
"tz": 8,
"reference_date": "2026-06-29",
},
case_id="unit_timing_first",
)
order = [item["section"] for item in report["request_manifest"]["requests"]]
assert order[:2] == ["events_overview", "dasha_all"]
assert order.index("events_overview") < order.index("chart_core")
assert order.index("dasha_all") < order.index("house_core")
def test_official_full_snapshot_marks_semantic_rate_limit_payloads(monkeypatch) -> None:
from scripts import vedastro_service_adapter as adapter