fix(phase6): demo-data fallback when Supabase env vars missing#96
Merged
fix(phase6): demo-data fallback when Supabase env vars missing#96
Conversation
6 tasks
397106a to
a1a3806
Compare
…error parser
Two related fixes for the Phase 6 Trust Engine integration test:
1. apps/agentanchor/app/api/phase6/stats/route.ts
getPhase6Service() throws Error('Missing Supabase configuration for
Phase 6 service') when NEXT_PUBLIC_SUPABASE_URL / SUPABASE_SERVICE_ROLE_KEY
are unset (which they are in the integration-test and load-test CI jobs).
That call was OUTSIDE the inner try/catch that handles the demo-data
fallback, so the throw went straight to the outer catch and the route
returned HTTP 500 {"error": "Failed to fetch Phase 6 statistics"}.
Move the service instantiation inside the inner try so missing-config
errors fall back to demo data, matching the stated intent of the
fallback block.
2. packages/car-python/vorion_car/client.py
The HTTP error parser assumed every error body was shaped
{"error": {"message": "..."}}, but our API returns {"error": "..."}.
When the Python SDK hit the 500 above, it crashed with
AttributeError: 'str' object has no attribute 'get' instead of raising
a useful CARError. Handle both dict and string shapes.
Unblocks the `Integration Test` job in ci-phase6.yml. The `Load Test` job
hits additional phase6 endpoints without demo fallbacks and will need a
separate fix (or scope restriction) — it's nightly-only so it doesn't
block PRs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Black (line-length=100, target-py39) reformatted client.py after the previous commit. Zero semantic change. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CI runs 'black --check .' with no arguments, which uses Black's default line-length of 88. My previous reformat used --line-length 100 to match the ruff setting in pyproject.toml, which silently diverged from what CI actually checks. Reformat with defaults. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a1a3806 to
dfa4408
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related fixes for the Phase 6 Trust Engine Integration Test job.
1. apps/agentanchor/app/api/phase6/stats/route.ts
getPhase6Service()throws `Error('Missing Supabase configuration for Phase 6 service')` when `NEXT_PUBLIC_SUPABASE_URL` / `SUPABASE_SERVICE_ROLE_KEY` are unset (which they are in the integration-test and load-test CI jobs). That call was outside the inner try/catch that has the demo-data fallback, so the throw went straight to the outer catch and the route returned HTTP 500 `{"error": "Failed to fetch Phase 6 statistics"}`. Move the service instantiation inside the inner try so missing-config errors fall back to demo data — matching the stated intent of the fallback block.2. packages/car-python/vorion_car/client.py
The HTTP error parser assumed every error body was shaped `{"error": {"message": "..."}}`, but our API returns `{"error": "..."}`. When the Python SDK hit the 500 above, it crashed with `AttributeError: 'str' object has no attribute 'get'` instead of raising a useful `CARError`. Handle both dict and string shapes.
Impact
Test plan