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,48 @@
package adminstop
// 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`. Service-layer callers (Stage
// 19 handlers) import 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 GameID, unknown stop reason).
ErrorCodeInvalidRequest = "invalid_request"
// ErrorCodeRuntimeNotFound reports that no runtime_records row
// exists for the requested game id.
ErrorCodeRuntimeNotFound = "runtime_not_found"
// ErrorCodeConflict reports that the runtime is in a status that
// cannot transition to `stopped` (currently only `starting`), or
// that a CAS guard mid-flow lost the race to a concurrent mutation.
ErrorCodeConflict = "conflict"
// ErrorCodeServiceUnavailable reports that a steady-state dependency
// (PostgreSQL, Runtime Manager) was unreachable for this call.
ErrorCodeServiceUnavailable = "service_unavailable"
// ErrorCodeInternal reports an unexpected error not classified by
// the other codes.
ErrorCodeInternal = "internal_error"
)
// Allowed values of Input.Reason mirror the README §Stop wording
// «reason ∈ {admin_request, finished, timeout}». Callers that pass an
// empty string get the documented default `admin_request`.
const (
// ReasonAdminRequest is the operator-driven stop reason and the
// default when Input.Reason is empty.
ReasonAdminRequest = "admin_request"
// ReasonFinished is reserved for callers that wrap a
// finish-detected stop (currently unused; documented for
// completeness).
ReasonFinished = "finished"
// ReasonTimeout is reserved for callers that wrap an automated
// timeout-driven stop (currently unused; documented for
// completeness).
ReasonTimeout = "timeout"
)