Classify VedAstro capability catalog domains
This commit is contained in:
@@ -190,3 +190,70 @@ def test_vedastro_orchestrator_surfaces_daily_windows_by_domain(monkeypatch) ->
|
||||
|
||||
assert result["daily_windows_by_domain"]["career"][0]["date"] == "2026-07-18"
|
||||
assert result["top_daily_window_by_domain"]["career"]["score"] == 5
|
||||
|
||||
|
||||
def test_vedastro_orchestrator_passes_non_core_themes_to_official_catalog(monkeypatch) -> None:
|
||||
from scripts import vedastro_evidence_orchestrator as orchestrator
|
||||
|
||||
seen_snapshot_cases = []
|
||||
seen_scan_domains = []
|
||||
|
||||
def fake_snapshot(case, *, case_id="user_chart"):
|
||||
seen_snapshot_cases.append(case)
|
||||
return {
|
||||
"status": "partial",
|
||||
"available": True,
|
||||
"section_statuses": {},
|
||||
"source_metadata": {
|
||||
"official_full_capability_catalog": {
|
||||
"status": "partial",
|
||||
"summary": {"catalog_method_count": 641, "unknown_method_count": 0},
|
||||
"domain_routing": {
|
||||
"health": {"method_count": 3, "auto_method_count": 1, "high_priority_methods": ["HealthProblemEvent"]},
|
||||
},
|
||||
"dynamic_selection": {
|
||||
"health": {
|
||||
"requested_theme": "health",
|
||||
"selected_methods": [
|
||||
{
|
||||
"method": "HealthProblemEvent",
|
||||
"citation_id": "vedastro:health:HealthProblemEvent",
|
||||
"execution_policy": "auto",
|
||||
}
|
||||
],
|
||||
"report_reference": {
|
||||
"theme": "health",
|
||||
"citation_ids": ["vedastro:health:HealthProblemEvent"],
|
||||
"auto_count": 1,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
def fake_scan(case, domain, start_date, end_date, case_id):
|
||||
seen_scan_domains.append(domain)
|
||||
return {
|
||||
"status": "unsupported_range_scan_domain",
|
||||
"available": False,
|
||||
"reason": f"Unsupported range scan domain: {domain}",
|
||||
"event_count": 0,
|
||||
"evidence_ledger": [],
|
||||
}
|
||||
|
||||
monkeypatch.setattr(orchestrator, "run_official_full_snapshot_for_case", fake_snapshot)
|
||||
monkeypatch.setattr(orchestrator, "run_range_scan_for_case", fake_scan)
|
||||
|
||||
result = orchestrator.orchestrate_vedastro_evidence(
|
||||
{"year": REDACTED_YEAR, "month": 4, "day": 17, "hour": 14, "minute": 49, "lat": 36.42, "lon": 114.2, "tz": 8},
|
||||
route="health",
|
||||
reference_date="2026-06-30",
|
||||
)
|
||||
|
||||
assert seen_snapshot_cases[0]["themes"] == ["health"]
|
||||
assert seen_scan_domains == ["health"]
|
||||
assert result["source_metadata"]["official_report_references"]["health"]["citation_ids"] == [
|
||||
"vedastro:health:HealthProblemEvent"
|
||||
]
|
||||
assert result["source_metadata"]["domain_statuses"]["health"] == "unsupported_range_scan_domain"
|
||||
|
||||
@@ -374,3 +374,134 @@ def test_official_capability_runner_builds_dynamic_theme_selection_and_citations
|
||||
assert marriage["needs_user_context_methods"][0]["method"] == "MatchReport"
|
||||
assert marriage["needs_user_context_methods"][0]["citation_id"] == "vedastro:marriage:MatchReport"
|
||||
assert marriage["report_reference"]["needs_user_context_count"] == 1
|
||||
|
||||
|
||||
def test_full_catalog_classification_marks_non_core_domains_and_unknowns() -> None:
|
||||
completed = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"scripts/vedastro_official_capability_runner.py",
|
||||
"--bundle",
|
||||
"official_full_capability_catalog",
|
||||
"--birth-json",
|
||||
json.dumps(
|
||||
{
|
||||
"year": REDACTED_YEAR,
|
||||
"month": 4,
|
||||
"day": 17,
|
||||
"hour": 14,
|
||||
"minute": 49,
|
||||
"lat": 36.42,
|
||||
"lon": 114.2,
|
||||
"tz": 8,
|
||||
"reference_date": "2026-06-29",
|
||||
"themes": ["health", "education", "property", "children", "migration", "prashna"],
|
||||
}
|
||||
),
|
||||
],
|
||||
cwd=ROOT,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
timeout=120,
|
||||
check=False,
|
||||
env={
|
||||
**dict(**__import__("os").environ),
|
||||
"VEDASTRO_OFFICIAL_CAPABILITY_CATALOG_STUB": json.dumps(
|
||||
{
|
||||
"available": True,
|
||||
"status": "ok",
|
||||
"capabilities": [
|
||||
{
|
||||
"method": "HealthProblemEvent",
|
||||
"signature": "(birthTime, startTime, endTime)",
|
||||
"bucket": "event_range",
|
||||
"parameter_names": ["birthTime", "startTime", "endTime"],
|
||||
"callable": True,
|
||||
},
|
||||
{
|
||||
"method": "EducationDegreeYoga",
|
||||
"signature": "(birthTime)",
|
||||
"bucket": "birth_time_only",
|
||||
"parameter_names": ["birthTime"],
|
||||
"callable": True,
|
||||
},
|
||||
{
|
||||
"method": "PropertyHouseVehicleResult",
|
||||
"signature": "(birthTime)",
|
||||
"bucket": "birth_time_only",
|
||||
"parameter_names": ["birthTime"],
|
||||
"callable": True,
|
||||
},
|
||||
{
|
||||
"method": "ChildrenProgenyPromise",
|
||||
"signature": "(birthTime)",
|
||||
"bucket": "birth_time_only",
|
||||
"parameter_names": ["birthTime"],
|
||||
"callable": True,
|
||||
},
|
||||
{
|
||||
"method": "ForeignTravelMigrationEvent",
|
||||
"signature": "(birthTime, startTime, endTime)",
|
||||
"bucket": "event_range",
|
||||
"parameter_names": ["birthTime", "startTime", "endTime"],
|
||||
"callable": True,
|
||||
},
|
||||
{
|
||||
"method": "PrashnaHoraryJudgement",
|
||||
"signature": "(queryTime, questionText)",
|
||||
"bucket": "query_text",
|
||||
"parameter_names": ["queryTime", "questionText"],
|
||||
"callable": True,
|
||||
},
|
||||
{
|
||||
"method": "OpaqueExperimentalCalculator",
|
||||
"signature": "(complexPayload)",
|
||||
"bucket": "opaque",
|
||||
"parameter_names": ["complexPayload"],
|
||||
"callable": True,
|
||||
},
|
||||
],
|
||||
"buckets": {
|
||||
"event_range": {"count": 2, "examples": ["HealthProblemEvent", "ForeignTravelMigrationEvent"]},
|
||||
"birth_time_only": {"count": 3, "examples": ["EducationDegreeYoga"]},
|
||||
"query_text": {"count": 1, "examples": ["PrashnaHoraryJudgement"]},
|
||||
"opaque": {"count": 1, "examples": ["OpaqueExperimentalCalculator"]},
|
||||
},
|
||||
}
|
||||
),
|
||||
"VEDASTRO_OFFICIAL_CAPABILITY_RUNNER_STUB": json.dumps(
|
||||
{
|
||||
"HealthProblemEvent": {"available": True, "status": "ok", "result": {}},
|
||||
"EducationDegreeYoga": {"available": True, "status": "ok", "result": {}},
|
||||
"PropertyHouseVehicleResult": {"available": True, "status": "ok", "result": {}},
|
||||
"ChildrenProgenyPromise": {"available": True, "status": "ok", "result": {}},
|
||||
"ForeignTravelMigrationEvent": {"available": True, "status": "ok", "result": {}},
|
||||
}
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
assert completed.returncode == 0, completed.stderr or completed.stdout
|
||||
report = json.loads(completed.stdout)
|
||||
required_fields = {"domains", "execution_policy", "adjudicator_use", "confidence_role", "blocked_reason"}
|
||||
for status in report["method_statuses"].values():
|
||||
assert required_fields.issubset(status)
|
||||
|
||||
assert "health" in report["method_statuses"]["HealthProblemEvent"]["domains"]
|
||||
assert "education" in report["method_statuses"]["EducationDegreeYoga"]["domains"]
|
||||
assert "property" in report["method_statuses"]["PropertyHouseVehicleResult"]["domains"]
|
||||
assert "children" in report["method_statuses"]["ChildrenProgenyPromise"]["domains"]
|
||||
assert "migration" in report["method_statuses"]["ForeignTravelMigrationEvent"]["domains"]
|
||||
assert "prashna" in report["method_statuses"]["PrashnaHoraryJudgement"]["domains"]
|
||||
assert report["method_statuses"]["PrashnaHoraryJudgement"]["execution_policy"] == "needs_user_text"
|
||||
assert report["method_statuses"]["PrashnaHoraryJudgement"]["adjudicator_use"] == "secondary_context"
|
||||
assert report["method_statuses"]["OpaqueExperimentalCalculator"]["domains"] == ["unknown"]
|
||||
assert report["method_statuses"]["OpaqueExperimentalCalculator"]["execution_policy"] == "blocked"
|
||||
assert report["method_statuses"]["OpaqueExperimentalCalculator"]["blocked_reason"] == "unsupported_signature"
|
||||
|
||||
for domain in ("health", "education", "property", "children", "migration", "prashna"):
|
||||
assert domain in report["domain_routing"]
|
||||
assert domain in report["dynamic_selection"]
|
||||
assert "general" not in report["domain_routing"]
|
||||
assert report["summary"]["unknown_method_count"] == 1
|
||||
assert report["summary"]["misrouted_general_method_count"] == 0
|
||||
|
||||
@@ -166,7 +166,7 @@ def test_vedastro_official_snapshot_stops_when_foreground_budget_is_exhausted(mo
|
||||
assert result["status"] == "official_snapshot_budget_exhausted"
|
||||
assert result["available"] is False
|
||||
assert result["source_metadata"]["official_python_bundle"]["status"] == "official_snapshot_budget_exhausted"
|
||||
assert result["source_metadata"]["official_full_capability_catalog"]["status"] == "official_full_capability_catalog_timeout"
|
||||
assert result["source_metadata"]["official_full_capability_catalog"]["status"] == "official_full_capability_catalog_skipped_budget_exhausted"
|
||||
|
||||
|
||||
def test_vedastro_official_snapshot_skips_bridge_after_runner_consumes_budget(monkeypatch) -> None:
|
||||
@@ -226,7 +226,7 @@ def test_vedastro_official_snapshot_skips_bridge_after_runner_consumes_budget(mo
|
||||
assert bridge_called["value"] is False
|
||||
assert result["status"] == "official_snapshot_budget_exhausted"
|
||||
assert result["source_metadata"]["official_python_bundle"]["status"] == "official_snapshot_budget_exhausted"
|
||||
assert result["source_metadata"]["official_full_capability_catalog"]["summary"]["catalog_method_count"] == 641
|
||||
assert result["source_metadata"]["official_full_capability_catalog"]["status"] == "official_full_capability_catalog_skipped_budget_exhausted"
|
||||
|
||||
|
||||
def test_vedastro_official_snapshot_budget_does_not_mask_mock_rest_endpoint(monkeypatch) -> None:
|
||||
|
||||
Reference in New Issue
Block a user