feat(api): 未定義サブパスの404と未捕捉500を imsx 形式で返す (C14/C15)#5
Merged
Conversation
CASE API パス(/{tenant}/ims/case/v1p1/...)での
- 未定義サブパスへのアクセスを 404 unknownobject の imsx_StatusInfo 形式に
- 未捕捉エラーを 500 internal_server_error の imsx_StatusInfo 形式に
変換するハンドラを main.py に追加。CASE API 以外のパス(Web UI 等)は
FastAPI/Starlette の既定挙動を維持。500 は ServerErrorMiddleware が
元例外を再 raise するためログには残る。
- StarletteHTTPException ハンドラ: CASE パスの 404 のみ imsx 化、他は既定へ委譲
- Exception ハンドラ: CASE パスは imsx 500、他は既定のプレーン 500
- tests/integration/test_error_envelope.py を追加(404/500/非CASE委譲)
- conformance backlog の C14/C15 を「対応済み」へ、api-spec/api-examples を更新
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XXFogp18twGiPFBAZcqJw2
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.
概要
conformance backlog の C14 / C15 を実装します。CASE API パス(
/{tenant}/ims/case/v1p1/...)でのエラー封筒を補完し、ドキュメント記載の挙動に実装を合わせます。unknownobjectの imsx_StatusInfo 形式internal_server_errorの imsx_StatusInfo 形式実装
src/main.pyに2つの例外ハンドラを追加:StarletteHTTPExceptionハンドラ: CASE API パスの 404 のみ imsx 化。それ以外(Web UI・静的ファイル・405 等)は FastAPI 既定ハンドラへ委譲。Exceptionハンドラ: CASE API パスは imsx 500、それ以外は Starlette 既定のプレーン 500。いずれもServerErrorMiddlewareが元例外を再 raise するためトレースバックはログに残る(観測性を維持)。CASE API 以外の挙動は一切変えません。
テスト
tests/integration/test_error_envelope.py(新規):POST /health)→ 既定形式を維持全 665 テスト pass / ruff clean。
ドキュメント
api-spec.md/api-examples.md: 「未実装」注記を「実装済み」に更新case-v1p1-conformance-backlog.md: C14 / C15 を「すでに対応済み」へ移動残りの C11 / C12 / C8 は別 PR で実装予定です。
🤖 Generated with Claude Code