chore(cleanup): purge /command residuals — fakeEngine, canon golden, openapi
Tests · UI / test (pull_request) Has been cancelled
Tests · Integration / integration (pull_request) Successful in 1m46s
Tests · Go / test (pull_request) Successful in 2m4s
Tests · Go / test (push) Successful in 2m28s
Tests · UI / test (push) Successful in 3m22s
Tests · UI / test (pull_request) Has been cancelled
Tests · Integration / integration (pull_request) Successful in 1m46s
Tests · Go / test (pull_request) Successful in 2m4s
Tests · Go / test (push) Successful in 2m28s
Tests · UI / test (push) Successful in 3m22s
Follow-up tidy after the cross-service /command removal (#73): - Rename the router test double dummyExecutor -> fakeEngine (and the newExecutor / setupRouterExecutor helpers -> newFakeEngine / setupRouterEngine): it implements handler.Engine now, "executor" was a leftover of the removed adapter. Test-only. - Regenerate the ui/core canon signing golden onto user.games.order (request_user_games_command.json -> request_user_games_order.json, fresh canonical bytes + Ed25519 signature) and drop the last user.games.command references from the Go/TS tests and docs. - Align game openapi: CommandRequest.cmd no longer carries minItems: 1. It is now used only by PUT /api/v1/order, which accepts an empty batch (clearing the player's stored order, equivalent to removing every command); the contract test freezes the empty-allowed shape. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,7 @@ func id() string {
|
||||
return uuid.New().String()
|
||||
}
|
||||
|
||||
type dummyExecutor struct {
|
||||
type fakeEngine struct {
|
||||
CommandsExecuted int
|
||||
|
||||
// ValidateOrderResult, when non-nil, is returned from ValidateOrder.
|
||||
@@ -55,7 +55,7 @@ type dummyExecutor struct {
|
||||
FetchBattleErr error
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) ValidateOrder(actor string, cmd ...order.DecodableCommand) (*order.UserGamesOrder, error) {
|
||||
func (e *fakeEngine) ValidateOrder(actor string, cmd ...order.DecodableCommand) (*order.UserGamesOrder, error) {
|
||||
e.CommandsExecuted = len(cmd)
|
||||
if e.ValidateOrderErr != nil {
|
||||
return nil, e.ValidateOrderErr
|
||||
@@ -70,48 +70,48 @@ func (e *dummyExecutor) ValidateOrder(actor string, cmd ...order.DecodableComman
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) FetchOrder(actor string, turn uint) (*order.UserGamesOrder, bool, error) {
|
||||
func (e *fakeEngine) FetchOrder(actor string, turn uint) (*order.UserGamesOrder, bool, error) {
|
||||
e.FetchOrderActor = actor
|
||||
e.FetchOrderTurn = turn
|
||||
return e.FetchOrderResult, e.FetchOrderOK, e.FetchOrderErr
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) FetchBattle(turn uint, ID uuid.UUID) (*report.BattleReport, bool, error) {
|
||||
func (e *fakeEngine) FetchBattle(turn uint, ID uuid.UUID) (*report.BattleReport, bool, error) {
|
||||
e.FetchBattleTurn = turn
|
||||
e.FetchBattleID = ID
|
||||
return e.FetchBattleResult, e.FetchBattleOK, e.FetchBattleErr
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) GenerateGame(gameID uuid.UUID, races []string) (game.State, error) {
|
||||
func (e *fakeEngine) GenerateGame(gameID uuid.UUID, races []string) (game.State, error) {
|
||||
return game.State{ID: gameID}, nil
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) GenerateTurn() (game.State, error) {
|
||||
func (e *fakeEngine) GenerateTurn() (game.State, error) {
|
||||
return game.State{}, nil
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) BanishRace(raceName string) error {
|
||||
func (e *fakeEngine) BanishRace(raceName string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) GameState() (game.State, error) {
|
||||
func (e *fakeEngine) GameState() (game.State, error) {
|
||||
return game.State{}, nil
|
||||
}
|
||||
|
||||
func (e *dummyExecutor) LoadReport(actor string, turn uint) (*report.Report, error) {
|
||||
func (e *fakeEngine) LoadReport(actor string, turn uint) (*report.Report, error) {
|
||||
return &report.Report{}, nil
|
||||
}
|
||||
|
||||
func setupRouter() *gin.Engine {
|
||||
return setupRouterExecutor(newExecutor())
|
||||
return setupRouterEngine(newFakeEngine())
|
||||
}
|
||||
|
||||
func setupRouterExecutor(e handler.Engine) *gin.Engine {
|
||||
func setupRouterEngine(e handler.Engine) *gin.Engine {
|
||||
return router.SetupRouter(e)
|
||||
}
|
||||
|
||||
func newExecutor() handler.Engine {
|
||||
return &dummyExecutor{}
|
||||
func newFakeEngine() handler.Engine {
|
||||
return &fakeEngine{}
|
||||
}
|
||||
|
||||
// newService builds a real controller.Service backed by a storage directory,
|
||||
|
||||
Reference in New Issue
Block a user