feat: gamemaster

This commit is contained in:
Ilia Denisov
2026-05-03 07:59:03 +02:00
committed by GitHub
parent a7cee15115
commit 3e2622757e
229 changed files with 41521 additions and 1098 deletions
@@ -0,0 +1,49 @@
package orderput
// Stable error codes returned in `Result.ErrorCode`. The values match the
// vocabulary frozen by `gamemaster/README.md §Error Model` and
// `gamemaster/api/internal-openapi.yaml`. Stage 19's REST handler imports
// these names rather than redeclare them; renaming any of them is a
// contract change.
const (
// ErrorCodeInvalidRequest reports that the request envelope failed
// structural validation (empty required field, malformed payload,
// non-object payload, payload missing the `commands` array).
ErrorCodeInvalidRequest = "invalid_request"
// ErrorCodeRuntimeNotFound reports that no `runtime_records` row
// exists for the requested game id.
ErrorCodeRuntimeNotFound = "runtime_not_found"
// ErrorCodeRuntimeNotRunning reports that the runtime exists but its
// current status is not `running`. Hot-path orders are rejected
// outside the running state to avoid racing with admin transitions
// and turn generation.
ErrorCodeRuntimeNotRunning = "runtime_not_running"
// ErrorCodeForbidden reports that the caller is not an active member
// of the game, or that the (game_id, user_id) pair lacks a player
// mapping.
ErrorCodeForbidden = "forbidden"
// ErrorCodeEngineUnreachable reports that the engine /api/v1/order
// call returned a 5xx status, timed out, or could not be dispatched.
ErrorCodeEngineUnreachable = "engine_unreachable"
// ErrorCodeEngineValidationError reports that the engine returned
// 4xx with a per-command result. The body is forwarded verbatim
// through `Result.RawResponse`.
ErrorCodeEngineValidationError = "engine_validation_error"
// ErrorCodeEngineProtocolViolation reports that the engine response
// did not match the expected schema. Stage 19 maps this to 502.
ErrorCodeEngineProtocolViolation = "engine_protocol_violation"
// ErrorCodeServiceUnavailable reports that a steady-state dependency
// (PostgreSQL, Lobby) was unreachable for this call.
ErrorCodeServiceUnavailable = "service_unavailable"
// ErrorCodeInternal reports an unexpected error not classified by
// the other codes.
ErrorCodeInternal = "internal_error"
)