`should_create_missing_views()` had `and result[0]["reltuples"]` which is falsy when reltuples=0. On a fresh empty PostgreSQL table, CREATE INDEX sets reltuples=0, causing the guard to return False and skip view creation entirely. Views like MonthlyGlobalSpendPerKey are never created, and the /global/spend/logs endpoint returns 500. Fix: change to `and result[0]["reltuples"] is not None` so reltuples=0 (empty table) and reltuples=-1 (unanalyzed table) both correctly return True. Also harden test_vertex_ai.py to return None instead of crashing with JSONDecodeError when the spend-logs endpoint returns a non-JSON 500 response, and add unit tests covering all three reltuples branches (0, -1, positive). |
||
|---|---|---|
| .. | ||
| ruby_passthrough_tests | ||
| base_anthropic_messages_test.py | ||
| test_anthropic_passthrough_basic.py | ||
| test_anthropic_passthrough_python_sdkpy | ||
| test_anthropic_passthrough.py | ||
| test_assembly_ai.py | ||
| test_gemini_with_spend.test.js | ||
| test_gemini.js | ||
| test_hosted_vllm_passthrough.py | ||
| test_local_gemini.js | ||
| test_local_vertex.js | ||
| test_mcp_routes.py | ||
| test_openai_assistants_passthrough.py | ||
| test_vertex_ai.py | ||
| test_vertex_with_spend.test.js | ||
| test_vertex.test.js | ||
| vertex_key.json | ||