feat: propagate VedAstro official raw snapshots
This commit is contained in:
@@ -144,6 +144,45 @@ def test_gateway_official_closure_verified_when_raw_response_present(monkeypatch
|
||||
assert packet["official_raw_response"] == {"Status": "Pass"}
|
||||
|
||||
|
||||
def test_gateway_requires_and_propagates_entrypoint_official_raw_response(monkeypatch):
|
||||
from scripts import vedastro_gateway, vedastro_user_entrypoint
|
||||
|
||||
raw_response = {
|
||||
"source": "vedastro_official_full_snapshot",
|
||||
"sections": {"chart_core": {"Status": "Pass"}},
|
||||
}
|
||||
monkeypatch.setenv("JYOTISH_SKIP_LOCAL_ENV", "1")
|
||||
monkeypatch.setenv("VEDASTRO_API_ENDPOINT", "https://api.vedastro.org/api")
|
||||
monkeypatch.setenv("VEDASTRO_ENABLE_NETWORK", "1")
|
||||
monkeypatch.setenv("VEDASTRO_GATEWAY_REQUIRE_OFFICIAL_RAW_RESPONSE", "1")
|
||||
monkeypatch.setattr(
|
||||
vedastro_user_entrypoint,
|
||||
"build_runtime_mode_report",
|
||||
lambda: {"mode": "official_extended", "official_ready": True, "readiness_blockers": []},
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
vedastro_user_entrypoint,
|
||||
"_run_capability_catalog",
|
||||
lambda _case: {"status": "ok", "available": True, "summary": {"catalog_method_count": 1}},
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
vedastro_user_entrypoint,
|
||||
"_run_official_full_snapshot",
|
||||
lambda _case: {"status": "ok", "available": True, "raw_response": raw_response},
|
||||
)
|
||||
|
||||
packet = vedastro_gateway.run_gateway_packet(
|
||||
{"year": 1955, "month": 2, "day": 24, "hour": 19, "minute": 15, "lat": 37.7749, "lon": -122.4194, "tz": 8},
|
||||
question="事业机会什么时候出现",
|
||||
themes=["career"],
|
||||
reference_date="2026-07-02",
|
||||
)
|
||||
|
||||
assert packet["official_closure_state"] == "official_verified"
|
||||
assert packet["official_closure_reason"] == "official_raw_response_present"
|
||||
assert packet["official_raw_response"] == raw_response
|
||||
|
||||
|
||||
def test_gateway_queue_lifecycle_uses_file_job_store(monkeypatch, tmp_path):
|
||||
from scripts import vedastro_gateway
|
||||
|
||||
|
||||
@@ -132,6 +132,87 @@ def test_user_entrypoint_runs_catalog_and_strict_workflow_contract() -> None:
|
||||
assert "official_full_capability_catalog" in report["user_commands"]["json"]
|
||||
|
||||
|
||||
def test_user_entrypoint_emits_official_raw_response_when_requested() -> None:
|
||||
catalog_stub = {
|
||||
"available": True,
|
||||
"status": "ok",
|
||||
"capabilities": [
|
||||
{
|
||||
"method": "AllPlanetData",
|
||||
"signature": "(birthTime)",
|
||||
"bucket": "chart_core",
|
||||
"parameter_names": ["birthTime"],
|
||||
"callable": True,
|
||||
}
|
||||
],
|
||||
"buckets": {"chart_core": {"count": 1, "examples": ["AllPlanetData"]}},
|
||||
}
|
||||
raw_response = {
|
||||
"source": "vedastro_official_full_snapshot",
|
||||
"sections": {"chart_core": {"Status": "Pass"}},
|
||||
"section_statuses": {"chart_core": "ok"},
|
||||
}
|
||||
snapshot_stub = {
|
||||
"status": "ok",
|
||||
"available": True,
|
||||
"operation": "official_full_snapshot",
|
||||
"raw_response": raw_response,
|
||||
"source_metadata": {"artifact_path": "scratch/local/vedastro_adapter/stub.json"},
|
||||
}
|
||||
|
||||
completed = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"scripts/vedastro_user_entrypoint.py",
|
||||
"--year",
|
||||
"1955",
|
||||
"--month",
|
||||
"2",
|
||||
"--day",
|
||||
"24",
|
||||
"--hour",
|
||||
"19",
|
||||
"--minute",
|
||||
"15",
|
||||
"--lat",
|
||||
"37.7749",
|
||||
"--lon",
|
||||
"-122.4194",
|
||||
"--tz",
|
||||
"8",
|
||||
"--question",
|
||||
"事业机会什么时候出现",
|
||||
"--themes",
|
||||
"career",
|
||||
"--reference-date",
|
||||
"2026-07-02",
|
||||
"--require-official-raw-response",
|
||||
"--format",
|
||||
"json",
|
||||
],
|
||||
cwd=ROOT,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
timeout=120,
|
||||
check=False,
|
||||
env={
|
||||
**os.environ,
|
||||
"JYOTISH_SKIP_LOCAL_ENV": "1",
|
||||
"VEDASTRO_API_ENDPOINT": "https://api.vedastro.org/api",
|
||||
"VEDASTRO_ENABLE_NETWORK": "1",
|
||||
"VEDASTRO_TIMEOUT_SECONDS": "20",
|
||||
"VEDASTRO_OFFICIAL_CAPABILITY_CATALOG_STUB": json.dumps(catalog_stub),
|
||||
"VEDASTRO_OFFICIAL_FULL_SNAPSHOT_STUB": json.dumps(snapshot_stub),
|
||||
},
|
||||
)
|
||||
|
||||
assert completed.returncode == 0, completed.stderr or completed.stdout
|
||||
report = json.loads(completed.stdout)
|
||||
assert report["vedastro_official_full_snapshot"]["status"] == "ok"
|
||||
assert report["vedastro_official_full_snapshot"]["raw_response_available"] is True
|
||||
assert report["official_raw_response"] == raw_response
|
||||
|
||||
|
||||
def test_user_entrypoint_markdown_documents_boundaries() -> None:
|
||||
completed = subprocess.run(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user