SlotKeeper 設計と品質

Message catalog: reservations/create_reservation

API

項目 値
domain reservations
api create_reservation
routes POST /reservations (createReservation)
router src/app/apis/reservations/create_reservation/router.py
messages 4
logger wrapper calls 4
levels WARNING:3, ERROR:1

生成・検証方針

  • WARNING以上のMessage catalogは router.py、functions.py または response_builders.py の ops_logger.warning/error(...) kwargsを一次情報にする。
  • api_error_response(...) のstatus/detailとlogger呼び出しのstatus/detailを照合する。
  • 実装中の app.core.logging ラッパー呼び出しを検出し、WARN以上はAPI operation内のemitとcatalog定義の一致を検証する。
  • logging.getLogger(...)、logger.info(...) などの直接呼び出しは許可しない。
  • WARNING以上は運用上の意味を持つ前提で、必要な確認手順・runbook・contextを検証対象にする。

メッセージ一覧

id message_id ログ概要
M001 createReservation.idempotency_key_reused 同じIdempotency-Keyで異なる入力が送られたため、予約作成を拒否した。
M002 createReservation.resource_inactive 予約対象の資源が無効化されているため、予約作成を拒否した。
M003 createReservation.slot_taken 同じ資源の確定予約と時間帯が重なるため、予約作成を拒否した。
M004 createReservation.router_api_function_error Routerで捕捉したApiFunctionErrorにより予約作成が失敗した。

ログ詳細

M001 createReservation.idempotency_key_reused

項目 内容
id M001
message_id createReservation.idempotency_key_reused
level WARNING
status 409
wrapper calls 1
ログ概要 同じIdempotency-Keyで異なる入力が送られたため、予約作成を拒否した。
説明 有効期限内の成功記録と正規化入力のhashが一致しない場合。
対応すべきこと 利用者へ新しいIdempotency-Keyで予約し直すよう案内する。
runbook RUNBOOK-idempotency-conflict
実装参照 src/app/apis/reservations/create_reservation/functions.py
wrapper: src/app/apis/reservations/create_reservation/functions.py (ops_logger.warning)

出力項目

出力項目 型 説明
traceId string | null リクエストとログを横断して追跡する相関IDです。
actorPrincipalId string | null APIを呼び出した認証主体IDです。
api.statusCode integer | null API responseとして返したHTTP status codeです。
resource ErrorResource ログに出力するAPI固有のErrorResourceです。
resource.resourceId string | null 予約対象資源の存在確認、予約表の再取得に使用する資源IDです。
error.code string | null エラー分類を表す機械処理向けコードです。
error.message string | null エラー内容を運用者が理解するための説明です。

M002 createReservation.resource_inactive

項目 内容
id M002
message_id createReservation.resource_inactive
level WARNING
status 409
wrapper calls 1
ログ概要 予約対象の資源が無効化されているため、予約作成を拒否した。
説明 予約対象の資源のactiveがfalseの場合。
対応すべきこと 資源の有効状態と利用者への案内を確認する。
runbook RUNBOOK-resource-deactivation
実装参照 src/app/apis/reservations/create_reservation/functions.py
wrapper: src/app/apis/reservations/create_reservation/functions.py (ops_logger.warning)

出力項目

出力項目 型 説明
traceId string | null リクエストとログを横断して追跡する相関IDです。
actorPrincipalId string | null APIを呼び出した認証主体IDです。
api.statusCode integer | null API responseとして返したHTTP status codeです。
resource ErrorResource ログに出力するAPI固有のErrorResourceです。
resource.resourceId string | null 予約対象資源の存在確認、予約表の再取得に使用する資源IDです。
error.code string | null エラー分類を表す機械処理向けコードです。
error.message string | null エラー内容を運用者が理解するための説明です。

M003 createReservation.slot_taken

項目 内容
id M003
message_id createReservation.slot_taken
level WARNING
status 409
wrapper calls 1
ログ概要 同じ資源の確定予約と時間帯が重なるため、予約作成を拒否した。
説明 半開区間[開始,終了)が重なる確定予約が同じ資源にある場合。
対応すべきこと 利用者へ予約表を再取得して別の時間帯を選ぶよう案内する。
runbook RUNBOOK-reservation-conflict
実装参照 src/app/apis/reservations/create_reservation/functions.py
wrapper: src/app/apis/reservations/create_reservation/functions.py (ops_logger.warning)

出力項目

出力項目 型 説明
traceId string | null リクエストとログを横断して追跡する相関IDです。
actorPrincipalId string | null APIを呼び出した認証主体IDです。
api.statusCode integer | null API responseとして返したHTTP status codeです。
resource ErrorResource ログに出力するAPI固有のErrorResourceです。
resource.resourceId string | null 予約対象資源の存在確認、予約表の再取得に使用する資源IDです。
error.code string | null エラー分類を表す機械処理向けコードです。
error.message string | null エラー内容を運用者が理解するための説明です。

M004 createReservation.router_api_function_error

項目 内容
id M004
message_id createReservation.router_api_function_error
level ERROR
status
wrapper calls 1
ログ概要 Routerで捕捉したApiFunctionErrorにより予約作成が失敗した。
説明 ROUTER_HANDLED_EXCEPTIONSを捕捉した場合。
対応すべきこと 同一routeの4xx/5xx率、直近deploy、DB状態を確認する。
runbook RUNBOOK-unexpected-api-failure
実装参照 src/app/apis/reservations/create_reservation/functions.py
wrapper: src/app/apis/reservations/create_reservation/functions.py (ops_logger.error)

出力項目

出力項目 型 説明
traceId string | null リクエストとログを横断して追跡する相関IDです。
actorPrincipalId string | null APIを呼び出した認証主体IDです。
api.statusCode integer | null API responseとして返したHTTP status codeです。
resource ErrorResource ログに出力するAPI固有のErrorResourceです。
resource.resourceId string | null 予約対象資源の存在確認、予約表の再取得に使用する資源IDです。
resource.idempotencyKey string | null 同じ要求を再送するときに再利用するIdempotency-Keyです。
error.code string | null エラー分類を表す機械処理向けコードです。
error.message string | null エラー内容を運用者が理解するための説明です。
error.exceptionType string | null 捕捉された例外の型名です。

strict検証で要求する項目

Level 必須項目
WARNING why_production
ERROR check_procedure, context_model, runbook
CRITICAL remediation_procedure, context_model, runbook, escalation