[codex] Harden API error contracts#253
Merged
Merged
Conversation
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
errors[]payloads and request IDs.Why
This is the first focused slice of the v1.0 API contract hardening work. It gives us a central error model, safer dependency failure behavior, and request IDs for support/debug correlation without broad-breaking every legacy 4xx response shape in one pass.
Validation
docker compose -p data-api run --rm --no-deps --pull never api bash -lc 'cd /app && uv pip install -e ./backend[dev] --system >/tmp/dev-install.log && cd /app/backend && python -m pytest tests/api/test_error_contracts.py tests/elasticsearch/test_search.py::TestElasticsearchSearch::test_search_resources_error_handling tests/services/test_mcp_service.py::TestOGMMCPService::test_search_resources_tool_surfaces_api_errors'docker compose -p data-api run --rm --no-deps --pull never api bash -lc 'cd /app && uv pip install -e ./backend[dev] --system >/tmp/dev-install.log && cd /app/backend && python -m ruff check app/api/errors.py app/main.py app/api/v1/endpoint_modules/search.py app/elasticsearch/search.py tests/api/test_error_contracts.py tests/api/v1/test_search_endpoints.py tests/elasticsearch/test_search.py tests/services/test_mcp_service.py'git diff --checkNote: the Docker services on this machine are running under compose project
data-api, so validation useddocker compose -p data-api ....